Переглянути джерело

Add parentheses to SD macros

Scott Lahteine 7 роки тому
джерело
коміт
c6a5c74208

+ 5
- 5
Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp Переглянути файл

@@ -19,7 +19,7 @@ void sd_mmc_spi_mem_init(void) {
19 19
 }
20 20
 
21 21
 Ctrl_status sd_mmc_spi_test_unit_ready(void) {
22
-  if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
22
+  if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.cardOK)
23 23
     return CTRL_NO_PRESENT;
24 24
   return CTRL_GOOD;
25 25
 }
@@ -27,7 +27,7 @@ Ctrl_status sd_mmc_spi_test_unit_ready(void) {
27 27
 // NOTE: This function is defined as returning the address of the last block
28 28
 // in the card, which is cardSize() - 1
29 29
 Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
30
-  if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
30
+  if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.cardOK)
31 31
     return CTRL_NO_PRESENT;
32 32
   *nb_sector = card.getSd2Card().cardSize() - 1;
33 33
   return CTRL_GOOD;
@@ -42,7 +42,7 @@ bool sd_mmc_spi_wr_protect(void) {
42 42
 }
43 43
 
44 44
 bool sd_mmc_spi_removal(void) {
45
-  if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
45
+  if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.cardOK)
46 46
     return true;
47 47
   return false;
48 48
 }
@@ -61,7 +61,7 @@ uint8_t sector_buf[SD_MMC_BLOCK_SIZE];
61 61
 // #define DEBUG_MMC
62 62
 
63 63
 Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
64
-  if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
64
+  if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.cardOK)
65 65
     return CTRL_NO_PRESENT;
66 66
 
67 67
   #ifdef DEBUG_MMC
@@ -95,7 +95,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
95 95
 }
96 96
 
97 97
 Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
98
-  if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
98
+  if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.cardOK)
99 99
     return CTRL_NO_PRESENT;
100 100
 
101 101
   #ifdef DEBUG_MMC

+ 2
- 2
Marlin/src/HAL/HAL_LPC1768/main.cpp Переглянути файл

@@ -97,11 +97,11 @@ void HAL_idletask(void) {
97 97
   #if ENABLED(SDSUPPORT) && defined(SHARED_SD_CARD)
98 98
     // If Marlin is using the SD card we need to lock it to prevent access from
99 99
     // a PC via USB.
100
-    // Other HALs use IS_SD_PRINTING and IS_SD_FILE_OPEN to check for access but
100
+    // Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
101 101
     // this will not reliably detect delete operations. To be safe we will lock
102 102
     // the disk if Marlin has it mounted. Unfortuately there is currently no way
103 103
     // to unmount the disk from the LCD menu.
104
-    // if (IS_SD_PRINTING || IS_SD_FILE_OPEN)
104
+    // if (IS_SD_PRINTING() || IS_SD_FILE_OPEN())
105 105
     if (card.cardOK)
106 106
       MSC_Aquire_Lock();
107 107
     else

+ 1
- 1
Marlin/src/Marlin.cpp Переглянути файл

@@ -417,7 +417,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
417 417
     // ---------------------------------------------------------
418 418
     static int homeDebounceCount = 0;   // poor man's debouncing count
419 419
     const int HOME_DEBOUNCE_DELAY = 2500;
420
-    if (!IS_SD_PRINTING && !READ(HOME_PIN)) {
420
+    if (!IS_SD_PRINTING() && !READ(HOME_PIN)) {
421 421
       if (!homeDebounceCount) {
422 422
         enqueue_and_echo_commands_P(PSTR("G28"));
423 423
         LCD_MESSAGEPGM(MSG_AUTO_HOME);

+ 1
- 1
Marlin/src/feature/runout.h Переглянути файл

@@ -75,7 +75,7 @@ class TFilamentSensor : public FilamentSensorBase {
75 75
     }
76 76
 
77 77
     static void run() {
78
-      if (enabled && !filament_ran_out && (IS_SD_PRINTING || print_job_timer.isRunning())) {
78
+      if (enabled && !filament_ran_out && (IS_SD_PRINTING() || print_job_timer.isRunning())) {
79 79
         response.run();
80 80
         sensor.run();
81 81
         if (response.has_runout()) {

+ 1
- 1
Marlin/src/gcode/lcd/M73.cpp Переглянути файл

@@ -38,7 +38,7 @@
38 38
  *   This has no effect during an SD print job
39 39
  */
40 40
 void GcodeSuite::M73() {
41
-  if (!IS_SD_PRINTING && parser.seen('P')) {
41
+  if (!IS_SD_PRINTING() && parser.seen('P')) {
42 42
     progress_bar_percent = parser.value_byte();
43 43
     NOMORE(progress_bar_percent, 100);
44 44
   }

+ 1
- 1
Marlin/src/gcode/queue.cpp Переглянути файл

@@ -450,7 +450,7 @@ inline void get_serial_commands() {
450 450
                 #endif
451 451
               ;
452 452
 
453
-    if (!IS_SD_PRINTING) return;
453
+    if (!IS_SD_PRINTING()) return;
454 454
 
455 455
     /**
456 456
      * '#' stops reading from SD to the buffer prematurely, so procedural

+ 1
- 1
Marlin/src/lcd/dogm/status_screen_lite_ST7920.h Переглянути файл

@@ -885,7 +885,7 @@ void ST7920_Lite_Status_Screen::update_progress(const bool forceUpdate) {
885 885
 
886 886
     #if ENABLED(SDSUPPORT)
887 887
       // Progress bar % comes from SD when actively printing
888
-      if (IS_SD_PRINTING) progress_bar_percent = card.percentDone();
888
+      if (IS_SD_PRINTING()) progress_bar_percent = card.percentDone();
889 889
     #endif
890 890
 
891 891
     // Since the progress bar involves writing

+ 3
- 3
Marlin/src/lcd/extensible_ui/ui_api.cpp Переглянути файл

@@ -433,7 +433,7 @@ namespace UI {
433 433
   }
434 434
 
435 435
   bool isPrinting() {
436
-    return (planner.movesplanned() || IS_SD_PRINTING ||
436
+    return (planner.movesplanned() || IS_SD_PRINTING() ||
437 437
       #if ENABLED(SDSUPPORT)
438 438
         (card.cardOK && card.isFileOpen())
439 439
       #else
@@ -444,7 +444,7 @@ namespace UI {
444 444
 
445 445
   bool isMediaInserted() {
446 446
     #if ENABLED(SDSUPPORT)
447
-      return IS_SD_INSERTED && card.cardOK;
447
+      return IS_SD_INSERTED() && card.cardOK;
448 448
     #else
449 449
       return false;
450 450
     #endif
@@ -583,7 +583,7 @@ void lcd_init() {
583 583
 void lcd_update() {
584 584
   #if ENABLED(SDSUPPORT)
585 585
     static bool last_sd_status;
586
-    const bool sd_status = IS_SD_INSERTED;
586
+    const bool sd_status = IS_SD_INSERTED();
587 587
     if (sd_status != last_sd_status) {
588 588
       last_sd_status = sd_status;
589 589
       if (sd_status) {

+ 3
- 3
Marlin/src/lcd/ultralcd.cpp Переглянути файл

@@ -509,7 +509,7 @@ millis_t next_lcd_update_ms;
509 509
     return click;
510 510
   }
511 511
 
512
-  inline bool printer_busy() { return planner.movesplanned() || IS_SD_PRINTING; }
512
+  inline bool printer_busy() { return planner.movesplanned() || IS_SD_PRINTING(); }
513 513
 
514 514
   void lcd_move_z();
515 515
   float move_menu_scale;
@@ -689,7 +689,7 @@ void lcd_status_screen() {
689 689
 
690 690
   #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
691 691
     // Progress bar % comes from SD when actively printing
692
-    if (IS_SD_PRINTING)
692
+    if (IS_SD_PRINTING())
693 693
       progress_bar_percent = card.percentDone();
694 694
   #endif
695 695
 
@@ -5462,7 +5462,7 @@ void lcd_update() {
5462 5462
 
5463 5463
   #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
5464 5464
 
5465
-    const uint8_t sd_status = (uint8_t)IS_SD_INSERTED;
5465
+    const uint8_t sd_status = (uint8_t)IS_SD_INSERTED();
5466 5466
     if (sd_status != lcd_sd_status && lcd_detected()) {
5467 5467
 
5468 5468
       uint8_t old_sd_status = lcd_sd_status; // prevent re-entry to this block!

+ 1
- 1
Marlin/src/lcd/ultralcd_impl_HD44780.h Переглянути файл

@@ -571,7 +571,7 @@ FORCE_INLINE void _draw_bed_status(const bool blink) {
571 571
   FORCE_INLINE void _draw_print_progress() {
572 572
     const uint8_t percent = (
573 573
       #if ENABLED(SDSUPPORT)
574
-        IS_SD_PRINTING ? card.percentDone() : 0
574
+        IS_SD_PRINTING() ? card.percentDone() : 0
575 575
       #else
576 576
         progress_bar_percent
577 577
       #endif

+ 8
- 8
Marlin/src/sd/cardreader.h Переглянути файл

@@ -244,16 +244,16 @@ private:
244 244
 };
245 245
 
246 246
 #if ENABLED(USB_FLASH_DRIVE_SUPPORT)
247
-  #define IS_SD_INSERTED Sd2Card::isInserted()
247
+  #define IS_SD_INSERTED() Sd2Card::isInserted()
248 248
 #elif PIN_EXISTS(SD_DETECT)
249 249
   #if ENABLED(SD_DETECT_INVERTED)
250
-    #define IS_SD_INSERTED (READ(SD_DETECT_PIN) == HIGH)
250
+    #define IS_SD_INSERTED() (READ(SD_DETECT_PIN) == HIGH)
251 251
   #else
252
-    #define IS_SD_INSERTED (READ(SD_DETECT_PIN) == LOW)
252
+    #define IS_SD_INSERTED() (READ(SD_DETECT_PIN) == LOW)
253 253
   #endif
254 254
 #else
255 255
   // No card detect line? Assume the card is inserted.
256
-  #define IS_SD_INSERTED true
256
+  #define IS_SD_INSERTED() true
257 257
 #endif
258 258
 
259 259
 extern CardReader card;
@@ -261,11 +261,11 @@ extern CardReader card;
261 261
 #endif // SDSUPPORT
262 262
 
263 263
 #if ENABLED(SDSUPPORT)
264
-  #define IS_SD_PRINTING (card.sdprinting)
265
-  #define IS_SD_FILE_OPEN (card.isFileOpen())
264
+  #define IS_SD_PRINTING()  card.sdprinting
265
+  #define IS_SD_FILE_OPEN() card.isFileOpen()
266 266
 #else
267
-  #define IS_SD_PRINTING (false)
268
-  #define IS_SD_FILE_OPEN (false)
267
+  #define IS_SD_PRINTING()  false
268
+  #define IS_SD_FILE_OPEN() false
269 269
 #endif
270 270
 
271 271
 #endif // _CARDREADER_H_

Завантаження…
Відмінити
Зберегти