arduino-lmic icon indicating copy to clipboard operation
arduino-lmic copied to clipboard

LMIC should not assert()

Open terrillmoore opened this issue 7 years ago • 1 comments

assert()s are generally harmful, particularly as they cause a device hang in this implementation (rather than a restart) -- you'll have to roll a truck to get the device going again.

A code review is needed so that places where we currently assert instead:

  • return errors passed back to the caller,
  • continue by substituting sane values, or
  • shut down the LMIC code (potentially reinitializing later)

terrillmoore avatar Feb 07 '18 02:02 terrillmoore

My proposal would be to replace all asserts with EV_ASSERTED callbacks notificating upper layers that comms subsystem crashed, outcome uncertain, do something, e.g. repeat last action, or do an LMIC reinit.

Asserting because of SPI glitch is harmful for the end app, and also hiding the problem also too.

During development you can break on EV_ASSERTED and see conditions. I would even increase the number of these checkpoints, because it will can catch incompatible changes.

mrx23dot avatar Feb 20 '22 11:02 mrx23dot