Handle Long-Press in the main loop
The longpress function is currently called within the temperature ISR, which is bogus. Calling the longpress function at the wrong moment can corrupt the menu buffers. Move the call to the main loop by changing the logic slightly: - still sample the lcd buttons inside the temperature ISR, which keeps scrollong/pressing responsive, but... - set a flag to indicate that longpress has been triggered instead of calling the function directly - call the function on the next manage_inactivity run Combined with #3180 this removes _most_ unsafe operations out of the ISR which can happen during a normal run (max/mintemp warnings are still an exception).
This commit is contained in:
parent
a8a253c0ae
commit
06d91ddcee
3 changed files with 15 additions and 3 deletions
Firmware
|
@ -728,6 +728,8 @@ void lcd_update_enable(uint8_t enabled)
|
|||
}
|
||||
}
|
||||
|
||||
bool lcd_longpress_trigger = 0;
|
||||
|
||||
void lcd_buttons_update(void)
|
||||
{
|
||||
static uint8_t lcd_long_press_active = 0;
|
||||
|
@ -749,9 +751,7 @@ void lcd_buttons_update(void)
|
|||
else if (longPressTimer.expired(LONG_PRESS_TIME))
|
||||
{
|
||||
lcd_long_press_active = 1;
|
||||
//long press is not possible in modal mode
|
||||
if (lcd_longpress_func && lcd_update_enabled)
|
||||
lcd_longpress_func();
|
||||
lcd_longpress_trigger = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue