Compare commits

..

No commits in common. "f7fbcfefefbf48f891fd88a625d330978208b7ff" and "c56e4e560884947903694de17a2300e3e589ee91" have entirely different histories.

2 changed files with 12 additions and 19 deletions

View file

@ -78,7 +78,6 @@
calendar: [], calendar: [],
rom: [], rom: [],
bl: undefined, bl: undefined,
blName: '',
nowDrag: -1, nowDrag: -1,
showAdd: '', showAdd: '',
status: '' status: ''
@ -126,9 +125,7 @@
}) })
const loadBL = async() => { const loadBL = async() => {
const latestVersion = JSON.parse(await (await fetch('https://k5.vicicode.com/diyapi/bl.json')).text())!.latest; const fontPacket = await fetch('/L_BL001.bin')
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 = [];
@ -177,7 +174,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(state.blName.split('.')[0])) _name_bl_array.set(stringToUint8Array("L_BL001"))
await writeRange(0X40008, _name_bl_array, '引导程序版本') await writeRange(0X40008, _name_bl_array, '引导程序版本')
const writeMeta: any = []; const writeMeta: any = [];
@ -185,7 +182,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.replace(/[^\x00-\xff]/g, ''))) _meta_name.set(stringToUint8Array(item.binaryName))
_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))
@ -197,26 +194,22 @@
} }
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){
for(let i = 0; i < input.files.length; i++){ const blob = new Blob([input.files[0]], { type: 'application/octet-stream' });
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();
@ -296,7 +289,7 @@
} }
const changeName = (val: any) => { const changeName = (val: any) => {
state.rom[val].binaryName = state.rom[val].binaryName.replace(/[^\x00-\xff]/g, '') state.rom[val].binaryName = state.rom[val].binaryName.replace(/[^\a-\z\A-\Z0-9.]/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>