Compare commits

...

6 commits

Author SHA1 Message Date
073911ed65 update 2024-02-01 22:25:37 +08:00
8903144d90 update 2024-02-01 22:18:53 +08:00
49e681a2af update 2024-02-01 17:11:39 +08:00
b036cb21d8 update 2024-02-01 17:08:38 +08:00
2525cf2873 update 2024-02-01 17:07:39 +08:00
1af1b90c7e update 2024-02-01 16:11:29 +08:00
7 changed files with 86 additions and 18 deletions

View file

@ -1,6 +1,6 @@
<template> <template>
<a-layout-footer class="footer"> <a-layout-footer class="footer">
<a href="https://github.com/silenty4ng/k5web" target="_blank">K5Web</a> <a href="https://github.com/silenty4ng/k5web" target="_blank">K5Web - V0.1.202402011710</a>
</a-layout-footer> </a-layout-footer>
</template> </template>

View file

@ -133,6 +133,9 @@
const configuration_list : any = { const configuration_list : any = {
"LOSEHU.*P.*K" : "ltsk.json", "LOSEHU.*P.*K" : "ltsk.json",
"LOSEHU.*P.*" : "lts.json", "LOSEHU.*P.*" : "lts.json",
"LOSEHU12[0-9].*H" : "losehu118h.json",
"LOSEHU12[0-9].*K" : "losehu118k.json",
"LOSEHU12[0-9].*" : "losehu118.json",
"LOSEHU11[8-9].*H" : "losehu118h.json", "LOSEHU11[8-9].*H" : "losehu118h.json",
"LOSEHU11[8-9].*K" : "losehu118k.json", "LOSEHU11[8-9].*K" : "losehu118k.json",
"LOSEHU11[8-9].*" : "losehu118.json", "LOSEHU11[8-9].*" : "losehu118.json",

View file

@ -1,5 +1,5 @@
{ {
"name": "LoseHu 118 +", "name": "LoseHu 118+",
"uart": "official", "uart": "official",
"charset": "official" "charset": "official"
} }

View file

@ -1,5 +1,5 @@
{ {
"name": "LoseHu 118 + 2Mbit 扩容版", "name": "LoseHu 118+ 2Mbit 扩容版",
"uart": "losehu", "uart": "losehu",
"charset": "gb2312", "charset": "gb2312",
"H": true "H": true

View file

@ -1,5 +1,5 @@
{ {
"name": "LoseHu 118 + 扩容版", "name": "LoseHu 118+ 扩容版",
"uart": "losehu", "uart": "losehu",
"charset": "gb2312", "charset": "gb2312",
"K": true "K": true

View file

@ -6,8 +6,8 @@
<a-card class="general-card" title="字库写入"> <a-card class="general-card" title="字库写入">
<a-space> <a-space>
<a-button @click="restore(1)">写入 117 字库K</a-button> <a-button @click="restore(1)">写入 117 字库K</a-button>
<a-button @click="restore(2)">写入 118 字库K</a-button> <a-button @click="restore(2)">写入 118+ 字库K</a-button>
<a-button @click="restore(3)">写入 118 字库H</a-button> <a-button @click="restore(3)">写入 118+ 字库H</a-button>
</a-space> </a-space>
<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>

View file

@ -19,10 +19,20 @@
</a-button> </a-button>
</a-space> </a-space>
</a-col> </a-col>
<a-col :span="12" style="text-align: right;">
<a-space>
<a-button type="primary" @click="saveChannel">
保存
</a-button>
<a-button @click="restoreChannel">
加载
</a-button>
</a-space>
</a-col>
</a-row> </a-row>
<a-table v-bind:loading="loading" :columns="columns" :data="state.renderData" style="margin-top: 20px" :pagination="{pageSize: 15, current: state.nowPage}" @page-change="(e)=>{state.nowPage = e}"> <a-table v-bind:loading="loading" :columns="columns" :data="state.renderData" style="margin-top: 20px" :pagination="{pageSize: state.pageSize, current: state.nowPage, showPageSize: true, pageSizeOptions: [15, 30, 50] }" @page-change="(e)=>{state.nowPage = e}" @page-size-change="(e)=>{state.pageSize = e}">
<template #index="{ record, rowIndex }"> <template #index="{ record, rowIndex }">
{{(state.nowPage - 1) * 15 + rowIndex + 1}} {{(state.nowPage - 1) * state.pageSize + rowIndex + 1}}
</template> </template>
<template #name="{ record, rowIndex }"> <template #name="{ record, rowIndex }">
<a-input v-model="record.name" /> <a-input v-model="record.name" />
@ -102,8 +112,14 @@
<template #dtmf="{ record, rowIndex }"> <template #dtmf="{ record, rowIndex }">
<a-switch v-model="record.dtmf" /> <a-switch v-model="record.dtmf" />
</template> </template>
<template #scanlist="{ record, rowIndex }">
<a-checkbox-group v-model="record.scanlist">
<a-checkbox value="I">I</a-checkbox>
<a-checkbox value="II">II</a-checkbox>
</a-checkbox-group>
</template>
<template #operate="{ record, rowIndex }"> <template #operate="{ record, rowIndex }">
<a-button @click="clearRow((state.nowPage - 1) * 15 + rowIndex)">清空</a-button> <a-button @click="clearRow((state.nowPage - 1) * state.pageSize + rowIndex)">清空</a-button>
</template> </template>
</a-table> </a-table>
</a-card> </a-card>
@ -122,6 +138,7 @@
const { loading, setLoading } = useLoading(false); const { loading, setLoading } = useLoading(false);
const { t } = useI18n(); const { t } = useI18n();
const state: { const state: {
bandwidthOption: any[],
stepOption: any[], stepOption: any[],
scrambOption: any[], scrambOption: any[],
renderData: any[], renderData: any[],
@ -130,8 +147,11 @@
toneOption: any[], toneOption: any[],
CTCSSOption: any[], CTCSSOption: any[],
pttidOption: any[], pttidOption: any[],
modeOption: any[] modeOption: any[],
pageSize: number,
nowPage: number
} = reactive({ } = reactive({
pageSize: 15,
nowPage: 1, nowPage: 1,
bandwidthOption: {'0': '25KHz', '1': '12.5KHz'}, bandwidthOption: {'0': '25KHz', '1': '12.5KHz'},
modeOption: {'0': 'FM', '1': 'AM', '2': 'USB'}, modeOption: {'0': 'FM', '1': 'AM', '2': 'USB'},
@ -284,12 +304,18 @@
slotName: 'dtmf', slotName: 'dtmf',
width: 150 width: 150
}, },
{
title: '扫描列表',
dataIndex: 'scanlist',
slotName: 'scanlist',
width: 150
},
{ {
title: '操作', title: '操作',
dataIndex: 'operate', dataIndex: 'operate',
slotName: 'operate', slotName: 'operate',
width: 150 width: 150
}, }
]); ]);
const readChannel = async() => { const readChannel = async() => {
@ -301,6 +327,11 @@
const _data = await eeprom_read(appStore.connectPort, i, 0x80, appStore.configuration?.uart) const _data = await eeprom_read(appStore.connectPort, i, 0x80, appStore.configuration?.uart)
rawEEPROM.set(_data, i) rawEEPROM.set(_data, i)
} }
let rawEEPROM2 = new Uint8Array(0x0C0);
for (let i = 0x0D60; i < 0x0E20; i += 0x40) {
const _data = await eeprom_read(appStore.connectPort, i, 0x40, appStore.configuration?.uart)
rawEEPROM2.set(_data, i - 0x0D60)
}
let rawEEPROM3 = new Uint8Array(0x0C80); let rawEEPROM3 = new Uint8Array(0x0C80);
for (let i = 0x0F50; i < 0x1BD0; i += 0x80) { for (let i = 0x0F50; i < 0x1BD0; i += 0x80) {
const _data = await eeprom_read(appStore.connectPort, i, 0x80, appStore.configuration?.uart) const _data = await eeprom_read(appStore.connectPort, i, 0x80, appStore.configuration?.uart)
@ -310,10 +341,12 @@
const _renderData = []; const _renderData = [];
for (let i = 0; i < 0x0C80; i += 0x10) { for (let i = 0; i < 0x0C80; i += 0x10) {
const _channel = uint8ArrayToHexReverseString(rawEEPROM.subarray(i, i + 0x10)) const _channel = uint8ArrayToHexReverseString(rawEEPROM.subarray(i, i + 0x10))
console.log(_channel) const _scanlist = uint8ArrayToHexReverseString(rawEEPROM2.subarray(i / 0x10, i / 0x10 + 0x01))
const _channelData : any = {} const _channelData : any = {}
_channelData.rx = _channel.substr(24, 8) != "ffffffff" ? parseInt(_channel.substr(24, 8), 16) / 100000 : undefined _channelData.rx = _channel.substr(24, 8) != "ffffffff" ? parseInt(_channel.substr(24, 8), 16) / 100000 : undefined
if(_channelData.rx){ if(_channelData.rx && _scanlist != "ff"){
console.info(_channel)
console.info(_scanlist)
_channelData.offset = _channel.substr(16, 8) != "00000000" ? parseInt(_channel.substr(16, 8), 16) / 100000 : undefined _channelData.offset = _channel.substr(16, 8) != "00000000" ? parseInt(_channel.substr(16, 8), 16) / 100000 : undefined
_channelData.txcodeflag = _channel.substr(9, 1) _channelData.txcodeflag = _channel.substr(9, 1)
if(_channelData.txcodeflag == "1"){ if(_channelData.txcodeflag == "1"){
@ -348,6 +381,11 @@
_channelData.dtmf = _channelData.pttid_dtmf >> 0 & 0x01 ? true : false _channelData.dtmf = _channelData.pttid_dtmf >> 0 & 0x01 ? true : false
_channelData.mode = parseInt(_channel.substr(8, 1), 16).toString() _channelData.mode = parseInt(_channel.substr(8, 1), 16).toString()
_channelData.name = uint8ArrayToString(rawEEPROM3.subarray(i, i + 0x10), appStore.configuration?.charset) _channelData.name = uint8ArrayToString(rawEEPROM3.subarray(i, i + 0x10), appStore.configuration?.charset)
_channelData.scanlist = []
if(parseInt(_scanlist.substr(0, 1), 16) & 0x08)_channelData.scanlist.push("I")
if(parseInt(_scanlist.substr(0, 1), 16) & 0x04)_channelData.scanlist.push("II")
}else{
_channelData.rx = undefined
} }
_renderData.push(_channelData) _renderData.push(_channelData)
x += 1; x += 1;
@ -420,14 +458,19 @@
console.log(_channelhex) console.log(_channelhex)
rawEEPROM.set(hexReverseStringToUint8Array(_channelhex), i) rawEEPROM.set(hexReverseStringToUint8Array(_channelhex), i)
rawEEPROM2.set([0xC5], i >> 4)
let scanlist = 0;
if(_channel.scanlist?.indexOf('I') >= 0) scanlist += 8;
if(_channel.scanlist?.indexOf('II') >= 0) scanlist += 4;
console.log((scanlist << 4) + 0)
rawEEPROM2.set([(scanlist << 4) + 0], i >> 4)
const mergedArray = new Uint8Array(0x10); const mergedArray = new Uint8Array(0x10);
mergedArray.set(stringToUint8Array(_channel.name, appStore.configuration?.charset).subarray(0, 0x10), 0); mergedArray.set(stringToUint8Array(_channel.name ?? "", appStore.configuration?.charset).subarray(0, 0x10), 0);
rawEEPROM3.set(mergedArray, i) rawEEPROM3.set(mergedArray, i)
}else{ }else{
rawEEPROM.set(hexReverseStringToUint8Array("ffffffffffffffffffffffffffffffff"), i) rawEEPROM.set(hexReverseStringToUint8Array("ffffffffffffffffffffffffffffffff"), i)
rawEEPROM2.set([0x0F], i >> 4) rawEEPROM2.set([0xFF], i >> 4)
rawEEPROM3.set(hexReverseStringToUint8Array("ffffffffffffffffffffffffffffffff"), i) rawEEPROM3.set(hexReverseStringToUint8Array("ffffffffffffffffffffffffffffffff"), i)
} }
i += 0x10 i += 0x10
@ -445,6 +488,28 @@
const clearRow = async (row: any) =>{ const clearRow = async (row: any) =>{
state.renderData[row] = {} state.renderData[row] = {}
} }
const saveChannel = () => {
const _data = JSON.stringify(state.renderData);
const _blob = new Blob([_data], { type: 'application/octet-stream' });
const _file = URL.createObjectURL(_blob);
const _a = document.createElement("a");
_a.download="channel.json"
_a.href = _file;
document.body.appendChild(_a);
_a.click();
document.body.removeChild(_a);
URL.revokeObjectURL(_file);
}
const restoreChannel = () => {
const input = document.createElement('input');
input.type = 'file';
input.onchange = async() => {
const blob = new Blob([input.files[0]], {type: 'application/octet-stream' });
const _json = await blob.text()
state.renderData = JSON.parse(_json)
};
input.click();
}
</script> </script>
<script lang="ts"> <script lang="ts">