Closed jeffkowalski closed 4 months ago
Even with the TRS plugged in, it will go to sleep if there is no HTTP request in the time threshold. The reason you might not see it go to sleep is if you are running the browser web page for SOTACAT which checks the battery level (a REST API call) once per minute, and that resets the ESP32 shutdown watchdog such that it can't go to sleep. If you stop your connection to the device, the watchdog will eventually time out and initiate sleep.
So I think this is a feature request to check and see if we are still connected to the radio. To do that we need better management of when we talk to the radio since there are multiple threads that can be running and we need to queue/mutex access to the radio. Some access to the radio has to have a different priority than other access to the radio such as when doing an FT8 synthesis where timing is critical. Other cases aren't as time critical, but because some KX commands can take a LONG time, we can "blow" an FT8 initiation window if the prep commands are interrupted.
Likely then, this bug relates to #8
The grand solution I'm thinking of is two producer-consumer queues: one to handle the web side, fielding browser requests, queuing them, and awaiting producer response; another to do the same on the radio end. I have to dwell a little on how to make the queues respond synchronously for those callers who are expecting a return with a value, not just a "put your request in queue".
On second thought, maybe simple mutex would be the way to go.
...and the mechanism / queue for access to the radio has to have some concept of absolute priority so that I can "skip the line" or "freeze the queue" when doing an FT8 sequence. For example: a call to ask if the radio is still connected or to get the battery level should be at the back of the line compared to FT8 work.
There are a few places where FT8 timing matters:
Back to my original reported bug. You're correct, Brian, it's working correctly. After many minutes (AUTO_SHUTDOWN_TIME_SECONDS
currently 30 min), the SOTAcat notices inactivity and shuts down, per the code in idle_status_task
.
Closing this bug as "working as designed", and moving your last comment to a discussion so we can ponder threading and preserving FT8 timing.
It could be a common occurrence in the field:
Need to ping the radio over the uart from time to time to see it it's still connected. Otherwise, go into deep sleep.