Hi, I’m trying to use the main loop to manage app events. I’m using the RAK11722 dev kit. The problem is that once I run api.system.sleep.all(), main loop never continues execution after that. The software timers dont seem to wakeup the main loop.
This is a more straightforward version, I was under the assumption that timer events will wakeup the device, and hence continue the execution of the main loop?
But that is not happening. Is that only possible via a gpio interrupt?
Your app hangs for me after the xQueue = xQueueCreate(10, sizeof(uint32_t)); that’s why I think you can’t use FreeRTOS functions. There might be more steps required to use it. FreeRTOS functions are not in the official RUI3 documentation, because only the RAK11700 has it. RAK3172 and RAK4630 are bare bone SDK’s.
I am never using api.system.sleep function for waiting for events. I enable low power mode with api.system.lpm.set(0) and kill my loop or let it sleep forever. Then my app is waking on interrupts from GPIO’s or from timer events.
Why do you want to wake up loop from the timer? Why don’t you do you stuff inside the timer (if it is not too long).
Interesting, it works for me but I’ll avoid it’s usage.
I’m already using the software timers for other purposes (multiple time dependent calculations, timer based actions like turning motors on and off and periodic actions), ran out of software timers.
My device will be put into various states (via downlinks) but some states are mutually exclusive to each other, it’s easier to handle them centrally. I was using the timers in this example to simulate certain events. This works except I dont have a way to turn off the loop while the app is in the idle state, and resume on some event.
I could shift things around to try and make it so that everything is handed in ISRs, downlink and timer callbacks but i think that would affect readability.