I can't get sleep mode to work on my msom on device os version 5.8.2. It does not enter sleep mode and the code just flows to result.wakeReason() instantly.
The code runs in loop() and is triggered via a flag set by a cloud function, so the device is connected to the cloud and breathing cyan.
10s is used just for testing. What's strange is that the code does not stop when I call sleep, it immediately runs the next line as if it had ignored the sleep command.
The wake up reason is 0 - UNKNOWN, when network settings are left in.
When I remove network from the config, it enters sleep properly, wake up reason is 4 - BY_RTC
I think I know why it's not working: network wake is not supported on Gen 4 (RTL872x) including the M-SoM.
It's not supported on Wi-Fi only devices (P2 and Photon 2) because the Wi-Fi hardware is off during sleep, which would make it impossible to wake by Wi-Fi or keep the stack active.
However, it appears that the M-SoM may not have the feature either. It would only work for cellular, not when connected by Wi-Fi, which would be a strange behavior, so it's likely that it's never available.
It's possible that the code is in a completely different location, but it's certainly not in the RTL872x sleep_hal.cpp like it is for nRF52.
Makes sense, I was using sleep here to check wake by AB1805 fout to see if the chip was fine in newly manufactured devices, I have other ways of testing the chip.