Compare commits

..

No commits in common. "8937d257923f6a21c378d3474bb3a80153400a1f" and "762c0df773799bf202dde01f41f9d9086c28e5de" have entirely different histories.

2 changed files with 8 additions and 51 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: '卫星写入(Beta', locale: '卫星写入(WIP',
requiresAuth: true, requiresAuth: true,
roles: ['*'], roles: ['*'],
}, },

View file

@ -5,20 +5,9 @@
<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="浏览器时间" @click="showHide"> <a-form-item :label-col-style="{ width: '25%' }" field="dt" label="浏览器时间">
{{ state.dt }} {{ state.dt }}
</a-form-item> <!-- &nbsp;&nbsp;<t-button size="small" theme="success" @click="syncTime">同步时间到台站</t-button> -->
<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>
@ -46,15 +35,6 @@
: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>
@ -98,7 +78,6 @@ 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[],
@ -113,11 +92,8 @@ 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: [],
@ -138,9 +114,7 @@ const state: {
pass: undefined, pass: undefined,
passOption: [], passOption: [],
dt: '', dt: '',
timer: undefined, timer: undefined
passCustom: undefined,
dtCustom: undefined
}) })
onMounted(()=>{ onMounted(()=>{
@ -155,21 +129,8 @@ 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 = state.dtCustom ? new Date(state.dtCustom) : new Date(); const date = 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)),
@ -288,10 +249,6 @@ 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', {
@ -357,12 +314,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(parseInt((state.txTone * 10).toFixed(0)).toString(16)).subarray(0, 0x02)) payload.set(hexReverseStringToUint8Array(state.txTone.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(parseInt((state.rxTone * 10).toFixed(0)).toString(16)).subarray(0, 0x02)) payload.set(hexReverseStringToUint8Array(state.rxTone.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