mirror of
https://github.com/silenty4ng/k5web
synced 2025-04-10 18:48:50 +00:00
update
This commit is contained in:
parent
aef086229f
commit
dc50e34bb6
1 changed files with 15 additions and 2 deletions
|
@ -97,9 +97,22 @@
|
||||||
return rawEEPROM;
|
return rawEEPROM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isEqual = (arr1: Uint8Array, arr2: Uint8Array): boolean => {
|
||||||
|
if (arr1.length !== arr2.length) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr1.every((value, index) => value === arr2[index])
|
||||||
|
}
|
||||||
|
|
||||||
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 += 0xC0) {
|
for (let i = start; i < uint8Array.length + start; i += 0x80) {
|
||||||
await eeprom_write(appStore.connectPort, i, uint8Array.slice(i - start, i - start + 0xC0), uint8Array.slice(i - start, i - start + 0xC0).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)
|
||||||
|
// if(!isEqual(uint8Array.slice(i - start, i - start + 0x80), checkData)) {
|
||||||
|
// console.log("写入错误!!!")
|
||||||
|
// }
|
||||||
|
|
||||||
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(()=>{
|
||||||
const textarea = document?.getElementById('statusArea');
|
const textarea = document?.getElementById('statusArea');
|
||||||
|
|
Loading…
Add table
Reference in a new issue