Skip to content

Commit

Permalink
Merge 'bugfix-2.0.x' into pr/24063
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 21, 2022
2 parents 0a7306d + 6fc2842 commit f530358
Show file tree
Hide file tree
Showing 90 changed files with 557 additions and 871 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:

- name: Install PlatformIO
run: |
pip install -U https://github.com/platformio/platformio-core/archive/v5.2.5.zip
pip install -U https://github.com/platformio/platformio-core/archive/develop.zip
platformio update
- name: Run ${{ matrix.test-platform }} Tests
Expand Down
2 changes: 1 addition & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2005,7 +2005,7 @@
// @section temperature

//
// Preheat Constants - Up to 5 are supported without changes
// Preheat Constants - Up to 6 are supported without changes
//
#define PREHEAT_1_LABEL "PLA"
#define PREHEAT_1_TEMP_HOTEND 180
Expand Down
2 changes: 1 addition & 1 deletion Marlin/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2022-04-12"
//#define STRING_DISTRIBUTION_DATE "2022-04-21"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
Expand Down
16 changes: 4 additions & 12 deletions Marlin/src/core/serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,11 @@ uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE;

// Commonly-used strings in serial output
PGMSTR(NUL_STR, ""); PGMSTR(SP_P_STR, " P"); PGMSTR(SP_T_STR, " T");
PGMSTR(X_STR, "X"); PGMSTR(Y_STR, "Y"); PGMSTR(Z_STR, "Z"); PGMSTR(E_STR, "E");
PGMSTR(U_STR, STR_U); PGMSTR(V_STR, STR_V); PGMSTR(W_STR, STR_W);
PGMSTR(X_LBL, "X:"); PGMSTR(Y_LBL, "Y:"); PGMSTR(Z_LBL, "Z:"); PGMSTR(E_LBL, "E:");
PGMSTR(U_LBL, STR_U ":"); PGMSTR(V_LBL, STR_V ":"); PGMSTR(W_LBL, STR_W ":");
PGMSTR(SP_A_STR, " A"); PGMSTR(SP_B_STR, " B"); PGMSTR(SP_C_STR, " C");
PGMSTR(SP_X_STR, " X"); PGMSTR(SP_Y_STR, " Y"); PGMSTR(SP_Z_STR, " Z"); PGMSTR(SP_E_STR, " E");
PGMSTR(SP_X_LBL, " X:"); PGMSTR(SP_Y_LBL, " Y:"); PGMSTR(SP_Z_LBL, " Z:"); PGMSTR(SP_E_LBL, " E:");
PGMSTR(I_STR, STR_I); PGMSTR(J_STR, STR_J); PGMSTR(K_STR, STR_K);
PGMSTR(I_LBL, STR_I ":"); PGMSTR(J_LBL, STR_J ":"); PGMSTR(K_LBL, STR_K ":");
PGMSTR(SP_I_STR, " " STR_I); PGMSTR(SP_J_STR, " " STR_J); PGMSTR(SP_K_STR, " " STR_K);
PGMSTR(SP_U_STR, " " STR_U); PGMSTR(SP_V_STR, " " STR_V); PGMSTR(SP_W_STR, " " STR_W);
PGMSTR(SP_I_LBL, " " STR_I ":"); PGMSTR(SP_J_LBL, " " STR_J ":"); PGMSTR(SP_K_LBL, " " STR_K ":");
PGMSTR(SP_U_LBL, " " STR_U ":"); PGMSTR(SP_V_LBL, " " STR_V ":"); PGMSTR(SP_W_LBL, " " STR_W ":");
LOGICAL_AXIS_CODE(PGMSTR(SP_E_STR, " E"), PGMSTR(SP_X_STR, " X"), PGMSTR(SP_Y_STR, " Y"), PGMSTR(SP_Z_STR, " Z"), PGMSTR(SP_I_STR, " " STR_I), PGMSTR(SP_J_STR, " " STR_J), PGMSTR(SP_K_STR, " " STR_K), PGMSTR(SP_U_STR, " " STR_U), PGMSTR(SP_V_STR, " " STR_V), PGMSTR(SP_W_STR, " " STR_W));
LOGICAL_AXIS_CODE(PGMSTR(SP_E_LBL, " E:"), PGMSTR(SP_X_LBL, " X:"), PGMSTR(SP_Y_LBL, " Y:"), PGMSTR(SP_Z_LBL, " Z:"), PGMSTR(SP_I_LBL, " " STR_I ":"), PGMSTR(SP_J_LBL, " " STR_J ":"), PGMSTR(SP_K_LBL, " " STR_K ":"), PGMSTR(SP_U_LBL, " " STR_U ":"), PGMSTR(SP_V_LBL, " " STR_V ":"), PGMSTR(SP_W_LBL, " " STR_W ":"));
LOGICAL_AXIS_CODE(PGMSTR(E_STR, "E"), PGMSTR(X_STR, "X"), PGMSTR(Y_STR, "Y"), PGMSTR(Z_STR, "Z"), PGMSTR(I_STR, STR_I), PGMSTR(J_STR, STR_J), PGMSTR(K_STR, STR_K), PGMSTR(U_STR, STR_U), PGMSTR(V_STR, STR_V), PGMSTR(W_STR, STR_W));
LOGICAL_AXIS_CODE(PGMSTR(E_LBL, "E:"), PGMSTR(X_LBL, "X:"), PGMSTR(Y_LBL, "Y:"), PGMSTR(Z_LBL, "Z:"), PGMSTR(I_LBL, STR_I ":"), PGMSTR(J_LBL, STR_J ":"), PGMSTR(K_LBL, STR_K ":"), PGMSTR(U_LBL, STR_U ":"), PGMSTR(V_LBL, STR_V ":"), PGMSTR(W_LBL, STR_W ":"));

// Hook Meatpack if it's enabled on the first leaf
#if ENABLED(MEATPACK_ON_SERIAL_PORT_1)
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/core/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
// Commonly-used strings in serial output
extern const char NUL_STR[], SP_P_STR[], SP_T_STR[],
SP_A_STR[], SP_B_STR[], SP_C_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[], SP_E_STR[],
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[], SP_E_LBL[],
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[];
LOGICAL_AXIS_LIST(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[]),
LOGICAL_AXIS_LIST(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[]),
LOGICAL_AXIS_LIST(E_STR[], X_STR[], Y_STR[], Z_STR[], I_STR[], J_STR[], K_STR[], U_STR[], V_STR[], W_STR[]),
LOGICAL_AXIS_LIST(E_LBL[], X_LBL[], Y_LBL[], Z_LBL[], I_LBL[], J_LBL[], K_LBL[], U_LBL[], V_LBL[], W_LBL[]);

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);
Expand Down
14 changes: 6 additions & 8 deletions Marlin/src/feature/dac/stepper_dac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int StepperDAC::init() {
}

void StepperDAC::set_current_value(const uint8_t channel, uint16_t val) {
if (!dac_present) return;
if (!(dac_present && channel < LOGICAL_AXES)) return;

NOMORE(val, uint16_t(DAC_STEPPER_MAX));

Expand All @@ -85,13 +85,11 @@ void StepperDAC::print_values() {
if (!dac_present) return;
SERIAL_ECHO_MSG("Stepper current values in % (Amps):");
SERIAL_ECHO_START();
SERIAL_ECHOPGM_P(SP_X_LBL, dac_perc(X_AXIS), PSTR(" ("), dac_amps(X_AXIS), PSTR(")"));
#if HAS_Y_AXIS
SERIAL_ECHOPGM_P(SP_Y_LBL, dac_perc(Y_AXIS), PSTR(" ("), dac_amps(Y_AXIS), PSTR(")"));
#endif
#if HAS_Z_AXIS
SERIAL_ECHOPGM_P(SP_Z_LBL, dac_perc(Z_AXIS), PSTR(" ("), dac_amps(Z_AXIS), PSTR(")"));
#endif
LOOP_LOGICAL_AXES(a) {
SERIAL_CHAR(' ', IAXIS_CHAR(a), ':');
SERIAL_ECHO(dac_perc(a));
SERIAL_ECHOPGM_P(PSTR(" ("), dac_amps(AxisEnum(a)), PSTR(")"));
}
#if HAS_EXTRUDERS
SERIAL_ECHOLNPGM_P(SP_E_LBL, dac_perc(E_AXIS), PSTR(" ("), dac_amps(E_AXIS), PSTR(")"));
#endif
Expand Down
11 changes: 8 additions & 3 deletions Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,18 @@ void PrintJobRecovery::changed() {
*
* If a saved state exists send 'M1000 S' to initiate job recovery.
*/
void PrintJobRecovery::check() {
bool PrintJobRecovery::check() {
//if (!card.isMounted()) card.mount();
bool success = false;
if (card.isMounted()) {
load();
if (!valid()) return cancel();
queue.inject(F("M1000S"));
success = valid();
if (!success)
cancel();
else
queue.inject(F("M1000S"));
}
return success;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/powerloss.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ class PrintJobRecovery {
static void open(const bool read) { card.openJobRecoveryFile(read); }
static void close() { file.close(); }

static void check();
static bool check();
static void resume();
static void purge();

static void cancel() { purge(); IF_DISABLED(NO_SD_AUTOSTART, card.autofile_begin()); }
static void cancel() { purge(); }

static void load();
static void save(const bool force=ENABLED(SAVE_EACH_CMD_MODE), const float zraise=POWER_LOSS_ZRAISE, const bool raised=false);
Expand Down
2 changes: 0 additions & 2 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,6 @@ G29_TYPE GcodeSuite::G29() {

bool zig = PR_OUTER_SIZE & 1; // Always end at RIGHT and BACK_PROBE_BED_POSITION

abl.measured_z = 0;

// Outer loop is X with PROBE_Y_FIRST enabled
// Outer loop is Y with PROBE_Y_FIRST disabled
for (PR_OUTER_VAR = 0; PR_OUTER_VAR < PR_OUTER_SIZE && !isnan(abl.measured_z); PR_OUTER_VAR++) {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/calibrate/G34.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void GcodeSuite::G34() {
stepper.set_digipot_current(Z_AXIS, target_current);
#elif HAS_MOTOR_CURRENT_PWM
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
const uint32_t previous_current = stepper.motor_current_setting[Z_AXIS];
const uint32_t previous_current = stepper.motor_current_setting[1]; // Z
stepper.set_digipot_current(1, target_current);
#elif HAS_MOTOR_CURRENT_DAC
const float target_current = parser.floatval('S', GANTRY_CALIBRATION_CURRENT);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/calibrate/M666.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
DEBUG_SECTION(log_M666, "M666", DEBUGGING(LEVELING));
bool is_err = false, is_set = false;
LOOP_NUM_AXES(i) {
if (parser.seen(AXIS_CHAR(i))) {
if (parser.seenval(AXIS_CHAR(i))) {
is_set = true;
const float v = parser.value_linear_units();
if (v > 0)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/config/M281.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ void GcodeSuite::M281() {
return;
}
#endif
if (parser.seen('L')) servo_angles[servo_index][0] = parser.value_int();
if (parser.seen('U')) servo_angles[servo_index][1] = parser.value_int();
if (parser.seenval('L')) servo_angles[servo_index][0] = parser.value_int();
if (parser.seenval('U')) servo_angles[servo_index][1] = parser.value_int();
}
else
SERIAL_ERROR_MSG("Servo ", servo_index, " out of range");
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/gcode/config/M304.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
*/
void GcodeSuite::M304() {
if (!parser.seen("PID")) return M304_report();
if (parser.seen('P')) thermalManager.temp_bed.pid.Kp = parser.value_float();
if (parser.seen('I')) thermalManager.temp_bed.pid.Ki = scalePID_i(parser.value_float());
if (parser.seen('D')) thermalManager.temp_bed.pid.Kd = scalePID_d(parser.value_float());
if (parser.seenval('P')) thermalManager.temp_bed.pid.Kp = parser.value_float();
if (parser.seenval('I')) thermalManager.temp_bed.pid.Ki = scalePID_i(parser.value_float());
if (parser.seenval('D')) thermalManager.temp_bed.pid.Kd = scalePID_d(parser.value_float());
}

void GcodeSuite::M304_report(const bool forReplay/*=true*/) {
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/gcode/config/M305.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ void GcodeSuite::M305() {
if (t_index >= (USER_THERMISTORS) || (do_set && t_index < 0))
SERIAL_ECHO_MSG("!Invalid index. (0 <= P <= ", USER_THERMISTORS - 1, ")");
else if (do_set) {
if (parser.seen('R')) // Pullup resistor value
if (parser.seenval('R')) // Pullup resistor value
if (!thermalManager.set_pull_up_res(t_index, parser.value_float()))
SERIAL_ECHO_MSG("!Invalid series resistance. (0 < R < 1000000)");

if (parser.seen('T')) // Resistance at 25C
if (parser.seenval('T')) // Resistance at 25C
if (!thermalManager.set_res25(t_index, parser.value_float()))
SERIAL_ECHO_MSG("!Invalid 25C resistance. (0 < T < 10000000)");

if (parser.seen('B')) // Beta value
if (parser.seenval('B')) // Beta value
if (!thermalManager.set_beta(t_index, parser.value_float()))
SERIAL_ECHO_MSG("!Invalid beta. (0 < B < 1000000)");

if (parser.seen('C')) // Steinhart-Hart C coefficient
if (parser.seenval('C')) // Steinhart-Hart C coefficient
if (!thermalManager.set_sh_coeff(t_index, parser.value_float()))
SERIAL_ECHO_MSG("!Invalid Steinhart-Hart C coeff. (-0.01 < C < +0.01)");
} // If not setting then report parameters
Expand Down
26 changes: 4 additions & 22 deletions Marlin/src/gcode/control/M17_M18_M84.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,8 @@ void GcodeSuite::M17() {
stepper.enable_e_steppers();
}
#endif
NUM_AXIS_CODE(
if (parser.seen_test('X')) stepper.enable_axis(X_AXIS),
if (parser.seen_test('Y')) stepper.enable_axis(Y_AXIS),
if (parser.seen_test('Z')) stepper.enable_axis(Z_AXIS),
if (parser.seen_test(AXIS4_NAME)) stepper.enable_axis(I_AXIS),
if (parser.seen_test(AXIS5_NAME)) stepper.enable_axis(J_AXIS),
if (parser.seen_test(AXIS6_NAME)) stepper.enable_axis(K_AXIS),
if (parser.seen_test(AXIS7_NAME)) stepper.enable_axis(U_AXIS),
if (parser.seen_test(AXIS8_NAME)) stepper.enable_axis(V_AXIS),
if (parser.seen_test(AXIS9_NAME)) stepper.enable_axis(W_AXIS)
);
LOOP_NUM_AXES(a)
if (parser.seen_test(AXIS_CHAR(a))) stepper.enable_axis((AxisEnum)a);
}
}
else {
Expand Down Expand Up @@ -235,17 +226,8 @@ void GcodeSuite::M18_M84() {
stepper.disable_e_steppers();
}
#endif
NUM_AXIS_CODE(
if (parser.seen_test('X')) stepper.disable_axis(X_AXIS),
if (parser.seen_test('Y')) stepper.disable_axis(Y_AXIS),
if (parser.seen_test('Z')) stepper.disable_axis(Z_AXIS),
if (parser.seen_test(AXIS4_NAME)) stepper.disable_axis(I_AXIS),
if (parser.seen_test(AXIS5_NAME)) stepper.disable_axis(J_AXIS),
if (parser.seen_test(AXIS6_NAME)) stepper.disable_axis(K_AXIS),
if (parser.seen_test(AXIS7_NAME)) stepper.disable_axis(U_AXIS),
if (parser.seen_test(AXIS8_NAME)) stepper.disable_axis(V_AXIS),
if (parser.seen_test(AXIS9_NAME)) stepper.disable_axis(W_AXIS)
);
LOOP_NUM_AXES(a)
if (parser.seen_test(AXIS_CHAR(a))) stepper.disable_axis((AxisEnum)a);
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/control/M280.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void GcodeSuite::M280() {
const int anew = parser.value_int();
if (anew >= 0) {
#if ENABLED(POLARGRAPH)
if (parser.seen('T')) { // (ms) Total duration of servo move
if (parser.seenval('T')) { // (ms) Total duration of servo move
const int16_t t = constrain(parser.value_int(), 0, 10000);
const int aold = servo[servo_index].read();
millis_t now = millis();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/control/M3-M5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void GcodeSuite::M3_M4(const bool is_M4) {
// Laser power in inline mode
cutter.inline_direction(is_M4); // Should always be unused
#if ENABLED(SPINDLE_LASER_USE_PWM)
if (parser.seen('O')) {
if (parser.seenval('O')) {
cutter.unitPower = cutter.power_to_range(parser.value_byte(), 0);
cutter.inline_ocr_power(cutter.unitPower); // The OCR is a value from 0 to 255 (uint8_t)
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/control/M350_M351.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*/
void GcodeSuite::M350() {
if (parser.seen('S')) LOOP_DISTINCT_AXES(i) stepper.microstep_mode(i, parser.value_byte());
LOOP_LOGICAL_AXES(i) if (parser.seen(AXIS_CHAR(i))) stepper.microstep_mode(i, parser.value_byte());
LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_mode(i, parser.value_byte());
TERN_(HAS_M350_B_PARAM, if (parser.seenval('B')) stepper.microstep_mode(E_AXIS + 1, parser.value_byte()));
stepper.microstep_readings();
}
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/gcode/control/M605.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
void GcodeSuite::M605() {
planner.synchronize();

if (parser.seen('S')) {
if (parser.seenval('S')) {
const DualXMode previous_mode = dual_x_carriage_mode;

dual_x_carriage_mode = (DualXMode)parser.value_byte();
Expand All @@ -78,8 +78,8 @@

case DXC_DUPLICATION_MODE:
// Set the X offset, but no less than the safety gap
if (parser.seen('X')) duplicate_extruder_x_offset = _MAX(parser.value_linear_units(), (X2_MIN_POS) - (X1_MIN_POS));
if (parser.seen('R')) duplicate_extruder_temp_offset = parser.value_celsius_diff();
if (parser.seenval('X')) duplicate_extruder_x_offset = _MAX(parser.value_linear_units(), (X2_MIN_POS) - (X1_MIN_POS));
if (parser.seenval('R')) duplicate_extruder_temp_offset = parser.value_celsius_diff();
// Always switch back to tool 0
if (active_extruder != 0) tool_change(0);
break;
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/gcode/feature/cancel/M486.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ void GcodeSuite::M486() {
cancelable.object_count = parser.intval('T', 1);
}

if (parser.seen('S'))
if (parser.seenval('S'))
cancelable.set_active_object(parser.value_int());

if (parser.seen('C')) cancelable.cancel_active_object();

if (parser.seen('P')) cancelable.cancel_object(parser.value_int());
if (parser.seenval('P')) cancelable.cancel_object(parser.value_int());

if (parser.seen('U')) cancelable.uncancel_object(parser.value_int());
if (parser.seenval('U')) cancelable.uncancel_object(parser.value_int());
}

#endif // CANCEL_OBJECTS
Loading

0 comments on commit f530358

Please sign in to comment.