mirror of
https://github.com/silenty4ng/k5web
synced 2025-04-10 18:48:50 +00:00
update
This commit is contained in:
parent
eb4480d17f
commit
e15eca6cc0
1 changed files with 167 additions and 88 deletions
|
@ -27,7 +27,8 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label-col-style="{ width: '25%' }" field="pass" label="选择过境时间">
|
<a-form-item :label-col-style="{ width: '25%' }" field="pass" label="选择过境时间">
|
||||||
<a-select v-model="state.pass" allow-search allow-clear>
|
<a-select v-model="state.pass" allow-search allow-clear>
|
||||||
<a-option v-for="item in state.passOption" :key="item[0] + '|' + item[1]" :value="item[0] + '|' + item[1]">{{item[0] + " - " + item[1]}}</a-option>
|
<a-option v-for="item in state.passOption" :key="item[0] + '|' + item[1]"
|
||||||
|
:value="item[0] + '|' + item[1]">{{ item[0] + " - " + item[1] }}</a-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label-col-style="{ width: '25%' }" field="tx" label="上行频率">
|
<a-form-item :label-col-style="{ width: '25%' }" field="tx" label="上行频率">
|
||||||
|
@ -52,7 +53,9 @@
|
||||||
<a-button @click="writeIt">写入数据</a-button>
|
<a-button @click="writeIt">写入数据</a-button>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-divider />
|
<a-divider />
|
||||||
<div id="statusArea" style="height: 20em; background-color: azure; color: silver; overflow: auto; padding: 20px" v-html="state.status"></div>
|
<div id="statusArea"
|
||||||
|
style="height: 20em; background-color: azure; color: silver; overflow: auto; padding: 20px"
|
||||||
|
v-html="state.status"></div>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -63,7 +66,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, nextTick } from 'vue';
|
import { reactive, nextTick } from 'vue';
|
||||||
import { useAppStore } from '@/store';
|
import { useAppStore } from '@/store';
|
||||||
import { eeprom_write, eeprom_reboot, eeprom_init } from '@/utils/serial.js';
|
import { eeprom_write, eeprom_reboot, eeprom_init, hexReverseStringToUint8Array, stringToUint8Array } from '@/utils/serial.js';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
|
|
||||||
const { loading, setLoading } = useLoading(true);
|
const { loading, setLoading } = useLoading(true);
|
||||||
|
@ -189,8 +192,15 @@ const getPass = async () => {
|
||||||
})).json()
|
})).json()
|
||||||
const passOption = []
|
const passOption = []
|
||||||
for (let i = 0; i < res.pass_times.length; i++) {
|
for (let i = 0; i < res.pass_times.length; i++) {
|
||||||
const _passOption = [res.pass_times[i], res.departure_times[i]]
|
try{
|
||||||
|
let _passOption = undefined
|
||||||
|
if((Date.parse(res.departure_times[i]) - Date.parse(res.pass_times[i])) > 0){
|
||||||
|
_passOption = [res.pass_times[i], res.departure_times[i]]
|
||||||
|
}else{
|
||||||
|
_passOption = [res.pass_times[i], res.departure_times[i + 1]]
|
||||||
|
}
|
||||||
passOption.push(_passOption)
|
passOption.push(_passOption)
|
||||||
|
}catch{}
|
||||||
}
|
}
|
||||||
if (passOption.length > 0) {
|
if (passOption.length > 0) {
|
||||||
state.pass = passOption[0][0] + "|" + passOption[0][1]
|
state.pass = passOption[0][0] + "|" + passOption[0][1]
|
||||||
|
@ -228,24 +238,88 @@ const writeIt = async() => {
|
||||||
departure_time: state.pass.split('|')[1]
|
departure_time: state.pass.split('|')[1]
|
||||||
})
|
})
|
||||||
})).json()
|
})).json()
|
||||||
state.status += JSON.stringify(res.shift_array) + '<br/>'
|
|
||||||
nextTick(()=>{
|
const sat = state.sat
|
||||||
const textarea = document?.getElementById('statusArea');
|
const pass = state.pass.split('|')[0]
|
||||||
if(textarea)textarea.scrollTop = textarea?.scrollHeight;
|
const pass_year = pass.split('-')[0].substring(2, 4)
|
||||||
|
const pass_month = pass.split('-')[1]
|
||||||
|
const pass_day = pass.split('-')[2].split(' ')[0]
|
||||||
|
const pass_hour = pass.split(' ')[1].split(':')[0]
|
||||||
|
const pass_min = pass.split(' ')[1].split(':')[1]
|
||||||
|
const pass_sec = pass.split(' ')[1].split(':')[2]
|
||||||
|
const departure = state.pass.split('|')[1]
|
||||||
|
const departure_year = departure.split('-')[0].substring(2, 4)
|
||||||
|
const departure_month = departure.split('-')[1]
|
||||||
|
const departure_day = departure.split('-')[2].split(' ')[0]
|
||||||
|
const departure_hour = departure.split(' ')[1].split(':')[0]
|
||||||
|
const departure_min = departure.split(' ')[1].split(':')[1]
|
||||||
|
const departure_sec = departure.split(' ')[1].split(':')[2]
|
||||||
|
// console.log(sat.trim(), new Date(pass), pass_year, pass_month, pass_day, pass_hour, pass_min, pass_sec)
|
||||||
|
// console.log(sat.trim(), new Date(departure), departure_year, departure_month, departure_day, departure_hour, departure_min, departure_sec)
|
||||||
|
|
||||||
|
await eeprom_init(appStore.connectPort);
|
||||||
|
// 卫星名称
|
||||||
|
let payload = new Uint8Array(10)
|
||||||
|
payload.set(stringToUint8Array(sat.trim()).subarray(0, 9))
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BA0, payload, 10, appStore.configuration?.uart);
|
||||||
|
// 写入过境始末
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BAA, hexReverseStringToUint8Array(parseInt(pass_year).toString(16)).subarray(0, 1), 0x01, appStore.configuration?.uart);
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BAB, hexReverseStringToUint8Array(parseInt(pass_month).toString(16)).subarray(0, 1), 0x01, appStore.configuration?.uart);
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BAC, hexReverseStringToUint8Array(parseInt(pass_day).toString(16)).subarray(0, 1), 0x01, appStore.configuration?.uart);
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BAD, hexReverseStringToUint8Array(parseInt(pass_hour).toString(16)).subarray(0, 1), 0x01, appStore.configuration?.uart);
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BAE, hexReverseStringToUint8Array(parseInt(pass_min).toString(16)).subarray(0, 1), 0x01, appStore.configuration?.uart);
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BAF, hexReverseStringToUint8Array(parseInt(pass_sec).toString(16)).subarray(0, 1), 0x01, appStore.configuration?.uart);
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BB0, hexReverseStringToUint8Array(parseInt(departure_year).toString(16)).subarray(0, 1), 0x01, appStore.configuration?.uart);
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BB1, hexReverseStringToUint8Array(parseInt(departure_month).toString(16)).subarray(0, 1), 0x01, appStore.configuration?.uart);
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BB2, hexReverseStringToUint8Array(parseInt(departure_day).toString(16)).subarray(0, 1), 0x01, appStore.configuration?.uart);
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BB3, hexReverseStringToUint8Array(parseInt(departure_hour).toString(16)).subarray(0, 1), 0x01, appStore.configuration?.uart);
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BB4, hexReverseStringToUint8Array(parseInt(departure_min).toString(16)).subarray(0, 1), 0x01, appStore.configuration?.uart);
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BB5, hexReverseStringToUint8Array(parseInt(departure_sec).toString(16)).subarray(0, 1), 0x01, appStore.configuration?.uart);
|
||||||
|
// 总过境时间
|
||||||
|
payload = new Uint8Array(2)
|
||||||
|
payload.set(hexReverseStringToUint8Array(((Date.parse(departure) - Date.parse(pass)) / 1000).toString(16)).subarray(0, 0x02))
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BB6, payload, 0x02, appStore.configuration?.uart);
|
||||||
|
// 手台的发射接收亚音
|
||||||
|
payload = new Uint8Array(2)
|
||||||
|
if(state.txTone && state.txTone > 0){
|
||||||
|
payload.set(hexReverseStringToUint8Array(state.txTone.toString(16)).subarray(0, 0x02))
|
||||||
|
}
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BB8, payload, 0x02, appStore.configuration?.uart);
|
||||||
|
payload = new Uint8Array(2)
|
||||||
|
if(state.rxTone && state.rxTone > 0){
|
||||||
|
payload.set(hexReverseStringToUint8Array(state.rxTone.toString(16)).subarray(0, 0x02))
|
||||||
|
}
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BBA, payload, 0x02, appStore.configuration?.uart);
|
||||||
|
// 开始过境时间的UNIX时间戳与2000年1月1日UNIX时间戳的差
|
||||||
|
payload = new Uint8Array(4)
|
||||||
|
payload.set(hexReverseStringToUint8Array(((Date.parse(pass) - Date.parse('2000-01-01 00:00:00')) / 1000).toString(16)).subarray(0, 0x04))
|
||||||
|
await eeprom_write(appStore.connectPort, 0x2BBC, payload, 0x04, appStore.configuration?.uart);
|
||||||
|
|
||||||
|
const shift_arr: any = []
|
||||||
|
res.shift_array.filter((num: any, index: any) => index % 2 === 0).map((e: any)=>{
|
||||||
|
const _tx = new Uint8Array(4)
|
||||||
|
const _rx = new Uint8Array(4)
|
||||||
|
_tx.set(hexReverseStringToUint8Array(parseInt(((state.tx * 1000000 + e[0]) / 10).toFixed(0)).toString(16)))
|
||||||
|
_rx.set(hexReverseStringToUint8Array(parseInt(((state.rx * 1000000 + e[1]) / 10).toFixed(0)).toString(16)))
|
||||||
|
shift_arr.push(..._tx, ..._rx)
|
||||||
})
|
})
|
||||||
|
payload = new Uint8Array(0x1E00)
|
||||||
|
payload.set(new Uint8Array(shift_arr).subarray(0, 0x1E00))
|
||||||
|
await restoreRange(0x1E200, payload)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: 'Chi',
|
name: 'Sat',
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.container {
|
.container {
|
||||||
padding: 0 20px 20px 20px;
|
padding: 0 20px 20px 20px;
|
||||||
|
|
||||||
:deep(.arco-list-content) {
|
:deep(.arco-list-content) {
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
@ -254,6 +328,7 @@ const writeIt = async() => {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.arco-list-col) {
|
:deep(.arco-list-col) {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -269,21 +344,25 @@ const writeIt = async() => {
|
||||||
margin: 0 0 12px 0;
|
margin: 0 0 12px 0;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.list-wrap) {
|
:deep(.list-wrap) {
|
||||||
|
|
||||||
// min-height: 140px;
|
// min-height: 140px;
|
||||||
.list-row {
|
.list-row {
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
|
|
||||||
.list-col {
|
.list-col {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.arco-space) {
|
:deep(.arco-space) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
.arco-space-item {
|
.arco-space-item {
|
||||||
&:last-child {
|
&:last-child {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}</style>
|
||||||
</style>
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue