Skip to content

Commit

Permalink
Fix PROGMEM access
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 4, 2022
1 parent a04b5fa commit dc5fc9a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Marlin/src/core/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ extern const char NUL_STR[], SP_P_STR[], SP_T_STR[],
X_STR[], Y_STR[], Z_STR[], I_STR[], J_STR[], K_STR[], U_STR[], V_STR[], W_STR[], E_STR[],
X_LBL[], Y_LBL[], Z_LBL[], I_LBL[], J_LBL[], K_LBL[], U_LBL[], V_LBL[], W_LBL[], E_LBL[];

const char* const SP_AXIS_LBL[] PROGMEM = LOGICAL_AXIS_ARRAY(SP_E_LBL, SP_X_LBL, SP_Y_LBL, SP_Z_LBL, SP_I_LBL, SP_J_LBL, SP_K_LBL, SP_U_LBL, SP_V_LBL, SP_W_LBL);
const char* const SP_AXIS_STR[] PROGMEM = LOGICAL_AXIS_ARRAY(SP_E_STR, SP_X_STR, SP_Y_STR, SP_Z_STR, SP_I_STR, SP_J_STR, SP_K_STR, SP_U_STR, SP_V_STR, SP_W_STR);
PGM_P const SP_AXIS_LBL[] PROGMEM = LOGICAL_AXIS_ARRAY(SP_E_LBL, SP_X_LBL, SP_Y_LBL, SP_Z_LBL, SP_I_LBL, SP_J_LBL, SP_K_LBL, SP_U_LBL, SP_V_LBL, SP_W_LBL);
PGM_P const SP_AXIS_STR[] PROGMEM = LOGICAL_AXIS_ARRAY(SP_E_STR, SP_X_STR, SP_Y_STR, SP_Z_STR, SP_I_STR, SP_J_STR, SP_K_STR, SP_U_STR, SP_V_STR, SP_W_STR);

//
// Debugging flags for use by M111
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/core/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void safe_delay(millis_t ms) {
#if ABL_PLANAR
SERIAL_ECHOPGM("ABL Adjustment");
LOOP_NUM_AXES(a) {
SERIAL_ECHOPGM_P(SP_AXIS_STR[a]);
SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&SP_AXIS_STR[a]));
serial_offset(planner.get_axis_position_mm(AxisEnum(a)) - current_position[a]);
}
#else
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/calibrate/M425.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void GcodeSuite::M425() {
SERIAL_ECHOLNPGM(" Correction Amount/Fade-out: F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)");
SERIAL_ECHOPGM(" Backlash Distance (mm): ");
LOOP_NUM_AXES(a) if (axis_can_calibrate(a)) {
SERIAL_ECHOLNPGM_P(SP_AXIS_STR[a], backlash.get_distance_mm((AxisEnum)a));
SERIAL_ECHOLNPGM_P((PGM_P)pgm_read_ptr(&SP_AXIS_STR[a]), backlash.get_distance_mm((AxisEnum)a));
}

#ifdef BACKLASH_SMOOTHING_MM
Expand All @@ -103,7 +103,7 @@ void GcodeSuite::M425() {
SERIAL_ECHOPGM(" Average measured backlash (mm):");
if (backlash.has_any_measurement()) {
LOOP_NUM_AXES(a) if (axis_can_calibrate(a) && backlash.has_measurement(AxisEnum(a))) {
SERIAL_ECHOPGM_P(SP_AXIS_STR[a], backlash.get_measurement((AxisEnum)a));
SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&SP_AXIS_STR[a]), backlash.get_measurement((AxisEnum)a));
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/control/M17_M18_M84.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void try_to_disable(const axis_flags_t to_disable) {

auto overlap_warning = [](const ena_mask_t axis_bits) {
SERIAL_ECHOPGM(" not disabled. Shared with");
LOOP_NUM_AXES(a) if (TEST(axis_bits, a)) SERIAL_ECHOPGM_P(SP_AXIS_STR[a]);
LOOP_NUM_AXES(a) if (TEST(axis_bits, a)) SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&SP_AXIS_STR[a]));
#if HAS_EXTRUDERS
#define _EN_STILLON(N) if (TEST(axis_bits, INDEX_OF_AXIS(E_AXIS, N))) SERIAL_CHAR(' ', 'E', '0' + N);
REPEAT(EXTRUDERS, _EN_STILLON)
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/gcode/host/M114.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
void report_all_axis_pos(const xyze_pos_t &pos, const uint8_t n=LOGICAL_AXES, const uint8_t precision=3) {
char str[12];
LOOP_L_N(a, n) {
SERIAL_ECHOPGM_P(SP_AXIS_LBL[a]);
SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&SP_AXIS_LBL[a]));
if (pos[a] >= 0) SERIAL_CHAR(' ');
SERIAL_ECHO(dtostrf(pos[a], 1, precision, str));
}
Expand All @@ -47,7 +47,7 @@

void report_linear_axis_pos(const xyz_pos_t &pos, const uint8_t precision=3) {
char str[12];
LOOP_NUM_AXES(a) SERIAL_ECHOPGM_P(SP_AXIS_LBL[a], dtostrf(pos[a], 1, precision, str));
LOOP_NUM_AXES(a) SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&SP_AXIS_LBL[a]), dtostrf(pos[a], 1, precision, str));
SERIAL_EOL();
}

Expand Down Expand Up @@ -169,7 +169,7 @@

SERIAL_ECHOPGM("Stepper:");
LOOP_LOGICAL_AXES(i) {
SERIAL_ECHOPGM_P(SP_AXIS_LBL[i], stepper.position((AxisEnum)i));
SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&SP_AXIS_LBL[i]), stepper.position((AxisEnum)i));
}
SERIAL_EOL();

Expand Down

0 comments on commit dc5fc9a

Please sign in to comment.