1
0
Fork 0
mirror of https://github.com/silenty4ng/k5web synced 2025-01-21 11:12:37 +00:00

Compare commits

...

4 commits

Author SHA1 Message Date
f7fbcfefef update 2024-07-10 20:43:04 +08:00
fc8eacd2be update 2024-07-10 20:38:53 +08:00
ca3a01ef2e update 2024-07-10 20:17:18 +08:00
b0df237cbc del losehu protocol 2024-07-10 20:09:19 +08:00
2 changed files with 19 additions and 12 deletions
src/views/list

View file

@ -78,6 +78,7 @@
calendar: [],
rom: [],
bl: undefined,
blName: '',
nowDrag: -1,
showAdd: '',
status: ''
@ -125,7 +126,9 @@
})
const loadBL = async() => {
const fontPacket = await fetch('/L_BL001.bin')
const latestVersion = JSON.parse(await (await fetch('https://k5.vicicode.com/diyapi/bl.json')).text())!.latest;
state.blName = latestVersion;
const fontPacket = await fetch('https://k5.vicicode.com/diyapi/' + latestVersion);
if(fontPacket.body){
const reader = fontPacket.body.getReader();
const chunks = [];
@ -174,7 +177,7 @@
await writeRange(0x40000, new Uint8Array([firmware.length]), '固件数量');
const _name_bl_array = new Uint8Array(8);
_name_bl_array.set(stringToUint8Array("L_BL001"))
_name_bl_array.set(stringToUint8Array(state.blName.split('.')[0]))
await writeRange(0X40008, _name_bl_array, '引导程序版本')
const writeMeta: any = [];
@ -182,7 +185,7 @@
const _meta_name = new Uint8Array(16)
const _meta_address_start = new Uint8Array(4)
const _meta_address_end = new Uint8Array(4)
_meta_name.set(stringToUint8Array(item.binaryName))
_meta_name.set(stringToUint8Array(item.binaryName.replace(/[^\x00-\xff]/g, '')))
_meta_address_start.set(hexReverseStringToUint8Array((item.start).toString(16)));
_meta_address_end.set(hexReverseStringToUint8Array((item.end).toString(16)));
writeMeta.push(..._meta_name, ..._meta_address_start, ..._meta_address_end, ...new Uint8Array(8))
@ -194,22 +197,26 @@
}
await eeprom_reboot(appStore.connectPort);
state.status = state.status + "写入完成<br/>";
setLoading(false);
}
const selectFile = () => {
const input = document.createElement('input');
input.type = 'file';
input.multiple = true;
input.onchange = async () => {
if(input.files){
const blob = new Blob([input.files[0]], { type: 'application/octet-stream' });
const rawEEPROM = new Uint8Array(await blob.arrayBuffer());
const firmware = {
binaryFile: unpack(rawEEPROM),
binaryName: input.files[0].name,
color: getColor()
for(let i = 0; i < input.files.length; i++){
const blob = new Blob([input.files[i]], { type: 'application/octet-stream' });
const rawEEPROM = new Uint8Array(await blob.arrayBuffer());
const firmware = {
binaryFile: unpack(rawEEPROM),
binaryName: input.files[i].name.replace(/[^\x00-\xff]/g, ''),
color: getColor()
}
state.rom.push(firmware)
}
state.rom.push(firmware)
}
};
input.click();
@ -289,7 +296,7 @@
}
const changeName = (val: any) => {
state.rom[val].binaryName = state.rom[val].binaryName.replace(/[^\a-\z\A-\Z0-9.]/g, '')
state.rom[val].binaryName = state.rom[val].binaryName.replace(/[^\x00-\xff]/g, '')
};
</script>

View file

@ -14,7 +14,7 @@
<div>
<a-radio-group type="button" size="mini" v-model="state.protocol">
<a-radio value="Official">Official</a-radio>
<a-radio value="Losehu">Losehu</a-radio>
<!-- <a-radio value="Losehu">Losehu</a-radio> -->
</a-radio-group>
</div>
</div>