Add parentheses to SD macros

This commit is contained in:
Scott Lahteine 2018-10-19 13:52:44 -05:00
parent aa9202260d
commit c6a5c74208
11 changed files with 27 additions and 27 deletions

View file

@ -19,7 +19,7 @@ void sd_mmc_spi_mem_init(void) {
}
Ctrl_status sd_mmc_spi_test_unit_ready(void) {
if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.cardOK)
return CTRL_NO_PRESENT;
return CTRL_GOOD;
}
@ -27,7 +27,7 @@ Ctrl_status sd_mmc_spi_test_unit_ready(void) {
// NOTE: This function is defined as returning the address of the last block
// in the card, which is cardSize() - 1
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.cardOK)
return CTRL_NO_PRESENT;
*nb_sector = card.getSd2Card().cardSize() - 1;
return CTRL_GOOD;
@ -42,7 +42,7 @@ bool sd_mmc_spi_wr_protect(void) {
}
bool sd_mmc_spi_removal(void) {
if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.cardOK)
return true;
return false;
}
@ -61,7 +61,7 @@ uint8_t sector_buf[SD_MMC_BLOCK_SIZE];
// #define DEBUG_MMC
Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.cardOK)
return CTRL_NO_PRESENT;
#ifdef DEBUG_MMC
@ -95,7 +95,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
}
Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.cardOK)
return CTRL_NO_PRESENT;
#ifdef DEBUG_MMC

View file

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

View file

@ -417,7 +417,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);

View file

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

View file

@ -38,7 +38,7 @@
* This has no effect during an SD print job
*/
void GcodeSuite::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);
}

View file

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

View file

@ -885,7 +885,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

View file

@ -433,7 +433,7 @@ namespace UI {
}
bool isPrinting() {
return (planner.movesplanned() || IS_SD_PRINTING ||
return (planner.movesplanned() || IS_SD_PRINTING() ||
#if ENABLED(SDSUPPORT)
(card.cardOK && card.isFileOpen())
#else
@ -444,7 +444,7 @@ namespace UI {
bool isMediaInserted() {
#if ENABLED(SDSUPPORT)
return IS_SD_INSERTED && card.cardOK;
return IS_SD_INSERTED() && card.cardOK;
#else
return false;
#endif
@ -583,7 +583,7 @@ void lcd_init() {
void lcd_update() {
#if ENABLED(SDSUPPORT)
static bool last_sd_status;
const bool sd_status = IS_SD_INSERTED;
const bool sd_status = IS_SD_INSERTED();
if (sd_status != last_sd_status) {
last_sd_status = sd_status;
if (sd_status) {

View file

@ -509,7 +509,7 @@ millis_t next_lcd_update_ms;
return click;
}
inline bool printer_busy() { return planner.movesplanned() || IS_SD_PRINTING; }
inline bool printer_busy() { return planner.movesplanned() || IS_SD_PRINTING(); }
void lcd_move_z();
float move_menu_scale;
@ -689,7 +689,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
@ -5462,7 +5462,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!

View file

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

View file

@ -244,16 +244,16 @@ private:
};
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
#define IS_SD_INSERTED Sd2Card::isInserted()
#define IS_SD_INSERTED() Sd2Card::isInserted()
#elif 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) == HIGH)
#else
#define IS_SD_INSERTED (READ(SD_DETECT_PIN) == LOW)
#define IS_SD_INSERTED() (READ(SD_DETECT_PIN) == LOW)
#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;
@ -261,11 +261,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_