Serial macros cleanup

This commit is contained in:
Scott Lahteine
2021-02-28 19:43:46 -06:00
committed by Scott Lahteine
parent f0b662ff58
commit dd42831cba
48 changed files with 101 additions and 117 deletions

View File

@ -181,7 +181,7 @@ void unified_bed_leveling::display_map(const int map_type) {
}
else {
SERIAL_ECHOPGM(" for ");
serialprintPGM(csv ? PSTR("CSV:\n") : PSTR("LCD:\n"));
SERIAL_ECHOPGM_P(csv ? PSTR("CSV:\n") : PSTR("LCD:\n"));
}
// Add XY probe offset from extruder because probe.probe_at_point() subtracts them when
@ -212,7 +212,7 @@ void unified_bed_leveling::display_map(const int map_type) {
// TODO: Display on Graphical LCD
}
else if (isnan(f))
serialprintPGM(human ? PSTR(" . ") : PSTR("NAN"));
SERIAL_ECHOPGM_P(human ? PSTR(" . ") : PSTR("NAN"));
else if (human || csv) {
if (human && f >= 0.0) SERIAL_CHAR(f > 0 ? '+' : ' '); // Display sign also for positive numbers (' ' for 0)
SERIAL_ECHO_F(f, 3); // Positive: 5 digits, Negative: 6 digits

View File

@ -908,11 +908,11 @@ void unified_bed_leveling::shift_mesh_height() {
if (do_ubl_mesh_map) display_map(g29_map_type); // show user where we're probing
if (parser.seen('B')) {
serialprintPGM(GET_TEXT(MSG_UBL_BC_INSERT));
SERIAL_ECHOPGM_P(GET_TEXT(MSG_UBL_BC_INSERT));
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT);
}
else {
serialprintPGM(GET_TEXT(MSG_UBL_BC_INSERT2));
SERIAL_ECHOPGM_P(GET_TEXT(MSG_UBL_BC_INSERT2));
LCD_MESSAGEPGM(MSG_UBL_BC_INSERT2);
}
@ -1576,7 +1576,7 @@ void unified_bed_leveling::smart_fill_mesh() {
return normal.x * pos.x + normal.y * pos.y + zadd;
};
auto debug_pt = [](PGM_P const pre, const xy_pos_t &pos, const float &zadd) {
d_from(); serialprintPGM(pre);
d_from(); SERIAL_ECHOPGM_P(pre);
DEBUG_ECHO_F(normed(pos, zadd), 6);
DEBUG_ECHOLNPAIR_F(" Z error = ", zadd - get_z_correction(pos), 6);
};

View File

@ -40,7 +40,7 @@
void host_action(PGM_P const pstr, const bool eol) {
PORT_REDIRECT(SERIAL_ALL);
SERIAL_ECHOPGM("//action:");
serialprintPGM(pstr);
SERIAL_ECHOPGM_P(pstr);
if (eol) SERIAL_EOL();
}
@ -86,14 +86,13 @@ void host_action(PGM_P const pstr, const bool eol) {
void host_action_notify_P(PGM_P const message) {
PORT_REDIRECT(SERIAL_ALL);
host_action(PSTR("notification "), false);
serialprintPGM(message);
SERIAL_EOL();
SERIAL_ECHOLNPGM_P(message);
}
void host_action_prompt(PGM_P const ptype, const bool eol=true) {
PORT_REDIRECT(SERIAL_ALL);
host_action(PSTR("prompt_"), false);
serialprintPGM(ptype);
SERIAL_ECHOPGM_P(ptype);
if (eol) SERIAL_EOL();
}
@ -101,7 +100,7 @@ void host_action(PGM_P const pstr, const bool eol) {
host_action_prompt(ptype, false);
PORT_REDIRECT(SERIAL_ALL);
SERIAL_CHAR(' ');
serialprintPGM(pstr);
SERIAL_ECHOPGM_P(pstr);
if (extra_char != '\0') SERIAL_CHAR(extra_char);
SERIAL_EOL();
}

View File

@ -127,7 +127,7 @@ uint8_t Max7219::suspended; // = 0;
void Max7219::error(const char * const func, const int32_t v1, const int32_t v2/*=-1*/) {
#if ENABLED(MAX7219_ERRORS)
SERIAL_ECHOPGM("??? Max7219::");
serialprintPGM(func);
SERIAL_ECHOPGM_P(func);
SERIAL_CHAR('(');
SERIAL_ECHO(v1);
if (v2 > 0) SERIAL_ECHOPAIR(", ", v2);

View File

@ -179,7 +179,7 @@ void MeatPack::report_state() {
SERIAL_ECHOPGM("[MP] ");
SERIAL_ECHOPGM(MeatPack_ProtocolVersion " ");
serialprint_onoff(TEST(state, MPConfig_Bit_Active));
serialprintPGM(TEST(state, MPConfig_Bit_NoSpaces) ? PSTR(" NSP\n") : PSTR(" ESP\n"));
SERIAL_ECHOPGM_P(TEST(state, MPConfig_Bit_NoSpaces) ? PSTR(" NSP\n") : PSTR(" ESP\n"));
}
/**

View File

@ -460,7 +460,7 @@ void show_continue_prompt(const bool is_reload) {
ui.pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING);
SERIAL_ECHO_START();
serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
SERIAL_ECHOPGM_P(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
}
void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) {

View File

@ -531,7 +531,7 @@ void PrintJobRecovery::resume() {
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
void PrintJobRecovery::debug(PGM_P const prefix) {
DEBUG_PRINT_P(prefix);
DEBUG_ECHOPGM_P(prefix);
DEBUG_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", info.valid_head, " valid_foot:", info.valid_foot);
if (info.valid_head) {
if (info.valid_head == info.valid_foot) {

View File

@ -73,7 +73,7 @@ void ProbeTempComp::print_offsets() {
LOOP_L_N(s, TSI_COUNT) {
float temp = cali_info[s].start_temp;
for (int16_t i = -1; i < cali_info[s].measurements; ++i) {
serialprintPGM(s == TSI_BED ? PSTR("Bed") :
SERIAL_ECHOPGM_P(s == TSI_BED ? PSTR("Bed") :
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
s == TSI_EXT ? PSTR("Extruder") :
#endif

View File

@ -287,7 +287,7 @@ class FilamentSensorBase {
if (out != was_out) {
was_out = out;
SERIAL_ECHOPGM("Filament ");
serialprintPGM(out ? PSTR("OUT\n") : PSTR("IN\n"));
SERIAL_ECHOPGM_P(out ? PSTR("OUT\n") : PSTR("IN\n"));
}
#endif
}
@ -320,10 +320,8 @@ class FilamentSensorBase {
const millis_t ms = millis();
if (ELAPSED(ms, t)) {
t = millis() + 1000UL;
LOOP_L_N(i, EXTRUDERS) {
serialprintPGM(i ? PSTR(", ") : PSTR("Remaining mm: "));
SERIAL_ECHO(runout_mm_countdown[i]);
}
LOOP_L_N(i, EXTRUDERS)
SERIAL_ECHOPAIR_P(i ? PSTR(", ") : PSTR("Remaining mm: "), runout_mm_countdown[i]);
SERIAL_EOL();
}
#endif

View File

@ -546,7 +546,7 @@
};
template<class TMC>
static void print_vsense(TMC &st) { serialprintPGM(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); }
static void print_vsense(TMC &st) { SERIAL_ECHOPGM_P(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); }
#if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC5130)
static void _tmc_status(TMC2130Stepper &st, const TMC_debug_enum i) {
@ -717,7 +717,7 @@
SERIAL_ECHO(st.cs());
SERIAL_ECHOPGM("/31");
break;
case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break;
case TMC_VSENSE: SERIAL_ECHOPGM_P(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break;
case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break;
//case TMC_OTPW: serialprint_truefalse(st.otpw()); break;
//case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break;
@ -1208,7 +1208,7 @@ static bool test_connection(TMC &st) {
case 1: stat = PSTR("HIGH"); break;
case 2: stat = PSTR("LOW"); break;
}
serialprintPGM(stat);
SERIAL_ECHOPGM_P(stat);
SERIAL_EOL();
return test_result;

View File

@ -83,7 +83,7 @@ void TWIBus::send() {
// static
void TWIBus::echoprefix(uint8_t bytes, const char pref[], uint8_t adr) {
SERIAL_ECHO_START();
serialprintPGM(pref);
SERIAL_ECHOPGM_P(pref);
SERIAL_ECHOPAIR(": from:", adr, " bytes:", bytes, " data:");
}
@ -172,7 +172,7 @@ void TWIBus::flush() {
// static
void TWIBus::prefix(const char func[]) {
SERIAL_ECHOPGM("TWIBus::");
serialprintPGM(func);
SERIAL_ECHOPGM_P(func);
SERIAL_ECHOPGM(": ");
}
void TWIBus::debug(const char func[], uint32_t adr) {