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

View file

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

View file

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