Compare commits

...

12 Commits

22 changed files with 153 additions and 65 deletions

View File

@ -1,6 +1,6 @@
{
"name": "bdqh-course-platform",
"version": "3.4.0",
"version": "3.4.4",
"description": "北斗启航学习机课程平台",
"main": "./dist/main/app.js",
"scripts": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 KiB

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 147 KiB

View File

@ -62,8 +62,7 @@ await SerialPort.list().then((ports, err) => {
if (ports.length == 0) {
console.error('not connect')
comreturn = false
return
}else{
}else {
const { path, baudRate, dataBits, stopBits, parity } = getSerialPortConstructorArguments(ports)
console.log(path, baudRate, dataBits, stopBits, parity)
comports = ports

View File

@ -224,7 +224,7 @@ export class MainWindow extends LocalSoftwareWindow {
}
}
burnProgram(event: IpcMainEvent, binFileName: string) {
async burnProgram(event: IpcMainEvent, binFileName: string) {
if (!existsSync(ESP_TOOL_PATH) ||
!existsSync(BOOT_APP0_BIN_PATH) ||
!existsSync(BOOT_LOADER_BIN_PATH) ||
@ -246,18 +246,28 @@ export class MainWindow extends LocalSoftwareWindow {
}
// 参考1https://docs.espressif.com/projects/esptool/en/latest/esp32/
// 参考2https://blog.csdn.net/espressif/article/details/105028809
execFile(ESP_TOOL_PATH,
['--chip', 'esp32', '--port', mainWindow.selectedPort ? mainWindow.selectedPort.portName : '', '--baud', '921600', '--before', 'default_reset', '--after', 'hard_reset', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '80m', '--flash_size', 'detect',
'0xe000' , BOOT_APP0_BIN_PATH,
'0x1000' , BOOT_LOADER_BIN_PATH,
'0x10000', bin_file_path,
'0x8000' , PARTITIONS_BIN_PATH], (err, stdout) => {
if (err) {
event.sender.send('BURN_PROGRAM_FEEDBACK', { err } )
} else {
event.sender.send('BURN_PROGRAM_FEEDBACK', { stdout })
}
});
let resport: any
await comon().then((res:any) => {
if(!res.comoptions) {
event.sender.send('BURN_PROGRAM_FEEDBACK', { err: new Error('请先连接核心处理模块') } )
}else {
resport = res.comoptions.path
execFile(ESP_TOOL_PATH,
['--chip', 'esp32', '--port', resport, '--baud', '921600', '--before', 'default_reset', '--after', 'hard_reset', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '80m', '--flash_size', 'detect',
'0xe000' , BOOT_APP0_BIN_PATH,
'0x1000' , BOOT_LOADER_BIN_PATH,
'0x10000', bin_file_path,
'0x8000' , PARTITIONS_BIN_PATH], (err:any, stdout:any) => {
if (err) {
event.sender.send('BURN_PROGRAM_FEEDBACK', { err } )
} else {
event.sender.send('BURN_PROGRAM_FEEDBACK', { stdout })
}
});
}
})
}
launchOnlineSoftware(_: IpcMainEvent, param: any) {

View File

@ -17,7 +17,7 @@
<SerialPortReceivingMessageView class="h-full" />
</n-tab-pane>
<n-tab-pane display-directive="show:lazy" tab="地图" name="map">
<MapView />
<component :is="MapComponent"></component>
</n-tab-pane>
</Tabs>
</Layout>
@ -27,7 +27,7 @@
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue'
import { ref, defineAsyncComponent, onMounted } from 'vue'
import { NTabPane } from 'naive-ui'
import { Application } from '@/components/Application'
import { CustomTitleBar } from '@/components/CustomTitleBar'
@ -38,7 +38,6 @@ import { SerialPortReceivingMessageView } from '@/components/SerialPort'
import { BasicInfoView } from '@/views/BDDataAnalysisPlatform/BasicInfoView'
import { PlanisphereView } from '@/views/BDDataAnalysisPlatform/PlanisphereView'
import { SNRView } from '@/views/BDDataAnalysisPlatform/SNRView'
import MapView from '@/views/BDDataAnalysisPlatform/MapView.vue'
import { useNMEAStore, NMEADataSource } from '@/stores/nmea'
import { LineBreakParser } from '@/utils/parser'
@ -55,8 +54,14 @@ const onSerialPortData = (value: Uint8Array) => {
}
const softwareTitle = ref(null)
const MapComponent = ref(null)
const MapViewComponent = defineAsyncComponent(() => import('@/views/BDDataAnalysisPlatform/MapView.vue'))
onMounted(() => {
softwareTitle.value.title = '北斗数据分析平台'
setTimeout(async () => {
MapComponent.value = await MapViewComponent
}, 1000)
})
window.ipcRenderer.receive('COM_LISTENER', onSerialPortData)

View File

@ -1,10 +1,49 @@
import { ref } from 'vue'
import { defineStore } from 'pinia'
import { useMessage } from 'naive-ui'
import type { MessageReactive } from 'naive-ui'
export const useNetworkStore = defineStore('network', () => {
const message = useMessage()
const isOnLine = ref(window.navigator.onLine)
window.addEventListener( 'online' , () => isOnLine.value = true )
window.addEventListener( 'offline', () => isOnLine.value = false )
let checkLine
let messageReactive: MessageReactive | null = null
const createMessage = () => {
if (!messageReactive) {
messageReactive = message.loading('正在连接中', {
duration: 0
})
}
}
const removeMessage = () => {
if (messageReactive) {
messageReactive.destroy()
messageReactive = null
}
}
const setCheck = () => {
createMessage()
checkLine = setTimeout(() => {
removeMessage()
if(isOnLine.value) {
message.success('连接成功')
} else {
message.error('连接失败')
}
}, 20000)
}
window.addEventListener( 'online' , () => {
isOnLine.value = true
clearTimeout(checkLine)
removeMessage()
message.success('连接成功')
} )
window.addEventListener( 'offline', () => {
isOnLine.value = false
clearTimeout(checkLine)
removeMessage()
message.error('连接失败')
} )
return { isOnLine }
return { isOnLine, setCheck }
})

View File

@ -38,6 +38,9 @@ export const useNMEAStore = defineStore('nmea', {
// INS: null,
// TIM: null,
handled: false,
handled1: false,
handled2: false,
handled3: false,
}),
getters: {
dateTime () {
@ -120,6 +123,9 @@ export const useNMEAStore = defineStore('nmea', {
// 监听最后一条语句并设置handled为true
if (result.sentence === 'TXT') {
this.handled = true
this.handled1 = true
this.handled2 = true
this.handled3 = true
}
})
},

View File

@ -19,7 +19,7 @@
</template>
<script lang="ts" setup>
import { ref, watch, onMounted } from 'vue'
import { ref, watch } from 'vue'
import { NDescriptions, NDescriptionsItem, NTime, useMessage } from 'naive-ui'
import { useNMEAStore } from '@/stores/nmea'
@ -38,10 +38,6 @@ const connectErrMsg = (value: Boolean) => {
window.ipcRenderer.receive('CANNOT_CONNECT',connectErrMsg)
onMounted(() => {
window.ipcRenderer.send('COM_READY')
})
watch(() => nmea.handled, (value) => {
if (!value) return
@ -49,6 +45,7 @@ watch(() => nmea.handled, (value) => {
longitude.value = nmea.longitude
latitude.value = nmea.latitude
altitude.value = nmea.altitude
nmea.handled = false
})
</script>

View File

@ -14,15 +14,21 @@ const position = ref()
const mapRef = ref()
onMounted(() => {
window.ipcRenderer.send('COM_READY')
})
watch(() => nmea.handled, (value) => {
watch(() => nmea.handled3, (value) => {
if (!value || !nmea.longitude || !nmea.latitude) return
position.value = lonlat2Position( nmea.longitude, nmea.latitude )
mapRef.value.setZoomAndCenter(16, position.value)
nmea.handled3 = false
})
onMounted(() => {
if (!nmea.longitude || !nmea.latitude) return
position.value = lonlat2Position( nmea.longitude, nmea.latitude )
mapRef.value.setZoomAndCenter(16, position.value)
nmea.handled3 = false
})
</script>

View File

@ -22,12 +22,8 @@ use([
PolarComponent
])
onMounted(() => {
window.ipcRenderer.send('COM_READY')
})
const nmea = useNMEAStore()
watch(() => nmea.handled, (value) => {
watch(() => nmea.handled1, (value) => {
if (!value) return
const satellites = nmea.satellites('BD')
@ -38,5 +34,18 @@ watch(() => nmea.handled, (value) => {
})
option.series[0].data = data
nmea.handled1 = false
})
onMounted(() => {
const satellites = nmea.satellites('BD')
if (!satellites) return
const data = satellites.map(({ id, elevationDeg, azimuthTrue, active }) => {
return [parseInt(elevationDeg) * -1, azimuthTrue, id, active]
})
option.series[0].data = data
nmea.handled1 = false
})
</script>

View File

@ -22,12 +22,8 @@ use([
GridComponent
])
onMounted(() => {
window.ipcRenderer.send('COM_READY')
})
const nmea = useNMEAStore()
watch(() => nmea.handled, (value) => {
watch(() => nmea.handled2, (value) => {
if (!value) return
const xAxisData = []
@ -43,5 +39,23 @@ watch(() => nmea.handled, (value) => {
option.xAxis.data = xAxisData
option.series[0].data = seriesData
nmea.handled2 = false
})
onMounted(() => {
const xAxisData = []
const seriesData = []
const satellites = nmea.satellites('BD')
if (!satellites) return
satellites.forEach(({ id, SNRdB, active }) => {
xAxisData.push(id)
seriesData.push([id, SNRdB, active])
})
option.xAxis.data = xAxisData
option.series[0].data = seriesData
nmea.handled2 = false
})
</script>

View File

@ -39,7 +39,7 @@ const onBtnClick = async () => {
const decoder = new TextDecoder()
const parser = new LineBreakParser()
const onSerialPortData = (value: Uint8Array) => {
debugger
// debugger
const result: Array<String> = parser.parse(decoder.decode(value))
if (result.length === 0) return

View File

@ -14,7 +14,7 @@
<n-li>北京市海淀区黑泉路8号1幢宝盛广场B座8013</n-li>
<n-li>400-166-5286</n-li>
<n-li>sales@hwasmart.com</n-li>
<n-li>版本号{{ version }}</n-li>
<n-li>北斗实验平台软件V2.0 (bmp280{{ version }})</n-li>
</n-ul>
</n-modal>
</template>

View File

@ -32,15 +32,15 @@ const onBurnProgramBtnClick = async (binFileName: string) => {
if (!('serial' in navigator)) return
try {
await navigator.serial.requestPort()
// await navigator.serial.requestPort()
window.ipcRenderer.send('BURN_PROGRAM', binFileName)
dialog.info({
title: '系统提示',
closable: false,
maskClosable: false,
closable: true,
maskClosable: true,
class: 'text-center',
content: () => h(
NSpin,

View File

@ -25,6 +25,9 @@ import { h, ref } from 'vue'
import { NDivider, NCard, NDataTable, NInput, NButton, NIcon, useMessage } from 'naive-ui'
import { Wifi1BarFilled, Wifi2BarFilled, WifiFilled, RefreshFilled } from '@vicons/material'
import { hasIpcRenderer } from '@/utils'
import { useNetworkStore } from '@/stores/modules/network'
const network = useNetworkStore()
const emit = defineEmits(['done'])
@ -74,12 +77,15 @@ const columns = [
return h(
NButton,
{
type: 'info',
type: row.ssid === current.value?.ssid && network.isOnLine ? 'primary' : 'info',
secondary: true,
disabled: row.ssid === current.value?.ssid || !row.password,
onClick: () => connect({ ssid:row.ssid, password: row.password })
disabled: row.ssid === current.value?.ssid && network.isOnLine || !row.password || row.password.length < 8,
onClick: () => {
connect({ ssid:row.ssid, password: row.password })
network.setCheck();
}
},
{ default: () => row.ssid === current.value?.ssid ? '已连接' : '连 接' }
{ default: () => row.ssid === current.value?.ssid && network.isOnLine ? '已连接' : '连 接' }
)
}
}
@ -90,12 +96,17 @@ const connect = ( connectionOpts ) => {
message.error('密码为空')
return
}
if(connectionOpts.password.length < 8) {
message.error('密码长度不足8位')
return
}
if (!hasIpcRenderer()) return
const result = window.ipcRenderer.sendSync('NETWORK_CONNECT', connectionOpts)
if (result === 'OK') {
message.success('网络连接成功')
message.success('网络连接请求发送成功')
emit('done')
} else {
message.error(result.message)

View File

@ -1,18 +1,13 @@
<template>
<n-space class="toolbar">
<div class="button-background">
<n-popover :show="!network.isOnLine" placement="bottom">
<template #trigger>
<n-button size="large" circle type="info" @click="emit('systemSettings')">
<n-button size="large" circle type="info" @click="emit('systemSettings')">
<template #icon>
<n-icon>
<Settings />
</n-icon>
</template>
</n-button>
</template>
请连接网络
</n-popover >
<n-button size="large" circle type="info" @click="emit('quickBurning')">
<template #icon>
@ -42,7 +37,7 @@
</template>
<script setup lang="ts">
import { NSpace, NPopover , NButton, NIcon, useDialog } from 'naive-ui'
import { NSpace, NButton, NIcon, useDialog } from 'naive-ui'
import {
PhoneFilled as Phone,
SettingsFilled as Settings,

View File

@ -26,7 +26,7 @@ const onBurnProgramBtnClick = async (binFileName: string) => {
if (!('serial' in navigator)) return
try {
await navigator.serial.requestPort()
// await navigator.serial.requestPort()
window.ipcRenderer.send('BURN_PROGRAM', binFileName)
@ -71,12 +71,9 @@ const onBurnProgramFeedback = ({ err }) => {
onMounted(() => {
if (!hasIpcRenderer()) return
window.ipcRenderer.receive('BURN_PROGRAM_FEEDBACK', onBurnProgramFeedback)
})
onUnmounted(() => {
if (!hasIpcRenderer()) return
window.ipcRenderer.unreceive('BURN_PROGRAM_FEEDBACK')
window.ipcRenderer.receive('BURN_PROGRAM_FEEDBACK', onBurnProgramFeedback)
})
</script>