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:
co-authored by
philon-
parent
5b417a321a
commit
50ca75da0e
@@ -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`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user