Skip to content

Commit

Permalink
Add parentheses to card macros
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Oct 19, 2018
1 parent d8caa7d commit 86ac468
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions Marlin/cardreader.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,25 +206,25 @@ class CardReader {

#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;

#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_
2 changes: 1 addition & 1 deletion Marlin/status_screen_lite_ST7920.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions Marlin/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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!
Expand Down
4 changes: 2 additions & 2 deletions Marlin/ultralcd_impl_HD44780.h
Original file line number Diff line number Diff line change
Expand Up @@ -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("---"));
Expand Down Expand Up @@ -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("---"));
Expand Down

0 comments on commit 86ac468

Please sign in to comment.