Describe the bug.
I have created a FAP app that handles GPIO interrupts by delegating the events to an FuriEventLoop with furi_event_loop_subscribe_event_flag.
Interestingly, it seems that every furi_event_flag_set event is delayed, and is delivered after the very next set to the same FuriEventFlag. I only call furi_event_flag_set methods from interrupts.
After the very first interrupt the FuriEventLoop does not wake up, and then somehow on every subsequent set it wakes up, and when the handler runs and attempts to get the new flag value, it receives exactly the previous value.
I have created an example to demonstrate the issue.
The application sets interrupts for the left and right input GPIOs. When a button is pressed, the interrupt writes the L or R letters into a buffer„and calls furi_event_loop_set. Then the handler in the event loop gets the flags with either furi_event_flag_get or furi_event_flag_clear, and based on the received flags, it appends the same L or R character to another buffer. These buffers are printed to the gui. I have the same problem with other interrupts too.

https://github.com/sorgloomer/flipper_eventflag_demo
I am using a periodic timer to redraw the text unconditionally to make sure the problem is not in my gui programming.
Reproduction
- Instantiate
FuriEventLoop and FuriEventFlag
- Subscribe to the event with
furi_event_loop_subscribe_event_flag
- Subscribe to an interrupt with
furi_event_loop_subscribe_event_flag
- Use
furi_event_flag_set in the interrupt handler
- Use
furi_event_flag_wait in the event handler to get and reset the flags
- Observe that the individual events arrive late to the interrupts, one interrupt late, in lockstep.
Target
No response
Logs
Anything else?
No response
Describe the bug.
I have created a FAP app that handles GPIO interrupts by delegating the events to an
FuriEventLoopwith furi_event_loop_subscribe_event_flag.Interestingly, it seems that every furi_event_flag_set event is delayed, and is delivered after the very next
setto the sameFuriEventFlag. I only callfuri_event_flag_setmethods from interrupts.After the very first interrupt the
FuriEventLoopdoes not wake up, and then somehow on every subsequentsetit wakes up, and when the handler runs and attempts to get the new flag value, it receives exactly the previous value.I have created an example to demonstrate the issue.
The application sets interrupts for the left and right input GPIOs. When a button is pressed, the interrupt writes the
LorRletters into a buffer„and callsfuri_event_loop_set. Then the handler in the event loop gets the flags with eitherfuri_event_flag_getorfuri_event_flag_clear, and based on the received flags, it appends the sameLorRcharacter to another buffer. These buffers are printed to the gui. I have the same problem with other interrupts too.https://github.com/sorgloomer/flipper_eventflag_demo
I am using a periodic timer to redraw the text unconditionally to make sure the problem is not in my gui programming.
Reproduction
FuriEventLoopandFuriEventFlagfuri_event_loop_subscribe_event_flagfuri_event_loop_subscribe_event_flagfuri_event_flag_setin the interrupt handlerfuri_event_flag_waitin the event handler to get and reset the flagsTarget
No response
Logs
Anything else?
No response