Will sofware timers normally expire when a the loop gets blocked?

In the documentation it says that interrupts should be active for the application watchdog to function.
In my current application however, there is a part for which I cannot allow the interrupts to be active, so I disabled them with noInterrupts() and after that part enable them again with interrupts().
So: I cannot use the application watchdog function.
I have a function in my application that I absolutely do not want to crash and block te photon.
I am now thinking of starting a software timer in parallel to tat function, that expires after a certain time and that will then launch a System-reset().
Is this a valid approach, or will the timer not work if the loop gets blocked? (assuming the timer will be started well before the loop might get blocked???
In other words: will a software timer normally expire or will it also be halted as soon as the photon gets blocked???

The software timer will not activate either if interrupts are disabled.

Both the application watchdog and software timer are FreeRTOS threads and thread swapping is disabled when you use noInterrupts().

@Jan_dM, what exactly does your “critical” part do that cannot be interrupted?

But what will happen if a certain timer is activated when the main program is still running with interrupts() being active, and the main program then enters into nonInterrupt mode: will the timer be stopped at that instance, or will it continue until the period is done and then still execute the function system.reset()???

Because I have utilised all photon inputs, I am switching some of the analogue inputs from “doing an analogue measurement” to “waiting for an interrupt”.

IIRC, deactivating interrupts will also prevent context switching.
So in whatever context your program is whe you disable interrupts, that’s where your program will keep on running till interrupts and hence context switching is reenabled.

@Jan_dM, if you code is designed with non-blocking FSMs, you shouldn't need to kill all interrupts. BTW, what do you mean by:

Waiting for an interrupt runs counter to the point of interrupts in that they occur asynchronously. Can you share a bit of your code?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.