switching to faster comms

node_mode
Jake 2025-09-28 22:05:51 +08:00
parent 84d24d93a2
commit bcb240773d
1 changed files with 54 additions and 48 deletions

View File

@ -235,7 +235,9 @@ window.onload = () => {
const header = [0xAA, 0x55];
const length = payload.length;
const message = [...header, commandCode, length, ...payload];
const lengthHigh = (length >> 8) & 0xFF;
const lengthLow = length & 0xFF;
const message = [...header, commandCode, lengthHigh, lengthLow, ...payload];
const writer = port.writable.getWriter();
await writer.write(new Uint8Array(message));
@ -426,7 +428,11 @@ window.onload = () => {
writer.releaseLock();
console.log(`Sent chunk: ${filename} offset=${offset} size=${chunkData.length}`);
console.log(packet);
}
console.log("Total animation size:", totalSize);
}