(1.0.16) dbg

This commit is contained in:
chopster44 committed 2025-11-30 11:47:25 +00:00
1 parent 3e07911cac
commit 4900cf6acd
3 files changed
+21 -11

No files matched your search

+10 -5
View File
@@ -198,13 +198,10 @@ class Updater {
// check for error // check for error
// write file length // write file length
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const buffer = new ArrayBuffer(4);
let view = new Int32Array(buffer);
view[0] = this._fileSize;
await this.bleObject.withPromises.write(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, buffer);
// start notify // start notify
this.bleObject.startNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, async (rawData) => { this.bleObject.startNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, async (rawData) => {
let dataView = new Int8Array(rawData); let dataView = new Uint8Array(rawData);
console.log(dataView);
if (dataView[0] == 1) { if (dataView[0] == 1) {
// send file // send file
await this.sendNextPacket(); await this.sendNextPacket();
@@ -235,6 +232,10 @@ class Updater {
progressCallback(`Error on remote`); progressCallback(`Error on remote`);
reject("Error on remote"); reject("Error on remote");
} }
else if (dataView[0] == 0) {
// ignore no command
progressCallback(`Board is on`);
}
else { else {
// no command // no command
progressCallback(`Error on remote`); progressCallback(`Error on remote`);
@@ -244,6 +245,10 @@ class Updater {
reject("Error: Failed to start notify"); reject("Error: Failed to start notify");
console.error(error); console.error(error);
}); });
const buffer = new ArrayBuffer(4);
let view = new Int32Array(buffer);
view[0] = this._fileSize;
await this.bleObject.withPromises.write(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, buffer);
}); });
} }
} }
+10 -5
View File
@@ -196,13 +196,10 @@ class Updater {
// check for error // check for error
// write file length // write file length
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const buffer = new ArrayBuffer(4);
let view = new Int32Array(buffer);
view[0] = this._fileSize;
await this.bleObject.withPromises.write(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, buffer);
// start notify // start notify
this.bleObject.startNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, async (rawData) => { this.bleObject.startNotification(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, async (rawData) => {
let dataView = new Int8Array(rawData); let dataView = new Uint8Array(rawData);
console.log(dataView);
if (dataView[0] == 1) { if (dataView[0] == 1) {
// send file // send file
await this.sendNextPacket(); await this.sendNextPacket();
@@ -233,6 +230,10 @@ class Updater {
progressCallback(`Error on remote`); progressCallback(`Error on remote`);
reject("Error on remote"); reject("Error on remote");
} }
else if (dataView[0] == 0) {
// ignore no command
progressCallback(`Board is on`);
}
else { else {
// no command // no command
progressCallback(`Error on remote`); progressCallback(`Error on remote`);
@@ -242,6 +243,10 @@ class Updater {
reject("Error: Failed to start notify"); reject("Error: Failed to start notify");
console.error(error); console.error(error);
}); });
const buffer = new ArrayBuffer(4);
let view = new Int32Array(buffer);
view[0] = this._fileSize;
await this.bleObject.withPromises.write(this.bleDeviceId, this._updaterServiceUUID, this._updaterCommandCharacterisitcUUID, buffer);
}); });
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "updaterweblibrary", "name": "updaterweblibrary",
"version": "1.0.15", "version": "1.0.16",
"description": "OTA Updater App frontend library", "description": "OTA Updater App frontend library",
"repository": { "repository": {
"type": "git", "type": "git",