diff --git a/dist/index.cjs.js b/dist/index.cjs.js index 7b7d62c..04048df 100644 --- a/dist/index.cjs.js +++ b/dist/index.cjs.js @@ -175,11 +175,12 @@ class Updater { } async sendNextPacket() { let packet = this.file.slice(this._fileProgress, this._fileProgress + this._packetSize); + this._fileProgress += this._packetSize; return new Promise((resolve, reject) => { this.bleObject.write(this.bleDeviceId, this._updaterServiceUUID, this._updateFileCharacteristicUUID, packet.buffer, () => { - this._fileProgress += this._packetSize; resolve(true); }, (error) => { + this._fileProgress -= this._packetSize; reject(error); }); }); diff --git a/dist/index.es.js b/dist/index.es.js index 97c7544..be84531 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -173,11 +173,12 @@ class Updater { } async sendNextPacket() { let packet = this.file.slice(this._fileProgress, this._fileProgress + this._packetSize); + this._fileProgress += this._packetSize; return new Promise((resolve, reject) => { this.bleObject.write(this.bleDeviceId, this._updaterServiceUUID, this._updateFileCharacteristicUUID, packet.buffer, () => { - this._fileProgress += this._packetSize; resolve(true); }, (error) => { + this._fileProgress -= this._packetSize; reject(error); }); }); diff --git a/package.json b/package.json index e1f82e1..1004479 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "updaterweblibrary", - "version": "1.0.19", + "version": "1.0.20", "description": "OTA Updater App frontend library", "repository": { "type": "git",