1
0
Fork 0
mirror of https://github.com/silenty4ng/k5web synced 2025-04-04 15:15:02 +00:00
This commit is contained in:
Silent YANG 2025-03-19 21:47:18 +08:00
parent dc50e34bb6
commit 9f86780e4a

View file

@ -108,10 +108,12 @@
const writeRange = async (start: any = 0, uint8Array: any, remark: string = '') => { const writeRange = async (start: any = 0, uint8Array: any, remark: string = '') => {
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), uint8Array.slice(i - start, i - start + 0x80).length, appStore.configuration?.uart); await eeprom_write(appStore.connectPort, i, uint8Array.slice(i - start, i - start + 0x80), uint8Array.slice(i - start, i - start + 0x80).length, appStore.configuration?.uart);
// const checkData = await eeprom_read(appStore.connectPort, i, uint8Array.slice(i - start, i - start + 0x80).length, appStore.configuration?.uart) const checkData = await eeprom_read(appStore.connectPort, i, uint8Array.slice(i - start, i - start + 0x80).length, appStore.configuration?.uart)
// if(!isEqual(uint8Array.slice(i - start, i - start + 0x80), checkData)) { if(!isEqual(uint8Array.slice(i - start, i - start + 0x80), checkData)) {
// console.log("") state.status = state.status + remark + "检测到写入错误!!!" + "<br/>";
// } i -= 0x80;
continue
}
state.status = state.status + remark + "写入进度:" + (((i - start) / uint8Array.length) * 100).toFixed(1) + "%<br/>"; state.status = state.status + remark + "写入进度:" + (((i - start) / uint8Array.length) * 100).toFixed(1) + "%<br/>";
nextTick(()=>{ nextTick(()=>{
@ -182,7 +184,7 @@
for(let i = 256; i < 4096; i++){ for(let i = 256; i < 4096; i++){
if(state.calendar[i] >= 0){ if(state.calendar[i] >= 0){
console.log(i); console.log(i);
const newBinaryFile = new Uint8Array(Math.ceil(state.rom[state.calendar[i]].binaryFile.length / 0x40) * 0x40); const newBinaryFile = new Uint8Array(Math.ceil(state.rom[state.calendar[i]].binaryFile.length / 0x40) * 0x40).fill(0xff);
newBinaryFile.set(state.rom[state.calendar[i]].binaryFile, 0) newBinaryFile.set(state.rom[state.calendar[i]].binaryFile, 0)
state.rom[state.calendar[i]].binaryFile = newBinaryFile state.rom[state.calendar[i]].binaryFile = newBinaryFile
firmware.push({ firmware.push({