arduino-lmic
arduino-lmic copied to clipboard
LMIC should not assert()
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)
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.