js icon indicating copy to clipboard operation
js copied to clipboard

[Bug]: We are ignoring some packet types and they are being treated as "padding" in Web and NodeJS serial connections

Open TheCyberRonin opened this issue 1 year ago • 1 comments

Hardware

Heltec V3

Connection Type

Serial

Firmware Version

2.4.2.5b45303

Description

I am connected to my device via NodeJS serial and just reading the logs with concurrentLogOutput set to true. There is an unhandled payload variant.

It looks a lot uglier when you turn off concurrentLogOutput and it seems as the unhandled payload is considered "padding" from the TransformStream.

Relevant console output

02:48:41:722    WARN    [iMeshDevice:SerialConnection]  HandleFromRadio ⚠️ Unhandled payload variant: undefined
DeviceDebugLog:  Uint8Array(203) [
   27, 91,  51,  50, 109,   0,  73,  78,  70,  79,  32,  32,
   27, 91,  48, 109, 124,  32,  63,  63,  58,  63,  63,  58,
   63, 63,  32,  50,  50,  56,  53,  32,  91,  83, 101, 114,
  105, 97, 108,  67, 111, 110, 115, 111, 108, 101,  93,  32,
   27, 91,  51,  50, 109,   0, 103, 101, 116,  70, 114, 111,
  109, 82,  97, 100, 105, 111,  61,  83,  84,  65,  84,  69,
   95, 83,  69,  78,  68,  95,  70,  73,  76,  69,  77,  65,
   78, 73,  70,  69,  83,  84,  13,  10,  27,  91,  48, 109,
    0, 27,  91,  51,
  ... 103 more items
]
FromRadio:  FromRadio {
  id: 0,
  payloadVariant: { case: undefined },
  [Symbol(@bufbuild/protobuf/unknown-fields)]: [
    {
      no: 15,
      wireType: 2,
      data: <Buffer 20 0a 1b 2f 73 74 61 74 69 63 2f 73 69 74 65 2e 77 65 62 6d 61 6e 69 66 65 73 74 2e 67 7a 10 c5 01>
    }
  ]
}

TheCyberRonin avatar Aug 24 '24 02:08 TheCyberRonin

Turns out a lot of the time this is actually ascii debug text that can be printed.

I added this to your sample code:

connection.events.onDeviceDebugLog.subscribe((packet) => { console.log(Array.from(packet).map((code)=>String.fromCharCode(code)).join('')); });

This results in the debug info from the radio printing out. Handy!

benbrown avatar Nov 21 '24 22:11 benbrown