Skip to content

Commit

Permalink
Forbid LcdUpdateDisabler to call lcd_update()
Browse files Browse the repository at this point in the history
The fixes a scenario where:

lcd_status_screen() calls lcd_commands() upon exiting
lcd_show_fullscreen_message_and_wait_P(_T(MSG_NOZZLE_CNG_READ_HELP));
and so not allowing the user to leave the screen since it will keep being rendered endlessly.

This change only affects lcd_show_fullscreen_message_and_wait_P
  • Loading branch information
gudnimg committed Jul 31, 2024
1 parent 549234f commit 83773d9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Firmware/lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,18 @@ extern void lcd_buttons_update(void);
//! When constructed (on stack), original state state of lcd_update_enabled is stored
//! and LCD updates are disabled.
//! When destroyed (gone out of scope), original state of LCD update is restored.
//! It has zero overhead compared to storing bool saved = lcd_update_enabled
//! and calling lcd_update_enable(false) and lcd_update_enable(saved).
//! Do not call lcd_update_enable() to prevent calling lcd_update() in sensitive code.
//! in certain scenarios it will cause recursion e.g. in the menus.
class LcdUpdateDisabler
{
public:
LcdUpdateDisabler(): m_updateEnabled(lcd_update_enabled)
{
lcd_update_enable(false);
lcd_update_enabled = false;
}
~LcdUpdateDisabler()
{
lcd_update_enable(m_updateEnabled);
lcd_update_enabled = m_updateEnabled;
}

private:
Expand Down

0 comments on commit 83773d9

Please sign in to comment.