mirror of
https://github.com/silenty4ng/k5web
synced 2025-04-23 04:55:53 +00:00
update
This commit is contained in:
parent
239a5aff04
commit
a78e16644f
18 changed files with 315 additions and 133 deletions
src
App.vue
components/navbar
drivers
losehu118.jsonlosehu118h.jsonlosehu118k.jsonlts.jsonltsk.jsonsilenty4ng.jsonsilenty4ngk.jsontodo.json
utils
views
|
@ -11,6 +11,12 @@
|
||||||
import GlobalSetting from '@/components/global-setting/index.vue';
|
import GlobalSetting from '@/components/global-setting/index.vue';
|
||||||
import useLocale from '@/hooks/locale';
|
import useLocale from '@/hooks/locale';
|
||||||
import Aegis from 'aegis-web-sdk';
|
import Aegis from 'aegis-web-sdk';
|
||||||
|
import { encodingIndexes } from "@zxing/text-encoding/es2015/encoding-indexes";
|
||||||
|
import { TextEncoder, TextDecoder } from "@zxing/text-encoding";
|
||||||
|
|
||||||
|
window.TextEncodingIndexes = { encodingIndexes: encodingIndexes };
|
||||||
|
window.TextEncoder = TextEncoder;
|
||||||
|
window.TextDecoder = TextDecoder;
|
||||||
|
|
||||||
// 遥测
|
// 遥测
|
||||||
if(location.hostname == 'k5.vicicode.com'){
|
if(location.hostname == 'k5.vicicode.com'){
|
||||||
|
|
|
@ -131,10 +131,12 @@
|
||||||
const toggleDrawerMenu = inject('toggleDrawerMenu') as () => void;
|
const toggleDrawerMenu = inject('toggleDrawerMenu') as () => void;
|
||||||
|
|
||||||
const configuration_list : any = {
|
const configuration_list : any = {
|
||||||
"LOSEHU.*P.*K" : "silenty4ngk.json",
|
"LOSEHU.*P.*K" : "ltsk.json",
|
||||||
"LOSEHU.*P.*" : "silenty4ng.json",
|
"LOSEHU.*P.*" : "lts.json",
|
||||||
"LOSEHU.*K" : "todo.json",
|
"LOSEHU11[8-9].*H" : "losehu118h.json",
|
||||||
"LOSEHU.*" : "todo.json"
|
"LOSEHU11[8-9].*K" : "losehu118k.json",
|
||||||
|
"LOSEHU11[8-9].*" : "losehu118.json",
|
||||||
|
".*" : "todo.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
const connectIt = async () => {
|
const connectIt = async () => {
|
||||||
|
@ -157,14 +159,23 @@
|
||||||
let _configuration = null;
|
let _configuration = null;
|
||||||
|
|
||||||
const version = await eeprom_init(_connect);
|
const version = await eeprom_init(_connect);
|
||||||
|
const config = {
|
||||||
|
"name": "TODO",
|
||||||
|
"uart": "official",
|
||||||
|
"charset": "official",
|
||||||
|
"K": false,
|
||||||
|
"H": false
|
||||||
|
}
|
||||||
|
|
||||||
Object.keys(configuration_list).some(e=>{
|
Object.keys(configuration_list).some(e=>{
|
||||||
const _re = new RegExp(e);
|
const _re = new RegExp(e);
|
||||||
if(_re.test(version)){
|
if(_re.test(version)){
|
||||||
_configuration = driversList[configuration_list[e]];
|
_configuration = Object.assign(config, driversList[configuration_list[e]]);
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log(_configuration);
|
||||||
appStore.updateSettings({ connectState: true, connectPort: _connect, firmwareVersion: version, configuration: _configuration });
|
appStore.updateSettings({ connectState: true, connectPort: _connect, firmwareVersion: version, configuration: _configuration });
|
||||||
}else{
|
}else{
|
||||||
disconnect(appStore.connectPort);
|
disconnect(appStore.connectPort);
|
||||||
|
|
5
src/drivers/losehu118.json
Normal file
5
src/drivers/losehu118.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"name": "LoseHu 118 +",
|
||||||
|
"uart": "official",
|
||||||
|
"charset": "official"
|
||||||
|
}
|
6
src/drivers/losehu118h.json
Normal file
6
src/drivers/losehu118h.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name": "LoseHu 118 + 2Mbit 扩容版",
|
||||||
|
"uart": "losehu",
|
||||||
|
"charset": "gb2312",
|
||||||
|
"H": true
|
||||||
|
}
|
6
src/drivers/losehu118k.json
Normal file
6
src/drivers/losehu118k.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name": "LoseHu 118 + 扩容版",
|
||||||
|
"uart": "losehu",
|
||||||
|
"charset": "gb2312",
|
||||||
|
"K": true
|
||||||
|
}
|
5
src/drivers/lts.json
Normal file
5
src/drivers/lts.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"name": "LoseHu Patch LTS(BD8DFN)",
|
||||||
|
"uart": "official",
|
||||||
|
"charset": "official"
|
||||||
|
}
|
6
src/drivers/ltsk.json
Normal file
6
src/drivers/ltsk.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name": "LoseHu Patch LTS(BD8DFN)扩容版",
|
||||||
|
"uart": "losehu",
|
||||||
|
"charset": "losehu",
|
||||||
|
"K": true
|
||||||
|
}
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"name": "LoseHu Patch(BD8DFN)"
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"name": "LoseHu Patch(BD8DFN)扩容版"
|
|
||||||
}
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"name": "TODO"
|
"name": "Official"
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
|
@ -6,11 +6,13 @@
|
||||||
</a-typography-title>
|
</a-typography-title>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-divider class="panel-border" />
|
<a-divider class="panel-border" />
|
||||||
<a-card v-show="appStore.connectState" :style="{ width: '360px', marginTop: '2em', marginBottom: '2em' }" title="手台信息">
|
<a-space>
|
||||||
|
<a-card v-show="appStore.connectState" :style="{ marginTop: '2em', marginBottom: '2em' }" title="手台信息">
|
||||||
当前固件版本:{{ appStore.firmwareVersion }} <br />
|
当前固件版本:{{ appStore.firmwareVersion }} <br />
|
||||||
匹配写频配置:{{ appStore.configuration?.name }} <br />
|
匹配写频配置:{{ appStore.configuration?.name }} <br />
|
||||||
存储大小:{{ state.eepromSize }} <a-button size="mini" type="primary" @click="checkEeprom">检测</a-button>
|
存储大小:{{ state.eepromSize }} <a-button size="mini" type="primary" @click="checkEeprom">检测</a-button>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
</a-space>
|
||||||
</a-col>
|
</a-col>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -25,6 +27,7 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
const checkEeprom = async () => {
|
const checkEeprom = async () => {
|
||||||
|
alert('TODO');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ const backupRange = async (start: any, end: any, name: any = new Date() + '_back
|
||||||
await eeprom_init(appStore.connectPort);
|
await eeprom_init(appStore.connectPort);
|
||||||
let rawEEPROM = new Uint8Array(end - start);
|
let rawEEPROM = new Uint8Array(end - start);
|
||||||
for (let i = start; i < end; i += 0x80) {
|
for (let i = start; i < end; i += 0x80) {
|
||||||
const data = await eeprom_read(appStore.connectPort, i);
|
const data = await eeprom_read(appStore.connectPort, i, 0x80, appStore.configuration?.uart);
|
||||||
rawEEPROM.set(data, i - start);
|
rawEEPROM.set(data, i - start);
|
||||||
}
|
}
|
||||||
const blob = new Blob([rawEEPROM], { type: 'application/octet-stream' });
|
const blob = new Blob([rawEEPROM], { type: 'application/octet-stream' });
|
||||||
|
@ -213,7 +213,7 @@ const backupRange = async (start: any, end: any, name: any = new Date() + '_back
|
||||||
const restoreRange = async (start: any = 0, uint8Array: any) => {
|
const restoreRange = async (start: any = 0, uint8Array: any) => {
|
||||||
await eeprom_init(appStore.connectPort);
|
await eeprom_init(appStore.connectPort);
|
||||||
for (let i = start; i < uint8Array.length + start; i += 0x80) {
|
for (let i = start; i < uint8Array.length + start; i += 0x80) {
|
||||||
await eeprom_write(appStore.connectPort, i, uint8Array.slice(i - start, i - start + 0x80));
|
await eeprom_write(appStore.connectPort, i, uint8Array.slice(i - start, i - start + 0x80), 0x80, appStore.configuration?.uart);
|
||||||
}
|
}
|
||||||
await eeprom_reboot(appStore.connectPort);
|
await eeprom_reboot(appStore.connectPort);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ const backupRange = async (start: any, end: any, name: any = new Date() + '_back
|
||||||
await eeprom_init(appStore.connectPort);
|
await eeprom_init(appStore.connectPort);
|
||||||
let rawEEPROM = new Uint8Array(end - start);
|
let rawEEPROM = new Uint8Array(end - start);
|
||||||
for (let i = start; i < end; i += 0x80) {
|
for (let i = start; i < end; i += 0x80) {
|
||||||
const data = await eeprom_read(appStore.connectPort, i);
|
const data = await eeprom_read(appStore.connectPort, i, 0x80, appStore.configuration?.uart);
|
||||||
rawEEPROM.set(data, i - start);
|
rawEEPROM.set(data, i - start);
|
||||||
state.status = state.status + "备份进度:" + (((i - start) / rawEEPROM.length) * 100).toFixed(1) + "%<br/>";
|
state.status = state.status + "备份进度:" + (((i - start) / rawEEPROM.length) * 100).toFixed(1) + "%<br/>";
|
||||||
nextTick(()=>{
|
nextTick(()=>{
|
||||||
|
@ -89,7 +89,7 @@ const restoreRange = async (start: any = 0) => {
|
||||||
const blob = new Blob([input.files[0]], {type: 'application/octet-stream' });
|
const blob = new Blob([input.files[0]], {type: 'application/octet-stream' });
|
||||||
const rawEEPROM = new Uint8Array(await blob.arrayBuffer());
|
const rawEEPROM = new Uint8Array(await blob.arrayBuffer());
|
||||||
for (let i = start; i < input.files[0].size + start; i += 0x80) {
|
for (let i = start; i < input.files[0].size + start; i += 0x80) {
|
||||||
await eeprom_write(appStore.connectPort, i, rawEEPROM.slice(i - start, i - start + 0x80));
|
await eeprom_write(appStore.connectPort, i, rawEEPROM.slice(i - start, i - start + 0x80), 0x80, appStore.configuration?.uart);
|
||||||
state.status = state.status + "恢复进度:" + (((i - start) / input.files[0].size) * 100).toFixed(1) + "%<br/>";
|
state.status = state.status + "恢复进度:" + (((i - start) / input.files[0].size) * 100).toFixed(1) + "%<br/>";
|
||||||
nextTick(()=>{
|
nextTick(()=>{
|
||||||
const textarea = document?.getElementById('statusArea');
|
const textarea = document?.getElementById('statusArea');
|
||||||
|
@ -139,6 +139,10 @@ const backup = async() => {
|
||||||
default:
|
default:
|
||||||
_max = 0x2000;
|
_max = 0x2000;
|
||||||
}
|
}
|
||||||
|
if(appStore.configuration?.uart == "official" && _max >= 0x20000){
|
||||||
|
alert('该固件不支持备份扩容空间');
|
||||||
|
return;
|
||||||
|
}
|
||||||
await backupRange(0, _max)
|
await backupRange(0, _max)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ const state = reactive({
|
||||||
const restoreRange = async (start: any = 0, uint8Array: any) => {
|
const restoreRange = async (start: any = 0, uint8Array: any) => {
|
||||||
await eeprom_init(appStore.connectPort);
|
await eeprom_init(appStore.connectPort);
|
||||||
for (let i = start; i < uint8Array.length + start; i += 0x80) {
|
for (let i = start; i < uint8Array.length + start; i += 0x80) {
|
||||||
await eeprom_write(appStore.connectPort, i, uint8Array.slice(i - start, i - start + 0x80));
|
await eeprom_write(appStore.connectPort, i, uint8Array.slice(i - start, i - start + 0x80), 0x80, appStore.configuration?.uart);
|
||||||
state.status = state.status + "写入进度:" + (((i - start) / uint8Array.length) * 100).toFixed(1) + "%<br/>";
|
state.status = state.status + "写入进度:" + (((i - start) / uint8Array.length) * 100).toFixed(1) + "%<br/>";
|
||||||
nextTick(()=>{
|
nextTick(()=>{
|
||||||
const textarea = document?.getElementById('statusArea');
|
const textarea = document?.getElementById('statusArea');
|
||||||
|
@ -45,6 +45,22 @@ const restoreRange = async (start: any = 0, uint8Array: any) => {
|
||||||
|
|
||||||
const restore = async(type: any = 1) => {
|
const restore = async(type: any = 1) => {
|
||||||
if(appStore.connectState != true){alert('请先连接手台!'); return;};
|
if(appStore.connectState != true){alert('请先连接手台!'); return;};
|
||||||
|
if(appStore.configuration?.uart == "official"){
|
||||||
|
alert('固件版本不匹配');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if((type == 1 && appStore.configuration?.charset != "losehu") || (type == 1 && appStore.configuration?.K != true)){
|
||||||
|
alert('固件版本不匹配');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if((type == 2 && appStore.configuration?.charset != "gb2312") || (type == 2 && appStore.configuration?.K != true)){
|
||||||
|
alert('固件版本不匹配');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if((type == 3 && appStore.configuration?.charset != "gb2312") || (type == 3 && appStore.configuration?.H != true)){
|
||||||
|
alert('固件版本不匹配');
|
||||||
|
return;
|
||||||
|
}
|
||||||
state.status = state.status + "正在下载字库...<br />"
|
state.status = state.status + "正在下载字库...<br />"
|
||||||
let fontPacket = undefined
|
let fontPacket = undefined
|
||||||
switch(type){
|
switch(type){
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, nextTick } from 'vue';
|
import { reactive, nextTick } from 'vue';
|
||||||
import { useAppStore } from '@/store';
|
import { useAppStore } from '@/store';
|
||||||
import { eeprom_write, eeprom_reboot, eeprom_init, disconnect, connect, readPacket, sendPacket, unpackVersion, unpack, flash_generateCommand } from '@/utils/serial.js';
|
import { disconnect, connect, readPacket, sendPacket, unpackVersion, unpack, flash_generateCommand } from '@/utils/serial.js';
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
|
||||||
|
@ -88,7 +88,8 @@ const flashIt = async () => {
|
||||||
const textarea = document?.getElementById('statusArea');
|
const textarea = document?.getElementById('statusArea');
|
||||||
if(textarea)textarea.scrollTop = textarea?.scrollHeight;
|
if(textarea)textarea.scrollTop = textarea?.scrollHeight;
|
||||||
})
|
})
|
||||||
appStore.updateSettings({ connectPort: _connect });
|
disconnect(_connect);
|
||||||
|
appStore.updateSettings({ connectState: false });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -103,13 +103,25 @@ const selectFile = () => {
|
||||||
|
|
||||||
const flashIt = async () => {
|
const flashIt = async () => {
|
||||||
if(appStore.connectState != true){alert('请先连接手台!'); return;};
|
if(appStore.connectState != true){alert('请先连接手台!'); return;};
|
||||||
|
if(appStore.configuration?.uart == "official"){
|
||||||
|
alert('固件版本不匹配');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(state.activeKey == 2 && appStore.configuration?.charset != "gb2312"){
|
||||||
|
alert('固件版本不匹配');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(state.activeKey == 1 && appStore.configuration?.charset != "losehu"){
|
||||||
|
alert('固件版本不匹配');
|
||||||
|
return;
|
||||||
|
}
|
||||||
state.loading = true
|
state.loading = true
|
||||||
let position = 0x1E350;
|
let position = 0x1E350;
|
||||||
if(state.activeKey == 2)position = 0x2080;
|
if(state.activeKey == 2)position = 0x2080;
|
||||||
await eeprom_init(appStore.connectPort);
|
await eeprom_init(appStore.connectPort);
|
||||||
const rawEEPROM = state.binaryFile;
|
const rawEEPROM = state.binaryFile;
|
||||||
for (let i = position; i < rawEEPROM.length + position; i += 0x80) {
|
for (let i = position; i < rawEEPROM.length + position; i += 0x80) {
|
||||||
await eeprom_write(appStore.connectPort, i, rawEEPROM.slice(i - position, i - position + 0x80));
|
await eeprom_write(appStore.connectPort, i, rawEEPROM.slice(i - position, i - position + 0x80), 0x80, appStore.configuration?.uart);
|
||||||
}
|
}
|
||||||
await eeprom_reboot(appStore.connectPort);
|
await eeprom_reboot(appStore.connectPort);
|
||||||
state.loading = false
|
state.loading = false
|
||||||
|
|
|
@ -298,12 +298,12 @@
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
let rawEEPROM = new Uint8Array(0x0C80);
|
let rawEEPROM = new Uint8Array(0x0C80);
|
||||||
for (let i = 0; i < 0x0C80; i += 0x80) {
|
for (let i = 0; i < 0x0C80; i += 0x80) {
|
||||||
const _data = await eeprom_read(appStore.connectPort, i)
|
const _data = await eeprom_read(appStore.connectPort, i, 0x80, appStore.configuration?.uart)
|
||||||
rawEEPROM.set(_data, i)
|
rawEEPROM.set(_data, i)
|
||||||
}
|
}
|
||||||
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)
|
const _data = await eeprom_read(appStore.connectPort, i, 0x80, appStore.configuration?.uart)
|
||||||
rawEEPROM3.set(_data, i - 0x0F50)
|
rawEEPROM3.set(_data, i - 0x0F50)
|
||||||
}
|
}
|
||||||
let x = 0;
|
let x = 0;
|
||||||
|
@ -347,7 +347,7 @@
|
||||||
_channelData.pttid = state.pttidOption[(_channelData.pttid_dtmf >> 1) - 1]
|
_channelData.pttid = state.pttidOption[(_channelData.pttid_dtmf >> 1) - 1]
|
||||||
_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))
|
_channelData.name = uint8ArrayToString(rawEEPROM3.subarray(i, i + 0x10), appStore.configuration?.charset)
|
||||||
}
|
}
|
||||||
_renderData.push(_channelData)
|
_renderData.push(_channelData)
|
||||||
x += 1;
|
x += 1;
|
||||||
|
@ -423,7 +423,7 @@
|
||||||
rawEEPROM2.set([0xC5], i >> 4)
|
rawEEPROM2.set([0xC5], i >> 4)
|
||||||
|
|
||||||
const mergedArray = new Uint8Array(0x10);
|
const mergedArray = new Uint8Array(0x10);
|
||||||
mergedArray.set(stringToUint8Array(_channel.name).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)
|
||||||
|
@ -433,11 +433,11 @@
|
||||||
i += 0x10
|
i += 0x10
|
||||||
})
|
})
|
||||||
for (let i = 0; i < 0x0C80; i += 0x80) {
|
for (let i = 0; i < 0x0C80; i += 0x80) {
|
||||||
await eeprom_write(appStore.connectPort, i, rawEEPROM.slice(i, i + 0x80));
|
await eeprom_write(appStore.connectPort, i, rawEEPROM.slice(i, i + 0x80), 0x80, appStore.configuration?.uart);
|
||||||
}
|
}
|
||||||
await eeprom_write(appStore.connectPort, 0x0D60, rawEEPROM2, 0x0C8);
|
await eeprom_write(appStore.connectPort, 0x0D60, rawEEPROM2, 0x0C8);
|
||||||
for (let i = 0x0F50; i < 0x1BD0; i += 0x80) {
|
for (let i = 0x0F50; i < 0x1BD0; i += 0x80) {
|
||||||
await eeprom_write(appStore.connectPort, i, rawEEPROM3.slice(i - 0x0F50, i - 0x0F50 + 0x80));
|
await eeprom_write(appStore.connectPort, i, rawEEPROM3.slice(i - 0x0F50, i - 0x0F50 + 0x80), 0x80, appStore.configuration?.uart);
|
||||||
}
|
}
|
||||||
await eeprom_reboot(appStore.connectPort);
|
await eeprom_reboot(appStore.connectPort);
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue