mirror of
https://github.com/silenty4ng/k5web
synced 2025-04-04 23:25:03 +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 :label-col-style="{ width: '25%' }" field="pass" label="选择过境时间">
|
||||
<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-form-item>
|
||||
<a-form-item :label-col-style="{ width: '25%' }" field="tx" label="上行频率">
|
||||
|
@ -52,7 +53,9 @@
|
|||
<a-button @click="writeIt">写入数据</a-button>
|
||||
</a-form-item>
|
||||
<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-card>
|
||||
</a-col>
|
||||
|
@ -63,7 +66,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { reactive, nextTick } from 'vue';
|
||||
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';
|
||||
|
||||
const { loading, setLoading } = useLoading(true);
|
||||
|
@ -189,8 +192,15 @@ const getPass = async () => {
|
|||
})).json()
|
||||
const passOption = []
|
||||
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)
|
||||
}catch{}
|
||||
}
|
||||
if (passOption.length > 0) {
|
||||
state.pass = passOption[0][0] + "|" + passOption[0][1]
|
||||
|
@ -228,24 +238,88 @@ const writeIt = async() => {
|
|||
departure_time: state.pass.split('|')[1]
|
||||
})
|
||||
})).json()
|
||||
state.status += JSON.stringify(res.shift_array) + '<br/>'
|
||||
nextTick(()=>{
|
||||
const textarea = document?.getElementById('statusArea');
|
||||
if(textarea)textarea.scrollTop = textarea?.scrollHeight;
|
||||
|
||||
const sat = state.sat
|
||||
const pass = state.pass.split('|')[0]
|
||||
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)
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'Chi',
|
||||
name: 'Sat',
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.container {
|
||||
padding: 0 20px 20px 20px;
|
||||
|
||||
:deep(.arco-list-content) {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
@ -254,6 +328,7 @@ const writeIt = async() => {
|
|||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.arco-list-col) {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
@ -269,21 +344,25 @@ const writeIt = async() => {
|
|||
margin: 0 0 12px 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
:deep(.list-wrap) {
|
||||
|
||||
// min-height: 140px;
|
||||
.list-row {
|
||||
align-items: stretch;
|
||||
|
||||
.list-col {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.arco-space) {
|
||||
width: 100%;
|
||||
|
||||
.arco-space-item {
|
||||
&:last-child {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}</style>
|
||||
|
|
Loading…
Add table
Reference in a new issue