More useful ENABLED / DISABLED macros (#17054)

This commit is contained in:
Scott Lahteine
2020-03-07 22:20:41 -06:00
committed by GitHub
parent 5eb6fb1c2f
commit 64d092935b
26 changed files with 636 additions and 766 deletions

View File

@@ -241,11 +241,8 @@ void setup_powerhold() {
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
#endif
#if ENABLED(PSU_CONTROL)
#if ENABLED(PSU_DEFAULT_OFF)
powersupply_on = true; PSU_OFF();
#else
powersupply_on = false; PSU_ON();
#endif
powersupply_on = ENABLED(PSU_DEFAULT_OFF);
if (ENABLED(PSU_DEFAULT_OFF)) PSU_OFF(); else PSU_ON();
#endif
}
@@ -425,14 +422,8 @@ void startOrResumeJob() {
switch (card.sdprinting_done_state) {
#if HAS_RESUME_CONTINUE // Display "Click to Continue..."
case 1:
did_state = queue.enqueue_P(PSTR("M0Q1S"
#if HAS_LCD_MENU
"1800" // ...for 30 minutes with LCD
#else
"60" // ...for 1 minute with no LCD
#endif
));
case 1: // 30 min timeout with LCD, 1 min without
did_state = queue.enqueue_P(PSTR("M0Q1S" TERN(HAS_LCD_MENU, "1800", "60")));
break;
#endif
@@ -501,31 +492,19 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
}
// Prevent steppers timing-out in the middle of M600
#if BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT)
#define MOVE_AWAY_TEST !did_pause_print
#else
#define MOVE_AWAY_TEST true
#endif
#define STAY_TEST (BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print)
if (stepper_inactive_time) {
static bool already_shutdown_steppers; // = false
if (planner.has_blocks_queued())
gcode.reset_stepper_timeout();
else if (MOVE_AWAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) {
else if (!STAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) {
if (!already_shutdown_steppers) {
already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this
#if ENABLED(DISABLE_INACTIVE_X)
DISABLE_AXIS_X();
#endif
#if ENABLED(DISABLE_INACTIVE_Y)
DISABLE_AXIS_Y();
#endif
#if ENABLED(DISABLE_INACTIVE_Z)
DISABLE_AXIS_Z();
#endif
#if ENABLED(DISABLE_INACTIVE_E)
disable_e_steppers();
#endif
if (ENABLED(DISABLE_INACTIVE_X)) DISABLE_AXIS_X();
if (ENABLED(DISABLE_INACTIVE_Y)) DISABLE_AXIS_Y();
if (ENABLED(DISABLE_INACTIVE_Z)) DISABLE_AXIS_Z();
if (ENABLED(DISABLE_INACTIVE_E)) disable_e_steppers();
#if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) {
ubl.lcd_map_control = false;
@@ -1191,7 +1170,6 @@ void setup() {
*/
void loop() {
do {
idle();
#if ENABLED(SDSUPPORT)
@@ -1204,9 +1182,5 @@ void loop() {
endstops.event_handler();
} while (false // Return to caller for best compatibility
#ifdef __AVR__
|| true // Loop forever on slower (AVR) boards
#endif
);
} while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
}