Continuing my morse communication project.
In my current code, when one of the NodeMCUs boots, it attempts to send a time synchronisation message to the other using
call_device(). If it succeeds, both devices calculate the difference between their
millis() values. When the button on one is pressed, it sends a message (either ON or OFF) to the other along with its
millis() value. The second one then determines when it should play or stop the buzzer based on the time difference.
My NodeMCU devices only need to communicate when a button is pressed on one of them, or when they are synchronising time. For the most part, they are just idle. Therefore, I want to put them in sleep mode. I have read about the different sleep methods on the NodeMCU, but I cannot decide how to make it work.
The problem is that if the NodeMCUs are sleeping, they cannot detect when one starts sending the other messages. The other problem is that if I, for example, wake them up often, the power savings will be minimal. I want to run this project off a 9V battery for at least weeks. When just idle, they for some reason do not go into automatic light/modem sleep, I assume that is because of the Thinger API?
Is this possible? How do you achieve power savings when connected to Thinger?
CC @ega do you know anything about this?