Serial refactor. Default 8-bit ECHO to int, not char (#20985)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
X-Ryl669
2021-02-08 07:37:24 +01:00
committed by GitHub
parent 1e726fe405
commit e7c711996b
72 changed files with 379 additions and 337 deletions

View File

@ -1305,7 +1305,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
const feedRate_t home_fr_mm_s = fr_mm_s ?: homing_feedrate(axis);
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOPAIR("...(", axis_codes[axis], ", ", distance, ", ");
DEBUG_ECHOPAIR("...(", AS_CHAR(axis_codes[axis]), ", ", distance, ", ");
if (fr_mm_s)
DEBUG_ECHO(fr_mm_s);
else
@ -1398,7 +1398,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
* Callers must sync the planner position after calling this!
*/
void set_axis_is_at_home(const AxisEnum axis) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> set_axis_is_at_home(", axis_codes[axis], ")");
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> set_axis_is_at_home(", AS_CHAR(axis_codes[axis]), ")");
set_axis_trusted(axis);
set_axis_homed(axis);
@ -1448,7 +1448,7 @@ void set_axis_is_at_home(const AxisEnum axis) {
if (DEBUGGING(LEVELING)) {
#if HAS_HOME_OFFSET
DEBUG_ECHOLNPAIR("> home_offset[", axis_codes[axis], "] = ", home_offset[axis]);
DEBUG_ECHOLNPAIR("> home_offset[", AS_CHAR(axis_codes[axis]), "] = ", home_offset[axis]);
#endif
DEBUG_POS("", current_position);
DEBUG_ECHOLNPAIR("<<< set_axis_is_at_home(", axis_codes[axis], ")");

View File

@ -719,7 +719,7 @@ float Probe::probe_at_point(const float &rx, const float &ry, const ProbePtRaise
DEBUG_ECHOLNPAIR(
"...(", LOGICAL_X_POSITION(rx), ", ", LOGICAL_Y_POSITION(ry),
", ", raise_after == PROBE_PT_RAISE ? "raise" : raise_after == PROBE_PT_STOW ? "stow" : "none",
", ", int(verbose_level),
", ", verbose_level,
", ", probe_relative ? "probe" : "nozzle", "_relative)"
);
DEBUG_POS("", current_position);

View File

@ -2289,7 +2289,7 @@ void MarlinSettings::postprocess() {
eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET));
if (eeprom_error) {
DEBUG_ECHO_START();
DEBUG_ECHOLNPAIR("Index: ", int(eeprom_index - (EEPROM_OFFSET)), " Size: ", datasize());
DEBUG_ECHOLNPAIR("Index: ", eeprom_index - (EEPROM_OFFSET), " Size: ", datasize());
IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_index());
}
else if (working_crc != stored_crc) {
@ -3039,7 +3039,7 @@ void MarlinSettings::reset() {
}
#if EXTRUDERS == 1
CONFIG_ECHO_MSG(" M200 S", int(parser.volumetric_enabled)
CONFIG_ECHO_MSG(" M200 S", parser.volumetric_enabled
, " D", LINEAR_UNIT(planner.filament_size[0])
#if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
, " L", LINEAR_UNIT(planner.volumetric_extruder_limit[0])
@ -3047,14 +3047,14 @@ void MarlinSettings::reset() {
);
#else
LOOP_L_N(i, EXTRUDERS) {
CONFIG_ECHO_MSG(" M200 T", int(i)
CONFIG_ECHO_MSG(" M200 T", i
, " D", LINEAR_UNIT(planner.filament_size[i])
#if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
, " L", LINEAR_UNIT(planner.volumetric_extruder_limit[i])
#endif
);
}
CONFIG_ECHO_MSG(" M200 S", int(parser.volumetric_enabled));
CONFIG_ECHO_MSG(" M200 S", parser.volumetric_enabled);
#endif
#endif // EXTRUDERS && !NO_VOLUMETRICS
@ -3076,7 +3076,7 @@ void MarlinSettings::reset() {
LOOP_L_N(i, E_STEPPERS) {
CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR_P(
PSTR(" M203 T"), (int)i
PSTR(" M203 T"), i
, SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS_N(i)])
);
}
@ -3096,7 +3096,7 @@ void MarlinSettings::reset() {
LOOP_L_N(i, E_STEPPERS) {
CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR_P(
PSTR(" M201 T"), (int)i
PSTR(" M201 T"), i
, SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(i)])
);
}
@ -3158,7 +3158,7 @@ void MarlinSettings::reset() {
CONFIG_ECHO_START();
LOOP_S_L_N(e, 1, HOTENDS) {
SERIAL_ECHOPAIR_P(
PSTR(" M218 T"), (int)e,
PSTR(" M218 T"), e,
SP_X_STR, LINEAR_UNIT(hotend_offset[e].x),
SP_Y_STR, LINEAR_UNIT(hotend_offset[e].y)
);
@ -3192,7 +3192,7 @@ void MarlinSettings::reset() {
CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR_P(
PSTR(" M420 S"), int(planner.leveling_active)
PSTR(" M420 S"), planner.leveling_active
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
, SP_Z_STR, LINEAR_UNIT(planner.z_fade_height)
#endif
@ -3204,7 +3204,7 @@ void MarlinSettings::reset() {
LOOP_L_N(py, GRID_MAX_POINTS_Y) {
LOOP_L_N(px, GRID_MAX_POINTS_X) {
CONFIG_ECHO_START();
SERIAL_ECHOPAIR_P(PSTR(" G29 S3 I"), (int)px, PSTR(" J"), (int)py);
SERIAL_ECHOPAIR_P(PSTR(" G29 S3 I"), px, PSTR(" J"), py);
SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(mbl.z_values[px][py]), 5);
}
}
@ -3233,7 +3233,7 @@ void MarlinSettings::reset() {
LOOP_L_N(py, GRID_MAX_POINTS_Y) {
LOOP_L_N(px, GRID_MAX_POINTS_X) {
CONFIG_ECHO_START();
SERIAL_ECHOPAIR(" G29 W I", (int)px, " J", (int)py);
SERIAL_ECHOPAIR(" G29 W I", px, " J", py);
SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(z_values[px][py]), 5);
}
}
@ -3258,7 +3258,7 @@ void MarlinSettings::reset() {
#elif ENABLED(BLTOUCH) || (HAS_Z_SERVO_PROBE && defined(Z_SERVO_ANGLES))
case Z_PROBE_SERVO_NR:
#endif
CONFIG_ECHO_MSG(" M281 P", int(i), " L", servo_angles[i][0], " U", servo_angles[i][1]);
CONFIG_ECHO_MSG(" M281 P", i, " L", servo_angles[i][0], " U", servo_angles[i][1]);
default: break;
}
}
@ -3334,7 +3334,7 @@ void MarlinSettings::reset() {
LOOP_L_N(i, PREHEAT_COUNT) {
CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR_P(
PSTR(" M145 S"), (int)i
PSTR(" M145 S"), i
#if HAS_HOTEND
, PSTR(" H"), TEMP_UNIT(ui.material_preset[i].hotend_temp)
#endif
@ -3403,7 +3403,7 @@ void MarlinSettings::reset() {
#if ENABLED(POWER_LOSS_RECOVERY)
CONFIG_ECHO_HEADING("Power-Loss Recovery:");
CONFIG_ECHO_MSG(" M413 S", int(recovery.enabled));
CONFIG_ECHO_MSG(" M413 S", recovery.enabled);
#endif
#if ENABLED(FWRETRACT)
@ -3425,11 +3425,9 @@ void MarlinSettings::reset() {
);
#if ENABLED(FWRETRACT_AUTORETRACT)
CONFIG_ECHO_HEADING("Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover");
CONFIG_ECHO_MSG(" M209 S", int(fwretract.autoretract_enabled));
#endif // FWRETRACT_AUTORETRACT
CONFIG_ECHO_MSG(" M209 S", fwretract.autoretract_enabled);
#endif
#endif // FWRETRACT
@ -3775,7 +3773,7 @@ void MarlinSettings::reset() {
CONFIG_ECHO_MSG(" M900 K", planner.extruder_advance_K[0]);
#else
LOOP_L_N(i, EXTRUDERS)
CONFIG_ECHO_MSG(" M900 T", int(i), " K", planner.extruder_advance_K[i]);
CONFIG_ECHO_MSG(" M900 T", i, " K", planner.extruder_advance_K[i]);
#endif
#endif
@ -3841,7 +3839,7 @@ void MarlinSettings::reset() {
#if HAS_FILAMENT_SENSOR
CONFIG_ECHO_HEADING("Filament runout sensor:");
CONFIG_ECHO_MSG(
" M412 S", int(runout.enabled)
" M412 S", runout.enabled
#if HAS_FILAMENT_RUNOUT_DISTANCE
, " D", LINEAR_UNIT(runout.runout_distance())
#endif
@ -3859,7 +3857,7 @@ void MarlinSettings::reset() {
#if HAS_MULTI_LANGUAGE
CONFIG_ECHO_HEADING("UI Language:");
SERIAL_ECHO_MSG(" M414 S", int(ui.language));
SERIAL_ECHO_MSG(" M414 S", ui.language);
#endif
}

View File

@ -828,7 +828,7 @@ void Temperature::_temp_error(const heater_id_t heater_id, PGM_P const serial_ms
serialprintPGM(serial_msg);
SERIAL_ECHOPGM(STR_STOPPED_HEATER);
if (heater_id >= 0)
SERIAL_ECHO((int)heater_id);
SERIAL_ECHO(heater_id);
else if (TERN0(HAS_HEATED_CHAMBER, heater_id == H_CHAMBER))
SERIAL_ECHOPGM(STR_HEATER_CHAMBER);
else
@ -1494,7 +1494,7 @@ void Temperature::manage_heater() {
float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) {
if (e > HOTENDS - DISABLED(TEMP_SENSOR_1_AS_REDUNDANT)) {
SERIAL_ERROR_START();
SERIAL_ECHO((int)e);
SERIAL_ECHO(e);
SERIAL_ECHOLNPGM(STR_INVALID_EXTRUDER_NUM);
kill();
return 0;
@ -2065,7 +2065,7 @@ void Temperature::init() {
switch (heater_id) {
case H_BED: SERIAL_ECHOPGM("bed"); break;
case H_CHAMBER: SERIAL_ECHOPGM("chamber"); break;
default: SERIAL_ECHO((int)heater_id);
default: SERIAL_ECHO(heater_id);
}
SERIAL_ECHOLNPAIR(
" ; sizeof(running_temp):", sizeof(running_temp),

View File

@ -186,7 +186,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
current_position.x = mpe_settings.parking_xpos[new_tool] + offsetcompensation;
DEBUG_ECHOPAIR("(1) Move extruder ", int(new_tool));
DEBUG_ECHOPAIR("(1) Move extruder ", new_tool);
DEBUG_POS(" to new extruder ParkPos", current_position);
planner.buffer_line(current_position, mpe_settings.fast_feedrate, new_tool);
@ -196,7 +196,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
current_position.x = grabpos + offsetcompensation;
DEBUG_ECHOPAIR("(2) Couple extruder ", int(new_tool));
DEBUG_ECHOPAIR("(2) Couple extruder ", new_tool);
DEBUG_POS(" to new extruder GrabPos", current_position);
planner.buffer_line(current_position, mpe_settings.slow_feedrate, new_tool);
@ -209,7 +209,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
current_position.x = mpe_settings.parking_xpos[new_tool] + offsetcompensation;
DEBUG_ECHOPAIR("(3) Move extruder ", int(new_tool));
DEBUG_ECHOPAIR("(3) Move extruder ", new_tool);
DEBUG_POS(" back to new extruder ParkPos", current_position);
planner.buffer_line(current_position, mpe_settings.slow_feedrate, new_tool);
@ -219,7 +219,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
current_position.x = mpe_settings.parking_xpos[active_extruder] + (active_extruder == 0 ? MPE_TRAVEL_DISTANCE : -MPE_TRAVEL_DISTANCE) + offsetcompensation;
DEBUG_ECHOPAIR("(4) Move extruder ", int(new_tool));
DEBUG_ECHOPAIR("(4) Move extruder ", new_tool);
DEBUG_POS(" close to old extruder ParkPos", current_position);
planner.buffer_line(current_position, mpe_settings.fast_feedrate, new_tool);
@ -229,7 +229,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
current_position.x = mpe_settings.parking_xpos[active_extruder] + offsetcompensation;
DEBUG_ECHOPAIR("(5) Park extruder ", int(new_tool));
DEBUG_ECHOPAIR("(5) Park extruder ", new_tool);
DEBUG_POS(" at old extruder ParkPos", current_position);
planner.buffer_line(current_position, mpe_settings.slow_feedrate, new_tool);
@ -239,7 +239,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
current_position.x = oldx;
DEBUG_ECHOPAIR("(6) Move extruder ", int(new_tool));
DEBUG_ECHOPAIR("(6) Move extruder ", new_tool);
DEBUG_POS(" to starting position", current_position);
planner.buffer_line(current_position, mpe_settings.fast_feedrate, new_tool);
@ -274,9 +274,9 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
if (homed_towards_final_tool) {
pe_solenoid_magnet_off(1 - final_tool);
DEBUG_ECHOLNPAIR("Disengage magnet", (int)(1 - final_tool));
DEBUG_ECHOLNPAIR("Disengage magnet", 1 - final_tool);
pe_solenoid_magnet_on(final_tool);
DEBUG_ECHOLNPAIR("Engage magnet", (int)final_tool);
DEBUG_ECHOLNPAIR("Engage magnet", final_tool);
parking_extruder_set_parked(false);
return false;
}
@ -315,7 +315,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
if (!extruder_parked) {
current_position.x = parkingposx[active_extruder] + x_offset;
DEBUG_ECHOLNPAIR("(1) Park extruder ", int(active_extruder));
DEBUG_ECHOLNPAIR("(1) Park extruder ", active_extruder);
DEBUG_POS("Moving ParkPos", current_position);
fast_line_to_current(X_AXIS);
@ -411,7 +411,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
current_position.x = placexpos;
DEBUG_ECHOLNPAIR("(1) Place old tool ", int(active_extruder));
DEBUG_ECHOLNPAIR("(1) Place old tool ", active_extruder);
DEBUG_POS("Move X SwitchPos", current_position);
fast_line_to_current(X_AXIS);
@ -509,7 +509,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
current_position.y = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR;
SERIAL_ECHOLNPAIR("(1) Place old tool ", int(active_extruder));
SERIAL_ECHOLNPAIR("(1) Place old tool ", active_extruder);
DEBUG_POS("Move Y SwitchPos + Security", current_position);
fast_line_to_current(Y_AXIS);
@ -709,7 +709,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
#if EXTRUDERS
inline void invalid_extruder_error(const uint8_t e) {
SERIAL_ECHO_START();
SERIAL_CHAR('T'); SERIAL_ECHO((int)e);
SERIAL_CHAR('T'); SERIAL_ECHO(e);
SERIAL_CHAR(' '); SERIAL_ECHOLNPGM(STR_INVALID_EXTRUDER);
}
#endif
@ -1196,7 +1196,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
gcode.process_subcommands_now_P(PSTR(EVENT_GCODE_AFTER_TOOLCHANGE));
#endif
SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, int(active_extruder));
SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, active_extruder);
#endif // HAS_MULTI_EXTRUDER
}