flipperzero-firmware
flipperzero-firmware copied to clipboard
event.input.sequence returns the same wrong value on remote control
qFlipper ver. 1.2.1 Code:
typedef enum { EventTypeTick, EventTypeKey, } EventType; typedef struct { EventType type; InputEvent input; } PluginEvent; FuriMessageQueue* event_queue; PluginEvent event; FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100); if(event_status == FuriStatusOk && event.type == EventTypeKey) {
here always >>> event.input.sequence == 536921112
}
Looks like it belongs to flipperzero-firmware.
Yep, external events doesn't hame valid sequence number. Can I see use your case of it?
switch(event.input.key) { case InputKeyOk: if(event.input.type == InputTypeLong) { ...func#1 key_press_seq_ok = event.input.sequence; } else if(event.input.type == InputTypeRelease && key_press_seq_ok != event.input.sequence) { // short press ...func#2 }
ViewPort and View are ensuring that input sequence is always complimentary. Using event.input.sequence here looks like overkill. There are some really special edge cases where you may want to use it, but I don't see any in your code.
Anyway, I'll update code to add sequence number for rpc input events.
I need to handle long keypress and single keypress. how to do it?
if(event.input.type == InputTypeShort) {
// Short
} else if(event.input.type == InputTypeLong) {
// Long
}
Something like that is not enough?
Thanks, it's ok. I used InputTypePress instead of InputTypeShort.
Couple releases ago I've implemented proper sequence number for external events. So your original issue should be solved.