My feedback_cb() is being called twice for every keypress

I have setup a feedback_cb on my keypad indev to catch a “global” BACK button press, which I have mapped to LV_KEY_ESC.

However, every time I press the ESC key, my feedback_cb gets called twice.

I enabled tracing and I can see that it is being called twice, but that the param is different (see output below – the lines starting with feedback are from my feedback_cb). This value is not passed in though, so I have no way to differentiate the two events passed to feedback_cb.

[Trace] (16.153, +9)     event_send_core: Sending event 13 to 2401d620 with 2407f92c param      (in lv_event.c line #416)
feedback: 13
feedback(): key=27 pressed
feedback(): ESC pressed
[Trace] (16.169, +16)    event_send_core: Sending event 13 to 2401d760 with 2407f8b4 param      (in lv_event.c line #416)
feedback: 13
feedback(): key=27 pressed
feedback(): ESC pressed

This doesn’t appear to be specific to MicroPython, so I’m posting here in General.

Any ideas what I can do so it only gets called once? I’d rather not just ignore every other event, as that is pretty hacky (and who knows if it might get called only once in some cases or 3 times in another case in the future).

Thanks for any insights.

I’ve tested it in C and see only an LV_EVENT_KEY and an LV_EVENT_CANCEL event code.

Do you see LV_EVENT_CANCEL (=32) too?

The relevant code from C is this:

Thanks Gabor. I’m not sure what was happening TBH, but it isn’t happening anymore. I was playing around with some changes in gridnav.c, but it doesn’t seem like that was causing it.

Assume it’s resolved for now, and if it comes back, I’ll resurrect this thread.

We can be happy. then… I guess :slight_smile: