How to retain control of an Electron using Cellular.on and Cellular.off

Have you seen this thread?


It looks like a TX buffer overrun, which should not happen due to the default behaviour of Serial.print() should be to block if there is no free space left
https://docs.particle.io/reference/firmware/electron/#blockonoverrun-

Unless some buggy code messes up the head/tail pointers.

Just for completeness, your int now = millis() should actually be unsigned.


As a side note:
Since the actual TX doesn't happen with the Serial.print() statement but async to your code Cellular.off() (and its effects) might be the source of the TX corruption, which might be something to investigate (@BDub ?)