only add to progress the number of bytes written

This commit is contained in:
2025-12-01 18:40:08 +00:00
parent 27403e0aed
commit e5ce96adcf

View File

@@ -209,10 +209,13 @@ export default class Updater {
private async sendNextPacket(): Promise<boolean> {
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();