Send heartbeat package to keep serial alive (#732)

* Send heartbeat package to keep the serial connection alive

* Update meshDevice.ts

---------

Co-authored-by: philon- <philon-@users.noreply.github.com>
This commit is contained in:
Jeremy Gallant
2025-07-24 10:15:27 -04:00
committed by GitHub
co-authored by philon-
parent 5b417a321a
commit 50ca75da0e
4 changed files with 37 additions and 2 deletions
+10
View File
@@ -44,6 +44,16 @@ export class Queue {
if (this.queue.findIndex((qi) => qi.id === item.id) !== -1) {
this.remove(item.id);
const decoded = fromBinary(Protobuf.Mesh.ToRadioSchema, item.data);
if (
decoded.payloadVariant.case === "heartbeat" ||
decoded.payloadVariant.case === "wantConfigId"
) {
// heartbeat and wantConfigId packets are not acknowledged by the device, assume success after timeout
resolve(item.id);
return;
}
console.warn(
`Packet ${item.id} of type ${decoded.payloadVariant.case} timed out`,
);