From e5ce96adcf57cf57682272d07e2d6e3280d1443a Mon Sep 17 00:00:00 2001 From: chopster44 Date: Mon, 1 Dec 2025 18:40:08 +0000 Subject: [PATCH] only add to progress the number of bytes written --- src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index f17aca6..04ca1d1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -209,10 +209,13 @@ export default class Updater { private async sendNextPacket(): Promise { let packet = this.file.slice(this._fileProgress, this._fileProgress + this._packetSize); - this._fileProgress += this._packetSize; + // this._fileProgress += this._packetSize; return new Promise((resolve, reject) => { this.bleObject.writeWithoutResponse(this.bleDeviceId, this._updaterServiceUUID, this._updateFileCharacteristicUUID, packet.buffer, () => { + console.log("Wrote") + console.log(packet.length); + this._fileProgress += packet.length; resolve(true); }, (error) => { @@ -246,7 +249,6 @@ export default class Updater { this.bleObject.startNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, (rawData: ArrayBuffer): void => { let dataView = new Uint8Array(rawData); - console.log(dataView); if (dataView[0] == 1) { // send file this.sendNextPacket();