Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Mar 19, 2023
1 parent f0ad3de commit b46535c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 0 additions & 5 deletions Marlin/src/core/serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ void serial_offset(const_float_t v, const uint8_t sp/*=0*/) {
SERIAL_DECIMAL(v);
}

void serial_ternary(const bool onoff, FSTR_P const pre, FSTR_P const on, FSTR_P const off, FSTR_P const post/*=nullptr*/) {
if (pre) serial_print(pre);
serial_print(onoff ? on : off);
if (post) serial_print(post);
}
void serialprint_onoff(const bool onoff) { serial_print(onoff ? F(STR_ON) : F(STR_OFF)); }
void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); }
void serialprint_truefalse(const bool tf) { serial_print(tf ? F("true") : F("false")); }
Expand Down
7 changes: 6 additions & 1 deletion Marlin/src/core/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,12 @@ inline void serial_echolnpair(FSTR_P const fstr, T v) { serial_echolnpair_P(FTOP

void serial_echo_start();
void serial_error_start();
void serial_ternary(const bool onoff, FSTR_P const pre, FSTR_P const on, FSTR_P const off, FSTR_P const post=nullptr);
inline void serial_ternary(const bool onoff, FSTR_P const pre, FSTR_P const on, FSTR_P const off, FSTR_P const post=nullptr) {
if (pre) serial_print(pre);
if (onoff && on) serial_print(on);
if (!onoff && off) serial_print(off);
if (post) serial_print(post);
}
void serialprint_onoff(const bool onoff);
void serialprintln_onoff(const bool onoff);
void serialprint_truefalse(const bool tf);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2979,7 +2979,7 @@ void Temperature::init() {
if (ENABLED(REPORT_ADAPTIVE_FAN_SLOWING) && DEBUGGING(INFO)) {
const uint8_t fss7 = fan_speed_scaler[fan_index] & 0x80;
if (fss7 ^ (scale & 0x80))
SERIAL_ECHO_TERNARY(fss7, "Adaptive Fan Slowing ", "", "de", "activated.\n");
serial_ternary(fss7, F("Adaptive Fan Slowing "), nullptr, F("de"), F("activated.\n"));
}

fan_speed_scaler[fan_index] = scale;
Expand Down

0 comments on commit b46535c

Please sign in to comment.