I have a workaround for flushing messages before entering Deep Sleep that so far seems to be working. We need a way to call
Spark_Sleep() to flush the messages. There's no way (that I can find) to call the
Spark_Sleep() function directly, but you can call it by entering STOP mode sleep with a pin wake. With a short value for
seconds (1 second), this should have the effect of flushing the messages, stopping the CPU for a second, then we can enter Deep Sleep. One other thing to save time/battery: keep the network connected during the first sleep call with the
SLEEP_NETWORK_STANDBY option, otherwise the sleep call seems to wait for the modem to connect again before returning.
This code should wait to flush the messages, then go to Deep Sleep (for 10 seconds):
I'll try to remember to post back after setting up a more thorough test and getting results.