0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-02-18 15:21:25 +00:00

🧑‍💻 AS_CHAR => C (#26569)

This commit is contained in:
Scott Lahteine 2023-12-27 01:25:51 -06:00 committed by GitHub
parent 10d80eb894
commit 15f26b4021
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 80 additions and 80 deletions

View file

@ -91,7 +91,7 @@ bool PersistentStore::access_finish() {
static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) {
#if ENABLED(DEBUG_SD_EEPROM_EMULATION)
FSTR_P const rw_str = write ? F("write") : F("read");
SERIAL_ECHOLN(AS_CHAR(' '), rw_str, F("_data("), pos, AS_CHAR(','), *value, AS_CHAR(','), size, F(", ...)"));
SERIAL_ECHOLN(C(' '), rw_str, F("_data("), pos, C(','), *value, C(','), size, F(", ...)"));
if (total)
SERIAL_ECHOLN(F(" f_"), rw_str, F("()="), s, F("\n size="), size, F("\n bytes_"), write ? F("written=") : F("read="), total);
else

View file

@ -109,7 +109,7 @@
#if ENABLED(MARLIN_DEV_MODE)
void dump_delay_accuracy_check() {
auto report_call_time = [](FSTR_P const name, FSTR_P const unit, const uint32_t cycles, const uint32_t total, const bool do_flush=true) {
SERIAL_ECHOLN(F("Calling "), name, F(" for "), cycles, AS_CHAR(' '), unit, F(" took: "), total, AS_CHAR(' '), unit);
SERIAL_ECHOLN(F("Calling "), name, F(" for "), cycles, C(' '), unit, F(" took: "), total, C(' '), unit);
if (do_flush) SERIAL_FLUSHTX();
};

View file

@ -39,7 +39,7 @@ private:
void echo_msg(FSTR_P const fpre) {
SERIAL_ECHO(fpre);
if (the_msg) SERIAL_ECHO(AS_CHAR(' '), the_msg);
if (the_msg) SERIAL_ECHO(C(' '), the_msg);
SERIAL_CHAR(' ');
print_xyz(xyz_pos_t(current_position));
}

View file

@ -98,7 +98,7 @@ public:
void debug(FSTR_P const f) {
#if ENABLED(MSTRING_DEBUG)
SERIAL_ECHOLN(f, AS_CHAR(':'), uintptr_t(str), AS_CHAR(' '), length(), AS_CHAR(' '), str);
SERIAL_ECHOLN(f, C(':'), uintptr_t(str), C(' '), length(), C(' '), str);
#endif
}

View file

@ -148,7 +148,7 @@ template <typename T> void SERIAL_ECHOLN(T x) { SERIAL_IMPL.println(x); }
// Wrapper for ECHO commands to interpret a char
void SERIAL_ECHO(serial_char_t x);
#define AS_DIGIT(C) AS_CHAR('0' + (C))
#define AS_DIGIT(n) C('0' + (n))
// Print an integer with a numeric base such as PrintBase::Hex
template <typename T> void SERIAL_PRINT(T x, PrintBase y) { SERIAL_IMPL.print(x, y); }

View file

@ -298,9 +298,9 @@ typedef IF<TERN0(ABL_USES_GRID, (GRID_MAX_POINTS > 255)), uint16_t, uint8_t>::ty
#define MMM_TO_MMS(MM_M) feedRate_t(static_cast<float>(MM_M) / 60.0f)
#define MMS_TO_MMM(MM_S) (static_cast<float>(MM_S) * 60.0f)
// Packaged character for AS_CHAR macro and other usage
// Packaged character for C macro and other usage
typedef struct SerialChar { char c; SerialChar(char n) : c(n) { } } serial_char_t;
#define AS_CHAR(C) serial_char_t(C)
#define C(c) serial_char_t(c)
// Packaged types: float with precision and/or width; a repeated space/character
typedef struct WFloat { float value; char width; char prec;

View file

@ -465,7 +465,7 @@ void unified_bed_leveling::G29() {
SERIAL_ECHOLNPGM("Mesh invalidated. Probing mesh.");
}
if (param.V_verbosity > 1)
SERIAL_ECHOLN(F("Probing around ("), param.XY_pos.x, AS_CHAR(','), param.XY_pos.y, F(").\n"));
SERIAL_ECHOLN(F("Probing around ("), param.XY_pos.x, C(','), param.XY_pos.y, F(").\n"));
probe_entire_mesh(param.XY_pos, parser.seen_test('T'), parser.seen_test('E'), parser.seen_test('U'));
report_current_position();
@ -1572,14 +1572,14 @@ void unified_bed_leveling::smart_fill_mesh() {
if (DEBUGGING(LEVELING)) {
#if ENABLED(UBL_TILT_ON_MESH_POINTS)
const xy_pos_t oldLpos = oldRpos.asLogical();
DEBUG_ECHO(F("Calculated point: ("), p_float_t(oldRpos.x, 7), AS_CHAR(','), p_float_t(oldRpos.y, 7),
F(") logical: ("), p_float_t(oldLpos.x, 7), AS_CHAR(','), p_float_t(oldLpos.y, 7),
DEBUG_ECHO(F("Calculated point: ("), p_float_t(oldRpos.x, 7), C(','), p_float_t(oldRpos.y, 7),
F(") logical: ("), p_float_t(oldLpos.x, 7), C(','), p_float_t(oldLpos.y, 7),
F(")\nSelected mesh point: ")
);
#endif
const xy_pos_t lpos = rpos.asLogical();
DEBUG_ECHO( AS_CHAR('('), p_float_t(rpos.x, 7), AS_CHAR(','), p_float_t(rpos.y, 7),
F(") logical: ("), p_float_t(lpos.x, 7), AS_CHAR(','), p_float_t(lpos.y, 7),
DEBUG_ECHO( C('('), p_float_t(rpos.x, 7), C(','), p_float_t(rpos.y, 7),
F(") logical: ("), p_float_t(lpos.x, 7), C(','), p_float_t(lpos.y, 7),
F(") measured: "), p_float_t(measured_z, 7),
F(" correction: "), p_float_t(zcorr, 7)
);
@ -1614,7 +1614,7 @@ void unified_bed_leveling::smart_fill_mesh() {
vector_3 normal = vector_3(lsf_results.A, lsf_results.B, 1).get_normal();
if (param.V_verbosity > 2)
SERIAL_ECHOLN(F("bed plane normal = ["), p_float_t(normal.x, 7), AS_CHAR(','), p_float_t(normal.y, 7), AS_CHAR(','), p_float_t(normal.z, 7), AS_CHAR(']'));
SERIAL_ECHOLN(F("bed plane normal = ["), p_float_t(normal.x, 7), C(','), p_float_t(normal.y, 7), C(','), p_float_t(normal.z, 7), C(']'));
matrix_3x3 rotation = matrix_3x3::create_look_at(vector_3(lsf_results.A, lsf_results.B, 1));
@ -1622,14 +1622,14 @@ void unified_bed_leveling::smart_fill_mesh() {
float mx = get_mesh_x(i), my = get_mesh_y(j), mz = z_values[i][j];
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> "));
DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), C(','), p_float_t(my, 7), C(','), p_float_t(mz, 7), F("] ---> "));
DEBUG_DELAY(20);
}
rotation.apply_rotation_xyz(mx, my, mz);
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> "));
DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), C(','), p_float_t(my, 7), C(','), p_float_t(mz, 7), F("] ---> "));
DEBUG_DELAY(20);
}
@ -1641,7 +1641,7 @@ void unified_bed_leveling::smart_fill_mesh() {
rotation.debug(F("rotation matrix:\n"));
DEBUG_ECHOLN(F("LSF Results A="), p_float_t(lsf_results.A, 7), F(" B="), p_float_t(lsf_results.B, 7), F(" D="), p_float_t(lsf_results.D, 7));
DEBUG_DELAY(55);
DEBUG_ECHOLN(F("bed plane normal = ["), p_float_t(normal.x, 7), AS_CHAR(','), p_float_t(normal.y, 7), AS_CHAR(','), p_float_t(normal.z, 7), AS_CHAR(']'));
DEBUG_ECHOLN(F("bed plane normal = ["), p_float_t(normal.x, 7), C(','), p_float_t(normal.y, 7), C(','), p_float_t(normal.z, 7), C(']'));
DEBUG_EOL();
/**
@ -1659,7 +1659,7 @@ void unified_bed_leveling::smart_fill_mesh() {
};
auto debug_pt = [](const int num, const xy_pos_t &pos, const_float_t zadd) {
d_from();
DEBUG_ECHOLN(F("Point "), num, AS_CHAR(':'), p_float_t(normed(pos, zadd), 6), F(" Z error = "), p_float_t(zadd - get_z_correction(pos), 6));
DEBUG_ECHOLN(F("Point "), num, C(':'), p_float_t(normed(pos, zadd), 6), F(" Z error = "), p_float_t(zadd - get_z_correction(pos), 6));
};
debug_pt(1, probe_pt[0], normal.z * gotz[0]);
debug_pt(2, probe_pt[1], normal.z * gotz[1]);
@ -1668,7 +1668,7 @@ void unified_bed_leveling::smart_fill_mesh() {
constexpr xy_float_t safe_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT };
d_from(); DEBUG_ECHOLN(F("safe home with Z="), F("0 : "), p_float_t(normed(safe_xy, 0), 6));
d_from(); DEBUG_ECHOLN(F("safe home with Z="), F("mesh value "), p_float_t(normed(safe_xy, get_z_correction(safe_xy)), 6));
DEBUG_ECHO(F(" Z error = ("), Z_SAFE_HOMING_X_POINT, AS_CHAR(','), Z_SAFE_HOMING_Y_POINT, F(") = "), p_float_t(get_z_correction(safe_xy), 6));
DEBUG_ECHO(F(" Z error = ("), Z_SAFE_HOMING_X_POINT, C(','), Z_SAFE_HOMING_Y_POINT, F(") = "), p_float_t(get_z_correction(safe_xy), 6));
#endif
#endif
} // DEBUGGING(LEVELING)

View file

@ -49,7 +49,7 @@ void I2CPositionEncoder::init(const uint8_t address, const AxisEnum axis) {
initialized = true;
SERIAL_ECHOLNPGM("Setting up encoder on ", AS_CHAR(AXIS_CHAR(encoderAxis)), " axis, addr = ", address);
SERIAL_ECHOLNPGM("Setting up encoder on ", C(AXIS_CHAR(encoderAxis)), " axis, addr = ", address);
position = get_position();
}
@ -67,7 +67,7 @@ void I2CPositionEncoder::update() {
/*
if (trusted) { //commented out as part of the note below
trusted = false;
SERIAL_ECHOLNPGM("Fault detected on ", AS_CHAR(AXIS_CHAR(encoderAxis)), " axis encoder. Disengaging error correction until module is trusted again.");
SERIAL_ECHOLNPGM("Fault detected on ", C(AXIS_CHAR(encoderAxis)), " axis encoder. Disengaging error correction until module is trusted again.");
}
*/
return;
@ -92,7 +92,7 @@ void I2CPositionEncoder::update() {
if (millis() - lastErrorTime > I2CPE_TIME_TRUSTED) {
trusted = true;
SERIAL_ECHOLNPGM("Untrusted encoder module on ", AS_CHAR(AXIS_CHAR(encoderAxis)), " axis has been fault-free for set duration, reinstating error correction.");
SERIAL_ECHOLNPGM("Untrusted encoder module on ", C(AXIS_CHAR(encoderAxis)), " axis has been fault-free for set duration, reinstating error correction.");
//the encoder likely lost its place when the error occurred, so we'll reset and use the printer's
//idea of where it the axis is to re-initialize
@ -106,7 +106,7 @@ void I2CPositionEncoder::update() {
SERIAL_ECHOLNPGM("Current position is ", pos);
SERIAL_ECHOLNPGM("Position in encoder ticks is ", positionInTicks);
SERIAL_ECHOLNPGM("New zero-offset of ", zeroOffset);
SERIAL_ECHOLN(F("New position reads as "), get_position(), AS_CHAR('('), mm_from_count(get_position()), AS_CHAR(')'));
SERIAL_ECHOLN(F("New position reads as "), get_position(), C('('), mm_from_count(get_position()), C(')'));
#endif
}
#endif

View file

@ -261,32 +261,32 @@ class I2CPositionEncodersMgr {
static void report_error_count(const int8_t idx, const AxisEnum axis) {
CHECK_IDX();
SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(AXIS_CHAR(axis)), " axis is ", encoders[idx].get_error_count());
SERIAL_ECHOLNPGM("Error count on ", C(AXIS_CHAR(axis)), " axis is ", encoders[idx].get_error_count());
}
static void reset_error_count(const int8_t idx, const AxisEnum axis) {
CHECK_IDX();
encoders[idx].set_error_count(0);
SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(AXIS_CHAR(axis)), " axis has been reset.");
SERIAL_ECHOLNPGM("Error count on ", C(AXIS_CHAR(axis)), " axis has been reset.");
}
static void enable_ec(const int8_t idx, const bool enabled, const AxisEnum axis) {
CHECK_IDX();
encoders[idx].set_ec_enabled(enabled);
SERIAL_ECHOPGM("Error correction on ", AS_CHAR(AXIS_CHAR(axis)));
SERIAL_ECHOPGM("Error correction on ", C(AXIS_CHAR(axis)));
SERIAL_ECHO_TERNARY(encoders[idx].get_ec_enabled(), " axis is ", "en", "dis", "abled.\n");
}
static void set_ec_threshold(const int8_t idx, const float newThreshold, const AxisEnum axis) {
CHECK_IDX();
encoders[idx].set_ec_threshold(newThreshold);
SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(AXIS_CHAR(axis)), " axis set to ", newThreshold, "mm.");
SERIAL_ECHOLNPGM("Error correct threshold for ", C(AXIS_CHAR(axis)), " axis set to ", newThreshold, "mm.");
}
static void get_ec_threshold(const int8_t idx, const AxisEnum axis) {
CHECK_IDX();
const float threshold = encoders[idx].get_ec_threshold();
SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(AXIS_CHAR(axis)), " axis is ", threshold, "mm.");
SERIAL_ECHOLNPGM("Error correct threshold for ", C(AXIS_CHAR(axis)), " axis is ", threshold, "mm.");
}
static int8_t idx_from_axis(const AxisEnum axis) {

View file

@ -136,7 +136,7 @@ uint8_t Max7219::suspended; // = 0;
void Max7219::error(FSTR_P const func, const int32_t v1, const int32_t v2/*=-1*/) {
#if ENABLED(MAX7219_ERRORS)
SERIAL_ECHO(F("??? Max7219::"), func, AS_CHAR('('), v1);
SERIAL_ECHO(F("??? Max7219::"), func, C('('), v1);
if (v2 > 0) SERIAL_ECHOPGM(", ", v2);
SERIAL_CHAR(')');
SERIAL_EOL();

View file

@ -140,7 +140,7 @@ void MeatPack::handle_output_char(const uint8_t c) {
#if ENABLED(MP_DEBUG)
if (chars_decoded < 1024) {
++chars_decoded;
DEBUG_ECHOLNPGM("RB: ", AS_CHAR(c));
DEBUG_ECHOLNPGM("RB: ", C(c));
}
#endif
}

View file

@ -60,7 +60,7 @@ void Mixer::normalize(const uint8_t tool_index) {
}
#ifdef MIXER_NORMALIZER_DEBUG
SERIAL_ECHOPGM("Mixer: Old relation : [ ");
MIXER_STEPPER_LOOP(i) SERIAL_ECHO(collector[i] / csum, AS_CHAR(' '));
MIXER_STEPPER_LOOP(i) SERIAL_ECHO(collector[i] / csum, C(' '));
SERIAL_ECHOLNPGM("]");
#endif
@ -72,12 +72,12 @@ void Mixer::normalize(const uint8_t tool_index) {
csum = 0;
SERIAL_ECHOPGM("Mixer: Normalize to : [ ");
MIXER_STEPPER_LOOP(i) {
SERIAL_ECHO(uint16_t(color[tool_index][i]), AS_CHAR(' '));
SERIAL_ECHO(uint16_t(color[tool_index][i]), C(' '));
csum += color[tool_index][i];
}
SERIAL_ECHOLNPGM("]");
SERIAL_ECHOPGM("Mixer: New relation : [ ");
MIXER_STEPPER_LOOP(i) SERIAL_ECHO(p_float_t(uint16_t(color[tool_index][i]) / csum, 3), AS_CHAR(' '));
MIXER_STEPPER_LOOP(i) SERIAL_ECHO(p_float_t(uint16_t(color[tool_index][i]) / csum, 3), C(' '));
SERIAL_ECHOLNPGM("]");
#endif

View file

@ -135,7 +135,7 @@ void event_filament_runout(const uint8_t extruder) {
if (run_runout_script) {
#if MULTI_FILAMENT_SENSOR
MString<strlen(FILAMENT_RUNOUT_SCRIPT)> script;
script.setf(F(FILAMENT_RUNOUT_SCRIPT), AS_CHAR(tool));
script.setf(F(FILAMENT_RUNOUT_SCRIPT), C(tool));
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
SERIAL_ECHOLNPGM("Runout Command: ", &script);
#endif

View file

@ -100,7 +100,7 @@ void GcodeSuite::G35() {
const float z_probed_height = probe.probe_at_point(tramming_points[i], PROBE_PT_RAISE);
if (isnan(z_probed_height)) {
SERIAL_ECHO(
F("G35 failed at point "), i + 1, F(" ("), FPSTR(pgm_read_ptr(&tramming_point_name[i])), AS_CHAR(')'),
F("G35 failed at point "), i + 1, F(" ("), FPSTR(pgm_read_ptr(&tramming_point_name[i])), C(')'),
FPSTR(SP_X_STR), tramming_points[i].x, FPSTR(SP_Y_STR), tramming_points[i].y
);
err_break = true;
@ -109,7 +109,7 @@ void GcodeSuite::G35() {
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLN(
F("Probing point "), i + 1, F(" ("), FPSTR(pgm_read_ptr(&tramming_point_name[i])), AS_CHAR(')'),
F("Probing point "), i + 1, F(" ("), FPSTR(pgm_read_ptr(&tramming_point_name[i])), C(')'),
FPSTR(SP_X_STR), tramming_points[i].x, FPSTR(SP_Y_STR), tramming_points[i].y,
FPSTR(SP_Z_STR), z_probed_height
);

View file

@ -92,7 +92,7 @@ void ac_cleanup() {
}
void print_signed_float(FSTR_P const prefix, const_float_t f) {
SERIAL_ECHO(F(" "), prefix, AS_CHAR(':'));
SERIAL_ECHO(F(" "), prefix, C(':'));
serial_offset(f);
}

View file

@ -245,7 +245,7 @@ void GcodeSuite::M48() {
sigma = SQRT(dev_sum / (n + 1));
if (verbose_level > 1) {
SERIAL_ECHO(n + 1, F(" of "), n_samples, F(": z: "), p_float_t(pz, 3), AS_CHAR(' '));
SERIAL_ECHO(n + 1, F(" of "), n_samples, F(": z: "), p_float_t(pz, 3), C(' '));
dev_report(verbose_level > 2, mean, sigma, min, max);
SERIAL_EOL();
}

View file

@ -52,7 +52,7 @@
is_err = true;
else {
delta_endstop_adj[i] = v;
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("delta_endstop_adj[", AS_CHAR(AXIS_CHAR(i)), "] = ", v);
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("delta_endstop_adj[", C(AXIS_CHAR(i)), "] = ", v);
}
}
}

View file

@ -82,7 +82,7 @@ void GcodeSuite::M92() {
if (wanted) {
const float best = uint16_t(wanted / z_full_step_mm) * z_full_step_mm;
SERIAL_ECHOPGM(", best:[", best);
if (best != wanted) { SERIAL_ECHO(AS_CHAR(','), best + z_full_step_mm); }
if (best != wanted) { SERIAL_ECHO(C(','), best + z_full_step_mm); }
SERIAL_CHAR(']');
}
SERIAL_ECHOLNPGM(" }");

View file

@ -144,7 +144,7 @@
HOTEND_LOOP() {
DEBUG_ECHOPGM_P(SP_T_STR, e);
LOOP_NUM_AXES(a) DEBUG_ECHOPGM(" hotend_offset[", e, "].", AS_CHAR(AXIS_CHAR(a) | 0x20), "=", hotend_offset[e][a]);
LOOP_NUM_AXES(a) DEBUG_ECHOPGM(" hotend_offset[", e, "].", C(AXIS_CHAR(a) | 0x20), "=", hotend_offset[e][a]);
DEBUG_EOL();
}
DEBUG_EOL();

View file

@ -131,7 +131,7 @@ void GcodeSuite::M900() {
SERIAL_ECHOLNPGM("Advance K=", planner.extruder_advance_K[0]);
#else
SERIAL_ECHOPGM("Advance K");
EXTRUDER_LOOP() SERIAL_ECHO(AS_CHAR(' '), AS_CHAR('0' + e), AS_CHAR(':'), planner.extruder_advance_K[e]);
EXTRUDER_LOOP() SERIAL_ECHO(C(' '), C('0' + e), C(':'), planner.extruder_advance_K[e]);
SERIAL_EOL();
#endif

View file

@ -257,10 +257,10 @@ void GcodeSuite::M493() {
flag.update_n = flag.reset_ft = flag.report_h = true;
}
else // Frequency out of range.
SERIAL_ECHOLNPGM("Invalid [", AS_CHAR('A'), "] frequency value.");
SERIAL_ECHOLNPGM("Invalid [", C('A'), "] frequency value.");
}
else // Mode doesn't use frequency.
SERIAL_ECHOLNPGM("Wrong mode for [", AS_CHAR('A'), "] frequency.");
SERIAL_ECHOLNPGM("Wrong mode for [", C('A'), "] frequency.");
}
#if HAS_DYNAMIC_FREQ
@ -271,7 +271,7 @@ void GcodeSuite::M493() {
flag.report_h = true;
}
else
SERIAL_ECHOLNPGM("Wrong mode for [", AS_CHAR('F'), "] frequency scaling.");
SERIAL_ECHOLNPGM("Wrong mode for [", C('F'), "] frequency scaling.");
}
#endif
@ -284,7 +284,7 @@ void GcodeSuite::M493() {
flag.update_n = flag.update_a = true;
}
else
SERIAL_ECHOLNPGM("Invalid X zeta [", AS_CHAR('I'), "] value."); // Zeta out of range.
SERIAL_ECHOLNPGM("Invalid X zeta [", C('I'), "] value."); // Zeta out of range.
}
else
SERIAL_ECHOLNPGM("Wrong mode for zeta parameter.");
@ -299,7 +299,7 @@ void GcodeSuite::M493() {
flag.update_a = true;
}
else
SERIAL_ECHOLNPGM("Invalid X vtol [", AS_CHAR('Q'), "] value."); // VTol out of range.
SERIAL_ECHOLNPGM("Invalid X vtol [", C('Q'), "] value."); // VTol out of range.
}
else
SERIAL_ECHOLNPGM("Wrong mode for vtol parameter.");
@ -318,10 +318,10 @@ void GcodeSuite::M493() {
flag.update_n = flag.reset_ft = flag.report_h = true;
}
else // Frequency out of range.
SERIAL_ECHOLNPGM("Invalid frequency [", AS_CHAR('B'), "] value.");
SERIAL_ECHOLNPGM("Invalid frequency [", C('B'), "] value.");
}
else // Mode doesn't use frequency.
SERIAL_ECHOLNPGM("Wrong mode for [", AS_CHAR('B'), "] frequency.");
SERIAL_ECHOLNPGM("Wrong mode for [", C('B'), "] frequency.");
}
#if HAS_DYNAMIC_FREQ
@ -332,7 +332,7 @@ void GcodeSuite::M493() {
flag.report_h = true;
}
else
SERIAL_ECHOLNPGM("Wrong mode for [", AS_CHAR('H'), "] frequency scaling.");
SERIAL_ECHOLNPGM("Wrong mode for [", C('H'), "] frequency scaling.");
}
#endif
@ -345,7 +345,7 @@ void GcodeSuite::M493() {
flag.update_n = flag.update_a = true;
}
else
SERIAL_ECHOLNPGM("Invalid Y zeta [", AS_CHAR('J'), "] value."); // Zeta Out of range
SERIAL_ECHOLNPGM("Invalid Y zeta [", C('J'), "] value."); // Zeta Out of range
}
else
SERIAL_ECHOLNPGM("Wrong mode for zeta parameter.");
@ -360,7 +360,7 @@ void GcodeSuite::M493() {
flag.update_a = true;
}
else
SERIAL_ECHOLNPGM("Invalid Y vtol [", AS_CHAR('R'), "] value."); // VTol out of range.
SERIAL_ECHOLNPGM("Invalid Y vtol [", C('R'), "] value."); // VTol out of range.
}
else
SERIAL_ECHOLNPGM("Wrong mode for vtol parameter.");

View file

@ -87,7 +87,7 @@ void GcodeSuite::G61() {
destination[i] = parser.seen(AXIS_CHAR(i))
? stored_position[slot][i] + parser.value_axis_units((AxisEnum)i)
: current_position[i];
DEBUG_ECHO(AS_CHAR(' '), AS_CHAR(AXIS_CHAR(i)), p_float_t(destination[i], 2));
DEBUG_ECHO(C(' '), C(AXIS_CHAR(i)), p_float_t(destination[i], 2));
}
DEBUG_EOL();
// Move to the saved position

View file

@ -160,7 +160,7 @@ void GcodeSuite::M569_report(const bool forReplay/*=true*/) {
auto say_M569 = [](const bool forReplay, FSTR_P const etc=nullptr, const bool eol=false) {
if (!forReplay) SERIAL_ECHO_START();
SERIAL_ECHOPGM(" M569 S1");
if (etc) SERIAL_ECHO(AS_CHAR(' '), etc);
if (etc) SERIAL_ECHO(C(' '), etc);
if (eol) SERIAL_EOL();
};

View file

@ -118,7 +118,7 @@ void GcodeSuite::M919() {
// Get the chopper timing for the specified axis and index
switch (i) {
default: // A specified axis isn't Trinamic
SERIAL_ECHOLNPGM("?Axis ", AS_CHAR(AXIS_CHAR(i)), " has no TMC drivers.");
SERIAL_ECHOLNPGM("?Axis ", C(AXIS_CHAR(i)), " has no TMC drivers.");
break;
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2)

View file

@ -37,7 +37,7 @@ static void config_prefix(PGM_P const name, PGM_P const pref=nullptr, const int8
SERIAL_ECHOPGM("Config:");
if (pref) SERIAL_ECHOPGM_P(pref);
if (ind >= 0) { SERIAL_ECHO(ind); SERIAL_CHAR(':'); }
SERIAL_ECHOPGM_P(name, AS_CHAR(':'));
SERIAL_ECHOPGM_P(name, C(':'));
}
static void config_line(PGM_P const name, const float val, PGM_P const pref=nullptr, const int8_t ind=-1) {
config_prefix(name, pref, ind);

View file

@ -339,7 +339,7 @@ void GCodeParser::parse(char *p) {
#if ENABLED(DEBUG_GCODE_PARSER)
if (debug) {
SERIAL_ECHOPGM("Got param ", AS_CHAR(param), " at index ", p - command_ptr - 1);
SERIAL_ECHOPGM("Got param ", C(param), " at index ", p - command_ptr - 1);
if (has_val) SERIAL_ECHOPGM(" (has_val)");
}
#endif

View file

@ -38,7 +38,7 @@ void GcodeSuite::M149() {
void GcodeSuite::M149_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, F(STR_TEMPERATURE_UNITS));
SERIAL_ECHOLN(F(" M149 "), AS_CHAR(parser.temp_units_code()), F(" ; Units in "), parser.temp_units_name());
SERIAL_ECHOLN(F(" M149 "), C(parser.temp_units_code()), F(" ; Units in "), parser.temp_units_name());
}
#endif // TEMPERATURE_UNITS_SUPPORT

View file

@ -294,14 +294,14 @@ private:
float mx = bedlevel.get_mesh_x(i), my = bedlevel.get_mesh_y(j), mz = bedlevel.z_values[i][j];
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> "));
DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), C(','), p_float_t(my, 7), C(','), p_float_t(mz, 7), F("] ---> "));
DEBUG_DELAY(20);
}
rotation.apply_rotation_xyz(mx, my, mz);
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), AS_CHAR(']'));
DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), C(','), p_float_t(my, 7), C(','), p_float_t(mz, 7), C(']'));
DEBUG_DELAY(20);
}

View file

@ -108,14 +108,14 @@ bool drawing_mesh = false;
float mx = bedlevel.get_mesh_x(i), my = bedlevel.get_mesh_y(j), mz = bedlevel.z_values[i][j];
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> "));
DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), C(','), p_float_t(my, 7), C(','), p_float_t(mz, 7), F("] ---> "));
DEBUG_DELAY(20);
}
rotation.apply_rotation_xyz(mx, my, mz);
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> "));
DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), C(','), p_float_t(my, 7), C(','), p_float_t(mz, 7), F("] ---> "));
DEBUG_DELAY(20);
}

View file

@ -139,10 +139,10 @@ bool NextionTFT::readTFTCommand() {
#if NEXDEBUG(N_SOME)
uint8_t req = atoi(&nextion_command[1]);
if (req > 7 && req != 20)
DEBUG_ECHOLNPGM( "> ", AS_CHAR(nextion_command[0]),
"\n> ", AS_CHAR(nextion_command[1]),
"\n> ", AS_CHAR(nextion_command[2]),
"\n> ", AS_CHAR(nextion_command[3]),
DEBUG_ECHOLNPGM( "> ", C(nextion_command[0]),
"\n> ", C(nextion_command[1]),
"\n> ", C(nextion_command[2]),
"\n> ", C(nextion_command[3]),
"\nprinter_state:", printer_state);
#endif
}

View file

@ -865,7 +865,7 @@ void MarlinUI::init() {
TERN_(MULTI_E_MANUAL, axis == E_AXIS ? e_index :) active_extruder
);
//SERIAL_ECHOLNPGM("Add planner.move with Axis ", AS_CHAR(AXIS_CHAR(axis)), " at FR ", fr_mm_s);
//SERIAL_ECHOLNPGM("Add planner.move with Axis ", C(AXIS_CHAR(axis)), " at FR ", fr_mm_s);
axis = NO_AXIS_ENUM;
@ -882,7 +882,7 @@ void MarlinUI::init() {
TERN_(MULTI_E_MANUAL, if (move_axis == E_AXIS) e_index = eindex);
start_time = millis() + (menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
axis = move_axis;
//SERIAL_ECHOLNPGM("Post Move with Axis ", AS_CHAR(AXIS_CHAR(axis)), " soon.");
//SERIAL_ECHOLNPGM("Post Move with Axis ", C(AXIS_CHAR(axis)), " soon.");
}
#if ENABLED(AUTO_BED_LEVELING_UBL)

View file

@ -927,7 +927,7 @@ void restore_feedrate_and_scaling() {
#endif
if (DEBUGGING(LEVELING))
SERIAL_ECHOLNPGM("Axis ", AS_CHAR(AXIS_CHAR(axis)), " min:", soft_endstop.min[axis], " max:", soft_endstop.max[axis]);
SERIAL_ECHOLNPGM("Axis ", C(AXIS_CHAR(axis)), " min:", soft_endstop.min[axis], " max:", soft_endstop.max[axis]);
}
/**
@ -1851,7 +1851,7 @@ void prepare_line_to_destination() {
const feedRate_t home_fr_mm_s = fr_mm_s ?: homing_feedrate(axis);
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOPGM("...(", AS_CHAR(AXIS_CHAR(axis)), ", ", distance, ", ");
DEBUG_ECHOPGM("...(", C(AXIS_CHAR(axis)), ", ", distance, ", ");
if (fr_mm_s)
DEBUG_ECHO(fr_mm_s);
else
@ -1941,12 +1941,12 @@ void prepare_line_to_destination() {
* "trusted" position).
*/
void set_axis_never_homed(const AxisEnum axis) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> set_axis_never_homed(", AS_CHAR(AXIS_CHAR(axis)), ")");
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> set_axis_never_homed(", C(AXIS_CHAR(axis)), ")");
set_axis_untrusted(axis);
set_axis_unhomed(axis);
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< set_axis_never_homed(", AS_CHAR(AXIS_CHAR(axis)), ")");
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< set_axis_never_homed(", C(AXIS_CHAR(axis)), ")");
TERN_(I2C_POSITION_ENCODERS, I2CPEM.unhomed(axis));
}
@ -2055,7 +2055,7 @@ void prepare_line_to_destination() {
if (ABS(phaseDelta) * planner.mm_per_step[axis] / phasePerUStep < 0.05f)
SERIAL_ECHOLNPGM("Selected home phase ", home_phase[axis],
" too close to endstop trigger phase ", phaseCurrent,
". Pick a different phase for ", AS_CHAR(AXIS_CHAR(axis)));
". Pick a different phase for ", C(AXIS_CHAR(axis)));
// Skip to next if target position is behind current. So it only moves away from endstop.
if (phaseDelta < 0) phaseDelta += 1024;
@ -2066,7 +2066,7 @@ void prepare_line_to_destination() {
// Optional debug messages
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLNPGM(
"Endstop ", AS_CHAR(AXIS_CHAR(axis)), " hit at Phase:", phaseCurrent,
"Endstop ", C(AXIS_CHAR(axis)), " hit at Phase:", phaseCurrent,
" Delta:", phaseDelta, " Distance:", mmDelta
);
}
@ -2100,7 +2100,7 @@ void prepare_line_to_destination() {
if (true MAIN_AXIS_MAP(_ANDCANT)) return;
#endif
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> homeaxis(", AS_CHAR(AXIS_CHAR(axis)), ")");
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> homeaxis(", C(AXIS_CHAR(axis)), ")");
const int axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS)
? TOOL_X_HOME_DIR(active_extruder) : home_dir(axis);
@ -2189,7 +2189,7 @@ void prepare_line_to_destination() {
default: break;
}
if (TEST(endstops.state(), es)) {
SERIAL_ECHO_MSG("Bad ", AS_CHAR(AXIS_CHAR(axis)), " Endstop?");
SERIAL_ECHO_MSG("Bad ", C(AXIS_CHAR(axis)), " Endstop?");
kill(GET_TEXT_F(MSG_KILL_HOMING_FAILED));
}
#endif
@ -2409,7 +2409,7 @@ void prepare_line_to_destination() {
if (axis == Z_AXIS) fwretract.current_hop = 0.0;
#endif
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< homeaxis(", AS_CHAR(AXIS_CHAR(axis)), ")");
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< homeaxis(", C(AXIS_CHAR(axis)), ")");
} // homeaxis()
@ -2434,7 +2434,7 @@ void prepare_line_to_destination() {
* Callers must sync the planner position after calling this!
*/
void set_axis_is_at_home(const AxisEnum axis) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> set_axis_is_at_home(", AS_CHAR(AXIS_CHAR(axis)), ")");
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> set_axis_is_at_home(", C(AXIS_CHAR(axis)), ")");
set_axis_trusted(axis);
set_axis_homed(axis);
@ -2481,10 +2481,10 @@ void set_axis_is_at_home(const AxisEnum axis) {
if (DEBUGGING(LEVELING)) {
#if HAS_HOME_OFFSET
DEBUG_ECHOLNPGM("> home_offset[", AS_CHAR(AXIS_CHAR(axis)), "] = ", home_offset[axis]);
DEBUG_ECHOLNPGM("> home_offset[", C(AXIS_CHAR(axis)), "] = ", home_offset[axis]);
#endif
DEBUG_POS("", current_position);
DEBUG_ECHOLNPGM("<<< set_axis_is_at_home(", AS_CHAR(AXIS_CHAR(axis)), ")");
DEBUG_ECHOLNPGM("<<< set_axis_is_at_home(", C(AXIS_CHAR(axis)), ")");
}
}

View file

@ -1487,7 +1487,7 @@ void Temperature::_temp_error(
OPTCODE(HAS_TEMP_CHAMBER, case H_CHAMBER: SERIAL_ECHOPGM(STR_HEATER_CHAMBER); break)
OPTCODE(HAS_TEMP_BED, case H_BED: SERIAL_ECHOPGM(STR_HEATER_BED); break)
default:
if (real_heater_id >= 0) SERIAL_ECHO(AS_CHAR('E'), real_heater_id);
if (real_heater_id >= 0) SERIAL_ECHO(C('E'), real_heater_id);
}
#if ENABLED(ERR_INCLUDE_TEMP)
SERIAL_ECHOLNPGM(STR_DETECTED_TEMP_B, deg, STR_DETECTED_TEMP_E);