Apply TERN to compact code (#17619)
This commit is contained in:
@ -923,9 +923,7 @@ void L64XX_Marlin::say_axis(const L64XX_axis_t axis, const uint8_t label/*=true*
|
||||
monitor_update(E5);
|
||||
#endif
|
||||
|
||||
#if ENABLED(L6470_DEBUG)
|
||||
if (report_L6470_status) DEBUG_EOL();
|
||||
#endif
|
||||
if (TERN0(L6470_DEBUG, report_L6470_status)) DEBUG_EOL();
|
||||
|
||||
spi_active = false; // done with all SPI transfers - clear handshake flags
|
||||
spi_abort = false;
|
||||
|
@ -42,9 +42,7 @@ Nozzle nozzle;
|
||||
* @param strokes number of strokes to execute
|
||||
*/
|
||||
void Nozzle::stroke(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes) {
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
const xyz_pos_t oldpos = current_position;
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t oldpos = current_position);
|
||||
|
||||
// Move to the starting point
|
||||
#if ENABLED(NOZZLE_CLEAN_NO_Z)
|
||||
@ -59,9 +57,7 @@ Nozzle nozzle;
|
||||
do_blocking_move_to_xy(start);
|
||||
}
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
do_blocking_move_to(oldpos);
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, do_blocking_move_to(oldpos));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,9 +73,7 @@ Nozzle nozzle;
|
||||
const xy_pos_t diff = end - start;
|
||||
if (!diff.x || !diff.y) return;
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
const xyz_pos_t back = current_position;
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t back = current_position);
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_NO_Z)
|
||||
do_blocking_move_to_xy(start);
|
||||
@ -108,9 +102,7 @@ Nozzle nozzle;
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
do_blocking_move_to(back);
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, do_blocking_move_to(back));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,15 +116,8 @@ Nozzle nozzle;
|
||||
void Nozzle::circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t &strokes, const float &radius) {
|
||||
if (strokes == 0) return;
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
const xyz_pos_t back = current_position;
|
||||
#endif
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_NO_Z)
|
||||
do_blocking_move_to_xy(start);
|
||||
#else
|
||||
do_blocking_move_to(start);
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t back = current_position);
|
||||
TERN(NOZZLE_CLEAN_NO_Z, do_blocking_move_to_xy, do_blocking_move_to)(start);
|
||||
|
||||
LOOP_L_N(s, strokes)
|
||||
LOOP_L_N(i, NOZZLE_CLEAN_CIRCLE_FN)
|
||||
@ -144,9 +129,7 @@ Nozzle nozzle;
|
||||
// Let's be safe
|
||||
do_blocking_move_to_xy(start);
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_GOBACK)
|
||||
do_blocking_move_to(back);
|
||||
#endif
|
||||
TERN_(NOZZLE_CLEAN_GOBACK, do_blocking_move_to(back));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,14 +34,10 @@ millis_t Stopwatch::startTimestamp;
|
||||
millis_t Stopwatch::stopTimestamp;
|
||||
|
||||
bool Stopwatch::stop() {
|
||||
#if ENABLED(DEBUG_STOPWATCH)
|
||||
Stopwatch::debug(PSTR("stop"));
|
||||
#endif
|
||||
Stopwatch::debug(PSTR("stop"));
|
||||
|
||||
if (isRunning() || isPaused()) {
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPrintTimerStopped();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStopped());
|
||||
state = STOPPED;
|
||||
stopTimestamp = millis();
|
||||
return true;
|
||||
@ -50,14 +46,10 @@ bool Stopwatch::stop() {
|
||||
}
|
||||
|
||||
bool Stopwatch::pause() {
|
||||
#if ENABLED(DEBUG_STOPWATCH)
|
||||
Stopwatch::debug(PSTR("pause"));
|
||||
#endif
|
||||
Stopwatch::debug(PSTR("pause"));
|
||||
|
||||
if (isRunning()) {
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPrintTimerPaused();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerPaused());
|
||||
state = PAUSED;
|
||||
stopTimestamp = millis();
|
||||
return true;
|
||||
@ -66,13 +58,9 @@ bool Stopwatch::pause() {
|
||||
}
|
||||
|
||||
bool Stopwatch::start() {
|
||||
#if ENABLED(DEBUG_STOPWATCH)
|
||||
Stopwatch::debug(PSTR("start"));
|
||||
#endif
|
||||
Stopwatch::debug(PSTR("start"));
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPrintTimerStarted();
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStarted());
|
||||
|
||||
if (!isRunning()) {
|
||||
if (isPaused()) accumulator = duration();
|
||||
@ -86,18 +74,14 @@ bool Stopwatch::start() {
|
||||
}
|
||||
|
||||
void Stopwatch::resume(const millis_t with_time) {
|
||||
#if ENABLED(DEBUG_STOPWATCH)
|
||||
Stopwatch::debug(PSTR("resume"));
|
||||
#endif
|
||||
Stopwatch::debug(PSTR("resume"));
|
||||
|
||||
reset();
|
||||
if ((accumulator = with_time)) state = RUNNING;
|
||||
}
|
||||
|
||||
void Stopwatch::reset() {
|
||||
#if ENABLED(DEBUG_STOPWATCH)
|
||||
Stopwatch::debug(PSTR("reset"));
|
||||
#endif
|
||||
Stopwatch::debug(PSTR("reset"));
|
||||
|
||||
state = STOPPED;
|
||||
startTimestamp = 0;
|
||||
|
@ -114,5 +114,9 @@ class Stopwatch {
|
||||
*/
|
||||
static void debug(const char func[]);
|
||||
|
||||
#else
|
||||
|
||||
static inline void debug(const char[]) {}
|
||||
|
||||
#endif
|
||||
};
|
||||
|
Reference in New Issue
Block a user