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', name: 'Sat',
component: () => import('@/views/list/sat/index.vue'), component: () => import('@/views/list/sat/index.vue'),
meta: { meta: {
locale: '卫星写入(WIP', locale: '卫星写入(Beta',
requiresAuth: true, requiresAuth: true,
roles: ['*'], roles: ['*'],
}, },

View file

@ -5,9 +5,20 @@
<a-col :span="24"> <a-col :span="24">
<a-card class="general-card" title="卫星写入"> <a-card class="general-card" title="卫星写入">
<a-spin :loading="loading" style="width: 100%;" tip="正在处理 ..."> <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 }} {{ 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>
<a-form-item :label-col-style="{ width: '25%' }" field="sat" label="选择卫星"> <a-form-item :label-col-style="{ width: '25%' }" field="sat" label="选择卫星">
<a-select v-model="state.sat" @change="changeSat" placeholder="选择卫星 ..." allow-search allow-clear> <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> :value="item[0] + '|' + item[1]">{{ item[0] + " - " + item[1] }}</a-option>
</a-select> </a-select>
</a-form-item> </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-form-item :label-col-style="{ width: '25%' }" field="tx" label="上行频率">
<a-input-number :precision="5" v-model="state.tx" /> <a-input-number :precision="5" v-model="state.tx" />
</a-form-item> </a-form-item>
@ -78,6 +98,7 @@ const { loading, setLoading } = useLoading(true);
const appStore = useAppStore(); const appStore = useAppStore();
const state: { const state: {
showh: number,
status: string, status: string,
sat: string, sat: string,
satData: any[], satData: any[],
@ -92,8 +113,11 @@ const state: {
passOption: any[], passOption: any[],
rxTone: number | undefined, rxTone: number | undefined,
dt: any, dt: any,
timer: any timer: any,
passCustom: any,
dtCustom: any
} = reactive({ } = reactive({
showh: 0,
status: "点击写入按钮写入卫星数据到设备<br/><br/>", status: "点击写入按钮写入卫星数据到设备<br/><br/>",
sat: '', sat: '',
satData: [], satData: [],
@ -114,7 +138,9 @@ const state: {
pass: undefined, pass: undefined,
passOption: [], passOption: [],
dt: '', dt: '',
timer: undefined timer: undefined,
passCustom: undefined,
dtCustom: undefined
}) })
onMounted(()=>{ onMounted(()=>{
@ -129,8 +155,21 @@ onUnmounted(()=>{
}catch{} }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 syncTime = async () => {
const date = new Date(); const date = state.dtCustom ? new Date(state.dtCustom) : new Date();
const dateArray = [ const dateArray = [
...hexReverseStringToUint8Array(parseInt(date.getFullYear().toString().substring(2,4)).toString(16)), ...hexReverseStringToUint8Array(parseInt(date.getFullYear().toString().substring(2,4)).toString(16)),
...hexReverseStringToUint8Array((date.getMonth() + 1).toString(16)), ...hexReverseStringToUint8Array((date.getMonth() + 1).toString(16)),
@ -249,6 +288,10 @@ const writeIt = async () => {
// alert(''); // alert('');
// return; // return;
// } // }
if (!state.sat) { alert('请选择卫星!'); return; };
if(state.passCustom){
state.pass = state.passCustom[0] + "|" + state.passCustom[1]
}
if (!state.pass) { alert('请选择过境时间!'); return; }; if (!state.pass) { alert('请选择过境时间!'); return; };
setLoading(true) setLoading(true)
const res = await (await fetch('https://k5.vicicode.com/api/doppler', { const res = await (await fetch('https://k5.vicicode.com/api/doppler', {
@ -314,12 +357,12 @@ const writeIt = async () => {
// //
payload = new Uint8Array(2) payload = new Uint8Array(2)
if(state.txTone && state.txTone > 0){ 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); await eeprom_write(appStore.connectPort, 0x2BB8, payload, 0x02, appStore.configuration?.uart);
payload = new Uint8Array(2) payload = new Uint8Array(2)
if(state.rxTone && state.rxTone > 0){ 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); await eeprom_write(appStore.connectPort, 0x2BBA, payload, 0x02, appStore.configuration?.uart);
// UNIX200011UNIX // UNIX200011UNIX