actually count up file progress

This commit is contained in:
2025-11-30 12:02:21 +00:00
parent 4900cf6acd
commit 90b8e08946

View File

@@ -212,6 +212,7 @@ export default class Updater {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.bleObject.write(this.bleDeviceId, this._updaterServiceUUID, this._updateFileCharacteristicUUID, packet.buffer, this.bleObject.write(this.bleDeviceId, this._updaterServiceUUID, this._updateFileCharacteristicUUID, packet.buffer,
() => { () => {
this._fileProgress += this._packetSize;
resolve(true); resolve(true);
}, },
(error) => { (error) => {
@@ -246,7 +247,7 @@ export default class Updater {
if (dataView[0] == 1) { if (dataView[0] == 1) {
// send file // send file
await this.sendNextPacket(); 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) { } else if (dataView[0] == 2) {
// done logic // done logic
if (this._fileProgress >= this._fileSize) { if (this._fileProgress >= this._fileSize) {