Compare commits

..

5 commits

Author SHA1 Message Date
8937d25792 update 2024-02-06 12:58:31 +08:00
c1ce965d4d update 2024-02-06 12:07:55 +08:00
bb62fc4484 update 2024-02-06 11:48:34 +08:00
d53d951ec0 update 2024-02-06 11:45:30 +08:00
62ce765efb update 2024-02-06 11:26:47 +08:00
2 changed files with 51 additions and 8 deletions

View file

@ -57,7 +57,7 @@ const LIST: AppRouteRecordRaw = {
name: 'Sat',
component: () => import('@/views/list/sat/index.vue'),
meta: {
locale: '卫星写入(WIP',
locale: '卫星写入(Beta',
requiresAuth: true,
roles: ['*'],
},

View file

@ -5,9 +5,20 @@
<a-col :span="24">
<a-card class="general-card" title="卫星写入">
<a-spin :loading="loading" style="width: 100%;" tip="正在处理 ...">
<a-form-item :label-col-style="{ width: '25%' }" field="dt" label="浏览器时间">
<a-form-item :label-col-style="{ width: '25%' }" field="dt" label="浏览器时间" @click="showHide">
{{ state.dt }}
<!-- &nbsp;&nbsp;<t-button size="small" theme="success" @click="syncTime">同步时间到台站</t-button> -->
</a-form-item>
<a-form-item v-show="state.showh >= 5" :label-col-style="{ width: '25%' }" field="dtCustom" label="自定义时间">
<div>
<a-date-picker
style="width: 220px; margin: 0 24px 24px 0;"
show-time
:time-picker-props="{ defaultValue: '00:00:00' }"
format="YYYY-MM-DD HH:mm:ss"
v-model="state.dtCustom"
/>
&nbsp;&nbsp;<t-button size="small" theme="success" @click="writeTime">写入时间到台站</t-button>
</div>
</a-form-item>
<a-form-item :label-col-style="{ width: '25%' }" field="sat" label="选择卫星">
<a-select v-model="state.sat" @change="changeSat" placeholder="选择卫星 ..." allow-search allow-clear>
@ -35,6 +46,15 @@
:value="item[0] + '|' + item[1]">{{ item[0] + " - " + item[1] }}</a-option>
</a-select>
</a-form-item>
<a-form-item v-show="state.showh >= 5" :label-col-style="{ width: '25%' }" field="passCustom" label="自定义过境时间">
<a-range-picker
style="width: 360px; margin: 0 24px 24px 0;"
show-time
:time-picker-props="{ defaultValue: ['00:00:00', '00:00:00'] }"
format="YYYY-MM-DD HH:mm:ss"
v-model="state.passCustom"
/>
</a-form-item>
<a-form-item :label-col-style="{ width: '25%' }" field="tx" label="上行频率">
<a-input-number :precision="5" v-model="state.tx" />
</a-form-item>
@ -78,6 +98,7 @@ const { loading, setLoading } = useLoading(true);
const appStore = useAppStore();
const state: {
showh: number,
status: string,
sat: string,
satData: any[],
@ -92,8 +113,11 @@ const state: {
passOption: any[],
rxTone: number | undefined,
dt: any,
timer: any
timer: any,
passCustom: any,
dtCustom: any
} = reactive({
showh: 0,
status: "点击写入按钮写入卫星数据到设备<br/><br/>",
sat: '',
satData: [],
@ -114,7 +138,9 @@ const state: {
pass: undefined,
passOption: [],
dt: '',
timer: undefined
timer: undefined,
passCustom: undefined,
dtCustom: undefined
})
onMounted(()=>{
@ -129,8 +155,21 @@ onUnmounted(()=>{
}catch{}
})
const showHide = () => {
state.showh += 1;
}
const writeTime = async () => {
if (appStore.connectState != true) { alert('请先连接手台!'); return; };
setLoading(true)
await eeprom_init(appStore.connectPort);
await syncTime();
await eeprom_reboot(appStore.connectPort);
setLoading(false)
}
const syncTime = async () => {
const date = new Date();
const date = state.dtCustom ? new Date(state.dtCustom) : new Date();
const dateArray = [
...hexReverseStringToUint8Array(parseInt(date.getFullYear().toString().substring(2,4)).toString(16)),
...hexReverseStringToUint8Array((date.getMonth() + 1).toString(16)),
@ -249,6 +288,10 @@ const writeIt = async () => {
// alert('');
// return;
// }
if (!state.sat) { alert('请选择卫星!'); return; };
if(state.passCustom){
state.pass = state.passCustom[0] + "|" + state.passCustom[1]
}
if (!state.pass) { alert('请选择过境时间!'); return; };
setLoading(true)
const res = await (await fetch('https://k5.vicicode.com/api/doppler', {
@ -314,12 +357,12 @@ const writeIt = async () => {
//
payload = new Uint8Array(2)
if(state.txTone && state.txTone > 0){
payload.set(hexReverseStringToUint8Array(state.txTone.toString(16)).subarray(0, 0x02))
payload.set(hexReverseStringToUint8Array(parseInt((state.txTone * 10).toFixed(0)).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))
payload.set(hexReverseStringToUint8Array(parseInt((state.rxTone * 10).toFixed(0)).toString(16)).subarray(0, 0x02))
}
await eeprom_write(appStore.connectPort, 0x2BBA, payload, 0x02, appStore.configuration?.uart);
// UNIX200011UNIX