Show Channel and Frame Number on OLED

To have my TTGO OLED show the channel and frame values the same as shown in the TTN Console Data (with the values of the transmission just completed) I insert my code into LMiC ttn-abp example as here:

void onEvent (ev_t ev) {
// Show TX channel (channel numbers are local to LMIC)
u8x8.setCursor(4, 3);
u8x8.printf("%u", LMIC.txChnl);

and here:

 u8x8.setCursor(11, 3);
 u8x8.printf("%u", LMIC.seqnoUp);
  // Prepare upstream data transmission at the next possible time.

This seems to work but Is it OK or are there better ways / places to add this functionality?

The big things to watch are when the values change compared to when they are used (for example if I recall correctly the frame count pre-increments, but not sure when the [incidentally insufficient] channel choosing code operates). And then being sure not to insert any time consuming operations into timing critical parts of the code, particularly anything that could delay opening a receive window on time such as if you add operations between when the code decides its time to start receiving and when it actually does, or between the actual end of the transmit frame and the recorded end time.

1 Like