diff --git a/src/index.ts b/src/index.ts index 88d6397..cf7d5a5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -212,6 +212,7 @@ export default class Updater { return new Promise((resolve, reject) => { this.bleObject.write(this.bleDeviceId, this._updaterServiceUUID, this._updateFileCharacteristicUUID, packet.buffer, () => { + this._fileProgress += this._packetSize; resolve(true); }, (error) => { @@ -246,7 +247,7 @@ export default class Updater { if (dataView[0] == 1) { // send file await this.sendNextPacket(); - progressCallback(`Sending (${Math.floor((this._fileProgress *100)/this._fileSize)})`); + progressCallback(`Sending (${Math.floor((this._fileProgress *100)/this._fileSize)}), ${this._fileProgress} / ${this._fileSize}`); } else if (dataView[0] == 2) { // done logic if (this._fileProgress >= this._fileSize) {