0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-01-31 14:12:52 +00:00

🧑‍💻 Serial ternary args, etc.

This commit is contained in:
Scott Lahteine 2023-05-15 19:48:30 -05:00
parent dd184cf3c2
commit 6e5f41fe6b
9 changed files with 9 additions and 14 deletions

View file

@ -292,7 +292,7 @@ inline void SERIAL_ECHO_F(EnsureDouble x, int digit=2) { SERIAL_IMPL.print(x, di
#define SERIAL_ECHO_SP(C) serial_spaces(C)
#define SERIAL_ECHO_TERNARY(TF, PRE, ON, OFF, POST) serial_ternary(TF, F(PRE), F(ON), F(OFF), F(POST))
#define SERIAL_ECHO_TERNARY(TF, PRE, ON, OFF, POST) serial_ternary(F(PRE), TF, F(ON), F(OFF), F(POST))
#if SERIAL_FLOAT_PRECISION
#define SERIAL_DECIMAL(V) SERIAL_PRINT(V, SERIAL_FLOAT_PRECISION)
@ -327,7 +327,7 @@ inline void serial_echolnpair(FSTR_P const fstr, T v) { serial_echolnpair_P(FTOP
void serial_echo_start();
void serial_error_start();
inline 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(FSTR_P const pre, const bool onoff, 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);

View file

@ -59,7 +59,7 @@ void unified_bed_leveling::report_current_mesh() {
void unified_bed_leveling::report_state() {
echo_name();
serial_ternary(planner.leveling_active, F(" System v" UBL_VERSION " "), nullptr, F("in"), F("active\n"));
serial_ternary(F(" System v" UBL_VERSION " "), planner.leveling_active, nullptr, F("in"), F("active\n"));
serial_delay(50);
}

View file

@ -232,7 +232,7 @@ bool I2CPositionEncoder::passes_test(const bool report) {
if (report) {
if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM("Warning. ");
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
serial_ternary(H == I2CPE_MAG_SIG_BAD, F(" axis "), F("magnetic strip "), F("encoder "));
serial_ternary(F(" axis "), H == I2CPE_MAG_SIG_BAD, F("magnetic strip "), F("encoder "));
switch (H) {
case I2CPE_MAG_SIG_GOOD:
case I2CPE_MAG_SIG_MID:

View file

@ -149,7 +149,7 @@ inline void servo_probe_test() {
#endif
SERIAL_ECHOLNPGM(". Probe " _PROBE_PREF "_PIN: ", PROBE_TEST_PIN);
serial_ternary(probe_hit_state, F(". " _PROBE_PREF "_ENDSTOP_HIT_STATE: "), F("HIGH"), F("LOW"));
serial_ternary(F(". " _PROBE_PREF "_ENDSTOP_HIT_STATE: "), probe_hit_state, F("HIGH"), F("LOW"));
SERIAL_EOL();
SET_INPUT_PULLUP(PROBE_TEST_PIN);

View file

@ -328,7 +328,6 @@ void GcodeSuite::M906_report(const bool forReplay/*=true*/) {
say_M906(forReplay);
SERIAL_ECHOLNPGM(" T7 E", stepperE7.getMilliamps());
#endif
SERIAL_EOL();
}
#endif // HAS_TRINAMIC_CONFIG

View file

@ -128,9 +128,7 @@ void GcodeSuite::M114() {
#if ENABLED(M114_DETAIL)
if (parser.seen_test('D')) {
#if DISABLED(M114_LEGACY)
planner.synchronize();
#endif
IF_DISABLED(M114_LEGACY, planner.synchronize());
report_current_position();
report_current_position_detail();
return;
@ -143,9 +141,7 @@ void GcodeSuite::M114() {
#endif
#endif
#if ENABLED(M114_REALTIME)
if (parser.seen_test('R')) { report_real_position(); return; }
#endif
TERN_(M114_REALTIME, if (parser.seen_test('R')) return report_real_position());
TERN_(M114_LEGACY, planner.synchronize());
report_current_position_projected();

View file

@ -29,7 +29,6 @@
*/
//#define DEBUG_DWIN 1
//#define NEED_HEX_PRINT 1
#if defined(__STM32F1__) || defined(STM32F1)
#define DASH_REDRAW 1

View file

@ -1929,6 +1929,7 @@ bool Planner::_populate_block(
#endif
#if HAS_W_AXIS
" " STR_W ":", target.w, " (", dw, " steps)"
#endif
#if HAS_EXTRUDERS
" E:", target.e, " (", de, " steps)"
#endif

View file

@ -3145,7 +3145,7 @@ void Temperature::init() {
if (TERN0(REPORT_ADAPTIVE_FAN_SLOWING, DEBUGGING(INFO))) {
const uint8_t fss7 = fan_speed_scaler[fan_index] & 0x80;
if (fss7 ^ (scale & 0x80))
serial_ternary(fss7, F("Adaptive Fan Slowing "), nullptr, F("de"), F("activated.\n"));
serial_ternary(F("Adaptive Fan Slowing "), fss7, nullptr, F("de"), F("activated.\n"));
}
fan_speed_scaler[fan_index] = scale;