🎨 Apply F() to G-code report header

This commit is contained in:
Scott Lahteine 2021-09-27 13:40:01 -05:00
parent eeffac697c
commit d7fede3a63
36 changed files with 50 additions and 50 deletions

View file

@ -243,7 +243,7 @@ void GcodeSuite::M420() {
}
void GcodeSuite::M420_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(
report_heading_etc(forReplay, F(
TERN(MESH_BED_LEVELING, "Mesh Bed Leveling", TERN(AUTO_BED_LEVELING_UBL, "Unified Bed Leveling", "Auto Bed Leveling"))
));
SERIAL_ECHOF(

View file

@ -538,7 +538,7 @@ void GcodeSuite::M422() {
}
void GcodeSuite::M422_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_Z_AUTO_ALIGN));
report_heading(forReplay, F(STR_Z_AUTO_ALIGN));
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
report_echo_start(forReplay);
SERIAL_ECHOLNPGM_P(

View file

@ -114,7 +114,7 @@ void GcodeSuite::M425() {
}
void GcodeSuite::M425_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_BACKLASH_COMPENSATION));
report_heading_etc(forReplay, F(STR_BACKLASH_COMPENSATION));
SERIAL_ECHOLNPGM_P(
PSTR(" M425 F"), backlash.get_correction()
#ifdef BACKLASH_SMOOTHING_MM

View file

@ -62,7 +62,7 @@
}
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_DELTA_SETTINGS));
report_heading_etc(forReplay, F(STR_DELTA_SETTINGS));
SERIAL_ECHOLNPGM_P(
PSTR(" M665 L"), LINEAR_UNIT(delta_diagonal_rod)
, PSTR(" R"), LINEAR_UNIT(delta_radius)
@ -132,7 +132,7 @@
}
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_SCARA_SETTINGS " (" STR_S_SEG_PER_SEC TERN_(HAS_SCARA_OFFSET, " " STR_SCARA_P_T_Z) ")"));
report_heading_etc(forReplay, F(STR_SCARA_SETTINGS " (" STR_S_SEG_PER_SEC TERN_(HAS_SCARA_OFFSET, " " STR_SCARA_P_T_Z) ")"));
SERIAL_ECHOLNPGM_P(
PSTR(" M665 S"), segments_per_second
#if HAS_SCARA_OFFSET
@ -162,7 +162,7 @@
}
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_POLARGRAPH_SETTINGS " (" STR_S_SEG_PER_SEC ")"));
report_heading_etc(forReplay, F(STR_POLARGRAPH_SETTINGS " (" STR_S_SEG_PER_SEC ")"));
SERIAL_ECHOLNPGM(" M665 S", segments_per_second);
}

View file

@ -61,7 +61,7 @@
}
void GcodeSuite::M666_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_ENDSTOP_ADJUSTMENT));
report_heading_etc(forReplay, F(STR_ENDSTOP_ADJUSTMENT));
SERIAL_ECHOLNPGM_P(
PSTR(" M666 X"), LINEAR_UNIT(delta_endstop_adj.a)
, SP_Y_STR, LINEAR_UNIT(delta_endstop_adj.b)
@ -105,7 +105,7 @@
}
void GcodeSuite::M666_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_ENDSTOP_ADJUSTMENT));
report_heading_etc(forReplay, F(STR_ENDSTOP_ADJUSTMENT));
SERIAL_ECHOPGM(" M666");
#if ENABLED(X_DUAL_ENDSTOPS)
SERIAL_ECHOLNPGM_P(SP_X_STR, LINEAR_UNIT(endstops.x2_endstop_adj));

View file

@ -92,7 +92,7 @@ void GcodeSuite::M852() {
}
void GcodeSuite::M852_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_SKEW_FACTOR));
report_heading_etc(forReplay, F(STR_SKEW_FACTOR));
SERIAL_ECHOPAIR_F(" M851 I", planner.skew_factor.xy, 6);
#if ENABLED(SKEW_CORRECTION_FOR_Z)
SERIAL_ECHOPAIR_F(" J", planner.skew_factor.xz, 6);

View file

@ -76,7 +76,7 @@
void GcodeSuite::M200_report(const bool forReplay/*=true*/) {
if (!forReplay) {
report_heading(forReplay, PSTR(STR_FILAMENT_SETTINGS), false);
report_heading(forReplay, F(STR_FILAMENT_SETTINGS), false);
if (!parser.volumetric_enabled) SERIAL_ECHOPGM(" (Disabled):");
SERIAL_EOL();
report_echo_start(forReplay);
@ -133,7 +133,7 @@ void GcodeSuite::M201() {
}
void GcodeSuite::M201_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_MAX_ACCELERATION));
report_heading_etc(forReplay, F(STR_MAX_ACCELERATION));
SERIAL_ECHOLNPGM_P(
LIST_N(DOUBLE(LINEAR_AXES),
PSTR(" M201 X"), LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS]),
@ -178,7 +178,7 @@ void GcodeSuite::M203() {
}
void GcodeSuite::M203_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_MAX_FEEDRATES));
report_heading_etc(forReplay, F(STR_MAX_FEEDRATES));
SERIAL_ECHOLNPGM_P(
LIST_N(DOUBLE(LINEAR_AXES),
PSTR(" M203 X"), LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS]),
@ -224,7 +224,7 @@ void GcodeSuite::M204() {
}
void GcodeSuite::M204_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_ACCELERATION_P_R_T));
report_heading_etc(forReplay, F(STR_ACCELERATION_P_R_T));
SERIAL_ECHOLNPGM_P(
PSTR(" M204 P"), LINEAR_UNIT(planner.settings.acceleration)
, PSTR(" R"), LINEAR_UNIT(planner.settings.retract_acceleration)
@ -285,7 +285,7 @@ void GcodeSuite::M205() {
}
void GcodeSuite::M205_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(
report_heading_etc(forReplay, F(
"Advanced (B<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate>"
TERN_(HAS_JUNCTION_DEVIATION, " J<junc_dev>")
TERN_(HAS_CLASSIC_JERK, " X<max_x_jerk> Y<max_y_jerk> Z<max_z_jerk>")

View file

@ -131,7 +131,7 @@ void GcodeSuite::M217() {
}
void GcodeSuite::M217_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_TOOL_CHANGING));
report_heading_etc(forReplay, F(STR_TOOL_CHANGING));
SERIAL_ECHOPGM(" M217");

View file

@ -57,7 +57,7 @@ void GcodeSuite::M218() {
}
void GcodeSuite::M218_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_HOTEND_OFFSETS));
report_heading_etc(forReplay, F(STR_HOTEND_OFFSETS));
LOOP_S_L_N(e, 1, HOTENDS) {
report_echo_start(forReplay);
SERIAL_ECHOPGM_P(

View file

@ -55,7 +55,7 @@ void GcodeSuite::M281() {
}
void GcodeSuite::M281_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_SERVO_ANGLES));
report_heading_etc(forReplay, F(STR_SERVO_ANGLES));
LOOP_L_N(i, NUM_SERVOS) {
switch (i) {
default: break;

View file

@ -79,7 +79,7 @@ void GcodeSuite::M301() {
}
void GcodeSuite::M301_report(const bool forReplay/*=true*/ E_OPTARG(const int8_t eindex/*=-1*/)) {
report_heading(forReplay, PSTR(STR_HOTEND_PID));
report_heading(forReplay, F(STR_HOTEND_PID));
IF_DISABLED(HAS_MULTI_EXTRUDER, constexpr int8_t eindex = -1);
HOTEND_LOOP() {
if (e == eindex || eindex == -1) {

View file

@ -42,7 +42,7 @@ void GcodeSuite::M304() {
}
void GcodeSuite::M304_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_BED_PID));
report_heading_etc(forReplay, F(STR_BED_PID));
SERIAL_ECHO_MSG(
" M304 P", thermalManager.temp_bed.pid.Kp
, " I", unscalePID_i(thermalManager.temp_bed.pid.Ki)

View file

@ -42,7 +42,7 @@ void GcodeSuite::M309() {
}
void GcodeSuite::M309_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_CHAMBER_PID));
report_heading_etc(forReplay, F(STR_CHAMBER_PID));
SERIAL_ECHOLNPGM(
" M309 P", thermalManager.temp_chamber.pid.Kp
, " I", unscalePID_i(thermalManager.temp_chamber.pid.Ki)

View file

@ -91,7 +91,7 @@ void GcodeSuite::M92() {
}
void GcodeSuite::M92_report(const bool forReplay/*=true*/, const int8_t e/*=-1*/) {
report_heading_etc(forReplay, PSTR(STR_STEPS_PER_UNIT));
report_heading_etc(forReplay, F(STR_STEPS_PER_UNIT));
SERIAL_ECHOPGM_P(LIST_N(DOUBLE(LINEAR_AXES),
PSTR(" M92 X"), LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS]),
SP_Y_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS]),

View file

@ -40,7 +40,7 @@ void GcodeSuite::M211() {
}
void GcodeSuite::M211_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_SOFT_ENDSTOPS));
report_heading_etc(forReplay, F(STR_SOFT_ENDSTOPS));
SERIAL_ECHOPGM(" M211 S", AS_DIGIT(soft_endstop._enabled), " ; ");
serialprintln_onoff(soft_endstop._enabled);

View file

@ -145,7 +145,7 @@ void GcodeSuite::M900() {
}
void GcodeSuite::M900_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_LINEAR_ADVANCE));
report_heading(forReplay, F(STR_LINEAR_ADVANCE));
#if EXTRUDERS < 2
report_echo_start(forReplay);
SERIAL_ECHOLNPGM(" M900 K", planner.extruder_advance_K[0]);

View file

@ -67,7 +67,7 @@ void GcodeSuite::M710() {
}
void GcodeSuite::M710_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_CONTROLLER_FAN));
report_heading_etc(forReplay, F(STR_CONTROLLER_FAN));
SERIAL_ECHOLNPGM(" M710"
" S", int(controllerFan.settings.active_speed),
" I", int(controllerFan.settings.idle_speed),

View file

@ -100,7 +100,7 @@ void GcodeSuite::M907() {
#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM
void GcodeSuite::M907_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_STEPPER_MOTOR_CURRENTS));
report_heading_etc(forReplay, F(STR_STEPPER_MOTOR_CURRENTS));
#if HAS_MOTOR_CURRENT_PWM
SERIAL_ECHOLNPGM_P( // PWM-based has 3 values:
PSTR(" M907 X"), stepper.motor_current_setting[0] // X and Y

View file

@ -38,7 +38,7 @@
void GcodeSuite::M207() { fwretract.M207(); }
void GcodeSuite::M207_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_RETRACT_S_F_Z));
report_heading_etc(forReplay, F(STR_RETRACT_S_F_Z));
fwretract.M207_report();
}
@ -53,7 +53,7 @@ void GcodeSuite::M207_report(const bool forReplay/*=true*/) {
void GcodeSuite::M208() { fwretract.M208(); }
void GcodeSuite::M208_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_RECOVER_S_F));
report_heading_etc(forReplay, F(STR_RECOVER_S_F));
fwretract.M208_report();
}
@ -68,7 +68,7 @@ void GcodeSuite::M208_report(const bool forReplay/*=true*/) {
void GcodeSuite::M209() { fwretract.M209(); }
void GcodeSuite::M209_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_AUTO_RETRACT_S));
report_heading_etc(forReplay, F(STR_AUTO_RETRACT_S));
fwretract.M209_report();
}

View file

@ -65,7 +65,7 @@ void GcodeSuite::M603() {
}
void GcodeSuite::M603_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_FILAMENT_LOAD_UNLOAD));
report_heading(forReplay, F(STR_FILAMENT_LOAD_UNLOAD));
#if EXTRUDERS == 1
report_echo_start(forReplay);

View file

@ -57,7 +57,7 @@ void GcodeSuite::M413() {
}
void GcodeSuite::M413_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_POWER_LOSS_RECOVERY));
report_heading_etc(forReplay, F(STR_POWER_LOSS_RECOVERY));
SERIAL_ECHOPGM(" M413 S", AS_DIGIT(recovery.enabled), " ; ");
serialprintln_onoff(recovery.enabled);
}

View file

@ -67,7 +67,7 @@ void GcodeSuite::M412() {
}
void GcodeSuite::M412_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
report_heading_etc(forReplay, F(STR_FILAMENT_RUNOUT_SENSOR));
SERIAL_ECHOPGM(
" M412 S", runout.enabled
#if HAS_FILAMENT_RUNOUT_DISTANCE

View file

@ -139,7 +139,7 @@ void GcodeSuite::M569() {
}
void GcodeSuite::M569_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_DRIVER_STEPPING_MODE));
report_heading(forReplay, F(STR_DRIVER_STEPPING_MODE));
auto say_M569 = [](const bool forReplay, const char * const etc=nullptr, const bool eol=false) {
if (!forReplay) SERIAL_ECHO_START();

View file

@ -199,7 +199,7 @@ void GcodeSuite::M906() {
}
void GcodeSuite::M906_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_STEPPER_DRIVER_CURRENT));
report_heading(forReplay, F(STR_STEPPER_DRIVER_CURRENT));
auto say_M906 = [](const bool forReplay) {
report_echo_start(forReplay);

View file

@ -311,7 +311,7 @@
}
void GcodeSuite::M913_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_HYBRID_THRESHOLD));
report_heading(forReplay, F(STR_HYBRID_THRESHOLD));
auto say_M913 = [](const bool forReplay) {
report_echo_start(forReplay);
@ -512,7 +512,7 @@
}
void GcodeSuite::M914_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_STALLGUARD_THRESHOLD));
report_heading(forReplay, F(STR_STALLGUARD_THRESHOLD));
auto say_M914 = [](const bool forReplay) {
report_echo_start(forReplay);

View file

@ -103,12 +103,12 @@ axis_bits_t GcodeSuite::axis_relative = 0 LOGICAL_AXIS_GANG(
#endif
void GcodeSuite::report_echo_start(const bool forReplay) { if (!forReplay) SERIAL_ECHO_START(); }
void GcodeSuite::report_heading(const bool forReplay, PGM_P const pstr, const bool eol/*=true*/) {
void GcodeSuite::report_heading(const bool forReplay, FSTR_P const fstr, const bool eol/*=true*/) {
if (forReplay) return;
if (pstr) {
if (fstr) {
SERIAL_ECHO_START();
SERIAL_ECHOPGM("; ");
SERIAL_ECHOPGM_P(pstr);
SERIAL_ECHOF(fstr);
}
if (eol) { SERIAL_CHAR(':'); SERIAL_EOL(); }
}

View file

@ -382,9 +382,9 @@ public:
}
static void report_echo_start(const bool forReplay);
static void report_heading(const bool forReplay, PGM_P const pstr, const bool eol=true);
static inline void report_heading_etc(const bool forReplay, PGM_P const pstr, const bool eol=true) {
report_heading(forReplay, pstr, eol);
static void report_heading(const bool forReplay, FSTR_P const fstr, const bool eol=true);
static inline void report_heading_etc(const bool forReplay, FSTR_P const fstr, const bool eol=true) {
report_heading(forReplay, fstr, eol);
report_echo_start(forReplay);
}
static void say_units();

View file

@ -53,7 +53,7 @@ void GcodeSuite::M206() {
}
void GcodeSuite::M206_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_HOME_OFFSET));
report_heading_etc(forReplay, F(STR_HOME_OFFSET));
SERIAL_ECHOLNPGM_P(
#if IS_CARTESIAN
LIST_N(DOUBLE(LINEAR_AXES),

View file

@ -61,7 +61,7 @@ void GcodeSuite::M145() {
}
void GcodeSuite::M145_report(const bool forReplay/*=true*/) {
report_heading(forReplay, PSTR(STR_MATERIAL_HEATUP));
report_heading(forReplay, F(STR_MATERIAL_HEATUP));
LOOP_L_N(i, PREHEAT_COUNT) {
report_echo_start(forReplay);
SERIAL_ECHOLNPGM_P(

View file

@ -38,7 +38,7 @@ void GcodeSuite::M250() {
}
void GcodeSuite::M250_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_LCD_CONTRAST));
report_heading_etc(forReplay, F(STR_LCD_CONTRAST));
SERIAL_ECHOLNPGM(" M250 C", ui.contrast);
}

View file

@ -37,7 +37,7 @@ void GcodeSuite::M256() {
}
void GcodeSuite::M256_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_LCD_BRIGHTNESS));
report_heading_etc(forReplay, F(STR_LCD_BRIGHTNESS));
SERIAL_ECHOLNPGM(" M256 B", ui.brightness);
}

View file

@ -44,7 +44,7 @@ void GcodeSuite::M414() {
}
void GcodeSuite::M414_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_UI_LANGUAGE));
report_heading_etc(forReplay, F(STR_UI_LANGUAGE));
SERIAL_ECHOLNPGM(" M414 S", ui.language);
}

View file

@ -84,7 +84,7 @@ void GcodeSuite::M851() {
}
void GcodeSuite::M851_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_Z_PROBE_OFFSET));
report_heading_etc(forReplay, F(STR_Z_PROBE_OFFSET));
SERIAL_ECHOPGM_P(
#if HAS_PROBE_XY_OFFSET
PSTR(" M851 X"), LINEAR_UNIT(probe.offset_xy.x),

View file

@ -37,7 +37,7 @@ void GcodeSuite::M149() {
}
void GcodeSuite::M149_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, PSTR(STR_TEMPERATURE_UNITS));
report_heading_etc(forReplay, F(STR_TEMPERATURE_UNITS));
SERIAL_ECHOPGM(" M149 ", AS_CHAR(parser.temp_units_code()), " ; Units in ");
SERIAL_ECHOLNF(parser.temp_units_name());
}

View file

@ -3037,7 +3037,7 @@ void MarlinSettings::reset() {
#define CONFIG_ECHO_START() gcode.report_echo_start(forReplay)
#define CONFIG_ECHO_MSG(V...) do{ CONFIG_ECHO_START(); SERIAL_ECHOLNPGM(V); }while(0)
#define CONFIG_ECHO_MSG_P(V...) do{ CONFIG_ECHO_START(); SERIAL_ECHOLNPGM_P(V); }while(0)
#define CONFIG_ECHO_HEADING(STR) gcode.report_heading(forReplay, PSTR(STR))
#define CONFIG_ECHO_HEADING(STR) gcode.report_heading(forReplay, F(STR))
void M92_report(const bool echo=true, const int8_t e=-1);

View file

@ -1727,7 +1727,7 @@ void Temperature::manage_heater() {
}
void Temperature::M305_report(const uint8_t t_index, const bool forReplay/*=true*/) {
gcode.report_heading_etc(forReplay, PSTR(STR_USER_THERMISTORS));
gcode.report_heading_etc(forReplay, F(STR_USER_THERMISTORS));
SERIAL_ECHOPGM(" M305 P", AS_DIGIT(t_index));
const user_thermistor_t &t = user_thermistor[t_index];