From 74ea9a7e43d7ab1bb51fdbcd78c808ab8cae2347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sat, 7 May 2022 16:00:09 +0000 Subject: [PATCH] Remove class LcdUpdateDisabler Calling lcd_update_enable directly gives us more control This also save a bit of flash memory --- Firmware/lcd.h | 24 ------------------------ Firmware/ultralcd.cpp | 2 +- 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/Firmware/lcd.h b/Firmware/lcd.h index c741fd700..7331131ad 100644 --- a/Firmware/lcd.h +++ b/Firmware/lcd.h @@ -127,30 +127,6 @@ extern void lcd_update_enable(uint8_t enabled); extern void lcd_buttons_update(void); -//! @brief Helper class to temporarily disable LCD updates -//! -//! 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). -class LcdUpdateDisabler -{ -public: - LcdUpdateDisabler(): m_updateEnabled(lcd_update_enabled) - { - lcd_update_enable(false); - } - ~LcdUpdateDisabler() - { - lcd_update_enable(m_updateEnabled); - } - -private: - bool m_updateEnabled; -}; - - //////////////////////////////////// // Setup button and encode mappings for each panel (into 'lcd_buttons' variable // diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index cf2f41c8f..758bc4a31 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3117,7 +3117,7 @@ const char* lcd_display_message_fullscreen_P(const char *msg) */ void lcd_show_fullscreen_message_and_wait_P(const char *msg) { - LcdUpdateDisabler lcdUpdateDisabler; + lcd_update_enable(false); const char *msg_next = lcd_display_message_fullscreen_P(msg); bool multi_screen = msg_next != NULL; lcd_set_custom_characters_nextpage();