Working on a gate controller. it uses a control anything single relay board. The same could be used for a automatic garage door. Fire the relay, the garage door moves. The relay is fired, a time is set for 1/2 second and the relay is released. The function that does this is cycle relay. All of this in a class. There is also a gate class that has a relay in it.
One of the functions is recover gate, when the code starts or during some parts of operation the system wants to know the state of the gate. Open, closed, opening, closing, unknown. Unknown is bad so in that case I call my recover gate. Recover gate call cycle relay, then sleeps for 60 seconds. Cycle relay in all normal cases energizes the relay, the call back from the timer then de-enegizes the relay. The code in recover gate, cycles the relay and then sleeps 60 seconds. I never see the relay call back happen when sleep is called. Outside of when I sleep right after calling cycle_relay which energize the relay and then starts a 1/2 timer the call back works.
I cannot post code right now but will get something up if needed this weekend.
So, a bit of reading which still has not given me all the confidence is that my timer may not be being called due to the fact that SYSTEM_THREAD(ENABLE) is not set… I haveread three or four post on timers and system_thread…
I can easily move the sleep or just get rid of it and set a new gate state “RECOVERING”. But in the end I did not really see why the timer did not fire. I have not tried SYSTEM_THREAD yet but will have some time this weekend to poke around a bit more. Thoughts?
Yes - I have read other post still not getting a clear picture on why the timer did not fire.
This also then leads to no semaphores, it seems there is only global blocking?
Thanks for your insights.