Add parentheses to SD macros
This commit is contained in:
parent
aa9202260d
commit
c6a5c74208
|
@ -19,7 +19,7 @@ void sd_mmc_spi_mem_init(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ctrl_status sd_mmc_spi_test_unit_ready(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_NO_PRESENT;
|
||||||
return CTRL_GOOD;
|
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
|
// NOTE: This function is defined as returning the address of the last block
|
||||||
// in the card, which is cardSize() - 1
|
// in the card, which is cardSize() - 1
|
||||||
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
|
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;
|
return CTRL_NO_PRESENT;
|
||||||
*nb_sector = card.getSd2Card().cardSize() - 1;
|
*nb_sector = card.getSd2Card().cardSize() - 1;
|
||||||
return CTRL_GOOD;
|
return CTRL_GOOD;
|
||||||
|
@ -42,7 +42,7 @@ bool sd_mmc_spi_wr_protect(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sd_mmc_spi_removal(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 true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ uint8_t sector_buf[SD_MMC_BLOCK_SIZE];
|
||||||
// #define DEBUG_MMC
|
// #define DEBUG_MMC
|
||||||
|
|
||||||
Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
|
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;
|
return CTRL_NO_PRESENT;
|
||||||
|
|
||||||
#ifdef DEBUG_MMC
|
#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) {
|
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;
|
return CTRL_NO_PRESENT;
|
||||||
|
|
||||||
#ifdef DEBUG_MMC
|
#ifdef DEBUG_MMC
|
||||||
|
|
|
@ -97,11 +97,11 @@ void HAL_idletask(void) {
|
||||||
#if ENABLED(SDSUPPORT) && defined(SHARED_SD_CARD)
|
#if ENABLED(SDSUPPORT) && defined(SHARED_SD_CARD)
|
||||||
// If Marlin is using the SD card we need to lock it to prevent access from
|
// If Marlin is using the SD card we need to lock it to prevent access from
|
||||||
// a PC via USB.
|
// 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
|
// 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
|
// the disk if Marlin has it mounted. Unfortuately there is currently no way
|
||||||
// to unmount the disk from the LCD menu.
|
// 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)
|
if (card.cardOK)
|
||||||
MSC_Aquire_Lock();
|
MSC_Aquire_Lock();
|
||||||
else
|
else
|
||||||
|
|
|
@ -417,7 +417,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
static int homeDebounceCount = 0; // poor man's debouncing count
|
static int homeDebounceCount = 0; // poor man's debouncing count
|
||||||
const int HOME_DEBOUNCE_DELAY = 2500;
|
const int HOME_DEBOUNCE_DELAY = 2500;
|
||||||
if (!IS_SD_PRINTING && !READ(HOME_PIN)) {
|
if (!IS_SD_PRINTING() && !READ(HOME_PIN)) {
|
||||||
if (!homeDebounceCount) {
|
if (!homeDebounceCount) {
|
||||||
enqueue_and_echo_commands_P(PSTR("G28"));
|
enqueue_and_echo_commands_P(PSTR("G28"));
|
||||||
LCD_MESSAGEPGM(MSG_AUTO_HOME);
|
LCD_MESSAGEPGM(MSG_AUTO_HOME);
|
||||||
|
|
|
@ -75,7 +75,7 @@ class TFilamentSensor : public FilamentSensorBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void run() {
|
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();
|
response.run();
|
||||||
sensor.run();
|
sensor.run();
|
||||||
if (response.has_runout()) {
|
if (response.has_runout()) {
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
* This has no effect during an SD print job
|
* This has no effect during an SD print job
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::M73() {
|
void GcodeSuite::M73() {
|
||||||
if (!IS_SD_PRINTING && parser.seen('P')) {
|
if (!IS_SD_PRINTING() && parser.seen('P')) {
|
||||||
progress_bar_percent = parser.value_byte();
|
progress_bar_percent = parser.value_byte();
|
||||||
NOMORE(progress_bar_percent, 100);
|
NOMORE(progress_bar_percent, 100);
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,7 +450,7 @@ inline void get_serial_commands() {
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
if (!IS_SD_PRINTING) return;
|
if (!IS_SD_PRINTING()) return;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* '#' stops reading from SD to the buffer prematurely, so procedural
|
* '#' stops reading from SD to the buffer prematurely, so procedural
|
||||||
|
|
|
@ -885,7 +885,7 @@ void ST7920_Lite_Status_Screen::update_progress(const bool forceUpdate) {
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
// Progress bar % comes from SD when actively printing
|
// 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
|
#endif
|
||||||
|
|
||||||
// Since the progress bar involves writing
|
// Since the progress bar involves writing
|
||||||
|
|
|
@ -433,7 +433,7 @@ namespace UI {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isPrinting() {
|
bool isPrinting() {
|
||||||
return (planner.movesplanned() || IS_SD_PRINTING ||
|
return (planner.movesplanned() || IS_SD_PRINTING() ||
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
(card.cardOK && card.isFileOpen())
|
(card.cardOK && card.isFileOpen())
|
||||||
#else
|
#else
|
||||||
|
@ -444,7 +444,7 @@ namespace UI {
|
||||||
|
|
||||||
bool isMediaInserted() {
|
bool isMediaInserted() {
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
return IS_SD_INSERTED && card.cardOK;
|
return IS_SD_INSERTED() && card.cardOK;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -583,7 +583,7 @@ void lcd_init() {
|
||||||
void lcd_update() {
|
void lcd_update() {
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
static bool last_sd_status;
|
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) {
|
if (sd_status != last_sd_status) {
|
||||||
last_sd_status = sd_status;
|
last_sd_status = sd_status;
|
||||||
if (sd_status) {
|
if (sd_status) {
|
||||||
|
|
|
@ -509,7 +509,7 @@ millis_t next_lcd_update_ms;
|
||||||
return click;
|
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();
|
void lcd_move_z();
|
||||||
float move_menu_scale;
|
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))
|
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
|
||||||
// Progress bar % comes from SD when actively printing
|
// Progress bar % comes from SD when actively printing
|
||||||
if (IS_SD_PRINTING)
|
if (IS_SD_PRINTING())
|
||||||
progress_bar_percent = card.percentDone();
|
progress_bar_percent = card.percentDone();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -5462,7 +5462,7 @@ void lcd_update() {
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
|
#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()) {
|
if (sd_status != lcd_sd_status && lcd_detected()) {
|
||||||
|
|
||||||
uint8_t old_sd_status = lcd_sd_status; // prevent re-entry to this block!
|
uint8_t old_sd_status = lcd_sd_status; // prevent re-entry to this block!
|
||||||
|
|
|
@ -571,7 +571,7 @@ FORCE_INLINE void _draw_bed_status(const bool blink) {
|
||||||
FORCE_INLINE void _draw_print_progress() {
|
FORCE_INLINE void _draw_print_progress() {
|
||||||
const uint8_t percent = (
|
const uint8_t percent = (
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
IS_SD_PRINTING ? card.percentDone() : 0
|
IS_SD_PRINTING() ? card.percentDone() : 0
|
||||||
#else
|
#else
|
||||||
progress_bar_percent
|
progress_bar_percent
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -244,16 +244,16 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
|
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
|
||||||
#define IS_SD_INSERTED Sd2Card::isInserted()
|
#define IS_SD_INSERTED() Sd2Card::isInserted()
|
||||||
#elif PIN_EXISTS(SD_DETECT)
|
#elif PIN_EXISTS(SD_DETECT)
|
||||||
#if ENABLED(SD_DETECT_INVERTED)
|
#if ENABLED(SD_DETECT_INVERTED)
|
||||||
#define IS_SD_INSERTED (READ(SD_DETECT_PIN) == HIGH)
|
#define IS_SD_INSERTED() (READ(SD_DETECT_PIN) == HIGH)
|
||||||
#else
|
#else
|
||||||
#define IS_SD_INSERTED (READ(SD_DETECT_PIN) == LOW)
|
#define IS_SD_INSERTED() (READ(SD_DETECT_PIN) == LOW)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// No card detect line? Assume the card is inserted.
|
// No card detect line? Assume the card is inserted.
|
||||||
#define IS_SD_INSERTED true
|
#define IS_SD_INSERTED() true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern CardReader card;
|
extern CardReader card;
|
||||||
|
@ -261,11 +261,11 @@ extern CardReader card;
|
||||||
#endif // SDSUPPORT
|
#endif // SDSUPPORT
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
#define IS_SD_PRINTING (card.sdprinting)
|
#define IS_SD_PRINTING() card.sdprinting
|
||||||
#define IS_SD_FILE_OPEN (card.isFileOpen())
|
#define IS_SD_FILE_OPEN() card.isFileOpen()
|
||||||
#else
|
#else
|
||||||
#define IS_SD_PRINTING (false)
|
#define IS_SD_PRINTING() false
|
||||||
#define IS_SD_FILE_OPEN (false)
|
#define IS_SD_FILE_OPEN() false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _CARDREADER_H_
|
#endif // _CARDREADER_H_
|
||||||
|
|
Loading…
Reference in a new issue