Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate OTA firmware updates to tasks #7256

Merged
merged 7 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/zwave-js/src/lib/driver/Driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2630,6 +2630,10 @@ export class Driver extends TypedEventEmitter<DriverEventCallbacks>
} catch {
// ignore
}

// No need to keep the node awake longer than necessary
node.keepAwake = false;
this.debounceSendNodeToSleep(node);
}
}

Expand Down Expand Up @@ -4144,7 +4148,7 @@ export class Driver extends TypedEventEmitter<DriverEventCallbacks>
"Attempting to recover controller again...",
"warn",
);
void this.softReset().catch(() => {
void this.softResetInternal(true).catch(() => {
this.driverLog.print(
"Automatic controller recovery failed. Returning to normal operation and hoping for the best.",
"warn",
Expand Down Expand Up @@ -4173,7 +4177,7 @@ export class Driver extends TypedEventEmitter<DriverEventCallbacks>
);

// Execute the soft-reset asynchronously
void this.softReset().then(() => {
void this.softResetInternal(true).then(() => {
// The controller responded. It is no longer unresponsive.

// Re-queue the transaction, so it can get handled next.
Expand Down
5 changes: 5 additions & 0 deletions packages/zwave-js/src/lib/driver/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ export type TaskTag =
// Rebuild routes for a single node
id: "rebuild-node-routes";
nodeId: number;
}
| {
// Perform an OTA firmware update for a node
id: "firmware-update-ota";
nodeId: number;
};

export class TaskScheduler {
Expand Down
Loading
Loading