From cee63a16887d7c8dc791ce488d837ddf3be9603b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 19 Oct 2018 14:19:51 -0500 Subject: [PATCH] Add parentheses to card macros --- Marlin/Marlin_main.cpp | 4 ++-- Marlin/cardreader.h | 14 +++++++------- Marlin/status_screen_lite_ST7920.h | 2 +- Marlin/ultralcd.cpp | 12 ++++++------ Marlin/ultralcd_impl_HD44780.h | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index e116ec6f0a..e7d8a78bca 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -8217,7 +8217,7 @@ inline void gcode_M42() { * This has no effect during an SD print job */ inline void gcode_M73() { - if (!IS_SD_PRINTING && parser.seen('P')) { + if (!IS_SD_PRINTING() && parser.seen('P')) { progress_bar_percent = parser.value_byte(); NOMORE(progress_bar_percent, 100); } @@ -14786,7 +14786,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { // --------------------------------------------------------- static int homeDebounceCount = 0; // poor man's debouncing count const int HOME_DEBOUNCE_DELAY = 2500; - if (!IS_SD_PRINTING && !READ(HOME_PIN)) { + if (!IS_SD_PRINTING() && !READ(HOME_PIN)) { if (!homeDebounceCount) { enqueue_and_echo_commands_P(PSTR("G28")); LCD_MESSAGEPGM(MSG_AUTO_HOME); diff --git a/Marlin/cardreader.h b/Marlin/cardreader.h index bbc84d9db3..fb6f003a99 100644 --- a/Marlin/cardreader.h +++ b/Marlin/cardreader.h @@ -206,13 +206,13 @@ private: #if PIN_EXISTS(SD_DETECT) #if ENABLED(SD_DETECT_INVERTED) - #define IS_SD_INSERTED (READ(SD_DETECT_PIN) == HIGH) + #define IS_SD_INSERTED() READ(SD_DETECT_PIN) #else - #define IS_SD_INSERTED (READ(SD_DETECT_PIN) == LOW) + #define IS_SD_INSERTED() !READ(SD_DETECT_PIN) #endif #else // No card detect line? Assume the card is inserted. - #define IS_SD_INSERTED true + #define IS_SD_INSERTED() true #endif extern CardReader card; @@ -220,11 +220,11 @@ extern CardReader card; #endif // SDSUPPORT #if ENABLED(SDSUPPORT) - #define IS_SD_PRINTING (card.sdprinting) - #define IS_SD_FILE_OPEN (card.isFileOpen()) + #define IS_SD_PRINTING() card.sdprinting + #define IS_SD_FILE_OPEN() card.isFileOpen() #else - #define IS_SD_PRINTING (false) - #define IS_SD_FILE_OPEN (false) + #define IS_SD_PRINTING() false + #define IS_SD_FILE_OPEN() false #endif #endif // _CARDREADER_H_ diff --git a/Marlin/status_screen_lite_ST7920.h b/Marlin/status_screen_lite_ST7920.h index 0c9e4d24f7..dcbe065478 100644 --- a/Marlin/status_screen_lite_ST7920.h +++ b/Marlin/status_screen_lite_ST7920.h @@ -884,7 +884,7 @@ void ST7920_Lite_Status_Screen::update_progress(const bool forceUpdate) { #if ENABLED(SDSUPPORT) // Progress bar % comes from SD when actively printing - if (IS_SD_PRINTING) progress_bar_percent = card.percentDone(); + if (IS_SD_PRINTING()) progress_bar_percent = card.percentDone(); #endif // Since the progress bar involves writing diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 7ba2b94b72..d97349defe 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -505,7 +505,7 @@ uint16_t max_display_update_time = 0; if (currentScreen == lcd_status_screen) doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL; } - else if (screen == lcd_status_screen && currentScreen == lcd_main_menu && PENDING(millis(), doubleclick_expire_ms) && (planner.movesplanned() || IS_SD_PRINTING)) + else if (screen == lcd_status_screen && currentScreen == lcd_main_menu && PENDING(millis(), doubleclick_expire_ms) && (planner.movesplanned() || IS_SD_PRINTING())) screen = #if ENABLED(BABYSTEP_ZPROBE_OFFSET) lcd_babystep_zoffset @@ -652,7 +652,7 @@ void lcd_status_screen() { #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD)) // Progress bar % comes from SD when actively printing - if (IS_SD_PRINTING) + if (IS_SD_PRINTING()) progress_bar_percent = card.percentDone(); #endif @@ -1109,7 +1109,7 @@ void lcd_quick_feedback(const bool clear_buttons) { MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light); #endif - if (planner.movesplanned() || IS_SD_PRINTING) + if (planner.movesplanned() || IS_SD_PRINTING()) MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu); else MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu); @@ -2732,7 +2732,7 @@ void lcd_quick_feedback(const bool clear_buttons) { // Change filament // #if ENABLED(ADVANCED_PAUSE_FEATURE) - if (!IS_SD_FILE_OPEN) { + if (!IS_SD_FILE_OPEN()) { #if E_STEPPERS == 1 && !ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) if (thermalManager.targetHotEnoughToExtrude(active_extruder)) MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600 B0")); @@ -4411,7 +4411,7 @@ void lcd_quick_feedback(const bool clear_buttons) { #endif // E_STEPPERS == 1 #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - if (!planner.movesplanned() && !IS_SD_FILE_OPEN) { + if (!planner.movesplanned() && !IS_SD_FILE_OPEN()) { // Load filament #if E_STEPPERS == 1 PGM_P msg0 = PSTR(MSG_FILAMENTLOAD); @@ -5158,7 +5158,7 @@ void lcd_update() { #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) - const uint8_t sd_status = (uint8_t)IS_SD_INSERTED; + const uint8_t sd_status = (uint8_t)IS_SD_INSERTED(); if (sd_status != lcd_sd_status && lcd_detected()) { uint8_t old_sd_status = lcd_sd_status; // prevent re-entry to this block! diff --git a/Marlin/ultralcd_impl_HD44780.h b/Marlin/ultralcd_impl_HD44780.h index d229a8378b..779b6d09e4 100644 --- a/Marlin/ultralcd_impl_HD44780.h +++ b/Marlin/ultralcd_impl_HD44780.h @@ -803,7 +803,7 @@ static void lcd_implementation_status_screen() { #if ENABLED(SDSUPPORT) lcd.setCursor(0, 2); lcd_printPGM(PSTR("SD")); - if (IS_SD_PRINTING) + if (IS_SD_PRINTING()) lcd.print(itostr3(card.percentDone())); else lcd_printPGM(PSTR("---")); @@ -867,7 +867,7 @@ static void lcd_implementation_status_screen() { lcd.setCursor(7, 2); lcd_printPGM(PSTR("SD")); - if (IS_SD_PRINTING) + if (IS_SD_PRINTING()) lcd.print(itostr3(card.percentDone())); else lcd_printPGM(PSTR("---"));