Skip to content

Commit

Permalink
fix: remove all tasks when hard-resetting or entering bootloader (#7255)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone authored Oct 8, 2024
1 parent e2b049c commit 37629fa
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/zwave-js/src/lib/driver/Driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3150,6 +3150,15 @@ export class Driver extends TypedEventEmitter<DriverEventCallbacks>
cacheKeys.controller.privateKey,
);

// Drop all scheduled tasks - they don't make sense after a hard reset
await this.scheduler.removeTasks(
() => true,
new ZWaveError(
"The controller is being hard-reset",
ZWaveErrorCodes.Driver_TaskRemoved,
),
);

// Update the controller NIF prior to hard resetting
await this.controller.setControllerNIF();
await this.controller.hardReset();
Expand Down Expand Up @@ -7066,6 +7075,14 @@ ${handlers.length} left`,
try {
// await this.controller.toggleRF(false);
// Avoid re-transmissions etc. communicating with the bootloader
await this.scheduler.removeTasks(
() => true,
new ZWaveError(
"The controller is entering bootloader mode.",
ZWaveErrorCodes.Driver_TaskRemoved,
),
);

this.rejectTransactions(
(_t) => true,
"The controller is entering bootloader mode.",
Expand Down

0 comments on commit 37629fa

Please sign in to comment.