parent
31ad7459d5
commit
e9f4b9980e
|
@ -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
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
@ -18,11 +18,12 @@ 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
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -27,7 +27,7 @@ onMounted(() => {
|
|||
})
|
||||
|
||||
const nmea = useNMEAStore()
|
||||
watch(() => nmea.handled, (value) => {
|
||||
watch(() => nmea.handled1, (value) => {
|
||||
if (!value) return
|
||||
|
||||
const satellites = nmea.satellites('BD')
|
||||
|
@ -38,5 +38,6 @@ watch(() => nmea.handled, (value) => {
|
|||
})
|
||||
|
||||
option.series[0].data = data
|
||||
nmea.handled1 = false
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -27,7 +27,7 @@ onMounted(() => {
|
|||
})
|
||||
|
||||
const nmea = useNMEAStore()
|
||||
watch(() => nmea.handled, (value) => {
|
||||
watch(() => nmea.handled2, (value) => {
|
||||
if (!value) return
|
||||
|
||||
const xAxisData = []
|
||||
|
@ -43,5 +43,6 @@ watch(() => nmea.handled, (value) => {
|
|||
|
||||
option.xAxis.data = xAxisData
|
||||
option.series[0].data = seriesData
|
||||
nmea.handled2 = false
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue