From ceeb6c646b01264ea1443cfe64c010d64ccf719f Mon Sep 17 00:00:00 2001 From: kisslorand <50251547+kisslorand@users.noreply.github.com> Date: Tue, 31 May 2022 20:05:57 +0300 Subject: [PATCH 01/27] Fix axis string 'N' (#24259) Followup to 167672d --- Marlin/src/core/serial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/core/serial.cpp b/Marlin/src/core/serial.cpp index 7d0f6dc23ff92..77beb3eec9b26 100644 --- a/Marlin/src/core/serial.cpp +++ b/Marlin/src/core/serial.cpp @@ -35,7 +35,7 @@ PGMSTR(SP_P_STR, " P"); PGMSTR(SP_T_STR, " T"); PGMSTR(NUL_STR, ""); #define _N_STR(N) PGMSTR(N##_STR, STR_##N); #define _N_LBL(N) PGMSTR(N##_LBL, STR_##N ":"); -#define _SP_N_STR(N) PGMSTR(SP_##N##_STR, STR_##N ":"); +#define _SP_N_STR(N) PGMSTR(SP_##N##_STR, " " STR_##N); #define _SP_N_LBL(N) PGMSTR(SP_##N##_LBL, " " STR_##N ":"); MAP(_N_STR, LOGICAL_AXIS_NAMES); MAP(_SP_N_STR, LOGICAL_AXIS_NAMES); MAP(_N_LBL, LOGICAL_AXIS_NAMES); MAP(_SP_N_LBL, LOGICAL_AXIS_NAMES); From 03b50354cbffac0bffb2eee1bc3c419e4bc54872 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 3 Apr 2022 20:52:27 -0500 Subject: [PATCH 02/27] =?UTF-8?q?=F0=9F=8F=97=EF=B8=8F=20Extend=20AXIS=5FC?= =?UTF-8?q?HAR=20to=20include=20E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: DerAndere <26200979+DerAndere1@users.noreply.github.com> --- Marlin/src/core/utility.h | 3 +- Marlin/src/feature/encoder_i2c.cpp | 44 +++++++++---------- Marlin/src/feature/encoder_i2c.h | 10 ++--- Marlin/src/gcode/config/M92.cpp | 2 +- Marlin/src/gcode/control/M17_M18_M84.cpp | 6 +-- Marlin/src/gcode/control/M350_M351.cpp | 8 ++-- Marlin/src/gcode/feature/L6470/M906.cpp | 4 +- Marlin/src/gcode/feature/trinamic/M122.cpp | 2 +- Marlin/src/gcode/feature/trinamic/M569.cpp | 2 +- Marlin/src/gcode/feature/trinamic/M906.cpp | 2 +- .../src/gcode/feature/trinamic/M911-M914.cpp | 2 +- Marlin/src/gcode/feature/trinamic/M919.cpp | 4 +- Marlin/src/gcode/geometry/G92.cpp | 4 +- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 2 +- Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp | 2 +- Marlin/src/lcd/lcdprint.cpp | 2 +- Marlin/src/lcd/marlinui.cpp | 4 +- Marlin/src/lcd/tft/tft_string.cpp | 2 +- Marlin/src/libs/L64XX/L64XX_Marlin.cpp | 8 ++-- 19 files changed, 56 insertions(+), 57 deletions(-) diff --git a/Marlin/src/core/utility.h b/Marlin/src/core/utility.h index 628b3c7209e82..6cd5efe075dd9 100644 --- a/Marlin/src/core/utility.h +++ b/Marlin/src/core/utility.h @@ -84,8 +84,7 @@ constexpr uint8_t ui8_to_percent(const uint8_t i) { return (int(i) * 100 + 127) // Axis names for G-code parsing, reports, etc. const xyze_char_t axis_codes LOGICAL_AXIS_ARRAY('E', 'X', 'Y', 'Z', AXIS4_NAME, AXIS5_NAME, AXIS6_NAME); - -#if LINEAR_AXES <= XYZ +#if LINEAR_AXES <= XYZ && !HAS_EXTRUDERS #define AXIS_CHAR(A) ((char)('X' + A)) #define IAXIS_CHAR AXIS_CHAR #else diff --git a/Marlin/src/feature/encoder_i2c.cpp b/Marlin/src/feature/encoder_i2c.cpp index fa14c9ac715da..33413c9349319 100644 --- a/Marlin/src/feature/encoder_i2c.cpp +++ b/Marlin/src/feature/encoder_i2c.cpp @@ -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_codes[encoderAxis]), " axis, addr = ", address); + SERIAL_ECHOLNPGM("Setting up encoder on ", AS_CHAR(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_codes[encoderAxis]), " axis encoder. Disengaging error correction until module is trusted again."); + SERIAL_ECHOLNPGM("Fault detected on ", AS_CHAR(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_codes[encoderAxis]), " axis has been fault-free for set duration, reinstating error correction."); + SERIAL_ECHOLNPGM("Untrusted encoder module on ", AS_CHAR(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 @@ -172,7 +172,7 @@ void I2CPositionEncoder::update() { float sumP = 0; LOOP_L_N(i, I2CPE_ERR_PRST_ARRAY_SIZE) sumP += errPrst[i]; const int32_t errorP = int32_t(sumP * RECIPROCAL(I2CPE_ERR_PRST_ARRAY_SIZE)); - SERIAL_CHAR(axis_codes[encoderAxis]); + SERIAL_CHAR(AXIS_CHAR(encoderAxis)); SERIAL_ECHOLNPGM(" : CORRECT ERR ", errorP * planner.mm_per_step[encoderAxis], "mm"); babystep.add_steps(encoderAxis, -LROUND(errorP)); errPrstIdx = 0; @@ -192,7 +192,7 @@ void I2CPositionEncoder::update() { if (ABS(error) > I2CPE_ERR_CNT_THRESH * planner.settings.axis_steps_per_mm[encoderAxis]) { const millis_t ms = millis(); if (ELAPSED(ms, nextErrorCountTime)) { - SERIAL_CHAR(axis_codes[encoderAxis]); + SERIAL_CHAR(AXIS_CHAR(encoderAxis)); SERIAL_ECHOLNPGM(" : LARGE ERR ", error, "; diffSum=", diffSum); errorCount++; nextErrorCountTime = ms + I2CPE_ERR_CNT_DEBOUNCE_MS; @@ -212,7 +212,7 @@ void I2CPositionEncoder::set_homed() { homed = trusted = true; #ifdef I2CPE_DEBUG - SERIAL_CHAR(axis_codes[encoderAxis]); + SERIAL_CHAR(AXIS_CHAR(encoderAxis)); SERIAL_ECHOLNPGM(" axis encoder homed, offset of ", zeroOffset, " ticks."); #endif } @@ -223,7 +223,7 @@ void I2CPositionEncoder::set_unhomed() { homed = trusted = false; #ifdef I2CPE_DEBUG - SERIAL_CHAR(axis_codes[encoderAxis]); + SERIAL_CHAR(AXIS_CHAR(encoderAxis)); SERIAL_ECHOLNPGM(" axis encoder unhomed."); #endif } @@ -231,7 +231,7 @@ void I2CPositionEncoder::set_unhomed() { bool I2CPositionEncoder::passes_test(const bool report) { if (report) { if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM("Warning. "); - SERIAL_CHAR(axis_codes[encoderAxis]); + SERIAL_CHAR(AXIS_CHAR(encoderAxis)); serial_ternary(H == I2CPE_MAG_SIG_BAD, F(" axis "), F("magnetic strip "), F("encoder ")); switch (H) { case I2CPE_MAG_SIG_GOOD: @@ -252,7 +252,7 @@ float I2CPositionEncoder::get_axis_error_mm(const bool report) { error = ABS(diff) > 10000 ? 0 : diff; // Huge error is a bad reading if (report) { - SERIAL_CHAR(axis_codes[encoderAxis]); + SERIAL_CHAR(AXIS_CHAR(encoderAxis)); SERIAL_ECHOLNPGM(" axis target=", target, "mm; actual=", actual, "mm; err=", error, "mm"); } @@ -262,7 +262,7 @@ float I2CPositionEncoder::get_axis_error_mm(const bool report) { int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) { if (!active) { if (report) { - SERIAL_CHAR(axis_codes[encoderAxis]); + SERIAL_CHAR(AXIS_CHAR(encoderAxis)); SERIAL_ECHOLNPGM(" axis encoder not active!"); } return 0; @@ -287,7 +287,7 @@ int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) { errorPrev = error; if (report) { - SERIAL_CHAR(axis_codes[encoderAxis]); + SERIAL_CHAR(AXIS_CHAR(encoderAxis)); SERIAL_ECHOLNPGM(" axis target=", target, "; actual=", encoderCountInStepperTicksScaled, "; err=", error); } @@ -657,7 +657,7 @@ void I2CPositionEncodersMgr::report_position(const int8_t idx, const bool units, else { if (noOffset) { const int32_t raw_count = encoders[idx].get_raw_count(); - SERIAL_CHAR(axis_codes[encoders[idx].get_axis()], ' '); + SERIAL_CHAR(AXIS_CHAR(encoders[idx).get_axis()], ' '); for (uint8_t j = 31; j > 0; j--) SERIAL_ECHO((bool)(0x00000001 & (raw_count >> j))); @@ -712,7 +712,7 @@ void I2CPositionEncodersMgr::change_module_address(const uint8_t oldaddr, const // and enable it (it will likely have failed initialization on power-up, before the address change). const int8_t idx = idx_from_addr(newaddr); if (idx >= 0 && !encoders[idx].get_active()) { - SERIAL_CHAR(axis_codes[encoders[idx].get_axis()]); + SERIAL_CHAR(AXIS_CHAR(encoders[idx).get_axis()]); SERIAL_ECHOLNPGM(" axis encoder was not detected on printer startup. Trying again."); encoders[idx].set_active(encoders[idx].passes_test(true)); } @@ -814,7 +814,7 @@ void I2CPositionEncodersMgr::M860() { if (I2CPE_idx == 0xFF) { LOOP_LOGICAL_AXES(i) { - if (!I2CPE_anyaxis || parser.seen_test(axis_codes[i])) { + if (!I2CPE_anyaxis || parser.seen_test(AXIS_CHAR(i))) { const uint8_t idx = idx_from_axis(AxisEnum(i)); if ((int8_t)idx >= 0) report_position(idx, hasU, hasO); } @@ -841,7 +841,7 @@ void I2CPositionEncodersMgr::M861() { if (I2CPE_idx == 0xFF) { LOOP_LOGICAL_AXES(i) { - if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) { + if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) { const uint8_t idx = idx_from_axis(AxisEnum(i)); if ((int8_t)idx >= 0) report_status(idx); } @@ -869,7 +869,7 @@ void I2CPositionEncodersMgr::M862() { if (I2CPE_idx == 0xFF) { LOOP_LOGICAL_AXES(i) { - if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) { + if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) { const uint8_t idx = idx_from_axis(AxisEnum(i)); if ((int8_t)idx >= 0) test_axis(idx); } @@ -900,7 +900,7 @@ void I2CPositionEncodersMgr::M863() { if (I2CPE_idx == 0xFF) { LOOP_LOGICAL_AXES(i) { - if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) { + if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) { const uint8_t idx = idx_from_axis(AxisEnum(i)); if ((int8_t)idx >= 0) calibrate_steps_mm(idx, iterations); } @@ -976,7 +976,7 @@ void I2CPositionEncodersMgr::M865() { if (!I2CPE_addr) { LOOP_LOGICAL_AXES(i) { - if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) { + if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) { const uint8_t idx = idx_from_axis(AxisEnum(i)); if ((int8_t)idx >= 0) report_module_firmware(encoders[idx].get_address()); } @@ -1007,7 +1007,7 @@ void I2CPositionEncodersMgr::M866() { if (I2CPE_idx == 0xFF) { LOOP_LOGICAL_AXES(i) { - if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) { + if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) { const uint8_t idx = idx_from_axis(AxisEnum(i)); if ((int8_t)idx >= 0) { if (hasR) @@ -1045,7 +1045,7 @@ void I2CPositionEncodersMgr::M867() { if (I2CPE_idx == 0xFF) { LOOP_LOGICAL_AXES(i) { - if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) { + if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) { const uint8_t idx = idx_from_axis(AxisEnum(i)); if ((int8_t)idx >= 0) { const bool ena = onoff == -1 ? !encoders[I2CPE_idx].get_ec_enabled() : !!onoff; @@ -1081,7 +1081,7 @@ void I2CPositionEncodersMgr::M868() { if (I2CPE_idx == 0xFF) { LOOP_LOGICAL_AXES(i) { - if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) { + if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) { const uint8_t idx = idx_from_axis(AxisEnum(i)); if ((int8_t)idx >= 0) { if (newThreshold != -9999) @@ -1115,7 +1115,7 @@ void I2CPositionEncodersMgr::M869() { if (I2CPE_idx == 0xFF) { LOOP_LOGICAL_AXES(i) { - if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) { + if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) { const uint8_t idx = idx_from_axis(AxisEnum(i)); if ((int8_t)idx >= 0) report_error(idx); } diff --git a/Marlin/src/feature/encoder_i2c.h b/Marlin/src/feature/encoder_i2c.h index 50fb27a135cae..f25fe2ea6bc4d 100644 --- a/Marlin/src/feature/encoder_i2c.h +++ b/Marlin/src/feature/encoder_i2c.h @@ -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_codes[axis]), " axis is ", encoders[idx].get_error_count()); + SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(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_codes[axis]), " axis has been reset."); + SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(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_codes[axis])); + SERIAL_ECHOPGM("Error correction on ", AS_CHAR(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_codes[axis]), " axis set to ", newThreshold, "mm."); + SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(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_codes[axis]), " axis is ", threshold, "mm."); + SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(AXIS_CHAR(axis)), " axis is ", threshold, "mm."); } static int8_t idx_from_axis(const AxisEnum axis) { diff --git a/Marlin/src/gcode/config/M92.cpp b/Marlin/src/gcode/config/M92.cpp index 8f527919fd835..7b5336201566f 100644 --- a/Marlin/src/gcode/config/M92.cpp +++ b/Marlin/src/gcode/config/M92.cpp @@ -47,7 +47,7 @@ void GcodeSuite::M92() { return M92_report(true, target_extruder); LOOP_LOGICAL_AXES(i) { - if (parser.seenval(axis_codes[i])) { + if (parser.seenval(AXIS_CHAR(i))) { if (TERN1(HAS_EXTRUDERS, i != E_AXIS)) planner.settings.axis_steps_per_mm[i] = parser.value_per_axis_units((AxisEnum)i); else { diff --git a/Marlin/src/gcode/control/M17_M18_M84.cpp b/Marlin/src/gcode/control/M17_M18_M84.cpp index 9e24a38e7dfe9..2ec350148c3ca 100644 --- a/Marlin/src/gcode/control/M17_M18_M84.cpp +++ b/Marlin/src/gcode/control/M17_M18_M84.cpp @@ -74,7 +74,7 @@ void do_enable(const stepper_flags_t to_enable) { LOOP_LINEAR_AXES(a) { if (TEST(shall_enable, a)) { stepper.enable_axis(AxisEnum(a)); // Mark and enable the requested axis - DEBUG_ECHOLNPGM("Enabled ", axis_codes[a], " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... Enabled: ", hex_word(stepper.axis_enabled.bits)); + DEBUG_ECHOLNPGM("Enabled ", AXIS_CHAR(a), " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... Enabled: ", hex_word(stepper.axis_enabled.bits)); also_enabled |= enable_overlap[a]; } } @@ -147,7 +147,7 @@ void try_to_disable(const stepper_flags_t to_disable) { // Attempt to disable all flagged axes LOOP_LINEAR_AXES(a) if (TEST(to_disable.bits, a)) { - DEBUG_ECHOPGM("Try to disable ", axis_codes[a], " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... "); + DEBUG_ECHOPGM("Try to disable ", AXIS_CHAR(a), " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... "); if (stepper.disable_axis(AxisEnum(a))) { // Mark the requested axis and request to disable DEBUG_ECHOPGM("OK"); still_enabled &= ~(_BV(a) | enable_overlap[a]); // If actually disabled, clear one or more tracked bits @@ -185,7 +185,7 @@ void try_to_disable(const stepper_flags_t to_disable) { // If any of the requested axes are still enabled, give a warning LOOP_LINEAR_AXES(a) { if (TEST(still_enabled, a)) { - SERIAL_CHAR(axis_codes[a]); + SERIAL_CHAR(AXIS_CHAR(a)); overlap_warning(stepper.axis_enabled.bits & enable_overlap[a]); } } diff --git a/Marlin/src/gcode/control/M350_M351.cpp b/Marlin/src/gcode/control/M350_M351.cpp index d0ab75bb00a59..e78d95af98ad4 100644 --- a/Marlin/src/gcode/control/M350_M351.cpp +++ b/Marlin/src/gcode/control/M350_M351.cpp @@ -40,21 +40,21 @@ void GcodeSuite::M350() { } /** - * M351: Toggle MS1 MS2 pins directly with axis codes X Y Z E B + * M351: Toggle MS1 MS2 pins directly with axis codes X Y Z . . . E [B] * S# determines MS1, MS2 or MS3, X# sets the pin high/low. */ void GcodeSuite::M351() { if (parser.seenval('S')) switch (parser.value_byte()) { case 1: - LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1, -1); + LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_ms(i, parser.value_byte(), -1, -1); if (parser.seenval('B')) stepper.microstep_ms(4, parser.value_byte(), -1, -1); break; case 2: - LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, parser.value_byte(), -1); + LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_ms(i, -1, parser.value_byte(), -1); if (parser.seenval('B')) stepper.microstep_ms(4, -1, parser.value_byte(), -1); break; case 3: - LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, -1, parser.value_byte()); + LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_ms(i, -1, -1, parser.value_byte()); if (parser.seenval('B')) stepper.microstep_ms(4, -1, -1, parser.value_byte()); break; } diff --git a/Marlin/src/gcode/feature/L6470/M906.cpp b/Marlin/src/gcode/feature/L6470/M906.cpp index f55405b798ad3..a745b5117ac77 100644 --- a/Marlin/src/gcode/feature/L6470/M906.cpp +++ b/Marlin/src/gcode/feature/L6470/M906.cpp @@ -211,7 +211,7 @@ void L64XX_report_current(L64XX &motor, const L64XX_axis_t axis) { * 1 - monitor only X2, Y2, Z2 * 2 - monitor only Z3 * 3 - monitor only Z4 - * Xxxx, Yxxx, Zxxx, Exxx - axis to change (optional) + * Xxxx, Yxxx, Zxxx, Axxx, Bxxx, Cxxx, Exxx - axis to change (optional) * L6474 - current in mA (4A max) * All others - 0-255 * @@ -236,7 +236,7 @@ void GcodeSuite::M906() { constexpr int8_t index = -1; #endif - LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(axis_codes[i])) { + LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(AXIS_CHAR(i))) { report_current = false; diff --git a/Marlin/src/gcode/feature/trinamic/M122.cpp b/Marlin/src/gcode/feature/trinamic/M122.cpp index 520d41c0f9c7d..07fe9e5bd82d0 100644 --- a/Marlin/src/gcode/feature/trinamic/M122.cpp +++ b/Marlin/src/gcode/feature/trinamic/M122.cpp @@ -35,7 +35,7 @@ void GcodeSuite::M122() { xyze_bool_t print_axis = ARRAY_N_1(LOGICAL_AXES, false); bool print_all = true; - LOOP_LOGICAL_AXES(i) if (parser.seen_test(axis_codes[i])) { print_axis[i] = true; print_all = false; } + LOOP_LOGICAL_AXES(i) if (parser.seen_test(AXIS_CHAR(i))) { print_axis[i] = true; print_all = false; } if (print_all) LOOP_LOGICAL_AXES(i) print_axis[i] = true; diff --git a/Marlin/src/gcode/feature/trinamic/M569.cpp b/Marlin/src/gcode/feature/trinamic/M569.cpp index c0293080eaa91..ca8e596062c2d 100644 --- a/Marlin/src/gcode/feature/trinamic/M569.cpp +++ b/Marlin/src/gcode/feature/trinamic/M569.cpp @@ -53,7 +53,7 @@ static void set_stealth_status(const bool enable, const int8_t eindex) { constexpr int8_t index = -1; #endif - LOOP_LOGICAL_AXES(i) if (parser.seen(axis_codes[i])) { + LOOP_LOGICAL_AXES(i) if (parser.seen(AXIS_CHAR(i))) { switch (i) { case X_AXIS: TERN_(X_HAS_STEALTHCHOP, if (index < 0 || index == 0) TMC_SET_STEALTH(X)); diff --git a/Marlin/src/gcode/feature/trinamic/M906.cpp b/Marlin/src/gcode/feature/trinamic/M906.cpp index c85d0be8a19a7..2ebe4e22d2151 100644 --- a/Marlin/src/gcode/feature/trinamic/M906.cpp +++ b/Marlin/src/gcode/feature/trinamic/M906.cpp @@ -63,7 +63,7 @@ void GcodeSuite::M906() { constexpr int8_t index = -1; #endif - LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(axis_codes[i])) { + LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(AXIS_CHAR(i))) { report = false; switch (i) { #if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2) diff --git a/Marlin/src/gcode/feature/trinamic/M911-M914.cpp b/Marlin/src/gcode/feature/trinamic/M911-M914.cpp index ece733cb67b4e..f75b28097184a 100644 --- a/Marlin/src/gcode/feature/trinamic/M911-M914.cpp +++ b/Marlin/src/gcode/feature/trinamic/M911-M914.cpp @@ -261,7 +261,7 @@ #elif AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z) constexpr uint8_t index = 0; #endif - LOOP_LOGICAL_AXES(i) if (int32_t value = parser.longval(axis_codes[i])) { + LOOP_LOGICAL_AXES(i) if (int32_t value = parser.longval(AXIS_CHAR(i))) { report = false; switch (i) { #if X_HAS_STEALTHCHOP || X2_HAS_STEALTHCHOP diff --git a/Marlin/src/gcode/feature/trinamic/M919.cpp b/Marlin/src/gcode/feature/trinamic/M919.cpp index d4ba4f74eaa1b..6f3dcf729ae97 100644 --- a/Marlin/src/gcode/feature/trinamic/M919.cpp +++ b/Marlin/src/gcode/feature/trinamic/M919.cpp @@ -112,13 +112,13 @@ void GcodeSuite::M919() { int8_t eindex = -1; #endif bool report = true; - LOOP_LOGICAL_AXES(i) if (parser.seen_test(axis_codes[i])) { + LOOP_LOGICAL_AXES(i) if (parser.seen_test(AXIS_CHAR(i))) { report = false; // 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_codes[i]), " has no TMC drivers."); + SERIAL_ECHOLNPGM("?Axis ", AS_CHAR(AXIS_CHAR(i)), " has no TMC drivers."); break; #if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2) diff --git a/Marlin/src/gcode/geometry/G92.cpp b/Marlin/src/gcode/geometry/G92.cpp index 6ff69491ec5b7..f961837e1584a 100644 --- a/Marlin/src/gcode/geometry/G92.cpp +++ b/Marlin/src/gcode/geometry/G92.cpp @@ -73,7 +73,7 @@ void GcodeSuite::G92() { #if ENABLED(POWER_LOSS_RECOVERY) case 9: // G92.9 - Set Current Position directly (like Marlin 1.0) LOOP_LOGICAL_AXES(i) { - if (parser.seenval(axis_codes[i])) { + if (parser.seenval(AXIS_CHAR(i))) { if (TERN1(HAS_EXTRUDERS, i != E_AXIS)) sync_XYZE = true; else { @@ -87,7 +87,7 @@ void GcodeSuite::G92() { case 0: LOOP_LOGICAL_AXES(i) { - if (parser.seenval(axis_codes[i])) { + if (parser.seenval(AXIS_CHAR(i))) { const float l = parser.value_axis_units((AxisEnum)i), // Given axis coordinate value, converted to millimeters v = TERN0(HAS_EXTRUDERS, i == E_AXIS) ? l : LOGICAL_TO_NATIVE(l, i), // Axis position in NATIVE space (applying the existing offset) d = v - current_position[i]; // How much is the current axis position altered by? diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index edeca52f36eb5..67039d52de7b5 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -432,7 +432,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const const bool is_inch = parser.using_inch_units(); const AxisEnum a = TERN(LCD_SHOW_E_TOTAL, axis == E_AXIS ? X_AXIS : axis, axis); const uint8_t offs = a * (is_inch ? XYZ_SPACING_IN : XYZ_SPACING); - lcd_put_lchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, axis_codes[axis]); + lcd_put_lchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, AXIS_CHAR(axis)); lcd_moveto((is_inch ? X_VALUE_POS_IN : X_VALUE_POS) + offs, XYZ_BASELINE); if (blink) diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp b/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp index 24c43bc513ecc..38a8eafe2366e 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp @@ -72,7 +72,7 @@ void DWIN_String::add(const char *tpl, const int8_t index, const char *cstr/*=nu else if (ch == '$' && cstr) add(cstr); else if (ch == '@') - add_character(axis_codes[index]); + add_character(AXIS_CHAR(index)); else add_character(ch); } diff --git a/Marlin/src/lcd/lcdprint.cpp b/Marlin/src/lcd/lcdprint.cpp index 064b1c4d9888b..7757379ac9d21 100644 --- a/Marlin/src/lcd/lcdprint.cpp +++ b/Marlin/src/lcd/lcdprint.cpp @@ -78,7 +78,7 @@ lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char *cstr/ n -= lcd_put_u8str_max(cstr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH); } else if (wc == '@') { - lcd_put_lchar(axis_codes[ind]); + lcd_put_lchar(AXIS_CHAR(ind)); n--; } else { diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 2a3e2bb14d1fa..741cd4ee299e4 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -841,7 +841,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_codes[axis]), " at FR ", fr_mm_s); + //SERIAL_ECHOLNPGM("Add planner.move with Axis ", AS_CHAR(AXIS_CHAR(axis)), " at FR ", fr_mm_s); axis = NO_AXIS_ENUM; @@ -858,7 +858,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_codes[axis]), " soon."); + //SERIAL_ECHOLNPGM("Post Move with Axis ", AS_CHAR(AXIS_CHAR(axis)), " soon."); } #if ENABLED(AUTO_BED_LEVELING_UBL) diff --git a/Marlin/src/lcd/tft/tft_string.cpp b/Marlin/src/lcd/tft/tft_string.cpp index 0b85f1809242b..d589b0465b7f9 100644 --- a/Marlin/src/lcd/tft/tft_string.cpp +++ b/Marlin/src/lcd/tft/tft_string.cpp @@ -116,7 +116,7 @@ void TFT_String::add(const char *tpl, const int8_t index, const char *cstr/*=nul else if (ch == '$' && cstr) add(cstr); else if (ch == '@') - add_character(axis_codes[index]); + add_character(AXIS_CHAR(index)); else add_character(ch); } diff --git a/Marlin/src/libs/L64XX/L64XX_Marlin.cpp b/Marlin/src/libs/L64XX/L64XX_Marlin.cpp index a9bb67811567e..cf871b1959072 100644 --- a/Marlin/src/libs/L64XX/L64XX_Marlin.cpp +++ b/Marlin/src/libs/L64XX/L64XX_Marlin.cpp @@ -412,11 +412,11 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in } uint8_t found_displacement = false; - LOOP_LOGICAL_AXES(i) if (uint16_t _displacement = parser.intval(axis_codes[i])) { + LOOP_LOGICAL_AXES(i) if (uint16_t _displacement = parser.intval(AXIS_CHAR(i))) { found_displacement = true; displacement = _displacement; - uint8_t axis_offset = parser.byteval('J'); - axis_mon[0][0] = axis_codes[i]; // Axis first character, one of XYZE + const uint8_t axis_offset = parser.byteval('J'); + axis_mon[0][0] = AXIS_CHAR(i); // Axis first character, one of XYZ...E const bool single_or_e = axis_offset >= 2 || axis_mon[0][0] == 'E', one_or_more = !single_or_e && axis_offset == 0; uint8_t driver_count_local = 0; // Can't use "driver_count" directly as a subscript because it's passed by reference @@ -667,7 +667,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in static constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE; const uint8_t num_feedrates = COUNT(default_max_feedrate); for (j = 0; j < num_feedrates; j++) { - if (axis_codes[j] == axis_mon[0][0]) { + if (AXIS_CHAR(j) == axis_mon[0][0]) { final_feedrate = default_max_feedrate[j]; break; } From 38391eb116aba4540b80b2be048b074d78d3e9c3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 18 Jul 2022 19:52:47 -0500 Subject: [PATCH 03/27] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20manual=20move=20titl?= =?UTF-8?q?es=20(#24518)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_an.h | 1 + Marlin/src/lcd/language/language_bg.h | 1 + Marlin/src/lcd/language/language_ca.h | 1 + Marlin/src/lcd/language/language_cz.h | 1 + Marlin/src/lcd/language/language_da.h | 3 +++ Marlin/src/lcd/language/language_el.h | 1 + Marlin/src/lcd/language/language_el_gr.h | 1 + Marlin/src/lcd/language/language_es.h | 1 + Marlin/src/lcd/language/language_eu.h | 1 + Marlin/src/lcd/language/language_fi.h | 1 + Marlin/src/lcd/language/language_gl.h | 1 + Marlin/src/lcd/language/language_hr.h | 4 ++++ Marlin/src/lcd/language/language_jp_kana.h | 2 ++ Marlin/src/lcd/language/language_nl.h | 1 + Marlin/src/lcd/language/language_pl.h | 1 + Marlin/src/lcd/language/language_pt.h | 1 + Marlin/src/lcd/language/language_pt_br.h | 1 + Marlin/src/lcd/language/language_ro.h | 1 + Marlin/src/lcd/language/language_sv.h | 1 + Marlin/src/lcd/language/language_tr.h | 1 + Marlin/src/lcd/language/language_vi.h | 1 + Marlin/src/lcd/language/language_zh_CN.h | 1 + Marlin/src/lcd/language/language_zh_TW.h | 1 + Marlin/src/lcd/marlinui.h | 2 ++ Marlin/src/lcd/menu/menu.cpp | 2 +- Marlin/src/lcd/menu/menu.h | 2 -- Marlin/src/lcd/menu/menu_delta_calibrate.cpp | 2 +- Marlin/src/lcd/menu/menu_item.h | 2 -- Marlin/src/lcd/menu/menu_motion.cpp | 6 ++---- 29 files changed, 35 insertions(+), 10 deletions(-) diff --git a/Marlin/src/lcd/language/language_an.h b/Marlin/src/lcd/language/language_an.h index 98f3d4ed97e1f..37c90c34daf93 100644 --- a/Marlin/src/lcd/language/language_an.h +++ b/Marlin/src/lcd/language/language_an.h @@ -83,6 +83,7 @@ namespace Language_an { LSTR MSG_MOVE_X = _UxGT("Mover X"); LSTR MSG_MOVE_Y = _UxGT("Mover Y"); LSTR MSG_MOVE_Z = _UxGT("Mover Z"); + LSTR MSG_MOVE_N = _UxGT("Mover @"); LSTR MSG_MOVE_E = _UxGT("Extrusor"); LSTR MSG_MOVE_EN = _UxGT("Extrusor *"); LSTR MSG_MOVE_N_MM = _UxGT("Mover $mm"); diff --git a/Marlin/src/lcd/language/language_bg.h b/Marlin/src/lcd/language/language_bg.h index 2596d62564e64..038df3eccbb67 100644 --- a/Marlin/src/lcd/language/language_bg.h +++ b/Marlin/src/lcd/language/language_bg.h @@ -72,6 +72,7 @@ namespace Language_bg { LSTR MSG_MOVE_X = _UxGT("Движение по X"); LSTR MSG_MOVE_Y = _UxGT("Движение по Y"); LSTR MSG_MOVE_Z = _UxGT("Движение по Z"); + LSTR MSG_MOVE_N = _UxGT("Движение по @"); LSTR MSG_MOVE_E = _UxGT("Екструдер"); LSTR MSG_MOVE_EN = _UxGT("Екструдер *"); LSTR MSG_MOVE_N_MM = _UxGT("Премести с $mm"); diff --git a/Marlin/src/lcd/language/language_ca.h b/Marlin/src/lcd/language/language_ca.h index fd46bcc28fc01..54b968ede2412 100644 --- a/Marlin/src/lcd/language/language_ca.h +++ b/Marlin/src/lcd/language/language_ca.h @@ -83,6 +83,7 @@ namespace Language_ca { LSTR MSG_MOVE_X = _UxGT("Mou X"); LSTR MSG_MOVE_Y = _UxGT("Mou Y"); LSTR MSG_MOVE_Z = _UxGT("Mou Z"); + LSTR MSG_MOVE_N = _UxGT("Mou @"); LSTR MSG_MOVE_E = _UxGT("Extrusor"); LSTR MSG_MOVE_EN = _UxGT("Extrusor *"); LSTR MSG_MOVE_N_MM = _UxGT("Mou $mm"); diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index 555fec1d20a2e..9c5bafc96ec56 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -232,6 +232,7 @@ namespace Language_cz { LSTR MSG_MOVE_X = _UxGT("Posunout X"); LSTR MSG_MOVE_Y = _UxGT("Posunout Y"); LSTR MSG_MOVE_Z = _UxGT("Posunout Z"); + LSTR MSG_MOVE_N = _UxGT("Posunout @"); LSTR MSG_MOVE_E = _UxGT("Extrudér"); LSTR MSG_MOVE_EN = _UxGT("Extrudér *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Hotend je studený"); diff --git a/Marlin/src/lcd/language/language_da.h b/Marlin/src/lcd/language/language_da.h index 05474744d0ac9..b4afca9d99a88 100644 --- a/Marlin/src/lcd/language/language_da.h +++ b/Marlin/src/lcd/language/language_da.h @@ -74,6 +74,9 @@ namespace Language_da { LSTR MSG_MOVE_X = _UxGT("Flyt X"); LSTR MSG_MOVE_Y = _UxGT("Flyt Y"); LSTR MSG_MOVE_Z = _UxGT("Flyt Z"); + LSTR MSG_MOVE_N = _UxGT("Flyt @"); + LSTR MSG_MOVE_E = _UxGT("Flyt E"); + LSTR MSG_MOVE_EN = _UxGT("Flyt *"); LSTR MSG_MOVE_N_MM = _UxGT("Flyt $mm"); LSTR MSG_MOVE_01MM = _UxGT("Flyt 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Flyt 1mm"); diff --git a/Marlin/src/lcd/language/language_el.h b/Marlin/src/lcd/language/language_el.h index 47d6a5b2da35b..41b73ddc571de 100644 --- a/Marlin/src/lcd/language/language_el.h +++ b/Marlin/src/lcd/language/language_el.h @@ -92,6 +92,7 @@ namespace Language_el { LSTR MSG_MOVE_X = _UxGT("Μετακίνηση X"); LSTR MSG_MOVE_Y = _UxGT("Μετακίνηση Y"); LSTR MSG_MOVE_Z = _UxGT("Μετακίνηση Z"); + LSTR MSG_MOVE_N = _UxGT("Μετακίνηση @"); LSTR MSG_MOVE_E = _UxGT("Εξωθητής"); LSTR MSG_MOVE_EN = _UxGT("Εξωθητής *"); LSTR MSG_MOVE_N_MM = _UxGT("Μετακίνηση %s μμ"); diff --git a/Marlin/src/lcd/language/language_el_gr.h b/Marlin/src/lcd/language/language_el_gr.h index bd2e7d595d9a2..7306aab1235a8 100644 --- a/Marlin/src/lcd/language/language_el_gr.h +++ b/Marlin/src/lcd/language/language_el_gr.h @@ -81,6 +81,7 @@ namespace Language_el_gr { LSTR MSG_MOVE_X = _UxGT("Μετακίνηση X"); LSTR MSG_MOVE_Y = _UxGT("Μετακίνηση Y"); LSTR MSG_MOVE_Z = _UxGT("Μετακίνηση Z"); + LSTR MSG_MOVE_N = _UxGT("Μετακίνηση @"); LSTR MSG_MOVE_E = _UxGT("Εξωθητήρας"); LSTR MSG_MOVE_EN = _UxGT("Εξωθητήρας *"); LSTR MSG_MOVE_N_MM = _UxGT("Μετακίνηση %s μμ"); diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index 9cb86c5c32468..5f88f8426d112 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -226,6 +226,7 @@ namespace Language_es { LSTR MSG_MOVE_X = _UxGT("Mover X"); LSTR MSG_MOVE_Y = _UxGT("Mover Y"); LSTR MSG_MOVE_Z = _UxGT("Mover Z"); + LSTR MSG_MOVE_N = _UxGT("Mover @"); LSTR MSG_MOVE_E = _UxGT("Extrusor"); LSTR MSG_MOVE_EN = _UxGT("Extrusor *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Hotend muy frio"); diff --git a/Marlin/src/lcd/language/language_eu.h b/Marlin/src/lcd/language/language_eu.h index 5504d4da942ea..210fdbdc168ef 100644 --- a/Marlin/src/lcd/language/language_eu.h +++ b/Marlin/src/lcd/language/language_eu.h @@ -136,6 +136,7 @@ namespace Language_eu { LSTR MSG_MOVE_X = _UxGT("Mugitu X"); LSTR MSG_MOVE_Y = _UxGT("Mugitu Y"); LSTR MSG_MOVE_Z = _UxGT("Mugitu Z"); + LSTR MSG_MOVE_N = _UxGT("Mugitu @"); LSTR MSG_MOVE_E = _UxGT("Estrusorea"); LSTR MSG_MOVE_EN = _UxGT("Estrusorea *"); LSTR MSG_MOVE_N_MM = _UxGT("Mugitu $mm"); diff --git a/Marlin/src/lcd/language/language_fi.h b/Marlin/src/lcd/language/language_fi.h index 8fd53a79e36dd..ff1c23eee7e6f 100644 --- a/Marlin/src/lcd/language/language_fi.h +++ b/Marlin/src/lcd/language/language_fi.h @@ -69,6 +69,7 @@ namespace Language_fi { LSTR MSG_MOVE_X = _UxGT("Liikuta X"); LSTR MSG_MOVE_Y = _UxGT("Liikuta Y"); LSTR MSG_MOVE_Z = _UxGT("Liikuta Z"); + LSTR MSG_MOVE_N = _UxGT("Liikuta @"); LSTR MSG_MOVE_E = _UxGT("Extruder"); LSTR MSG_MOVE_EN = _UxGT("Extruder *"); LSTR MSG_MOVE_N_MM = _UxGT("Liikuta $mm"); diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 827130de6c46a..9ae64f0809254 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -223,6 +223,7 @@ namespace Language_gl { LSTR MSG_MOVE_X = _UxGT("Mover X"); LSTR MSG_MOVE_Y = _UxGT("Mover Y"); LSTR MSG_MOVE_Z = _UxGT("Mover Z"); + LSTR MSG_MOVE_N = _UxGT("Mover @"); LSTR MSG_MOVE_E = _UxGT("Extrusor"); LSTR MSG_MOVE_EN = _UxGT("Extrusor *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Bico moi frío"); diff --git a/Marlin/src/lcd/language/language_hr.h b/Marlin/src/lcd/language/language_hr.h index 10f11f616f5f8..08ff6cc38c6f3 100644 --- a/Marlin/src/lcd/language/language_hr.h +++ b/Marlin/src/lcd/language/language_hr.h @@ -78,6 +78,10 @@ namespace Language_hr { LSTR MSG_LEVEL_BED = _UxGT("Niveliraj bed"); LSTR MSG_MOVE_X = _UxGT("Miči X"); LSTR MSG_MOVE_Y = _UxGT("Miči Y"); + LSTR MSG_MOVE_Z = _UxGT("Miči Z"); + LSTR MSG_MOVE_N = _UxGT("Miči @"); + LSTR MSG_MOVE_E = _UxGT("Miči E"); + LSTR MSG_MOVE_EN = _UxGT("Miči *"); LSTR MSG_MOVE_N_MM = _UxGT("Miči $mm"); LSTR MSG_MOVE_01MM = _UxGT("Miči 0.1mm"); LSTR MSG_MOVE_1MM = _UxGT("Miči 1mm"); diff --git a/Marlin/src/lcd/language/language_jp_kana.h b/Marlin/src/lcd/language/language_jp_kana.h index 0a53ee50d21f4..bc8c9ba40ecb4 100644 --- a/Marlin/src/lcd/language/language_jp_kana.h +++ b/Marlin/src/lcd/language/language_jp_kana.h @@ -92,7 +92,9 @@ namespace Language_jp_kana { LSTR MSG_MOVE_X = _UxGT("Xジク イドウ"); // "Move X" LSTR MSG_MOVE_Y = _UxGT("Yジク イドウ"); // "Move Y" LSTR MSG_MOVE_Z = _UxGT("Zジク イドウ"); // "Move Z" + LSTR MSG_MOVE_N = _UxGT("@ジク イドウ"); // "Move @" LSTR MSG_MOVE_E = _UxGT("エクストルーダー"); // "Extruder" + LSTR MSG_MOVE_EN = _UxGT("* エクストルーダー"); // "En" LSTR MSG_MOVE_N_MM = _UxGT("$mm イドウ"); // "Move 0.025mm" LSTR MSG_MOVE_01MM = _UxGT("0.1mm イドウ"); // "Move 0.1mm" LSTR MSG_MOVE_1MM = _UxGT(" 1mm イドウ"); // "Move 1mm" diff --git a/Marlin/src/lcd/language/language_nl.h b/Marlin/src/lcd/language/language_nl.h index ca51198034ea5..8aa74d7e9fdc4 100644 --- a/Marlin/src/lcd/language/language_nl.h +++ b/Marlin/src/lcd/language/language_nl.h @@ -84,6 +84,7 @@ namespace Language_nl { LSTR MSG_MOVE_X = _UxGT("Verplaats X"); LSTR MSG_MOVE_Y = _UxGT("Verplaats Y"); LSTR MSG_MOVE_Z = _UxGT("Verplaats Z"); + LSTR MSG_MOVE_N = _UxGT("Verplaats @"); LSTR MSG_MOVE_E = _UxGT("Extruder"); LSTR MSG_MOVE_EN = _UxGT("Extruder *"); LSTR MSG_MOVE_N_MM = _UxGT("Verplaats $mm"); diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 34155f87fed87..635866baf106e 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -235,6 +235,7 @@ namespace Language_pl { LSTR MSG_MOVE_X = _UxGT("Przesuń w X"); LSTR MSG_MOVE_Y = _UxGT("Przesuń w Y"); LSTR MSG_MOVE_Z = _UxGT("Przesuń w Z"); + LSTR MSG_MOVE_N = _UxGT("Przesuń w @"); LSTR MSG_MOVE_E = _UxGT("Ekstruzja (os E)"); LSTR MSG_MOVE_EN = _UxGT("Ekstruzja (os E) *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Dysza za zimna"); diff --git a/Marlin/src/lcd/language/language_pt.h b/Marlin/src/lcd/language/language_pt.h index 69df8bdf5427d..55d9c1d7c5725 100644 --- a/Marlin/src/lcd/language/language_pt.h +++ b/Marlin/src/lcd/language/language_pt.h @@ -78,6 +78,7 @@ namespace Language_pt { LSTR MSG_MOVE_X = _UxGT("Mover X"); LSTR MSG_MOVE_Y = _UxGT("Mover Y"); LSTR MSG_MOVE_Z = _UxGT("Mover Z"); + LSTR MSG_MOVE_N = _UxGT("Mover @"); LSTR MSG_MOVE_E = _UxGT("Mover Extrusor"); LSTR MSG_MOVE_EN = _UxGT("Mover Extrusor *"); LSTR MSG_MOVE_N_MM = _UxGT("Mover $mm"); diff --git a/Marlin/src/lcd/language/language_pt_br.h b/Marlin/src/lcd/language/language_pt_br.h index 0f0f8c5287c21..1d07b2b94f22c 100644 --- a/Marlin/src/lcd/language/language_pt_br.h +++ b/Marlin/src/lcd/language/language_pt_br.h @@ -209,6 +209,7 @@ namespace Language_pt_br { LSTR MSG_MOVE_X = _UxGT("Mover X"); LSTR MSG_MOVE_Y = _UxGT("Mover Y"); LSTR MSG_MOVE_Z = _UxGT("Mover Z"); + LSTR MSG_MOVE_N = _UxGT("Mover @"); LSTR MSG_MOVE_E = _UxGT("Mover Extrusor"); LSTR MSG_MOVE_EN = _UxGT("Mover Extrusor *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Extrus. mto fria"); diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index 3bd15f18a4924..2cf6fff263cc5 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -222,6 +222,7 @@ namespace Language_ro { LSTR MSG_MOVE_X = _UxGT("Move X"); LSTR MSG_MOVE_Y = _UxGT("Move Y"); LSTR MSG_MOVE_Z = _UxGT("Move Z"); + LSTR MSG_MOVE_N = _UxGT("Move @"); LSTR MSG_MOVE_E = _UxGT("Extruder"); LSTR MSG_MOVE_EN = _UxGT("Extruder *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Capat Prea Rece"); diff --git a/Marlin/src/lcd/language/language_sv.h b/Marlin/src/lcd/language/language_sv.h index 6bfb7100f4ef4..1342ccaad7643 100644 --- a/Marlin/src/lcd/language/language_sv.h +++ b/Marlin/src/lcd/language/language_sv.h @@ -249,6 +249,7 @@ namespace Language_sv { LSTR MSG_MOVE_X = _UxGT("Flytta X"); LSTR MSG_MOVE_Y = _UxGT("Flytta Y"); LSTR MSG_MOVE_Z = _UxGT("Flytta Z"); + LSTR MSG_MOVE_N = _UxGT("Flytta @"); LSTR MSG_MOVE_E = _UxGT("Extruder"); LSTR MSG_MOVE_EN = _UxGT("Extruder *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Hetände för kall"); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index c9967f72ec2d6..cb2766306c8e3 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -225,6 +225,7 @@ namespace Language_tr { LSTR MSG_MOVE_X = _UxGT("X Hareketi"); LSTR MSG_MOVE_Y = _UxGT("Y Hareketi"); LSTR MSG_MOVE_Z = _UxGT("Z Hareketi"); + LSTR MSG_MOVE_N = _UxGT("@ Hareketi"); LSTR MSG_MOVE_E = _UxGT("Ekstruder"); LSTR MSG_MOVE_EN = _UxGT("Ekstruder *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Nozul Çok Soğuk"); diff --git a/Marlin/src/lcd/language/language_vi.h b/Marlin/src/lcd/language/language_vi.h index 989a201d4d923..27c6ee11812f0 100644 --- a/Marlin/src/lcd/language/language_vi.h +++ b/Marlin/src/lcd/language/language_vi.h @@ -198,6 +198,7 @@ namespace Language_vi { LSTR MSG_MOVE_X = _UxGT("Di chuyển X"); // Move X LSTR MSG_MOVE_Y = _UxGT("Di chuyển Y"); LSTR MSG_MOVE_Z = _UxGT("Di chuyển Z"); + LSTR MSG_MOVE_N = _UxGT("Di chuyển @"); LSTR MSG_MOVE_E = _UxGT("Máy đùn"); // Extruder LSTR MSG_MOVE_EN = _UxGT("Máy đùn *"); LSTR MSG_HOTEND_TOO_COLD = _UxGT("Đầu nóng quá lạnh"); // Hotend too cold diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index fc61b020ffc2b..4c5a94edcdc83 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -222,6 +222,7 @@ namespace Language_zh_CN { LSTR MSG_MOVE_X = _UxGT("移动X"); // "Move X" LSTR MSG_MOVE_Y = _UxGT("移动Y"); // "Move Y" LSTR MSG_MOVE_Z = _UxGT("移动Z"); // "Move Z" + LSTR MSG_MOVE_N = _UxGT("移动@"); // "Move @" LSTR MSG_MOVE_E = _UxGT("挤出机"); // "Extruder" LSTR MSG_MOVE_EN = _UxGT("挤出机 *"); // "Extruder" LSTR MSG_HOTEND_TOO_COLD = _UxGT("热端太冷"); diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index b35a486e4f6a0..4eba832c4ffb6 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -218,6 +218,7 @@ namespace Language_zh_TW { LSTR MSG_MOVE_X = _UxGT("移動X"); // "Move X" LSTR MSG_MOVE_Y = _UxGT("移動Y"); // "Move Y" LSTR MSG_MOVE_Z = _UxGT("移動Z"); // "Move Z" + LSTR MSG_MOVE_N = _UxGT("移動Q"); // "Move @" LSTR MSG_MOVE_E = _UxGT("擠出機"); // "Extruder" LSTR MSG_MOVE_EN = _UxGT("擠出機 *"); // "Extruder *" LSTR MSG_HOTEND_TOO_COLD = _UxGT("噴嘴溫度不夠"); // "Hotend too cold" diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index df72538397a2d..84b6f5ddc1bf8 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -178,6 +178,8 @@ typedef bool (*statusResetFunc_t)(); static void soon(const AxisEnum axis OPTARG(MULTI_E_MANUAL, const int8_t eindex=active_extruder)); }; + void lcd_move_axis(const AxisEnum); + #endif //////////////////////////////////////////// diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index a1e2beaf72d04..c11f389276a79 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -191,7 +191,7 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co else { #if ENABLED(MOVE_Z_WHEN_IDLE) ui.manual_move.menu_scale = MOVE_Z_IDLE_MULTIPLICATOR; - screen = lcd_move_z; + screen = []{ lcd_move_axis(Z_AXIS); }; #endif } } diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 6f5a9efb15160..befffe5f72d28 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -214,8 +214,6 @@ void menu_move(); //////// Menu Item Helper Functions //////// //////////////////////////////////////////// -void lcd_move_axis(const AxisEnum); -void lcd_move_z(); void _lcd_draw_homing(); #define HAS_LINE_TO_Z ANY(DELTA, PROBE_MANUALLY, MESH_BED_LEVELING, LCD_BED_TRAMMING) diff --git a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp index b86f1012586d3..ae935e53c446b 100644 --- a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp +++ b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp @@ -52,7 +52,7 @@ void _man_probe_pt(const xy_pos_t &xy) { ui.wait_for_move = false; ui.synchronize(); ui.manual_move.menu_scale = _MAX(PROBE_MANUALLY_STEP, MIN_STEPS_PER_SEGMENT / planner.settings.axis_steps_per_mm[0]); // Use first axis as for delta XYZ should always match - ui.goto_screen(lcd_move_z); + ui.goto_screen([]{ lcd_move_axis(Z_AXIS); }); } } diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index 3e1733ee1c904..cbbaf0fbabaa4 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -31,8 +31,6 @@ #include "../../module/planner.h" #endif -void lcd_move_z(); - //////////////////////////////////////////// ///////////// Base Menu Items ////////////// //////////////////////////////////////////// diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 3f7a1f4e02199..5c78cc2836870 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -77,6 +77,7 @@ void lcd_move_axis(const AxisEnum axis) { } ui.encoderPosition = 0; if (ui.should_draw()) { + MenuEditItemBase::itemIndex = axis; const float pos = ui.manual_move.axis_value(axis); if (parser.using_inch_units()) { const float imp_pos = LINEAR_UNIT(pos); @@ -87,9 +88,6 @@ void lcd_move_axis(const AxisEnum axis) { } } -// Move Z easy accessor -void lcd_move_z() { lcd_move_axis(Z_AXIS); } - #if E_MANUAL static void lcd_move_e(TERN_(MULTI_E_MANUAL, const int8_t eindex=active_extruder)) { @@ -121,7 +119,7 @@ void lcd_move_z() { lcd_move_axis(Z_AXIS); } void _goto_manual_move_z(const_float_t scale) { ui.manual_move.menu_scale = scale; - ui.goto_screen(lcd_move_z); + ui.goto_screen([]{ lcd_move_axis(Z_AXIS); }); } #endif From cf1e4df51b32518d7f851eb68c47c4e8e566c551 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 22 Jul 2022 12:38:00 -0500 Subject: [PATCH 04/27] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20MAX31865=20approxima?= =?UTF-8?q?tions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #24407 --- Marlin/src/libs/MAX31865.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/libs/MAX31865.cpp b/Marlin/src/libs/MAX31865.cpp index 0d709b1b0b426..3fe0694644639 100644 --- a/Marlin/src/libs/MAX31865.cpp +++ b/Marlin/src/libs/MAX31865.cpp @@ -489,9 +489,9 @@ float MAX31865::temperature(float rtd_res) { temp = RTD_C[0]; temp += rpoly * RTD_C[1]; rpoly *= rtd_res; temp += rpoly * RTD_C[2]; - if (MAX31865_APPROX >= 3) rpoly *= rtd_res; temp += rpoly * RTD_C[3]; - if (MAX31865_APPROX >= 4) rpoly *= rtd_res; temp += rpoly * RTD_C[4]; - if (MAX31865_APPROX >= 5) rpoly *= rtd_res; temp += rpoly * RTD_C[5]; + if (MAX31865_APPROX >= 3) { rpoly *= rtd_res; temp += rpoly * RTD_C[3]; } + if (MAX31865_APPROX >= 4) { rpoly *= rtd_res; temp += rpoly * RTD_C[4]; } + if (MAX31865_APPROX >= 5) { rpoly *= rtd_res; temp += rpoly * RTD_C[5]; } } return temp; From ca06ec9abb17c394ac5dd912e6011a487f38cfa6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 28 Jul 2022 20:52:33 -0500 Subject: [PATCH 05/27] =?UTF-8?q?=F0=9F=8E=A8=20Misc.=20'else'=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/STM32/tft/tft_ltdc.cpp | 4 +- Marlin/src/feature/direct_stepping.cpp | 19 +++---- .../generic/change_filament_screen.cpp | 4 +- .../generic/files_screen.cpp | 11 ++-- .../src/lcd/extui/mks_ui/wifiSerial_STM32.cpp | 53 ++++++++++--------- 5 files changed, 48 insertions(+), 43 deletions(-) diff --git a/Marlin/src/HAL/STM32/tft/tft_ltdc.cpp b/Marlin/src/HAL/STM32/tft/tft_ltdc.cpp index 66cfd65995ddd..95871bf41f5c4 100644 --- a/Marlin/src/HAL/STM32/tft/tft_ltdc.cpp +++ b/Marlin/src/HAL/STM32/tft/tft_ltdc.cpp @@ -372,9 +372,9 @@ void TFT_LTDC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou if (MemoryIncrease == DMA_PINC_ENABLE) { DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data); Data += width * height; - } else { - DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data); } + else + DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data); y_cur += height; } diff --git a/Marlin/src/feature/direct_stepping.cpp b/Marlin/src/feature/direct_stepping.cpp index 052e79de41e5b..13cf71e07695e 100644 --- a/Marlin/src/feature/direct_stepping.cpp +++ b/Marlin/src/feature/direct_stepping.cpp @@ -143,14 +143,16 @@ namespace DirectStepping { // special case for 8-bit, check if rolled back to 0 if (Cfg::DIRECTIONAL || !write_page_size) { // full 256 bytes if (write_byte_idx) return true; - } else { - if (write_byte_idx < write_page_size) return true; } - } else if (Cfg::DIRECTIONAL) { - if (write_byte_idx != Cfg::PAGE_SIZE) return true; - } else { - if (write_byte_idx < write_page_size) return true; + else if (write_byte_idx < write_page_size) + return true; + } + else if (Cfg::DIRECTIONAL) { + if (write_byte_idx != Cfg::PAGE_SIZE) + return true; } + else if (write_byte_idx < write_page_size) + return true; state = State::CHECKSUM; return true; @@ -161,11 +163,10 @@ namespace DirectStepping { return true; } case State::UNFAIL: - if (c == 0) { + if (c == 0) set_page_state(write_page_idx, PageState::FREE); - } else { + else fatal_error = true; - } state = State::MONITOR; return true; } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/change_filament_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/change_filament_screen.cpp index fa0748c17b372..17ec975692ea5 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/change_filament_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/change_filament_screen.cpp @@ -171,9 +171,9 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { const bool t_ok = getActualTemp_celsius(e) > getSoftenTemp() - 10; - if (mydata.t_tag && !t_ok) { + if (mydata.t_tag && !t_ok) cmd.text(HEATING_LBL_POS, GET_TEXT_F(MSG_HEATING)); - } else if (getActualTemp_celsius(e) > 100) { + else if (getActualTemp_celsius(e) > 100) { cmd.cmd(COLOR_RGB(0xFF0000)) .text(CAUTION_LBL_POS, GET_TEXT_F(MSG_CAUTION)) .colors(normal_btn) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/files_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/files_screen.cpp index 00768dbaf7de6..290c20f43e598 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/files_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/files_screen.cpp @@ -111,16 +111,17 @@ void FilesScreen::drawFileButton(int x, int y, int w, int h, const char *filenam cmd.cmd(COLOR_RGB(is_highlighted ? fg_action : bg_color)); cmd.font(font_medium).rectangle(bx, by, bw, bh); cmd.cmd(COLOR_RGB(is_highlighted ? normal_btn.rgb : bg_text_enabled)); - #if ENABLED(SCROLL_LONG_FILENAMES) - if (is_highlighted) { + if (TERN0(SCROLL_LONG_FILENAMES, is_highlighted)) { + #if ENABLED(SCROLL_LONG_FILENAMES) cmd.cmd(SAVE_CONTEXT()); cmd.cmd(SCISSOR_XY(x,y)); cmd.cmd(SCISSOR_SIZE(w,h)); cmd.cmd(MACRO(0)); cmd.text(bx, by, bw, bh, filename, OPT_CENTERY | OPT_NOFIT); - } else - #endif - draw_text_with_ellipsis(cmd, bx,by, bw - (is_dir ? 20 : 0), bh, filename, OPT_CENTERY, font_medium); + #endif + } + else + draw_text_with_ellipsis(cmd, bx,by, bw - (is_dir ? 20 : 0), bh, filename, OPT_CENTERY, font_medium); if (is_dir && !is_highlighted) cmd.text(bx, by, bw, bh, F("> "), OPT_CENTERY | OPT_RIGHTX); #if ENABLED(SCROLL_LONG_FILENAMES) if (is_highlighted) cmd.cmd(RESTORE_CONTEXT()); diff --git a/Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32.cpp b/Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32.cpp index 6607e7531f0ea..0e55b3448ba15 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32.cpp @@ -53,42 +53,45 @@ void WifiSerial::init(PinName _rx, PinName _tx) { WifiSerial::WifiSerial(void *peripheral) { // If PIN_SERIALy_RX is not defined assume half-duplex _serial.pin_rx = NC; + if (false) { + // for else if / else below... + } // If Serial is defined in variant set // the Rx/Tx pins for com port if defined #if defined(Serial) && defined(PIN_SERIAL_TX) - if ((void *)this == (void *)&Serial) { + else if ((void *)this == (void *)&Serial) { #ifdef PIN_SERIAL_RX setRx(PIN_SERIAL_RX); #endif setTx(PIN_SERIAL_TX); - } else + } #endif #if defined(PIN_SERIAL1_TX) && defined(USART1_BASE) - if (peripheral == USART1) { + else if (peripheral == USART1) { #ifdef PIN_SERIAL1_RX setRx(PIN_SERIAL1_RX); #endif setTx(PIN_SERIAL1_TX); - } else + } #endif #if defined(PIN_SERIAL2_TX) && defined(USART2_BASE) - if (peripheral == USART2) { + else if (peripheral == USART2) { #ifdef PIN_SERIAL2_RX setRx(PIN_SERIAL2_RX); #endif setTx(PIN_SERIAL2_TX); - } else + } #endif #if defined(PIN_SERIAL3_TX) && defined(USART3_BASE) - if (peripheral == USART3) { + else if (peripheral == USART3) { #ifdef PIN_SERIAL3_RX setRx(PIN_SERIAL3_RX); #endif setTx(PIN_SERIAL3_TX); - } else + } #endif #ifdef PIN_SERIAL4_TX - if (false + else if (false #ifdef USART4_BASE || peripheral == USART4 #elif defined(UART4_BASE) @@ -99,10 +102,10 @@ WifiSerial::WifiSerial(void *peripheral) { setRx(PIN_SERIAL4_RX); #endif setTx(PIN_SERIAL4_TX); - } else + } #endif #ifdef PIN_SERIAL5_TX - if (false + else if (false #ifdef USART5_BASE || peripheral == USART5 #elif defined(UART5_BASE) @@ -113,18 +116,18 @@ WifiSerial::WifiSerial(void *peripheral) { setRx(PIN_SERIAL5_RX); #endif setTx(PIN_SERIAL5_TX); - } else + } #endif #if defined(PIN_SERIAL6_TX) && defined(USART6_BASE) - if (peripheral == USART6) { + else if (peripheral == USART6) { #ifdef PIN_SERIAL6_RX setRx(PIN_SERIAL6_RX); #endif setTx(PIN_SERIAL6_TX); - } else + } #endif #ifdef PIN_SERIAL7_TX - if (false + else if (false #ifdef USART7_BASE || peripheral == USART7 #elif defined(UART7_BASE) @@ -135,10 +138,10 @@ WifiSerial::WifiSerial(void *peripheral) { setRx(PIN_SERIAL7_RX); #endif setTx(PIN_SERIAL7_TX); - } else + } #endif #ifdef PIN_SERIAL8_TX - if (false + else if (false #ifdef USART8_BASE || peripheral == USART8 #elif defined(UART8_BASE) @@ -149,18 +152,18 @@ WifiSerial::WifiSerial(void *peripheral) { setRx(PIN_SERIAL8_RX); #endif setTx(PIN_SERIAL8_TX); - } else + } #endif #if defined(PIN_SERIAL9_TX) && defined(UART9_BASE) - if (peripheral == UART9) { + else if (peripheral == UART9) { #ifdef PIN_SERIAL9_RX setRx(PIN_SERIAL9_RX); #endif setTx(PIN_SERIAL9_TX); - } else + } #endif #ifdef PIN_SERIAL10_TX - if (false + else if (false #ifdef USART10_BASE || peripheral == USART10 #elif defined(UART10_BASE) @@ -171,18 +174,18 @@ WifiSerial::WifiSerial(void *peripheral) { setRx(PIN_SERIAL10_RX); #endif setTx(PIN_SERIAL10_TX); - } else + } #endif #if defined(PIN_SERIALLP1_TX) && defined(LPUART1_BASE) - if (peripheral == LPUART1) { + else if (peripheral == LPUART1) { #ifdef PIN_SERIALLP1_RX setRx(PIN_SERIALLP1_RX); #endif setTx(PIN_SERIALLP1_TX); - } else + } #endif // else get the pins of the first peripheral occurrence in PinMap - { + else { _serial.pin_rx = pinmap_pin(peripheral, PinMap_UART_RX); _serial.pin_tx = pinmap_pin(peripheral, PinMap_UART_TX); } From ce5497218af78afd1a4b7391461919aab336178b Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Wed, 20 Jul 2022 04:08:19 -0400 Subject: [PATCH 06/27] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Archim2=20USB=20Hang?= =?UTF-8?q?=20(#24314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/sam/pins_ARCHIM2.h | 9 ++++++-- .../sd/usb_flashdrive/Sd2Card_FlashDrive.cpp | 22 +++++++++---------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Marlin/src/pins/sam/pins_ARCHIM2.h b/Marlin/src/pins/sam/pins_ARCHIM2.h index ecff888ff05e0..310dd8e2ac272 100644 --- a/Marlin/src/pins/sam/pins_ARCHIM2.h +++ b/Marlin/src/pins/sam/pins_ARCHIM2.h @@ -245,8 +245,6 @@ #define LCD_PINS_D5 54 // D54 PA16_SCK1 #define LCD_PINS_D6 68 // D68 PA1_CANRX0 #define LCD_PINS_D7 34 // D34 PC2_PWML0 - - #define SD_DETECT_PIN 2 // D2 PB25_TIOA0 #endif #if ANY(IS_ULTIPANEL, TOUCH_UI_ULTIPANEL, TOUCH_UI_FTDI_EVE) @@ -255,3 +253,10 @@ #define BTN_EN2 13 // D13 PB27_TIOB0 #define BTN_ENC 16 // D16 PA13_TXD1 // the click #endif + +#if ANY(HAS_WIRED_LCD, TOUCH_UI_ULTIPANEL, TOUCH_UI_FTDI_EVE, USB_FLASH_DRIVE_SUPPORT) + #define SD_DETECT_PIN 2 // D2 PB25_TIOA0 + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define DISABLE_DUE_SD_MMC + #endif +#endif diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp index 7d698247e5653..b5968b7021fe1 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp @@ -159,18 +159,18 @@ void DiskIODriver_USBFlash::idle() { static uint8_t laststate = 232; if (task_state != laststate) { laststate = task_state; - #define UHS_USB_DEBUG(x) case UHS_STATE(x): SERIAL_ECHOLNPGM(#x); break + #define UHS_USB_DEBUG(x,y) case UHS_STATE(x): SERIAL_ECHOLNPGM(y); break switch (task_state) { - UHS_USB_DEBUG(IDLE); - UHS_USB_DEBUG(RESET_DEVICE); - UHS_USB_DEBUG(RESET_NOT_COMPLETE); - UHS_USB_DEBUG(DEBOUNCE); - UHS_USB_DEBUG(DEBOUNCE_NOT_COMPLETE); - UHS_USB_DEBUG(WAIT_SOF); - UHS_USB_DEBUG(ERROR); - UHS_USB_DEBUG(CONFIGURING); - UHS_USB_DEBUG(CONFIGURING_DONE); - UHS_USB_DEBUG(RUNNING); + UHS_USB_DEBUG(IDLE, "IDLE"); + UHS_USB_DEBUG(RESET_DEVICE, "RESET_DEVICE"); + UHS_USB_DEBUG(RESET_NOT_COMPLETE, "RESET_NOT_COMPLETE"); + UHS_USB_DEBUG(DEBOUNCE, "DEBOUNCE"); + UHS_USB_DEBUG(DEBOUNCE_NOT_COMPLETE, "DEBOUNCE_NOT_COMPLETE"); + UHS_USB_DEBUG(WAIT_SOF, "WAIT_SOF"); + UHS_USB_DEBUG(ERROR, "ERROR"); + UHS_USB_DEBUG(CONFIGURING, "CONFIGURING"); + UHS_USB_DEBUG(CONFIGURING_DONE, "CONFIGURING_DONE"); + UHS_USB_DEBUG(RUNNING, "RUNNING"); default: SERIAL_ECHOLNPGM("UHS_USB_HOST_STATE: ", task_state); break; From 9bd39749d75b6ecd5cbe598fc72feaf285945eab Mon Sep 17 00:00:00 2001 From: Miguel Risco-Castillo Date: Thu, 14 Jul 2022 00:00:33 -0500 Subject: [PATCH 07/27] =?UTF-8?q?=F0=9F=9A=B8=20Fix=20and=20update=20ProUI?= =?UTF-8?q?=20(#24477)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/common/dwin_font.h | 2 + .../{ubl_tools.cpp => bedlevel_tools.cpp} | 82 ++++-- .../proui/{ubl_tools.h => bedlevel_tools.h} | 46 +++- Marlin/src/lcd/e3v2/proui/dwin.cpp | 250 ++++++++++-------- Marlin/src/lcd/e3v2/proui/dwin.h | 11 +- Marlin/src/lcd/e3v2/proui/dwin_defines.h | 47 +--- Marlin/src/lcd/e3v2/proui/dwinui.cpp | 60 ++--- Marlin/src/lcd/e3v2/proui/dwinui.h | 157 +++++------ Marlin/src/lcd/e3v2/proui/lockscreen.cpp | 8 +- Marlin/src/lcd/e3v2/proui/menus.cpp | 26 +- Marlin/src/lcd/e3v2/proui/menus.h | 6 +- Marlin/src/lcd/e3v2/proui/meshviewer.cpp | 15 +- Marlin/src/lcd/e3v2/proui/meshviewer.h | 3 - Marlin/src/lcd/e3v2/proui/plot.cpp | 9 +- Marlin/src/lcd/language/language_en.h | 1 + Marlin/src/module/planner.h | 2 +- Marlin/src/module/settings.cpp | 13 +- 17 files changed, 395 insertions(+), 343 deletions(-) rename Marlin/src/lcd/e3v2/proui/{ubl_tools.cpp => bedlevel_tools.cpp} (78%) rename Marlin/src/lcd/e3v2/proui/{ubl_tools.h => bedlevel_tools.h} (64%) diff --git a/Marlin/src/lcd/e3v2/common/dwin_font.h b/Marlin/src/lcd/e3v2/common/dwin_font.h index 5a4b1a61cf242..10bb104d27bcd 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_font.h +++ b/Marlin/src/lcd/e3v2/common/dwin_font.h @@ -21,6 +21,8 @@ */ #pragma once +typedef uint8_t fontid_t; + /** * 3-.0:The font size, 0x00-0x09, corresponds to the font size below: * 0x00=6*12 0x01=8*16 0x02=10*20 0x03=12*24 0x04=14*28 diff --git a/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp similarity index 78% rename from Marlin/src/lcd/e3v2/proui/ubl_tools.cpp rename to Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp index 6c91757005744..e967c26198bef 100644 --- a/Marlin/src/lcd/e3v2/proui/ubl_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp @@ -21,18 +21,19 @@ */ /** - * UBL Tools and Mesh Viewer for Pro UI - * Version: 1.0.0 - * Date: 2022/04/13 + * Bed Level Tools for Pro UI + * Extended by: Miguel A. Risco-Castillo (MRISCOC) + * Version: 2.0.0 + * Date: 2022/05/23 * - * Original Author: Henri-J-Norden - * Original Source: https://github.com/Jyers/Marlin/pull/126 + * Based on the original work of: Henri-J-Norden + * https://github.com/Jyers/Marlin/pull/126 */ #include "../../../inc/MarlinConfigPre.h" -#include "ubl_tools.h" +#include "bedlevel_tools.h" -#if ENABLED(DWIN_LCD_PROUI) +#if BOTH(DWIN_LCD_PROUI, HAS_LEVELING) #include "../../marlinui.h" #include "../../../core/types.h" @@ -47,27 +48,29 @@ #include "../../../libs/least_squares_fit.h" #include "../../../libs/vector_3.h" -UBLMeshToolsClass ubl_tools; +BedLevelToolsClass BedLevelTools; -#if ENABLED(USE_UBL_VIEWER) - bool UBLMeshToolsClass::viewer_asymmetric_range = false; - bool UBLMeshToolsClass::viewer_print_value = false; +#if USE_UBL_VIEWER + bool BedLevelToolsClass::viewer_asymmetric_range = false; + bool BedLevelToolsClass::viewer_print_value = false; #endif -bool UBLMeshToolsClass::goto_mesh_value = false; -uint8_t UBLMeshToolsClass::tilt_grid = 1; +bool BedLevelToolsClass::goto_mesh_value = false; +uint8_t BedLevelToolsClass::mesh_x = 0; +uint8_t BedLevelToolsClass::mesh_y = 0; +uint8_t BedLevelToolsClass::tilt_grid = 1; bool drawing_mesh = false; char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16]; #if ENABLED(AUTO_BED_LEVELING_UBL) - void UBLMeshToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/*=false*/) { + void BedLevelToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/*=false*/) { sprintf_P(cmd, PSTR("M421 I%i J%i Z%s %s"), mesh_x, mesh_y, dtostrf(current_position.z, 1, 3, str_1), undefined ? "N" : ""); gcode.process_subcommands_now(cmd); planner.synchronize(); } - bool UBLMeshToolsClass::create_plane_from_mesh() { + bool BedLevelToolsClass::create_plane_from_mesh() { struct linear_fit_data lsf_results; incremental_LSF_reset(&lsf_results); GRID_LOOP(x, y) { @@ -119,7 +122,7 @@ char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16]; #else - void UBLMeshToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y) { + void BedLevelToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y) { sprintf_P(cmd, PSTR("G29 I%i J%i Z%s"), mesh_x, mesh_y, dtostrf(current_position.z, 1, 3, str_1)); gcode.process_subcommands_now(cmd); planner.synchronize(); @@ -127,7 +130,8 @@ char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16]; #endif -void UBLMeshToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) { +void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) { + gcode.process_subcommands_now(F("G28O")); if (zmove) { planner.synchronize(); current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; @@ -149,8 +153,28 @@ void UBLMeshToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, } } -float UBLMeshToolsClass::get_max_value() { - float max = __FLT_MIN__; +void BedLevelToolsClass::MoveToXYZ() { + BedLevelTools.goto_mesh_value = true; + BedLevelTools.manual_move(BedLevelTools.mesh_x, BedLevelTools.mesh_y, false); +} +void BedLevelToolsClass::MoveToXY() { + BedLevelTools.goto_mesh_value = false; + BedLevelTools.manual_move(BedLevelTools.mesh_x, BedLevelTools.mesh_y, false); +} +void BedLevelToolsClass::MoveToZ() { + BedLevelTools.goto_mesh_value = true; + BedLevelTools.manual_move(BedLevelTools.mesh_x, BedLevelTools.mesh_y, true); +} +void BedLevelToolsClass::ProbeXY() { + sprintf_P(cmd, PSTR("G30X%sY%s"), + dtostrf(bedlevel.get_mesh_x(BedLevelTools.mesh_x), 1, 2, str_1), + dtostrf(bedlevel.get_mesh_y(BedLevelTools.mesh_y), 1, 2, str_2) + ); + gcode.process_subcommands_now(cmd); +} + +float BedLevelToolsClass::get_max_value() { + float max = __FLT_MAX__ * -1; GRID_LOOP(x, y) { if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max) max = bedlevel.z_values[x][y]; @@ -158,7 +182,7 @@ float UBLMeshToolsClass::get_max_value() { return max; } -float UBLMeshToolsClass::get_min_value() { +float BedLevelToolsClass::get_min_value() { float min = __FLT_MAX__; GRID_LOOP(x, y) { if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min) @@ -167,19 +191,20 @@ float UBLMeshToolsClass::get_min_value() { return min; } -bool UBLMeshToolsClass::validate() { - float min = __FLT_MAX__, max = __FLT_MIN__; +bool BedLevelToolsClass::meshvalidate() { + float min = __FLT_MAX__, max = __FLT_MAX__ * -1; GRID_LOOP(x, y) { if (isnan(bedlevel.z_values[x][y])) return false; if (bedlevel.z_values[x][y] < min) min = bedlevel.z_values[x][y]; if (bedlevel.z_values[x][y] > max) max = bedlevel.z_values[x][y]; } - return max <= UBL_Z_OFFSET_MAX && min >= UBL_Z_OFFSET_MIN; + return WITHIN(max, MESH_Z_OFFSET_MIN, MESH_Z_OFFSET_MAX); } -#if ENABLED(USE_UBL_VIEWER) - void UBLMeshToolsClass::Draw_Bed_Mesh(int16_t selected /*= -1*/, uint8_t gridline_width /*= 1*/, uint16_t padding_x /*= 8*/, uint16_t padding_y_top /*= 40 + 53 - 7*/) { +#if USE_UBL_VIEWER + + void BedLevelToolsClass::Draw_Bed_Mesh(int16_t selected /*= -1*/, uint8_t gridline_width /*= 1*/, uint16_t padding_x /*= 8*/, uint16_t padding_y_top /*= 40 + 53 - 7*/) { drawing_mesh = true; const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x; const uint16_t cell_width_px = total_width_px / (GRID_MAX_POINTS_X); @@ -237,7 +262,7 @@ bool UBLMeshToolsClass::validate() { } } - void UBLMeshToolsClass::Set_Mesh_Viewer_Status() { // TODO: draw gradient with values as a legend instead + void BedLevelToolsClass::Set_Mesh_Viewer_Status() { // TODO: draw gradient with values as a legend instead float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); if (v_min > 3e+10F) v_min = 0.0000001; if (v_max > 3e+10F) v_max = 0.0000001; @@ -255,6 +280,7 @@ bool UBLMeshToolsClass::validate() { ui.set_status(msg); drawing_mesh = false; } -#endif -#endif // DWIN_LCD_PROUI +#endif // USE_UBL_VIEWER + +#endif // DWIN_LCD_PROUI && HAS_LEVELING diff --git a/Marlin/src/lcd/e3v2/proui/ubl_tools.h b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h similarity index 64% rename from Marlin/src/lcd/e3v2/proui/ubl_tools.h rename to Marlin/src/lcd/e3v2/proui/bedlevel_tools.h index 563794a46385b..9373d593f9698 100644 --- a/Marlin/src/lcd/e3v2/proui/ubl_tools.h +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h @@ -1,10 +1,9 @@ -/** - * UBL Tools and Mesh Viewer for Pro UI - * Version: 1.0.0 - * Date: 2022/04/13 +/* + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * - * Original Author: Henri-J-Norden (https://github.com/Henri-J-Norden) - * Original Source: https://github.com/Jyers/Marlin/pull/135 + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,22 +19,37 @@ * along with this program. If not, see . * */ + +/** + * Bed Level Tools for Pro UI + * Extended by: Miguel A. Risco-Castillo (MRISCOC) + * Version: 2.0.0 + * Date: 2022/05/23 + * + * Based on the original work of: Henri-J-Norden + * https://github.com/Jyers/Marlin/pull/126 + */ + #pragma once #include "../../../inc/MarlinConfigPre.h" -//#define USE_UBL_VIEWER 1 +#if ENABLED(AUTO_BED_LEVELING_UBL) + //#define USE_UBL_VIEWER 1 +#endif -#define UBL_Z_OFFSET_MIN -3.0 -#define UBL_Z_OFFSET_MAX 3.0 +#define MESH_Z_OFFSET_MIN -3.0 +#define MESH_Z_OFFSET_MAX 3.0 -class UBLMeshToolsClass { +class BedLevelToolsClass { public: - #if ENABLED(USE_UBL_VIEWER) + #if USE_UBL_VIEWER static bool viewer_asymmetric_range; static bool viewer_print_value; #endif static bool goto_mesh_value; + static uint8_t mesh_x; + static uint8_t mesh_y; static uint8_t tilt_grid; #if ENABLED(AUTO_BED_LEVELING_UBL) @@ -45,15 +59,19 @@ class UBLMeshToolsClass { static void manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y); #endif static void manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove=false); + static void MoveToXYZ(); + static void MoveToXY(); + static void MoveToZ(); + static void ProbeXY(); static float get_max_value(); static float get_min_value(); - static bool validate(); - #if ENABLED(USE_UBL_VIEWER) + static bool meshvalidate(); + #if USE_UBL_VIEWER static void Draw_Bed_Mesh(int16_t selected = -1, uint8_t gridline_width = 1, uint16_t padding_x = 8, uint16_t padding_y_top = 40 + 53 - 7); static void Set_Mesh_Viewer_Status(); #endif }; -extern UBLMeshToolsClass ubl_tools; +extern BedLevelToolsClass BedLevelTools; void Goto_MeshViewer(); diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index c98fd6a0e150b..7296e996bc01b 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -70,17 +70,18 @@ #if HAS_MESH || HAS_ONESTEP_LEVELING #include "../../../feature/bedlevel/bedlevel.h" + #include "bedlevel_tools.h" #endif #if HAS_BED_PROBE #include "../../../module/probe.h" #endif -#ifdef BLTOUCH_HS_MODE +#if ENABLED(BLTOUCH) #include "../../../feature/bltouch.h" #endif -#if ANY(BABYSTEPPING, HAS_BED_PROBE, HAS_WORKSPACE_OFFSET) +#if EITHER(BABYSTEPPING, HAS_BED_PROBE) #define HAS_ZOFFSET_ITEM 1 #if ENABLED(BABYSTEPPING) #include "../../../feature/babystep.h" @@ -110,10 +111,6 @@ #include "meshviewer.h" #endif -#if ENABLED(AUTO_BED_LEVELING_UBL) - #include "ubl_tools.h" -#endif - #if ENABLED(PRINTCOUNTER) #include "printstats.h" #endif @@ -126,16 +123,14 @@ #include "../../../feature/leds/leds.h" #endif -#include -#include -#include +#if HAS_LOCKSCREEN + #include "lockscreen.h" +#endif #ifndef MACHINE_SIZE #define MACHINE_SIZE STRINGIFY(X_BED_SIZE) "x" STRINGIFY(Y_BED_SIZE) "x" STRINGIFY(Z_MAX_POS) #endif -#include "lockscreen.h" - #define PAUSE_HEAT #define MENU_CHAR_LIMIT 24 @@ -208,8 +203,21 @@ uint8_t index_file = MROWS; bool hash_changed = true; // Flag to know if message status was changed -constexpr float max_feedrate_edit_values[] = MAX_FEEDRATE_EDIT_VALUES; -constexpr float max_acceleration_edit_values[] = MAX_ACCEL_EDIT_VALUES; +constexpr float max_feedrate_edit_values[] = + #ifdef MAX_FEEDRATE_EDIT_VALUES + MAX_FEEDRATE_EDIT_VALUES + #else + { 1000, 1000, 10, 50 } + #endif +; + +constexpr float max_acceleration_edit_values[] = + #ifdef MAX_ACCEL_EDIT_VALUES + MAX_ACCEL_EDIT_VALUES + #else + { 1000, 1000, 200, 2000 } + #endif +; #if HAS_CLASSIC_JERK constexpr float max_jerk_edit_values[] = MAX_JERK_EDIT_VALUES; @@ -252,7 +260,9 @@ MenuClass *FilamentMenu = nullptr; MenuClass *TemperatureMenu = nullptr; MenuClass *MaxSpeedMenu = nullptr; MenuClass *MaxAccelMenu = nullptr; -MenuClass *MaxJerkMenu = nullptr; +#if HAS_CLASSIC_JERK + MenuClass *MaxJerkMenu = nullptr; +#endif MenuClass *StepsMenu = nullptr; MenuClass *HotendPIDMenu = nullptr; MenuClass *BedPIDMenu = nullptr; @@ -499,14 +509,9 @@ void Popup_window_PauseOrStop() { #endif // Draw status line -void DWIN_DrawStatusLine(const char *text) { - DWIN_Draw_Rectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); - if (text) DWINUI::Draw_CenteredString(HMI_data.StatusTxt_Color, STATUS_Y + 2, text); -} - -void DWIN_DrawStatusLine(FSTR_P fstr) { +void DWIN_DrawStatusLine() { DWIN_Draw_Rectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); - if (fstr) DWINUI::Draw_CenteredString(HMI_data.StatusTxt_Color, STATUS_Y + 2, fstr); + DWINUI::Draw_CenteredString(HMI_data.StatusTxt_Color, STATUS_Y + 2, ui.status_message); } // Clear & reset status line @@ -535,7 +540,7 @@ void DWIN_DrawStatusMessage() { // If the string fits the status line do not scroll it if (slen <= LCD_WIDTH) { if (hash_changed) { - DWIN_DrawStatusLine(ui.status_message); + DWIN_DrawStatusLine(); hash_changed = false; } } @@ -567,7 +572,7 @@ void DWIN_DrawStatusMessage() { if (hash_changed) { ui.status_message[LCD_WIDTH] = 0; - DWIN_DrawStatusLine(ui.status_message); + DWIN_DrawStatusLine(); hash_changed = false; } @@ -610,7 +615,7 @@ void ICON_ResumeOrPause() { } // Update filename on print -void DWIN_Print_Header(const char *text = nullptr) { +void DWIN_Print_Header(const char *text=nullptr) { static char headertxt[31] = ""; // Print header text if (text) { const int8_t size = _MIN(30U, strlen_P(text)); @@ -1044,7 +1049,7 @@ void DWIN_Draw_Dashboard() { DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); #endif - #if BOTH(BABYSTEPPING, HAS_BED_PROBE) + #if HAS_ZOFFSET_ITEM DWINUI::Draw_Icon(planner.leveling_active ? ICON_SetZOffset : ICON_Zoffset, 187, 416); #endif @@ -1315,13 +1320,15 @@ void Draw_Main_Area() { case ESDiagProcess: Draw_EndStopDiag(); break; #endif case Popup: popupDraw(); break; - case Locked: lockScreen.draw(); break; + #if HAS_LOCKSCREEN + case Locked: lockScreen.draw(); break; + #endif case Menu: case SetInt: case SetPInt: case SetIntNoDraw: case SetFloat: - case SetPFloat: ReDrawMenu(); break; + case SetPFloat: ReDrawMenu(true); break; default: break; } } @@ -1512,7 +1519,9 @@ void DWIN_HandleScreen() { case PrintProcess: HMI_Printing(); break; case Popup: HMI_Popup(); break; case Leveling: break; - case Locked: HMI_LockScreen(); break; + #if HAS_LOCKSCREEN + case Locked: HMI_LockScreen(); break; + #endif case PrintDone: TERN_(HAS_ESDIAG, case ESDiagProcess:) case WaitResponse: HMI_WaitForUser(); break; @@ -1714,7 +1723,7 @@ void DWIN_Print_Aborted() { Goto_PrintDone(); } -// Progress Bar update +// Progress and remaining time update void DWIN_M73() { if (parser.seenval('P')) { _percent_done = parser.value_byte(); @@ -1788,11 +1797,6 @@ void DWIN_CopySettingsFrom(const char * const buff) { TERN_(PREVENT_COLD_EXTRUSION, ApplyExtMinT()); feedrate_percentage = 100; TERN_(BAUD_RATE_GCODE, HMI_SetBaudRate()); - #if BOTH(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) - // Apply Case light brightness - caselight.brightness = HMI_data.CaseLight_Brightness; - caselight.update_brightness(); - #endif #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) leds.set_color( (HMI_data.LED_Color >> 16) & 0xFF, @@ -1825,7 +1829,7 @@ void DWIN_InitScreen() { index_file = MROWS; hash_changed = true; last_E = 0; - DWIN_DrawStatusLine(FSTR_P(nullptr)); + DWIN_DrawStatusLine(); DWIN_Draw_Dashboard(); Goto_Main_Menu(); } @@ -1880,7 +1884,7 @@ void DWIN_RedrawScreen() { case PAUSE_MESSAGE_PARKING: DWIN_Popup_Pause(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; // M125 case PAUSE_MESSAGE_CHANGING: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; // pause_print (M125, M600) case PAUSE_MESSAGE_WAITING: DWIN_Popup_Pause(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), BTN_Continue); break; - case PAUSE_MESSAGE_INSERT: DWIN_Popup_Continue(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break; + case PAUSE_MESSAGE_INSERT: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT), BTN_Continue); break; case PAUSE_MESSAGE_LOAD: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; case PAUSE_MESSAGE_UNLOAD: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; // Unload of pause and Unload of M702 case PAUSE_MESSAGE_PURGE: @@ -1933,28 +1937,32 @@ void DWIN_RedrawScreen() { } #endif // HAS_MESH -void DWIN_LockScreen() { - if (checkkey != Locked) { - lockScreen.rprocess = checkkey; - checkkey = Locked; - lockScreen.init(); + +#if HAS_LOCKSCREEN + + void DWIN_LockScreen() { + if (checkkey != Locked) { + lockScreen.rprocess = checkkey; + checkkey = Locked; + lockScreen.init(); + } } -} -void DWIN_UnLockScreen() { - if (checkkey == Locked) { - checkkey = lockScreen.rprocess; - Draw_Main_Area(); + void DWIN_UnLockScreen() { + if (checkkey == Locked) { + checkkey = lockScreen.rprocess; + Draw_Main_Area(); + } } -} -void HMI_LockScreen() { - EncoderState encoder_diffState = get_encoder_state(); - if (encoder_diffState == ENCODER_DIFF_NO) return; - lockScreen.onEncoder(encoder_diffState); - if (lockScreen.isUnlocked()) DWIN_UnLockScreen(); -} + void HMI_LockScreen() { + EncoderState encoder_diffState = get_encoder_state(); + if (encoder_diffState == ENCODER_DIFF_NO) return; + lockScreen.onEncoder(encoder_diffState); + if (lockScreen.isUnlocked()) DWIN_UnLockScreen(); + } +#endif // HAS_LOCKSCREEN #if HAS_GCODE_PREVIEW @@ -1996,7 +2004,8 @@ void HMI_LockScreen() { #if ENABLED(EEPROM_SETTINGS) void WriteEeprom() { - DWIN_DrawStatusLine(GET_TEXT_F(MSG_STORE_EEPROM)); + ui.set_status(GET_TEXT_F(MSG_STORE_EEPROM)); + DWIN_DrawStatusLine(); DWIN_UpdateLCD(); DONE_BUZZ(settings.save()); } @@ -2051,11 +2060,13 @@ void HomeX() { queue.inject(F("G28X")); } void HomeY() { queue.inject(F("G28Y")); } void HomeZ() { queue.inject(F("G28Z")); } -void SetHome() { +#if HAS_HOME_OFFSET // Apply workspace offset, making the current position 0,0,0 + void SetHome() { queue.inject(F("G92X0Y0Z0")); DONE_BUZZ(true); -} + } +#endif #if HAS_ZOFFSET_ITEM @@ -2077,22 +2088,25 @@ void SetHome() { void SetMoveZto0() { #if ENABLED(Z_SAFE_HOMING) char cmd[54], str_1[5], str_2[5]; - sprintf_P(cmd, PSTR("G28XYO\nG28Z\nG0X%sY%sF5000\nM420S0\nG0Z0F300\nM400"), + sprintf_P(cmd, PSTR("G28XYO\nG28Z\nG0X%sY%sF5000\nG0Z0F300\nM400"), dtostrf(Z_SAFE_HOMING_X_POINT, 1, 1, str_1), dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 1, str_2) ); gcode.process_subcommands_now(cmd); #else - gcode.process_subcommands_now(F("G28O\nM420S0\nG0Z0F300\nM400")); + set_bed_leveling_enabled(false); + gcode.process_subcommands_now(F("G28O\nG0Z0F300\nM400")); #endif ui.reset_status(); DONE_BUZZ(true); } - void HomeZandDisable() { - SetMoveZto0(); - DisableMotors(); - } + #if !HAS_BED_PROBE + void HomeZandDisable() { + SetMoveZto0(); + DisableMotors(); + } + #endif #endif // HAS_ZOFFSET_ITEM @@ -2768,9 +2782,6 @@ void onDrawGetColorItem(MenuItemClass* menuitem, int8_t line) { DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240); } -#if HAS_FILAMENT_SENSOR - void onDrawRunoutEnable(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, runout.enabled); } -#endif void onDrawPIDi(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_i(*(float*)static_cast(menuitem)->value)); } void onDrawPIDd(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_d(*(float*)static_cast(menuitem)->value)); } @@ -3177,7 +3188,9 @@ void Draw_AdvancedSettings_Menu() { MENU_ITEM_F(ICON_PrintStats, MSG_INFO_STATS_MENU, onDrawSubMenu, Goto_PrintStats); MENU_ITEM_F(ICON_PrintStatsReset, MSG_INFO_PRINT_COUNT_RESET, onDrawSubMenu, PrintStats.Reset); #endif - MENU_ITEM_F(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen); + #if HAS_LOCKSCREEN + MENU_ITEM_F(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen); + #endif } ui.reset_status(true); UpdateMenu(AdvancedSettings); @@ -3223,12 +3236,15 @@ void Draw_Move_Menu() { EDIT_ITEM_F(ICON_ProbeOffsetX, MSG_ZPROBE_XOFFSET, onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x); EDIT_ITEM_F(ICON_ProbeOffsetY, MSG_ZPROBE_YOFFSET, onDrawPFloatMenu, SetProbeOffsetY, &probe.offset.y); EDIT_ITEM_F(ICON_ProbeOffsetZ, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z); - #ifdef BLTOUCH_HS_MODE - EDIT_ITEM_F(ICON_HSMode, MSG_ENABLE_HS_MODE, onDrawChkbMenu, SetHSMode, &bltouch.high_speed_mode); + #if ENABLED(BLTOUCH) + MENU_ITEM_F(ICON_ProbeStow, MSG_MANUAL_STOW, onDrawMenuItem, ProbeStow); + MENU_ITEM_F(ICON_ProbeDeploy, MSG_MANUAL_DEPLOY, onDrawMenuItem, ProbeDeploy); + MENU_ITEM_F(ICON_BltouchReset, MSG_BLTOUCH_RESET, onDrawMenuItem, bltouch._reset); + #ifdef BLTOUCH_HS_MODE + EDIT_ITEM_F(ICON_HSMode, MSG_ENABLE_HS_MODE, onDrawChkbMenu, SetHSMode, &bltouch.high_speed_mode); + #endif #endif MENU_ITEM_F(ICON_ProbeTest, MSG_M48_TEST, onDrawMenuItem, ProbeTest); - MENU_ITEM_F(ICON_ProbeStow, MSG_MANUAL_STOW, onDrawMenuItem, ProbeStow); - MENU_ITEM_F(ICON_ProbeDeploy, MSG_MANUAL_DEPLOY, onDrawMenuItem, ProbeDeploy); } UpdateMenu(ProbeSetMenu); } @@ -3312,14 +3328,24 @@ void Draw_GetColor_Menu() { #endif #if ENABLED(LED_CONTROL_MENU) - void Draw_LedControl_Menu() { - checkkey = Menu; - if (SetMenu(LedControlMenu, GET_TEXT_F(MSG_LED_CONTROL), 6)) { - BACK_ITEM(Draw_Control_Menu); - #if !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) - EDIT_ITEM_F(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, SetLedStatus, &leds.lights_on); - #endif - #if HAS_COLOR_LEDS + void Draw_LedControl_Menu() { + checkkey = Menu; + if (SetMenu(LedControlMenu, GET_TEXT_F(MSG_LED_CONTROL), 6)) { + BACK_ITEM(Draw_Control_Menu); + #if !BOTH(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) + EDIT_ITEM_F(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, SetLedStatus, &leds.lights_on); + #endif + #if HAS_COLOR_LEDS + #if ENABLED(LED_COLOR_PRESETS) + MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_WHITE, onDrawMenuItem, leds.set_white); + MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_RED, onDrawMenuItem, leds.set_red); + MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_ORANGE, onDrawMenuItem, leds.set_orange); + MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_YELLOW, onDrawMenuItem, leds.set_yellow); + MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_GREEN, onDrawMenuItem, leds.set_green); + MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_BLUE, onDrawMenuItem, leds.set_blue); + MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_INDIGO, onDrawMenuItem, leds.set_indigo); + MENU_ITEM_F(ICON_LedControl, MSG_SET_LEDS_VIOLET, onDrawMenuItem, leds.set_violet); + #else EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_RED, onDrawPInt8Menu, SetLEDColorR, &leds.color.r); EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_GREEN, onDrawPInt8Menu, SetLEDColorG, &leds.color.g); EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_BLUE, onDrawPInt8Menu, SetLEDColorB, &leds.color.b); @@ -3327,9 +3353,10 @@ void Draw_GetColor_Menu() { EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_WHITE, onDrawPInt8Menu, SetLedColorW, &leds.color.w); #endif #endif - } - UpdateMenu(LedControlMenu); + #endif } + UpdateMenu(LedControlMenu); + } #endif void Draw_Tune_Menu() { @@ -3360,7 +3387,9 @@ void Draw_Tune_Menu() { #if ENABLED(FWRETRACT) MENU_ITEM_F(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu); #endif - MENU_ITEM_F(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen); + #if HAS_LOCKSCREEN + MENU_ITEM_F(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen); + #endif #if HAS_LCD_BRIGHTNESS EDIT_ITEM_F(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, SetBrightness, &ui.brightness); MENU_ITEM_F(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, TurnOffBacklight); @@ -3677,18 +3706,17 @@ void Draw_Steps_Menu() { void SetBedLevT() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } #endif - uint8_t mesh_x = 0; - uint8_t mesh_y = 0; - #define Z_OFFSET_MIN -3 - #define Z_OFFSET_MAX 3 - - void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &bedlevel.z_values[HMI_value.Select ? mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : mesh_y]; EditZValueItem->redraw(); } - void ApplyEditMeshX() { mesh_x = MenuData.Value; } - void SetEditMeshX() { HMI_value.Select = 0; SetIntOnClick(0, GRID_MAX_POINTS_X - 1, mesh_x, ApplyEditMeshX, LiveEditMesh); } - void ApplyEditMeshY() { mesh_y = MenuData.Value; } - void SetEditMeshY() { HMI_value.Select = 1; SetIntOnClick(0, GRID_MAX_POINTS_Y - 1, mesh_y, ApplyEditMeshY, LiveEditMesh); } - void SetEditZValue() { SetPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); } - + #if ENABLED(MESH_EDIT_MENU) + #define Z_OFFSET_MIN -3 + #define Z_OFFSET_MAX 3 + + void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &bedlevel.z_values[HMI_value.Select ? BedLevelTools.mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : BedLevelTools.mesh_y]; EditZValueItem->redraw(); } + void ApplyEditMeshX() { BedLevelTools.mesh_x = MenuData.Value; } + void SetEditMeshX() { HMI_value.Select = 0; SetIntOnClick(0, GRID_MAX_POINTS_X - 1, BedLevelTools.mesh_x, ApplyEditMeshX, LiveEditMesh); } + void ApplyEditMeshY() { BedLevelTools.mesh_y = MenuData.Value; } + void SetEditMeshY() { HMI_value.Select = 1; SetIntOnClick(0, GRID_MAX_POINTS_Y - 1, BedLevelTools.mesh_y, ApplyEditMeshY, LiveEditMesh); } + void SetEditZValue() { SetPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); } + #endif #endif #if ENABLED(AUTO_BED_LEVELING_UBL) @@ -3700,14 +3728,14 @@ void Draw_Steps_Menu() { onDrawIntMenu(menuitem, line, bedlevel.storage_slot); } - void ApplyUBLTiltGrid() { ubl_tools.tilt_grid = MenuData.Value; } - void SetUBLTiltGrid() { SetIntOnClick(1, 3, ubl_tools.tilt_grid, ApplyUBLTiltGrid); } + void ApplyUBLTiltGrid() { BedLevelTools.tilt_grid = MenuData.Value; } + void SetUBLTiltGrid() { SetIntOnClick(1, 3, BedLevelTools.tilt_grid, ApplyUBLTiltGrid); } void UBLTiltMesh() { if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0; char buf[15]; - if (ubl_tools.tilt_grid > 1) { - sprintf_P(buf, PSTR("G28O\nG29 J%i"), ubl_tools.tilt_grid); + if (BedLevelTools.tilt_grid > 1) { + sprintf_P(buf, PSTR("G28O\nG29 J%i"), BedLevelTools.tilt_grid); gcode.process_subcommands_now(buf); } else @@ -3716,16 +3744,10 @@ void Draw_Steps_Menu() { } void UBLSmartFillMesh() { - bedlevel.smart_fill_mesh(); + LOOP_L_N(x, GRID_MAX_POINTS_Y) bedlevel.smart_fill_mesh(); LCD_MESSAGE(MSG_UBL_MESH_FILLED); } - bool UBLValidMesh() { - const bool valid = ubl_tools.validate(); - if (!valid) bedlevel.invalidate(); - return valid; - } - void UBLSaveMesh() { if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0; settings.store_mesh(bedlevel.storage_slot); @@ -3736,14 +3758,6 @@ void Draw_Steps_Menu() { void UBLLoadMesh() { if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0; settings.load_mesh(bedlevel.storage_slot); - if (UBLValidMesh()) { - ui.status_printf(0, GET_TEXT_F(MSG_MESH_LOADED), bedlevel.storage_slot); - DONE_BUZZ(true); - } - else { - LCD_MESSAGE_F("Invalid Mesh Loaded"); - DONE_BUZZ(false); - } } #endif // AUTO_BED_LEVELING_UBL @@ -3765,7 +3779,7 @@ void Draw_Steps_Menu() { EDIT_ITEM_F(ICON_UBLActive, MSG_UBL_STORAGE_SLOT, onDrawUBLSlot, SetUBLSlot, &bedlevel.storage_slot); MENU_ITEM_F(ICON_UBLActive, MSG_UBL_SAVE_MESH, onDrawMenuItem, UBLSaveMesh); MENU_ITEM_F(ICON_UBLActive, MSG_UBL_LOAD_MESH, onDrawMenuItem, UBLLoadMesh); - EDIT_ITEM_F(ICON_UBLActive, MSG_UBL_TILTING_GRID, onDrawPInt8Menu, SetUBLTiltGrid, &ubl_tools.tilt_grid); + EDIT_ITEM_F(ICON_UBLActive, MSG_UBL_TILTING_GRID, onDrawPInt8Menu, SetUBLTiltGrid, &BedLevelTools.tilt_grid); MENU_ITEM_F(ICON_UBLActive, MSG_UBL_TILT_MESH, onDrawMenuItem, UBLTiltMesh); MENU_ITEM_F(ICON_UBLActive, MSG_UBL_SMART_FILLIN, onDrawMenuItem, UBLSmartFillMesh); #endif @@ -3779,13 +3793,15 @@ void Draw_Steps_Menu() { #if ENABLED(MESH_EDIT_MENU) void Draw_EditMesh_Menu() { + if (!leveling_is_valid()) { LCD_MESSAGE(MSG_UBL_MESH_INVALID); return; } + set_bed_leveling_enabled(false); checkkey = Menu; if (SetMenu(EditMeshMenu, GET_TEXT_F(MSG_EDIT_MESH), 4)) { - mesh_x = mesh_y = 0; + BedLevelTools.mesh_x = BedLevelTools.mesh_y = 0; BACK_ITEM(Draw_MeshSet_Menu); - EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_X, onDrawPInt8Menu, SetEditMeshX, &mesh_x); - EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_Y, onDrawPInt8Menu, SetEditMeshY, &mesh_y); - EditZValueItem = EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_EDIT_Z, onDrawPFloat3Menu, SetEditZValue, &bedlevel.z_values[mesh_x][mesh_y]); + EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_X, onDrawPInt8Menu, SetEditMeshX,&BedLevelTools.mesh_x); + EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_Y, onDrawPInt8Menu, SetEditMeshY,&BedLevelTools.mesh_y); + EditZValueItem = EDIT_ITEM_F(ICON_UBLActive, MSG_MESH_EDIT_Z, onDrawPFloat3Menu, SetEditZValue, &bedlevel.z_values[BedLevelTools.mesh_x][BedLevelTools.mesh_y]); } UpdateMenu(EditMeshMenu); } diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index f4e550295ea5a..89ec25f9286e1 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -160,8 +160,7 @@ void Goto_PowerLossRecovery(); void Goto_ConfirmToPrint(); void DWIN_Draw_Dashboard(const bool with_update); // Status Area void Draw_Main_Area(); // Redraw main area -void DWIN_DrawStatusLine(const char *text); // Draw simple status text -void DWIN_DrawStatusLine(FSTR_P fstr); +void DWIN_DrawStatusLine(); // Draw simple status text void DWIN_RedrawDash(); // Redraw Dash and Status line void DWIN_RedrawScreen(); // Redraw all screen elements void HMI_MainMenu(); // Main process screen @@ -210,9 +209,11 @@ void DWIN_RebootScreen(); #endif // Utility and extensions -void DWIN_LockScreen(); -void DWIN_UnLockScreen(); -void HMI_LockScreen(); +#if HAS_LOCKSCREEN + void DWIN_LockScreen(); + void DWIN_UnLockScreen(); + void HMI_LockScreen(); +#endif #if HAS_MESH void DWIN_MeshViewer(); #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index cb7b2f8160df4..9468149edf936 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -28,55 +28,21 @@ * Date: 2022/02/28 */ +#define HAS_GCODE_PREVIEW 1 +#define HAS_PIDPLOT 1 +#define HAS_ESDIAG 1 +#define HAS_LOCKSCREEN 1 //#define DEBUG_DWIN 1 //#define NEED_HEX_PRINT 1 #include "../../../inc/MarlinConfigPre.h" +#include "../common/dwin_color.h" #include -#define HAS_ESDIAG 1 -#define HAS_PIDPLOT 1 -#define HAS_GCODE_PREVIEW 1 #if defined(__STM32F1__) || defined(STM32F1) #define DASH_REDRAW 1 #endif -#if DISABLED(LIMITED_MAX_FR_EDITING) - #error "LIMITED_MAX_FR_EDITING is required with ProUI." -#endif -#if DISABLED(LIMITED_MAX_ACCEL_EDITING) - #error "LIMITED_MAX_ACCEL_EDITING is required with ProUI." -#endif -#if ENABLED(CLASSIC_JERK) && DISABLED(LIMITED_JERK_EDITING) - #error "LIMITED_JERK_EDITING is required with ProUI." -#endif -#if DISABLED(FILAMENT_RUNOUT_SENSOR) - #error "FILAMENT_RUNOUT_SENSOR is required with ProUI." -#endif -#if DISABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - #error "INDIVIDUAL_AXIS_HOMING_SUBMENU is required with ProUI." -#endif -#if DISABLED(LCD_SET_PROGRESS_MANUALLY) - #error "LCD_SET_PROGRESS_MANUALLY is required with ProUI." -#endif -#if DISABLED(STATUS_MESSAGE_SCROLLING) - #error "STATUS_MESSAGE_SCROLLING is required with ProUI." -#endif -#if DISABLED(BAUD_RATE_GCODE) - #error "BAUD_RATE_GCODE is required with ProUI." -#endif -#if DISABLED(SOUND_MENU_ITEM) - #error "SOUND_MENU_ITEM is required with ProUI." -#endif -#if DISABLED(PRINTCOUNTER) - #error "PRINTCOUNTER is required with ProUI." -#endif - -#include "../common/dwin_color.h" -#if ENABLED(LED_CONTROL_MENU) - #include "../../../feature/leds/leds.h" -#endif - #define Def_Background_Color RGB( 1, 12, 8) #define Def_Cursor_color RGB(20, 49, 31) #define Def_TitleBg_color RGB( 0, 23, 16) @@ -96,9 +62,6 @@ #define Def_Indicator_Color Color_White #define Def_Coordinate_Color Color_White #define Def_Button_Color RGB( 0, 23, 16) - -#define HAS_ESDIAG 1 - #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) #define Def_Leds_Color 0xFFFFFFFF #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.cpp b/Marlin/src/lcd/e3v2/proui/dwinui.cpp index ecb4754a0f354..5ed36e7dacf05 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwinui.cpp @@ -23,8 +23,8 @@ /** * DWIN Enhanced implementation for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 3.17.1 - * Date: 2022/04/12 + * Version: 3.18.1 + * Date: 2022/07/05 */ #include "../../../inc/MarlinConfigPre.h" @@ -44,7 +44,7 @@ uint16_t DWINUI::pencolor = Color_White; uint16_t DWINUI::textcolor = Def_Text_Color; uint16_t DWINUI::backcolor = Def_Background_Color; uint16_t DWINUI::buttoncolor = Def_Button_Color; -uint8_t DWINUI::font = font8x16; +uint8_t DWINUI::fontid = font8x16; FSTR_P const DWINUI::Author = F(STRING_CONFIG_H_AUTHOR); void (*DWINUI::onTitleDraw)(TitleClass* title) = nullptr; @@ -62,17 +62,15 @@ void DWINUI::init() { textcolor = Def_Text_Color; backcolor = Def_Background_Color; buttoncolor = Def_Button_Color; - font = font8x16; + fontid = font8x16; } // Set text/number font -void DWINUI::setFont(uint8_t cfont) { - font = cfont; -} +void DWINUI::setFont(fontid_t fid) { fontid = fid; } // Get font character width -uint8_t DWINUI::fontWidth(uint8_t cfont) { - switch (cfont) { +uint8_t DWINUI::fontWidth(fontid_t fid) { + switch (fid) { case font6x12 : return 6; case font8x16 : return 8; case font10x20: return 10; @@ -88,8 +86,8 @@ uint8_t DWINUI::fontWidth(uint8_t cfont) { } // Get font character height -uint8_t DWINUI::fontHeight(uint8_t cfont) { - switch (cfont) { +uint8_t DWINUI::fontHeight(fontid_t fid) { + switch (fid) { case font6x12 : return 12; case font8x16 : return 16; case font10x20: return 20; @@ -105,14 +103,10 @@ uint8_t DWINUI::fontHeight(uint8_t cfont) { } // Get screen x coordinates from text column -uint16_t DWINUI::ColToX(uint8_t col) { - return col * fontWidth(font); -} +uint16_t DWINUI::ColToX(uint8_t col) { return col * fontWidth(fontid); } // Get screen y coordinates from text row -uint16_t DWINUI::RowToY(uint8_t row) { - return row * fontHeight(font); -} +uint16_t DWINUI::RowToY(uint8_t row) { return row * fontHeight(fontid); } // Set text/number color void DWINUI::SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) { @@ -152,9 +146,9 @@ void DWINUI::MoveBy(xy_int_t point) { } // Draw a Centered string using arbitrary x1 and x2 margins -void DWINUI::Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) { - const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(size)) / 2 - 1; - DWIN_Draw_String(bShow, size, color, bColor, x, y, string); +void DWINUI::Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) { + const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(fid)) / 2 - 1; + DWIN_Draw_String(bShow, fid, color, bColor, x, y, string); } // Draw a char @@ -164,13 +158,13 @@ void DWINUI::Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint1 // c: ASCII code of char void DWINUI::Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c) { const char string[2] = { c, 0}; - DWIN_Draw_String(false, font, color, backcolor, x, y, string, 1); + DWIN_Draw_String(false, fontid, color, backcolor, x, y, string, 1); } // Draw a char at cursor position and increment cursor void DWINUI::Draw_Char(uint16_t color, const char c) { Draw_Char(color, cursor.x, cursor.y, c); - MoveBy(fontWidth(font), 0); + MoveBy(fontWidth(fontid), 0); } // Draw a string at cursor position @@ -178,49 +172,49 @@ void DWINUI::Draw_Char(uint16_t color, const char c) { // *string: The string // rlimit: For draw less chars than string length use rlimit void DWINUI::Draw_String(const char * const string, uint16_t rlimit) { - DWIN_Draw_String(false, font, textcolor, backcolor, cursor.x, cursor.y, string, rlimit); - MoveBy(strlen(string) * fontWidth(font), 0); + DWIN_Draw_String(false, fontid, textcolor, backcolor, cursor.x, cursor.y, string, rlimit); + MoveBy(strlen(string) * fontWidth(fontid), 0); } void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rlimit) { - DWIN_Draw_String(false, font, color, backcolor, cursor.x, cursor.y, string, rlimit); - MoveBy(strlen(string) * fontWidth(font), 0); + DWIN_Draw_String(false, fontid, color, backcolor, cursor.x, cursor.y, string, rlimit); + MoveBy(strlen(string) * fontWidth(fontid), 0); } // Draw a numeric integer value // bShow: true=display background color; false=don't display background color // signedMode: 1=signed; 0=unsigned -// size: Font size +// fid: Font ID // color: Character color // bColor: Background color // iNum: Number of digits // x/y: Upper-left coordinate // value: Integer value -void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) { +void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) { char nstr[10]; sprintf_P(nstr, PSTR("%*li"), (signedMode ? iNum + 1 : iNum), value); - DWIN_Draw_String(bShow, size, color, bColor, x, y, nstr); + DWIN_Draw_String(bShow, fid, color, bColor, x, y, nstr); } // Draw a numeric float value // bShow: true=display background color; false=don't display background color // signedMode: 1=signed; 0=unsigned -// size: Font size +// fid: Font ID // color: Character color // bColor: Background color // iNum: Number of digits // fNum: Number of decimal digits // x/y: Upper-left coordinate // value: float value -void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { +void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { char nstr[10]; - DWIN_Draw_String(bShow, size, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr)); + DWIN_Draw_String(bShow, fid, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr)); } // ------------------------- Buttons ------------------------------// void DWINUI::Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) { DWIN_Draw_Rectangle(1, bcolor, x1, y1, x2, y2); - Draw_CenteredString(0, font, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption); + Draw_CenteredString(0, fontid, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption); } void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) { diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.h b/Marlin/src/lcd/e3v2/proui/dwinui.h index f8ff0917694d6..a5444718312ce 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.h +++ b/Marlin/src/lcd/e3v2/proui/dwinui.h @@ -24,8 +24,8 @@ /** * DWIN Enhanced implementation for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 3.17.1 - * Date: 2022/04/12 + * Version: 3.18.1 + * Date: 2022/07/05 */ #include "dwin_lcd.h" @@ -39,6 +39,7 @@ #define ICON_BedSizeY ICON_PrintSize #define ICON_BedTramming ICON_SetHome #define ICON_Binary ICON_Contact +#define ICON_BltouchReset ICON_StockConfiguration #define ICON_Brightness ICON_Motion #define ICON_Cancel ICON_StockConfiguration #define ICON_CustomPreheat ICON_SetEndTemp @@ -145,7 +146,7 @@ #define DWIN_FONT_HEAD font10x20 #define DWIN_FONT_ALERT font10x20 #define STATUS_Y 354 -#define LCD_WIDTH (DWIN_WIDTH / 8) // only if the default font is font8x16 +#define LCD_WIDTH (DWIN_WIDTH / 8) // only if the default fontid is font8x16 // Minimum unit (0.1) : multiple (10) #define UNITFDIGITS 1 @@ -156,7 +157,7 @@ constexpr uint8_t TITLE_HEIGHT = 30, // Title bar heig TROWS = (STATUS_Y - TITLE_HEIGHT) / MLINE, // Total rows MROWS = TROWS - 1, // Other-than-Back ICOX = 26, // Menu item icon X position - LBLX = 60, // Menu item label X position + LBLX = 55, // Menu item label X position VALX = 210, // Menu item value X position MENU_CHR_W = 8, MENU_CHR_H = 16, // Menu font 8x16 STAT_CHR_W = 10; @@ -196,7 +197,7 @@ namespace DWINUI { extern uint16_t textcolor; extern uint16_t backcolor; extern uint16_t buttoncolor; - extern uint8_t font; + extern fontid_t fontid; extern FSTR_P const Author; extern void (*onTitleDraw)(TitleClass* title); @@ -205,15 +206,15 @@ namespace DWINUI { void init(); // Set text/number font - void setFont(uint8_t cfont); + void setFont(fontid_t cfont); // Get font character width - uint8_t fontWidth(uint8_t cfont); - inline uint8_t fontWidth() { return fontWidth(font); }; + uint8_t fontWidth(fontid_t cfont); + inline uint8_t fontWidth() { return fontWidth(fontid); }; // Get font character height - uint8_t fontHeight(uint8_t cfont); - inline uint8_t fontHeight() { return fontHeight(font); }; + uint8_t fontHeight(fontid_t cfont); + inline uint8_t fontHeight() { return fontHeight(fontid); }; // Get screen x coordinates from text column uint16_t ColToX(uint8_t col); @@ -278,108 +279,108 @@ namespace DWINUI { // Draw a numeric integer value // bShow: true=display background color; false=don't display background color // signedMode: 1=signed; 0=unsigned - // size: Font size + // fid: Font ID // color: Character color // bColor: Background color // iNum: Number of digits // x/y: Upper-left coordinate // value: Integer value - void Draw_Int(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value); + void Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value); // Draw a positive integer - inline void Draw_Int(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(bShow, 0, size, color, bColor, iNum, x, y, value); + inline void Draw_Int(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(bShow, 0, fid, color, bColor, iNum, x, y, value); } inline void Draw_Int(uint8_t iNum, long value) { - Draw_Int(false, 0, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value); - MoveBy(iNum * fontWidth(font), 0); + Draw_Int(false, 0, fontid, textcolor, backcolor, iNum, cursor.x, cursor.y, value); + MoveBy(iNum * fontWidth(fontid), 0); } inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 0, font, textcolor, backcolor, iNum, x, y, value); + Draw_Int(false, 0, fontid, textcolor, backcolor, iNum, x, y, value); } inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 0, font, color, backcolor, iNum, x, y, value); + Draw_Int(false, 0, fontid, color, backcolor, iNum, x, y, value); } inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 0, font, color, bColor, iNum, x, y, value); + Draw_Int(true, 0, fontid, color, bColor, iNum, x, y, value); } - inline void Draw_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 0, size, color, bColor, iNum, x, y, value); + inline void Draw_Int(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(true, 0, fid, color, bColor, iNum, x, y, value); } // Draw a signed integer - inline void Draw_Signed_Int(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(bShow, 1, size, color, bColor, iNum, x, y, value); + inline void Draw_Signed_Int(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(bShow, 1, fid, color, bColor, iNum, x, y, value); } inline void Draw_Signed_Int(uint8_t iNum, long value) { - Draw_Int(false, 1, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value); - MoveBy(iNum * fontWidth(font), 0); + Draw_Int(false, 1, fontid, textcolor, backcolor, iNum, cursor.x, cursor.y, value); + MoveBy(iNum * fontWidth(fontid), 0); } inline void Draw_Signed_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 1, font, textcolor, backcolor, iNum, x, y, value); + Draw_Int(false, 1, fontid, textcolor, backcolor, iNum, x, y, value); } inline void Draw_Signed_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 1, font, color, backcolor, iNum, x, y, value); + Draw_Int(false, 1, fontid, color, backcolor, iNum, x, y, value); } inline void Draw_Signed_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 1, font, color, bColor, iNum, x, y, value); + Draw_Int(true, 1, fontid, color, bColor, iNum, x, y, value); } - inline void Draw_Signed_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 1, size, color, bColor, iNum, x, y, value); + inline void Draw_Signed_Int(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + Draw_Int(true, 1, fid, color, bColor, iNum, x, y, value); } // Draw a numeric float value // bShow: true=display background color; false=don't display background color // signedMode: 1=signed; 0=unsigned - // size: Font size + // fid: Font ID // color: Character color // bColor: Background color // iNum: Number of digits // fNum: Number of decimal digits // x/y: Upper-left coordinate // value: float value - void Draw_Float(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value); + void Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value); // Draw a positive floating point number - inline void Draw_Float(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(bShow, 0, size, color, bColor, iNum, fNum, x, y, value); + inline void Draw_Float(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(bShow, 0, fid, color, bColor, iNum, fNum, x, y, value); } inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) { - Draw_Float(false, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); - MoveBy((iNum + fNum + 1) * fontWidth(font), 0); + Draw_Float(false, 0, fontid, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); + MoveBy((iNum + fNum + 1) * fontWidth(fontid), 0); } inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 0, font, textcolor, backcolor, iNum, fNum, x, y, value); + Draw_Float(false, 0, fontid, textcolor, backcolor, iNum, fNum, x, y, value); } - inline void Draw_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 0, size, textcolor, backcolor, iNum, fNum, x, y, value); + inline void Draw_Float(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(false, 0, fid, textcolor, backcolor, iNum, fNum, x, y, value); } inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 0, font, color, bColor, iNum, fNum, x, y, value); + Draw_Float(true, 0, fontid, color, bColor, iNum, fNum, x, y, value); } - inline void Draw_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 0, size, color, bColor, iNum, fNum, x, y, value); + inline void Draw_Float(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(true, 0, fid, color, bColor, iNum, fNum, x, y, value); } // Draw a signed floating point number - inline void Draw_Signed_Float(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(bShow, 1, size, color, bColor, iNum, fNum, x, y, value); + inline void Draw_Signed_Float(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(bShow, 1, fid, color, bColor, iNum, fNum, x, y, value); } inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) { - Draw_Float(false, 1, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); - MoveBy((iNum + fNum + 1) * fontWidth(font), 0); + Draw_Float(false, 1, fontid, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); + MoveBy((iNum + fNum + 1) * fontWidth(fontid), 0); } inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 1, font, textcolor, backcolor, iNum, fNum, x, y, value); + Draw_Float(false, 1, fontid, textcolor, backcolor, iNum, fNum, x, y, value); } - inline void Draw_Signed_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 1, size, textcolor, backcolor, iNum, fNum, x, y, value); + inline void Draw_Signed_Float(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(false, 1, fid, textcolor, backcolor, iNum, fNum, x, y, value); } inline void Draw_Signed_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 1, font, color, bColor, iNum, fNum, x, y, value); + Draw_Float(true, 1, fontid, color, bColor, iNum, fNum, x, y, value); } - inline void Draw_Signed_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 1, size, color, bColor, iNum, fNum, x, y, value); + inline void Draw_Signed_Float(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + Draw_Float(true, 1, fid, color, bColor, iNum, fNum, x, y, value); } // Draw a char @@ -407,70 +408,70 @@ namespace DWINUI { } // Draw a string - // size: Font size + // fid: Font ID // color: Character color // bColor: Background color // x/y: Upper-left coordinate of the string // *string: The string inline void Draw_String(uint16_t x, uint16_t y, const char * const string) { - DWIN_Draw_String(false, font, textcolor, backcolor, x, y, string); + DWIN_Draw_String(false, fontid, textcolor, backcolor, x, y, string); } inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_String(false, font, textcolor, backcolor, x, y, FTOP(title)); + DWIN_Draw_String(false, fontid, textcolor, backcolor, x, y, FTOP(title)); } inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) { - DWIN_Draw_String(false, font, color, backcolor, x, y, string); + DWIN_Draw_String(false, fontid, color, backcolor, x, y, string); } inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_String(false, font, color, backcolor, x, y, title); + DWIN_Draw_String(false, fontid, color, backcolor, x, y, title); } inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { - DWIN_Draw_String(true, font, color, bgcolor, x, y, string); + DWIN_Draw_String(true, fontid, color, bgcolor, x, y, string); } inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_String(true, font, color, bgcolor, x, y, title); + DWIN_Draw_String(true, fontid, color, bgcolor, x, y, title); } - inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { - DWIN_Draw_String(true, size, color, bgcolor, x, y, string); + inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { + DWIN_Draw_String(true, fid, color, bgcolor, x, y, string); } - inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_String(true, size, color, bgcolor, x, y, title); + inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { + DWIN_Draw_String(true, fid, color, bgcolor, x, y, title); } // Draw a centered string using DWIN_WIDTH // bShow: true=display background color; false=don't display background color - // size: Font size + // fid: Font ID // color: Character color // bColor: Background color // y: Upper coordinate of the string // *string: The string - void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string); - inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) { - Draw_CenteredString(bShow, size, color, bColor, 0, DWIN_WIDTH, y, string); + void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string); + inline void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) { + Draw_CenteredString(bShow, fid, color, bColor, 0, DWIN_WIDTH, y, string); } - inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) { - Draw_CenteredString(bShow, size, color, bColor, y, FTOP(string)); + inline void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) { + Draw_CenteredString(bShow, fid, color, bColor, y, FTOP(string)); } inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) { - Draw_CenteredString(true, font, color, bcolor, y, string); + Draw_CenteredString(true, fontid, color, bcolor, y, string); } - inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, const char * const string) { - Draw_CenteredString(false, size, color, backcolor, y, string); + inline void Draw_CenteredString(fontid_t fid, uint16_t color, uint16_t y, const char * const string) { + Draw_CenteredString(false, fid, color, backcolor, y, string); } - inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, FSTR_P title) { - Draw_CenteredString(false, size, color, backcolor, y, title); + inline void Draw_CenteredString(fontid_t fid, uint16_t color, uint16_t y, FSTR_P title) { + Draw_CenteredString(false, fid, color, backcolor, y, title); } inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) { - Draw_CenteredString(false, font, color, backcolor, y, string); + Draw_CenteredString(false, fontid, color, backcolor, y, string); } inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) { - Draw_CenteredString(false, font, color, backcolor, y, title); + Draw_CenteredString(false, fontid, color, backcolor, y, title); } inline void Draw_CenteredString(uint16_t y, const char * const string) { - Draw_CenteredString(false, font, textcolor, backcolor, y, string); + Draw_CenteredString(false, fontid, textcolor, backcolor, y, string); } inline void Draw_CenteredString(uint16_t y, FSTR_P title) { - Draw_CenteredString(false, font, textcolor, backcolor, y, title); + Draw_CenteredString(false, fontid, textcolor, backcolor, y, title); } // Draw a box diff --git a/Marlin/src/lcd/e3v2/proui/lockscreen.cpp b/Marlin/src/lcd/e3v2/proui/lockscreen.cpp index 44b595096a884..86c2095294b4b 100644 --- a/Marlin/src/lcd/e3v2/proui/lockscreen.cpp +++ b/Marlin/src/lcd/e3v2/proui/lockscreen.cpp @@ -31,8 +31,10 @@ #if ENABLED(DWIN_LCD_PROUI) -#include "../../../core/types.h" -#include "dwin_lcd.h" +#include "dwin_defines.h" + +#if HAS_LOCKSCREEN + #include "dwinui.h" #include "dwin.h" #include "lockscreen.h" @@ -73,4 +75,6 @@ void LockScreenClass::onEncoder(EncoderState encoder_diffState) { DWIN_UpdateLCD(); } +#endif // HAS_LOCKSCREEN + #endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/proui/menus.cpp b/Marlin/src/lcd/e3v2/proui/menus.cpp index 6438545cb251e..85594fecdbab1 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.cpp +++ b/Marlin/src/lcd/e3v2/proui/menus.cpp @@ -23,8 +23,8 @@ /** * Menu functions for ProUI * Author: Miguel A. Risco-Castillo - * Version: 1.4.1 - * Date: 2022/04/14 + * Version: 1.5.1 + * Date: 2022/05/23 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -166,6 +166,17 @@ void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, val); } +void DrawItemEdit() { + switch (checkkey) { + case SetIntNoDraw: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break; + case SetInt: + case SetPInt: DWINUI::Draw_Signed_Int(HMI_data.Text_Color, HMI_data.Selected_Color, 4 , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value); break; + case SetFloat: + case SetPFloat: DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Selected_Color, 3, MenuData.dp, VALX - MenuData.dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(CurrentMenu->line()), MenuData.Value / POW(10, MenuData.dp)); break; + default: break; + } +} + //----------------------------------------------------------------------------- // On click functions //----------------------------------------------------------------------------- @@ -307,7 +318,7 @@ int8_t HMI_GetInt(const int32_t lo, const int32_t hi) { return 2; } LIMIT(MenuData.Value, lo, hi); - DWINUI::Draw_Signed_Int(HMI_data.Text_Color, HMI_data.Selected_Color, 4 , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value); + DrawItemEdit(); return 1; } return 0; @@ -361,7 +372,7 @@ int8_t HMI_GetFloat(uint8_t dp, int32_t lo, int32_t hi) { return 2; } LIMIT(MenuData.Value, lo, hi); - DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Selected_Color, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(CurrentMenu->line()), MenuData.Value / POW(10, dp)); + DrawItemEdit(); return 1; } return 0; @@ -469,7 +480,7 @@ void MenuItemClass::SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, } void MenuItemClass::draw(int8_t line) { - if (line < 0 || line >= TROWS) return; + if (!WITHIN(line, 0, TROWS - 1)) return; if (onDraw != nullptr) (*onDraw)(this, line); }; @@ -547,6 +558,9 @@ void UpdateMenu(MenuClass* &menu) { menu->draw(); } -void ReDrawMenu() { if (CurrentMenu && checkkey==Menu) CurrentMenu->draw(); } +void ReDrawMenu(const bool force/*=false*/) { + if (CurrentMenu && (force || checkkey == Menu)) CurrentMenu->draw(); + if (force) DrawItemEdit(); +} #endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/proui/menus.h b/Marlin/src/lcd/e3v2/proui/menus.h index d4514d1732374..6a5f8786ca5f9 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.h +++ b/Marlin/src/lcd/e3v2/proui/menus.h @@ -23,8 +23,8 @@ /** * Menu functions for ProUI * Author: Miguel A. Risco-Castillo - * Version: 1.4.1 - * Date: 2022/04/14 + * Version: 1.5.1 + * Date: 2022/05/23 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -168,7 +168,7 @@ bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems); void UpdateMenu(MenuClass* &menu); //Redraw the current Menu if it is valid -void ReDrawMenu(); +void ReDrawMenu(const bool force=false); // Clear MenuItems array and free MenuItems elements void MenuItemsClear(); diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp index c2d01a07eb764..2511d33ff1244 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp @@ -31,8 +31,6 @@ #if BOTH(DWIN_LCD_PROUI, HAS_MESH) -#include "meshviewer.h" - #include "../../../core/types.h" #include "../../marlinui.h" #include "dwin_lcd.h" @@ -40,9 +38,10 @@ #include "dwin.h" #include "dwin_popup.h" #include "../../../feature/bedlevel/bedlevel.h" +#include "meshviewer.h" #if ENABLED(AUTO_BED_LEVELING_UBL) - #include "ubl_tools.h" + #include "bedlevel_tools.h" #endif MeshViewerClass MeshViewer; @@ -112,10 +111,10 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8 void MeshViewerClass::Draw(bool withsave /*= false*/) { Title.ShowCaption(GET_TEXT_F(MSG_MESH_VIEWER)); - #if ENABLED(USE_UBL_VIEWER) + #if USE_UBL_VIEWER DWINUI::ClearMainArea(); - ubl_tools.viewer_print_value = true; - ubl_tools.Draw_Bed_Mesh(-1, 1, 8, 10 + TITLE_HEIGHT); + BedLevelTools.viewer_print_value = true; + BedLevelTools.Draw_Bed_Mesh(-1, 1, 8, 10 + TITLE_HEIGHT); #else DrawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); #endif @@ -127,8 +126,8 @@ void MeshViewerClass::Draw(bool withsave /*= false*/) { else DWINUI::Draw_Button(BTN_Continue, 86, 305); - #if ENABLED(USE_UBL_VIEWER) - ubl_tools.Set_Mesh_Viewer_Status(); + #if USE_UBL_VIEWER + BedLevelTools.Set_Mesh_Viewer_Status(); #else char str_1[6], str_2[6] = ""; ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"), diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.h b/Marlin/src/lcd/e3v2/proui/meshviewer.h index 1e78ff2657b81..3aafe16984aa6 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.h +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.h @@ -21,9 +21,6 @@ */ #pragma once -#include "../../../core/types.h" -#include "../../../feature/bedlevel/bedlevel.h" - /** * Mesh Viewer for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) diff --git a/Marlin/src/lcd/e3v2/proui/plot.cpp b/Marlin/src/lcd/e3v2/proui/plot.cpp index ebc685fa2453c..cb1f6c2dda0fb 100644 --- a/Marlin/src/lcd/e3v2/proui/plot.cpp +++ b/Marlin/src/lcd/e3v2/proui/plot.cpp @@ -46,13 +46,16 @@ #ifdef DWIN_LCD_PROUI +#include "dwin_defines.h" + +#if HAS_PIDPLOT + #include "plot.h" #include "../../../core/types.h" #include "../../marlinui.h" #include "dwin_lcd.h" #include "dwinui.h" -#include "dwin_popup.h" #include "dwin.h" #define Plot_Bg_Color RGB( 1, 12, 8) @@ -71,7 +74,7 @@ void PlotClass::Draw(const frame_rect_t frame, const float max, const float ref) y2 = frame.y + frame.h - 1; r = round((y2) - ref * scale); DWINUI::Draw_Box(1, Plot_Bg_Color, frame); - for (uint8_t i = 1; i < 4; i++) if (i*50 < frame.w) DWIN_Draw_VLine(Line_Color, i*50 + frame.x, frame.y, frame.h); + for (uint8_t i = 1; i < 4; i++) if (i * 50 < frame.w) DWIN_Draw_VLine(Line_Color, i * 50 + frame.x, frame.y, frame.h); DWINUI::Draw_Box(0, Color_White, DWINUI::ExtendFrame(frame, 1)); DWIN_Draw_HLine(Color_Red, frame.x, r, frame.w); } @@ -91,4 +94,6 @@ void PlotClass::Update(const float value) { grphpoints++; } +#endif // HAS_PIDPLOT + #endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index f2a9cb0c08684..57cae3d328584 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -254,6 +254,7 @@ namespace Language_en { LSTR MSG_UBL_SMART_FILLIN = _UxGT("Smart Fill-in"); LSTR MSG_UBL_FILLIN_MESH = _UxGT("Fill-in Mesh"); LSTR MSG_UBL_MESH_FILLED = _UxGT("Missing Points Filled"); + LSTR MSG_UBL_MESH_INVALID = _UxGT("Invalid Mesh"); LSTR MSG_UBL_INVALIDATE_ALL = _UxGT("Invalidate All"); LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("Invalidate Closest"); LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("Fine Tune All"); diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index d65518d67df49..9375016ab05d7 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -187,7 +187,7 @@ typedef struct { * The "nominal" values are as-specified by G-code, and * may never actually be reached due to acceleration limits. */ -typedef struct block_t { +typedef struct PlannerBlock { volatile block_flags_t flag; // Block flags diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index e8511335c165e..6d88eb3df5a64 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -76,6 +76,7 @@ #include "../lcd/extui/ui_api.h" #elif ENABLED(DWIN_LCD_PROUI) #include "../lcd/e3v2/proui/dwin.h" + #include "../lcd/e3v2/proui/bedlevel_tools.h" #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) #include "../lcd/e3v2/jyersui/dwin.h" #endif @@ -2740,7 +2741,7 @@ void MarlinSettings::postprocess() { #endif persistentStore.access_start(); - const uint16_t status = persistentStore.read_data(pos, dest, MESH_STORE_SIZE, &crc); + uint16_t status = persistentStore.read_data(pos, dest, MESH_STORE_SIZE, &crc); persistentStore.access_finish(); #if ENABLED(OPTIMIZED_MESH_STORAGE) @@ -2753,6 +2754,16 @@ void MarlinSettings::postprocess() { bedlevel.set_mesh_from_store(z_mesh_store, bedlevel.z_values); #endif + #if ENABLED(DWIN_LCD_PROUI) + status = !BedLevelTools.meshvalidate(); + if (status) { + bedlevel.invalidate(); + LCD_MESSAGE(MSG_UBL_MESH_INVALID); + } + else + ui.status_printf(0, GET_TEXT_F(MSG_MESH_LOADED), bedlevel.storage_slot); + #endif + if (status) SERIAL_ECHOLNPGM("?Unable to load mesh data."); else DEBUG_ECHOLNPGM("Mesh loaded from slot ", slot); From 0ad83e0af5a7d7f216c8578ed70cd0666a28637b Mon Sep 17 00:00:00 2001 From: toomuchwonder <43323256+toomuchwonder@users.noreply.github.com> Date: Thu, 14 Jul 2022 04:17:53 +0100 Subject: [PATCH 08/27] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20MKS=20UI=20extruder?= =?UTF-8?q?=20speed=20(#24476)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/extui/mks_ui/draw_ui.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.h b/Marlin/src/lcd/extui/mks_ui/draw_ui.h index 798e662220ef3..9bc583d3ad324 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.h +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.h @@ -236,9 +236,9 @@ typedef struct UI_Config_Struct { eStepMax = 10; // Extruder speed (mm/s) uint8_t extruSpeed; - static constexpr uint8_t eSpeedH = 1, + static constexpr uint8_t eSpeedH = 20, eSpeedN = 10, - eSpeedL = 20; + eSpeedL = 1; uint8_t print_state; uint8_t stepPrintSpeed; uint8_t waitEndMoves; From 602e14704bdde975b243c6e5f7c55a7f4b64f4b5 Mon Sep 17 00:00:00 2001 From: DerAndere <26200979+DerAndere1@users.noreply.github.com> Date: Mon, 4 Apr 2022 04:43:42 +0200 Subject: [PATCH 09/27] =?UTF-8?q?=F0=9F=9A=B8=20Better=20M350,=20M114=20wi?= =?UTF-8?q?th=20more=20axes=20(#23986)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/gcode/control/M350_M351.cpp | 18 ++- Marlin/src/gcode/feature/L6470/M906.cpp | 2 +- .../src/gcode/feature/digipot/M907-M910.cpp | 10 +- Marlin/src/gcode/feature/trinamic/M569.cpp | 2 +- Marlin/src/gcode/feature/trinamic/M919.cpp | 2 +- Marlin/src/gcode/motion/G5.cpp | 2 +- Marlin/src/module/stepper.cpp | 111 ++++++++++-------- 7 files changed, 83 insertions(+), 64 deletions(-) diff --git a/Marlin/src/gcode/control/M350_M351.cpp b/Marlin/src/gcode/control/M350_M351.cpp index e78d95af98ad4..1e59865e9d23a 100644 --- a/Marlin/src/gcode/control/M350_M351.cpp +++ b/Marlin/src/gcode/control/M350_M351.cpp @@ -27,6 +27,13 @@ #include "../gcode.h" #include "../../module/stepper.h" +#if LINEAR_AXES == XYZ && EXTRUDERS >= 1 + #define HAS_M350_B_PARAM 1 // "5th axis" (after E0) for an original XYZEB setup. + #if AXIS_COLLISION('B') + #error "M350 parameter 'B' collision with axis name." + #endif +#endif + /** * M350: Set axis microstepping modes. S sets mode for all drivers. * @@ -35,27 +42,30 @@ void GcodeSuite::M350() { if (parser.seen('S')) LOOP_DISTINCT_AXES(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()); - if (parser.seenval('B')) stepper.microstep_mode(E_AXIS + 1, parser.value_byte()); + TERN_(HAS_M350_B_PARAM, if (parser.seenval('B')) stepper.microstep_mode(E_AXIS + 1, parser.value_byte())); stepper.microstep_readings(); } /** * M351: Toggle MS1 MS2 pins directly with axis codes X Y Z . . . E [B] * S# determines MS1, MS2 or MS3, X# sets the pin high/low. + * + * Parameter 'B' sets "5th axis" (after E0) only for an original XYZEB setup. */ void GcodeSuite::M351() { + const int8_t bval = TERN(HAS_M350_B_PARAM, parser.byteval('B', -1), -1); UNUSED(bval); if (parser.seenval('S')) switch (parser.value_byte()) { case 1: LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_ms(i, parser.value_byte(), -1, -1); - if (parser.seenval('B')) stepper.microstep_ms(4, parser.value_byte(), -1, -1); + TERN_(HAS_M350_B_PARAM, if (bval >= 0) stepper.microstep_ms(E_AXIS + 1, bval != 0, -1, -1)); break; case 2: LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_ms(i, -1, parser.value_byte(), -1); - if (parser.seenval('B')) stepper.microstep_ms(4, -1, parser.value_byte(), -1); + TERN_(HAS_M350_B_PARAM, if (bval >= 0) stepper.microstep_ms(E_AXIS + 1, -1, bval != 0, -1)); break; case 3: LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_ms(i, -1, -1, parser.value_byte()); - if (parser.seenval('B')) stepper.microstep_ms(4, -1, -1, parser.value_byte()); + TERN_(HAS_M350_B_PARAM, if (bval >= 0) stepper.microstep_ms(E_AXIS + 1, -1, -1, bval != 0)); break; } stepper.microstep_readings(); diff --git a/Marlin/src/gcode/feature/L6470/M906.cpp b/Marlin/src/gcode/feature/L6470/M906.cpp index a745b5117ac77..ee0211dbadf28 100644 --- a/Marlin/src/gcode/feature/L6470/M906.cpp +++ b/Marlin/src/gcode/feature/L6470/M906.cpp @@ -25,7 +25,7 @@ #if HAS_L64XX #if AXIS_COLLISION('I') - #error "M906 parameter collision with axis name." + #error "M906 parameter 'I' collision with axis name." #endif #include "../../gcode.h" diff --git a/Marlin/src/gcode/feature/digipot/M907-M910.cpp b/Marlin/src/gcode/feature/digipot/M907-M910.cpp index 7c0c8cdea5f1e..bc5882e95d1aa 100644 --- a/Marlin/src/gcode/feature/digipot/M907-M910.cpp +++ b/Marlin/src/gcode/feature/digipot/M907-M910.cpp @@ -52,7 +52,7 @@ void GcodeSuite::M907() { return M907_report(); if (parser.seenval('S')) LOOP_L_N(i, MOTOR_CURRENT_COUNT) stepper.set_digipot_current(i, parser.value_int()); - LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper.set_digipot_current(i, parser.value_int()); // X Y Z (I J K) E (map to drivers according to DIGIPOT_CHANNELS. Default with NUM_AXES 3: map X Y Z E to X Y Z E0) + LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper.set_digipot_current(i, parser.value_int()); // X Y Z (I J K) E (map to drivers according to DIGIPOT_CHANNELS. Default with LINEAR_AXES 3: map X Y Z E to X Y Z E0) // Additional extruders use B,C. // TODO: Change these parameters because 'E' is used and D should be reserved for debugging. B? #if E_STEPPERS >= 2 @@ -104,11 +104,11 @@ void GcodeSuite::M907() { #if HAS_MOTOR_CURRENT_I2C // this one uses actual amps in floating point if (parser.seenval('S')) LOOP_L_N(q, DIGIPOT_I2C_NUM_CHANNELS) digipot_i2c.set_current(q, parser.value_float()); - LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) digipot_i2c.set_current(i, parser.value_float()); // X Y Z (I J K) E (map to drivers according to pots adresses. Default with NUM_AXES 3 X Y Z E: map to X Y Z E0) + LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) digipot_i2c.set_current(i, parser.value_float()); // X Y Z (I J K) E (map to drivers according to pots adresses. Default with LINEAR_AXES 3 X Y Z E: map to X Y Z E0) // Additional extruders use B,C,D. // TODO: Change these parameters because 'E' is used and because 'D' should be reserved for debugging. B? #if E_STEPPERS >= 2 - for (uint8_t i = E_AXIS + 1; i < _MAX(DIGIPOT_I2C_NUM_CHANNELS, (NUM_AXES + 3)); i++) + for (uint8_t i = E_AXIS + 1; i < _MAX(DIGIPOT_I2C_NUM_CHANNELS, (LINEAR_AXES + 3)); i++) if (parser.seenval('B' + i - (E_AXIS + 1))) digipot_i2c.set_current(i, parser.value_float()); #endif #endif @@ -118,7 +118,7 @@ void GcodeSuite::M907() { const float dac_percent = parser.value_float(); LOOP_LOGICAL_AXES(i) stepper_dac.set_current_percent(i, dac_percent); } - LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper_dac.set_current_percent(i, parser.value_float()); // X Y Z (I J K) E (map to drivers according to DAC_STEPPER_ORDER. Default with NUM_AXES 3: X Y Z E map to X Y Z E0) + LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper_dac.set_current_percent(i, parser.value_float()); // X Y Z (I J K) E (map to drivers according to DAC_STEPPER_ORDER. Default with LINEAR_AXES 3: X Y Z E map to X Y Z E0) #endif } @@ -139,7 +139,7 @@ void GcodeSuite::M907() { SERIAL_ECHO(stepper.motor_current_setting[q]); } #if E_STEPPERS >= 2 - SERIAL_ECHOPGM_P(PSTR(" B"), stepper.motor_current_setting[E_AXIS + 1] // B (maps to E1 with NUM_AXES 3 according to DIGIPOT_CHANNELS) + SERIAL_ECHOPGM_P(PSTR(" B"), stepper.motor_current_setting[E_AXIS + 1] // B (maps to E1 with LINEAR_AXES 3 according to DIGIPOT_CHANNELS) #if E_STEPPERS >= 3 , PSTR(" C"), stepper.motor_current_setting[E_AXIS + 2] // C (mapping to E2 must be defined by DIGIPOT_CHANNELS) #endif diff --git a/Marlin/src/gcode/feature/trinamic/M569.cpp b/Marlin/src/gcode/feature/trinamic/M569.cpp index ca8e596062c2d..ba4e43985428e 100644 --- a/Marlin/src/gcode/feature/trinamic/M569.cpp +++ b/Marlin/src/gcode/feature/trinamic/M569.cpp @@ -25,7 +25,7 @@ #if HAS_STEALTHCHOP #if AXIS_COLLISION('I') - #error "M569 parameter collision with axis name." + #error "M569 parameter 'I' collision with axis name." #endif #include "../../gcode.h" diff --git a/Marlin/src/gcode/feature/trinamic/M919.cpp b/Marlin/src/gcode/feature/trinamic/M919.cpp index 6f3dcf729ae97..fa349e7f163bd 100644 --- a/Marlin/src/gcode/feature/trinamic/M919.cpp +++ b/Marlin/src/gcode/feature/trinamic/M919.cpp @@ -25,7 +25,7 @@ #if HAS_TRINAMIC_CONFIG #if AXIS_COLLISION('I') - #error "M919 parameter collision with axis name." + #error "M919 parameter 'I' collision with axis name." #endif #include "../../gcode.h" diff --git a/Marlin/src/gcode/motion/G5.cpp b/Marlin/src/gcode/motion/G5.cpp index 316a59b6506c8..c47f443d41a03 100644 --- a/Marlin/src/gcode/motion/G5.cpp +++ b/Marlin/src/gcode/motion/G5.cpp @@ -25,7 +25,7 @@ #if ENABLED(BEZIER_CURVE_SUPPORT) #if AXIS_COLLISION('I') || AXIS_COLLISION('J') - #error "G5 parameter collision with axis name." + #error "G5 parameter 'I' or 'J' collision with axis name." #endif #include "../../module/motion.h" diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 13a7c19b40033..3ed4259d2a4d7 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -3485,7 +3485,7 @@ void Stepper::report_positions() { void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3) { if (ms1 >= 0) switch (driver) { #if HAS_X_MS_PINS || HAS_X2_MS_PINS - case 0: + case X_AXIS: #if HAS_X_MS_PINS WRITE(X_MS1_PIN, ms1); #endif @@ -3495,7 +3495,7 @@ void Stepper::report_positions() { break; #endif #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS - case 1: + case Y_AXIS: #if HAS_Y_MS_PINS WRITE(Y_MS1_PIN, ms1); #endif @@ -3505,7 +3505,7 @@ void Stepper::report_positions() { break; #endif #if HAS_SOME_Z_MS_PINS - case 2: + case Z_AXIS: #if HAS_Z_MS_PINS WRITE(Z_MS1_PIN, ms1); #endif @@ -3520,43 +3520,43 @@ void Stepper::report_positions() { #endif break; #endif + #if HAS_I_MS_PINS + case I_AXIS: WRITE(I_MS1_PIN, ms1); break + #endif + #if HAS_J_MS_PINS + case J_AXIS: WRITE(J_MS1_PIN, ms1); break + #endif + #if HAS_K_MS_PINS + case K_AXIS: WRITE(K_MS1_PIN, ms1); break + #endif #if HAS_E0_MS_PINS - case 3: WRITE(E0_MS1_PIN, ms1); break; + case E_AXIS: WRITE(E0_MS1_PIN, ms1); break; #endif #if HAS_E1_MS_PINS - case 4: WRITE(E1_MS1_PIN, ms1); break; + case (E_AXIS + 1): WRITE(E1_MS1_PIN, ms1); break; #endif #if HAS_E2_MS_PINS - case 5: WRITE(E2_MS1_PIN, ms1); break; + case (E_AXIS + 2): WRITE(E2_MS1_PIN, ms1); break; #endif #if HAS_E3_MS_PINS - case 6: WRITE(E3_MS1_PIN, ms1); break; + case (E_AXIS + 3): WRITE(E3_MS1_PIN, ms1); break; #endif #if HAS_E4_MS_PINS - case 7: WRITE(E4_MS1_PIN, ms1); break; + case (E_AXIS + 4): WRITE(E4_MS1_PIN, ms1); break; #endif #if HAS_E5_MS_PINS - case 8: WRITE(E5_MS1_PIN, ms1); break; + case (E_AXIS + 5): WRITE(E5_MS1_PIN, ms1); break; #endif #if HAS_E6_MS_PINS - case 9: WRITE(E6_MS1_PIN, ms1); break; + case (E_AXIS + 6): WRITE(E6_MS1_PIN, ms1); break; #endif #if HAS_E7_MS_PINS - case 10: WRITE(E7_MS1_PIN, ms1); break; - #endif - #if HAS_I_MS_PINS - case 11: WRITE(I_MS1_PIN, ms1); break - #endif - #if HAS_J_MS_PINS - case 12: WRITE(J_MS1_PIN, ms1); break - #endif - #if HAS_K_MS_PINS - case 13: WRITE(K_MS1_PIN, ms1); break + case (E_AXIS + 7): WRITE(E7_MS1_PIN, ms1); break; #endif } if (ms2 >= 0) switch (driver) { #if HAS_X_MS_PINS || HAS_X2_MS_PINS - case 0: + case X_AXIS: #if HAS_X_MS_PINS WRITE(X_MS2_PIN, ms2); #endif @@ -3566,7 +3566,7 @@ void Stepper::report_positions() { break; #endif #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS - case 1: + case Y_AXIS: #if HAS_Y_MS_PINS WRITE(Y_MS2_PIN, ms2); #endif @@ -3576,7 +3576,7 @@ void Stepper::report_positions() { break; #endif #if HAS_SOME_Z_MS_PINS - case 2: + case Z_AXIS: #if HAS_Z_MS_PINS WRITE(Z_MS2_PIN, ms2); #endif @@ -3591,43 +3591,43 @@ void Stepper::report_positions() { #endif break; #endif + #if HAS_I_MS_PINS + case I_AXIS: WRITE(I_MS2_PIN, ms2); break + #endif + #if HAS_J_MS_PINS + case J_AXIS: WRITE(J_MS2_PIN, ms2); break + #endif + #if HAS_K_MS_PINS + case K_AXIS: WRITE(K_MS2_PIN, ms2); break + #endif #if HAS_E0_MS_PINS - case 3: WRITE(E0_MS2_PIN, ms2); break; + case E_AXIS: WRITE(E0_MS2_PIN, ms2); break; #endif #if HAS_E1_MS_PINS - case 4: WRITE(E1_MS2_PIN, ms2); break; + case (E_AXIS + 1): WRITE(E1_MS2_PIN, ms2); break; #endif #if HAS_E2_MS_PINS - case 5: WRITE(E2_MS2_PIN, ms2); break; + case (E_AXIS + 2): WRITE(E2_MS2_PIN, ms2); break; #endif #if HAS_E3_MS_PINS - case 6: WRITE(E3_MS2_PIN, ms2); break; + case (E_AXIS + 3): WRITE(E3_MS2_PIN, ms2); break; #endif #if HAS_E4_MS_PINS - case 7: WRITE(E4_MS2_PIN, ms2); break; + case (E_AXIS + 4): WRITE(E4_MS2_PIN, ms2); break; #endif #if HAS_E5_MS_PINS - case 8: WRITE(E5_MS2_PIN, ms2); break; + case (E_AXIS + 5): WRITE(E5_MS2_PIN, ms2); break; #endif #if HAS_E6_MS_PINS - case 9: WRITE(E6_MS2_PIN, ms2); break; + case (E_AXIS + 6): WRITE(E6_MS2_PIN, ms2); break; #endif #if HAS_E7_MS_PINS - case 10: WRITE(E7_MS2_PIN, ms2); break; - #endif - #if HAS_I_MS_PINS - case 11: WRITE(I_MS2_PIN, ms2); break - #endif - #if HAS_J_MS_PINS - case 12: WRITE(J_MS2_PIN, ms2); break - #endif - #if HAS_K_MS_PINS - case 13: WRITE(K_MS2_PIN, ms2); break + case (E_AXIS + 7): WRITE(E7_MS2_PIN, ms2); break; #endif } if (ms3 >= 0) switch (driver) { #if HAS_X_MS_PINS || HAS_X2_MS_PINS - case 0: + case X_AXIS: #if HAS_X_MS_PINS && PIN_EXISTS(X_MS3) WRITE(X_MS3_PIN, ms3); #endif @@ -3637,7 +3637,7 @@ void Stepper::report_positions() { break; #endif #if HAS_Y_MS_PINS || HAS_Y2_MS_PINS - case 1: + case Y_AXIS: #if HAS_Y_MS_PINS && PIN_EXISTS(Y_MS3) WRITE(Y_MS3_PIN, ms3); #endif @@ -3647,7 +3647,7 @@ void Stepper::report_positions() { break; #endif #if HAS_SOME_Z_MS_PINS - case 2: + case Z_AXIS: #if HAS_Z_MS_PINS && PIN_EXISTS(Z_MS3) WRITE(Z_MS3_PIN, ms3); #endif @@ -3662,29 +3662,38 @@ void Stepper::report_positions() { #endif break; #endif + #if HAS_I_MS_PINS + case I_AXIS: WRITE(I_MS3_PIN, ms3); break + #endif + #if HAS_J_MS_PINS + case J_AXIS: WRITE(J_MS3_PIN, ms3); break + #endif + #if HAS_K_MS_PINS + case K_AXIS: WRITE(K_MS3_PIN, ms3); break + #endif #if HAS_E0_MS_PINS && PIN_EXISTS(E0_MS3) - case 3: WRITE(E0_MS3_PIN, ms3); break; + case E_AXIS: WRITE(E0_MS3_PIN, ms3); break; #endif #if HAS_E1_MS_PINS && PIN_EXISTS(E1_MS3) - case 4: WRITE(E1_MS3_PIN, ms3); break; + case (E_AXIS + 1): WRITE(E1_MS3_PIN, ms3); break; #endif #if HAS_E2_MS_PINS && PIN_EXISTS(E2_MS3) - case 5: WRITE(E2_MS3_PIN, ms3); break; + case (E_AXIS + 2): WRITE(E2_MS3_PIN, ms3); break; #endif #if HAS_E3_MS_PINS && PIN_EXISTS(E3_MS3) - case 6: WRITE(E3_MS3_PIN, ms3); break; + case (E_AXIS + 3): WRITE(E3_MS3_PIN, ms3); break; #endif #if HAS_E4_MS_PINS && PIN_EXISTS(E4_MS3) - case 7: WRITE(E4_MS3_PIN, ms3); break; + case (E_AXIS + 4): WRITE(E4_MS3_PIN, ms3); break; #endif #if HAS_E5_MS_PINS && PIN_EXISTS(E5_MS3) - case 8: WRITE(E5_MS3_PIN, ms3); break; + case (E_AXIS + 5): WRITE(E5_MS3_PIN, ms3); break; #endif #if HAS_E6_MS_PINS && PIN_EXISTS(E6_MS3) - case 9: WRITE(E6_MS3_PIN, ms3); break; + case (E_AXIS + 6): WRITE(E6_MS3_PIN, ms3); break; #endif #if HAS_E7_MS_PINS && PIN_EXISTS(E7_MS3) - case 10: WRITE(E7_MS3_PIN, ms3); break; + case (E_AXIS + 7): WRITE(E7_MS3_PIN, ms3); break; #endif } } From 32765c600a5dd535fe7742a420498a79762fe417 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 22 Jul 2022 21:46:38 -0500 Subject: [PATCH 10/27] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20TFT=20image=20packin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/tft/tft_image.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Marlin/src/lcd/tft/tft_image.h b/Marlin/src/lcd/tft/tft_image.h index de046fb0c4c21..aeb1ca2bf5594 100644 --- a/Marlin/src/lcd/tft/tft_image.h +++ b/Marlin/src/lcd/tft/tft_image.h @@ -114,7 +114,13 @@ enum colorMode_t : uint8_t { typedef colorMode_t ColorMode; -typedef struct __attribute__((__packed__)) { +#ifdef __AVR__ + #define IMG_PACKED __attribute__((__packed__)) +#else + #define IMG_PACKED +#endif + +typedef struct IMG_PACKED { void *data; uint16_t width; uint16_t height; From 5ee7e3ffa414ebed8c36ee9a16536b1e021cfabb Mon Sep 17 00:00:00 2001 From: Mike La Spina Date: Fri, 8 Jul 2022 15:02:12 -0500 Subject: [PATCH 11/27] =?UTF-8?q?=F0=9F=90=9B=20Fix=20laser/fan=20sync=20(?= =?UTF-8?q?#24460)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #22690, 307dfb15 --- Marlin/src/lcd/menu/menu_item.h | 2 +- buildroot/tests/mega2560 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index cbbaf0fbabaa4..b0eab65c649be 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -540,7 +540,7 @@ class MenuItem_bool : public MenuEditItemBase { inline void on_fan_update() { thermalManager.set_fan_speed(MenuItemBase::itemIndex, editable.uint8); - TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_FLAG_SYNC_FANS)); + TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_BIT_SYNC_FANS)); } #if ENABLED(EXTRA_FAN_SPEED) diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index aa425564fcad1..89f9e046ce97b 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -188,8 +188,8 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 0 LCD_LANGUAGE en TEMP_SENSOR_C MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' \ AXIS_RELATIVE_MODES '{ false, false, false }' opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT MEATPACK_ON_SERIAL_PORT_1 \ - LASER_FEATURE LASER_SAFETY_TIMEOUT_MS LASER_COOLANT_FLOW_METER AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN -exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 12864 LCD | meatpack | Laser Safety Timeout | M3 Power Sync | Trap Power Smoothing | SERIAL_PORT_2 " "$3" + LASER_FEATURE LASER_SAFETY_TIMEOUT_MS LASER_COOLANT_FLOW_METER AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN LASER_SYNCHRONOUS_M106_M107 +exec_test $1 $2 "MEGA2560 RAMPS | Laser Options | 12864 | Meatpack | Fan Sync | SERIAL_PORT_2 " "$3" # # Test Laser features with 44780 LCD From ab346f24ca60ed78dcd3f44577fe1fc066bb1e67 Mon Sep 17 00:00:00 2001 From: Christophe Huriaux Date: Wed, 6 Jul 2022 22:43:38 +0200 Subject: [PATCH 12/27] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20ST7565=20LCD=20contr?= =?UTF-8?q?ast=20init=20(#24457)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp index bfd44d08dfbba..63e7b2e2b8b55 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp @@ -74,7 +74,6 @@ #define ST7565_ON(N) ((N) ? 0xAF : 0xAE) #define ST7565_OUT_MODE(N) ((N) ? 0xC8 : 0xC0) #define ST7565_POWER_CONTROL(N) (0x28 | (N)) -#define ST7565_V0_RATIO(N) (0x10 | ((N) & 0x7)) #define ST7565_V5_RATIO(N) (0x20 | ((N) & 0x7)) #define ST7565_CONTRAST(N) (0x81), (N) @@ -106,11 +105,14 @@ static const uint8_t u8g_dev_st7565_64128n_HAL_init_seq[] PROGMEM = { ST7565_POWER_CONTROL(0x7), // power control: turn on voltage follower U8G_ESC_DLY(50), // delay 50 ms - ST7565_V0_RATIO(0), // Set V0 voltage resistor ratio. Setting for controlling brightness of Displaytech 64128N + #ifdef ST7565_VOLTAGE_DIVIDER_VALUE + // Set V5 voltage resistor ratio. Affects brightness of Displaytech 64128N + ST7565_V5_RATIO(ST7565_VOLTAGE_DIVIDER_VALUE), + #endif ST7565_INVERTED(0), // display normal, bit val 0: LCD pixel off. - ST7565_CONTRAST(0x1E), // Contrast value. Setting for controlling brightness of Displaytech 64128N + ST7565_CONTRAST(0x1E), // Contrast value for Displaytech 64128N ST7565_ON(1), // display on From cd9a23c4d0b4b7e4a2a8d9dd020cdc787300102e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 20 Jun 2022 21:15:57 -0500 Subject: [PATCH 13/27] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20comments,=20formatti?= =?UTF-8?q?ng?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/marlinui.cpp | 11 ++++------- Marlin/src/module/planner.cpp | 12 ++++++------ Marlin/src/module/stepper/trinamic.cpp | 8 ++------ 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 741cd4ee299e4..7d9cb1b679d6a 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -489,13 +489,10 @@ void MarlinUI::init() { ui.manual_move.menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; ui.encoderPosition = dir; switch (axis) { - case X_AXIS: { void lcd_move_x(); lcd_move_x(); } break; - #if HAS_Y_AXIS - case Y_AXIS: { void lcd_move_y(); lcd_move_y(); } break; - #endif - #if HAS_Z_AXIS - case Z_AXIS: { void lcd_move_z(); lcd_move_z(); } break; - #endif + case X_AXIS: + TERN_(HAS_Y_AXIS, case Y_AXIS:) + TERN_(HAS_Z_AXIS, case Z_AXIS:) + lcd_move_axis(axis); default: break; } } diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index d5ee51f00b131..f2c0ccffd5b4f 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2073,9 +2073,9 @@ bool Planner::_populate_block( TERN_(HAS_K_AXIS, steps_dist_mm.k = dk * mm_per_step[K_AXIS]); #elif ENABLED(MARKFORGED_XY) steps_dist_mm.a = (da - db) * mm_per_step[A_AXIS]; - steps_dist_mm.b = db * mm_per_step[B_AXIS]; + steps_dist_mm.b = db * mm_per_step[B_AXIS]; #elif ENABLED(MARKFORGED_YX) - steps_dist_mm.a = da * mm_per_step[A_AXIS]; + steps_dist_mm.a = da * mm_per_step[A_AXIS]; steps_dist_mm.b = (db - da) * mm_per_step[B_AXIS]; #else XYZ_CODE( @@ -2134,16 +2134,16 @@ bool Planner::_populate_block( sq(steps_dist_mm.x) + sq(steps_dist_mm.y) #endif #else - XYZ_GANG(sq(steps_dist_mm.x), + sq(steps_dist_mm.y), + sq(steps_dist_mm.z)) + XYZ_GANG(sq(steps_dist_mm.x), + sq(steps_dist_mm.y), + sq(steps_dist_mm.z)) #endif ); } /** * At this point at least one of the axes has more steps than - * MIN_STEPS_PER_SEGMENT, ensuring the segment won't get dropped as - * zero-length. It's important to not apply corrections - * to blocks that would get dropped! + * MIN_STEPS_PER_SEGMENT, ensuring the segment won't get dropped + * as zero-length. It's important to not apply corrections to blocks + * that would get dropped! * * A correction function is permitted to add steps to an axis, it * should *never* remove steps! diff --git a/Marlin/src/module/stepper/trinamic.cpp b/Marlin/src/module/stepper/trinamic.cpp index 9811f0960335e..383c02fd608c1 100644 --- a/Marlin/src/module/stepper/trinamic.cpp +++ b/Marlin/src/module/stepper/trinamic.cpp @@ -942,9 +942,7 @@ void reset_trinamic_drivers() { struct SanityHwSerialDetails { const char port[20]; uint32_t address; }; #define TMC_HW_DETAIL_ARGS(A) TERN(A##_HAS_HW_SERIAL, STRINGIFY(A##_HARDWARE_SERIAL), ""), TERN0(A##_HAS_HW_SERIAL, A##_SLAVE_ADDRESS) #define TMC_HW_DETAIL(A) { TMC_HW_DETAIL_ARGS(A) } - constexpr SanityHwSerialDetails sanity_tmc_hw_details[] = { - MAPLIST(TMC_HW_DETAIL, ALL_AXIS_NAMES) - }; + constexpr SanityHwSerialDetails sanity_tmc_hw_details[] = { MAPLIST(TMC_HW_DETAIL, ALL_AXIS_NAMES) }; // constexpr compatible string comparison constexpr bool str_eq_ce(const char * a, const char * b) { @@ -969,9 +967,7 @@ void reset_trinamic_drivers() { struct SanitySwSerialDetails { int32_t txpin; int32_t rxpin; uint32_t address; }; #define TMC_SW_DETAIL_ARGS(A) TERN(A##_HAS_SW_SERIAL, A##_SERIAL_TX_PIN, -1), TERN(A##_HAS_SW_SERIAL, A##_SERIAL_RX_PIN, -1), TERN0(A##_HAS_SW_SERIAL, A##_SLAVE_ADDRESS) #define TMC_SW_DETAIL(A) { TMC_SW_DETAIL_ARGS(A) } - constexpr SanitySwSerialDetails sanity_tmc_sw_details[] = { - MAPLIST(TMC_SW_DETAIL, ALL_AXIS_NAMES) - }; + constexpr SanitySwSerialDetails sanity_tmc_sw_details[] = { MAPLIST(TMC_SW_DETAIL, ALL_AXIS_NAMES) }; constexpr bool sc_sw_done(size_t start, size_t end) { return start == end; } constexpr bool sc_sw_skip(int32_t txpin) { return txpin < 0; } From 9c2d0f47fb58b5dcff902ef351a138582a7b3915 Mon Sep 17 00:00:00 2001 From: Pauli Jokela Date: Thu, 7 Jul 2022 18:59:23 +0300 Subject: [PATCH 14/27] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20safe=20homing=20sani?= =?UTF-8?q?ty-check=20(#24462)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_LCD.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index e41dcdae93fb8..f97f9005da8f7 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1106,7 +1106,7 @@ #if NONE(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, HAS_DELTA_SENSORLESS_PROBING) #define USES_Z_MIN_PROBE_PIN 1 #endif - #if Z_HOME_TO_MIN && TERN1(USES_Z_MIN_PROBE_PIN, ENABLED(USE_PROBE_FOR_Z_HOMING)) + #if Z_HOME_TO_MIN && (DISABLED(USES_Z_MIN_PROBE_PIN) || ENABLED(USE_PROBE_FOR_Z_HOMING)) #define HOMING_Z_WITH_PROBE 1 #endif #ifndef Z_PROBE_LOW_POINT From 0ef496df2ba4c31e934b28b049e03cf34ce81782 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 26 Jun 2022 22:32:00 -0500 Subject: [PATCH 15/27] =?UTF-8?q?=F0=9F=93=9D=20=20Note=20about=20UBL=20ba?= =?UTF-8?q?d=20splits?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp index dbf513c340359..dab2fdd0748ba 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp @@ -35,8 +35,18 @@ #include "../../../MarlinCore.h" #include +//#define DEBUG_UBL_MOTION +#define DEBUG_OUT ENABLED(DEBUG_UBL_MOTION) +#include "../../../core/debug_out.h" + #if !UBL_SEGMENTED + // TODO: The first and last parts of a move might result in very short segment(s) + // after getting split on the cell boundary, so moves like that should not + // get split. This will be most common for moves that start/end near the + // corners of cells. To fix the issue, simply check if the start/end of the line + // is very close to a cell boundary in advance and don't split the line there. + void unified_bed_leveling::line_to_destination_cartesian(const_feedRate_t scaled_fr_mm_s, const uint8_t extruder) { /** * Much of the nozzle movement will be within the same cell. So we will do as little computation @@ -175,7 +185,9 @@ dest.z += z0; planner.buffer_segment(dest, scaled_fr_mm_s, extruder); - } //else printf("FIRST MOVE PRUNED "); + } + else + DEBUG_ECHOLNPGM("[ubl] skip Y segment"); } // At the final destination? Usually not, but when on a Y Mesh Line it's completed. @@ -224,7 +236,9 @@ dest.z += z0; if (!planner.buffer_segment(dest, scaled_fr_mm_s, extruder)) break; - } //else printf("FIRST MOVE PRUNED "); + } + else + DEBUG_ECHOLNPGM("[ubl] skip Y segment"); } if (xy_pos_t(current_position) != xy_pos_t(end)) From 028145909352713da28d5a801e010d145cba1393 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 9 Apr 2022 19:17:04 -0500 Subject: [PATCH 16/27] =?UTF-8?q?=F0=9F=8E=A8=20Misc.=206-axis=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lcd/extui/ftdi_eve_touch_ui/screen_data.h | 2 +- Marlin/src/module/tool_change.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screen_data.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screen_data.h index 057054a6af176..5d715572fa27f 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screen_data.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screen_data.h @@ -45,7 +45,7 @@ */ #define __DECL_DATA_IF_INCLUDED(CLASS) struct CLASS ## Data CLASS ; #define _DECL_DATA_IF_INCLUDED(CLASS) __DECL_DATA_IF_INCLUDED(CLASS) -#define DECL_DATA_IF_INCLUDED(HEADER) TERN(HEADER, _DECL_DATA_IF_INCLUDED(HEADER ## _CLASS), ) +#define DECL_DATA_IF_INCLUDED(HEADER) TERN_(HEADER, _DECL_DATA_IF_INCLUDED(HEADER ## _CLASS)) union screen_data_t { DECL_DATA_IF_INCLUDED(FTDI_INTERFACE_SETTINGS_SCREEN) diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index d9920ae6fcaee..8b35679b306af 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -1052,6 +1052,13 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. if (ok) { IF_DISABLED(TOOLCHANGE_PARK_Y_ONLY, current_position.x = toolchange_settings.change_point.x); IF_DISABLED(TOOLCHANGE_PARK_X_ONLY, current_position.y = toolchange_settings.change_point.y); + #if NONE(TOOLCHANGE_PARK_X_ONLY, TOOLCHANGE_PARK_Y_ONLY) + SECONDARY_AXIS_CODE( + current_position.i = toolchange_settings.change_point.i, + current_position.j = toolchange_settings.change_point.j, + current_position.k = toolchange_settings.change_point.k + ); + #endif planner.buffer_line(current_position, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE), active_extruder); planner.synchronize(); } @@ -1227,6 +1234,13 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { if (can_move_away && toolchange_settings.enable_park) { IF_DISABLED(TOOLCHANGE_PARK_Y_ONLY, current_position.x = toolchange_settings.change_point.x); IF_DISABLED(TOOLCHANGE_PARK_X_ONLY, current_position.y = toolchange_settings.change_point.y); + #if NONE(TOOLCHANGE_PARK_X_ONLY, TOOLCHANGE_PARK_Y_ONLY) + SECONDARY_AXIS_CODE( + current_position.i = toolchange_settings.change_point.i, + current_position.j = toolchange_settings.change_point.j, + current_position.k = toolchange_settings.change_point.k + ); + #endif planner.buffer_line(current_position, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE), old_tool); planner.synchronize(); } From 407c32563b1caf74ed4dead572a7ca159e668f63 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sat, 23 Apr 2022 21:16:15 +1200 Subject: [PATCH 17/27] =?UTF-8?q?=F0=9F=90=9B=20Fix=20BACKLASH=5FCOMPENSAT?= =?UTF-8?q?ION=20compile=20(#24072)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #23826 --- Marlin/src/feature/backlash.cpp | 45 ++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/Marlin/src/feature/backlash.cpp b/Marlin/src/feature/backlash.cpp index 84382cf85680b..8ff192d6872f6 100644 --- a/Marlin/src/feature/backlash.cpp +++ b/Marlin/src/feature/backlash.cpp @@ -162,32 +162,37 @@ int32_t Backlash::get_applied_steps(const AxisEnum axis) { } class Backlash::StepAdjuster { - xyz_long_t applied_steps; -public: - StepAdjuster() { - LOOP_LINEAR_AXES(axis) applied_steps[axis] = backlash.get_applied_steps((AxisEnum)axis); - } - ~StepAdjuster() { - // after backlash compensation parameter changes, ensure applied step count does not change - LOOP_LINEAR_AXES(axis) residual_error[axis] += backlash.get_applied_steps((AxisEnum)axis) - applied_steps[axis]; - } + private: + xyz_long_t applied_steps; + public: + StepAdjuster() { + LOOP_LINEAR_AXES(axis) applied_steps[axis] = backlash.get_applied_steps((AxisEnum)axis); + } + ~StepAdjuster() { + // after backlash compensation parameter changes, ensure applied step count does not change + LOOP_LINEAR_AXES(axis) residual_error[axis] += backlash.get_applied_steps((AxisEnum)axis) - applied_steps[axis]; + } }; -void Backlash::set_correction_uint8(const uint8_t v) { - StepAdjuster adjuster; - correction = v; -} +#if ENABLED(BACKLASH_GCODE) -void Backlash::set_distance_mm(const AxisEnum axis, const float v) { - StepAdjuster adjuster; - distance_mm[axis] = v; -} + void Backlash::set_correction_uint8(const uint8_t v) { + StepAdjuster adjuster; + correction = v; + } -#ifdef BACKLASH_SMOOTHING_MM - void Backlash::set_smoothing_mm(const float v) { + void Backlash::set_distance_mm(const AxisEnum axis, const float v) { StepAdjuster adjuster; - smoothing_mm = v; + distance_mm[axis] = v; } + + #ifdef BACKLASH_SMOOTHING_MM + void Backlash::set_smoothing_mm(const float v) { + StepAdjuster adjuster; + smoothing_mm = v; + } + #endif + #endif #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) From 6904e31e54805ba2ef0b0af2f323658d259c4e91 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Fri, 8 Jul 2022 13:30:03 -0700 Subject: [PATCH 18/27] =?UTF-8?q?=F0=9F=94=A7=20Assert=20Probe=20Temp=20Co?= =?UTF-8?q?mp=20requirements=20(#24468)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_adv.h | 10 ----- Marlin/src/inc/SanityCheck.h | 62 ++++++++++++++++++------------- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 26bdc73d57ac1..9609e0b16f847 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -556,16 +556,6 @@ #endif #endif -// Probe Temperature Compensation -#if !TEMP_SENSOR_PROBE - #undef PTC_PROBE -#endif -#if !TEMP_SENSOR_BED - #undef PTC_BED -#endif -#if !HAS_EXTRUDERS - #undef PTC_HOTEND -#endif #if ANY(PTC_PROBE, PTC_BED, PTC_HOTEND) #define HAS_PTC 1 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 0a29d19bbfba4..270a47c158ae0 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -664,34 +664,46 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #endif #endif - #ifdef PTC_PROBE_START - constexpr auto _ptc_sample_start = PTC_PROBE_START; - constexpr decltype(_ptc_sample_start) _test_ptc_sample_start = 12.3f; - static_assert(_test_ptc_sample_start != 12.3f, "PTC_PROBE_START must be a whole number."); - #endif - #ifdef PTC_PROBE_RES - constexpr auto _ptc_sample_res = PTC_PROBE_RES; - constexpr decltype(_ptc_sample_res) _test_ptc_sample_res = 12.3f; - static_assert(_test_ptc_sample_res != 12.3f, "PTC_PROBE_RES must be a whole number."); - #endif - #ifdef PTC_BED_START - constexpr auto _btc_sample_start = PTC_BED_START; - constexpr decltype(_btc_sample_start) _test_btc_sample_start = 12.3f; - static_assert(_test_btc_sample_start != 12.3f, "PTC_BED_START must be a whole number."); - #endif - #ifdef PTC_BED_RES - constexpr auto _btc_sample_res = PTC_BED_RES; - constexpr decltype(_btc_sample_res) _test_btc_sample_res = 12.3f; - static_assert(_test_btc_sample_res != 12.3f, "PTC_BED_RES must be a whole number."); - #endif - #ifdef PTC_PROBE_TEMP - constexpr auto _btc_probe_temp = PTC_PROBE_TEMP; - constexpr decltype(_btc_probe_temp) _test_btc_probe_temp = 12.3f; - static_assert(_test_btc_probe_temp != 12.3f, "PTC_PROBE_TEMP must be a whole number."); + #if ENABLED(PTC_PROBE) + #if !TEMP_SENSOR_PROBE + #error "PTC_PROBE requires a probe with a thermistor." + #endif + #ifdef PTC_PROBE_START + constexpr auto _ptc_sample_start = PTC_PROBE_START; + constexpr decltype(_ptc_sample_start) _test_ptc_sample_start = 12.3f; + static_assert(_test_ptc_sample_start != 12.3f, "PTC_PROBE_START must be a whole number."); + #endif + #ifdef PTC_PROBE_RES + constexpr auto _ptc_sample_res = PTC_PROBE_RES; + constexpr decltype(_ptc_sample_res) _test_ptc_sample_res = 12.3f; + static_assert(_test_ptc_sample_res != 12.3f, "PTC_PROBE_RES must be a whole number."); + #endif + #if ENABLED(PTC_BED) && defined(PTC_PROBE_TEMP) + constexpr auto _btc_probe_temp = PTC_PROBE_TEMP; + constexpr decltype(_btc_probe_temp) _test_btc_probe_temp = 12.3f; + static_assert(_test_btc_probe_temp != 12.3f, "PTC_PROBE_TEMP must be a whole number."); + #endif + #endif + + #if ENABLED(PTC_BED) + #if !TEMP_SENSOR_BED + #error "PTC_BED requires a bed with a thermistor." + #endif + #ifdef PTC_BED_START + constexpr auto _btc_sample_start = PTC_BED_START; + constexpr decltype(_btc_sample_start) _test_btc_sample_start = 12.3f; + static_assert(_test_btc_sample_start != 12.3f, "PTC_BED_START must be a whole number."); + #endif + #ifdef PTC_BED_RES + constexpr auto _btc_sample_res = PTC_BED_RES; + constexpr decltype(_btc_sample_res) _test_btc_sample_res = 12.3f; + static_assert(_test_btc_sample_res != 12.3f, "PTC_BED_RES must be a whole number."); + #endif #endif + #if ENABLED(PTC_HOTEND) #if EXTRUDERS != 1 - #error "PTC_HOTEND only works with a single extruder." + #error "PTC_HOTEND requires a single extruder." #endif #ifdef PTC_HOTEND_START constexpr auto _etc_sample_start = PTC_HOTEND_START; From 69a1c539fb402cfd8e8f8537d372015cdbc5af53 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 29 Jul 2022 03:42:04 -0500 Subject: [PATCH 19/27] =?UTF-8?q?=F0=9F=A9=B9=20Apply=20linearval=20in=20M?= =?UTF-8?q?600?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/feature/pause/M600.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/src/gcode/feature/pause/M600.cpp b/Marlin/src/gcode/feature/pause/M600.cpp index a74a81e85d3c6..1524041d1e23f 100644 --- a/Marlin/src/gcode/feature/pause/M600.cpp +++ b/Marlin/src/gcode/feature/pause/M600.cpp @@ -121,12 +121,12 @@ void GcodeSuite::M600() { // Move XY axes to filament change position or given position LINEAR_AXIS_CODE( - if (parser.seenval('X')) park_point.x = parser.value_linear_units(), - if (parser.seenval('Y')) park_point.y = parser.value_linear_units(), - if (parser.seenval('Z')) park_point.z = parser.value_linear_units(), // Lift Z axis - if (parser.seenval('I')) park_point.i = parser.value_linear_units(), - if (parser.seenval('J')) park_point.j = parser.value_linear_units(), - if (parser.seenval('K')) park_point.k = parser.value_linear_units() + if (parser.seenval('X')) park_point.x = parser.linearval('X'), + if (parser.seenval('Y')) park_point.y = parser.linearval('Y'), + if (parser.seenval('Z')) park_point.z = parser.linearval('Z'), // Lift Z axis + if (parser.seenval('I')) park_point.i = parser.linearval('I'), + if (parser.seenval('J')) park_point.j = parser.linearval('J'), + if (parser.seenval('K')) park_point.k = parser.linearval('K') ); #if HAS_HOTEND_OFFSET && NONE(DUAL_X_CARRIAGE, DELTA) From 799b8fccaf317ca0bf44b913478f5642fce90547 Mon Sep 17 00:00:00 2001 From: lujios <83166168+lujios@users.noreply.github.com> Date: Tue, 7 Jun 2022 02:22:17 +0200 Subject: [PATCH 20/27] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20G33=20Delta=20Sensor?= =?UTF-8?q?less=20Probing=20compile=20(#24291)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/calibrate/G33.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index f1af2959c1215..9ce1f7dd5bef3 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -437,7 +437,7 @@ void GcodeSuite::G33() { const bool stow_after_each = parser.seen_test('E'); #if HAS_DELTA_SENSORLESS_PROBING - probe.test_sensitivity.set(!parser.seen_test('X'), !parser.seen_test('Y'), !parser.seen_test('Z')); + probe.test_sensitivity = { !parser.seen_test('X'), !parser.seen_test('Y'), !parser.seen_test('Z') }; const bool do_save_offset_adj = parser.seen_test('S'); #endif From a720b1a335e0b8a9ca03671c8b1552af7d8402b0 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Thu, 2 Jun 2022 21:28:07 +1200 Subject: [PATCH 21/27] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20G60/G61=20debug=20co?= =?UTF-8?q?de=20(#24231)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/feature/pause/G60.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/feature/pause/G60.cpp b/Marlin/src/gcode/feature/pause/G60.cpp index 9cd289d7b4135..67bebca71c367 100644 --- a/Marlin/src/gcode/feature/pause/G60.cpp +++ b/Marlin/src/gcode/feature/pause/G60.cpp @@ -48,10 +48,13 @@ void GcodeSuite::G60() { #if ENABLED(SAVED_POSITIONS_DEBUG) { - DEBUG_ECHOPGM(STR_SAVED_POS " S", slot, " :"); const xyze_pos_t &pos = stored_position[slot]; + DEBUG_ECHOPGM(STR_SAVED_POS " S", slot, " :"); DEBUG_ECHOLNPGM_P( - LIST_N(DOUBLE(LINEAR_AXES), SP_X_STR, pos.x, SP_Y_STR, pos.y, SP_Z_STR, pos.z, SP_I_STR, pos.i, SP_J_STR, pos.j, SP_K_STR, pos.k) + LIST_N(DOUBLE(LINEAR_AXES), + SP_X_LBL, pos.x, SP_Y_LBL, pos.y, SP_Z_LBL, pos.z, + SP_I_LBL, pos.i, SP_J_LBL, pos.j, SP_K_LBL, pos.k + ) #if HAS_EXTRUDERS , SP_E_LBL, pos.e #endif From 9ba4c58595b09e21a4912c5e4178f9c977156d59 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 29 Jul 2022 04:00:39 -0500 Subject: [PATCH 22/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fix?= =?UTF-8?q?=20MAP=20macro=20use?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #24191 --- Marlin/src/feature/spindle_laser.h | 1 - Marlin/src/module/stepper/trinamic.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Marlin/src/feature/spindle_laser.h b/Marlin/src/feature/spindle_laser.h index b945032d8ea27..e758f9acbd4c1 100644 --- a/Marlin/src/feature/spindle_laser.h +++ b/Marlin/src/feature/spindle_laser.h @@ -40,7 +40,6 @@ #define PCT_TO_PWM(X) ((X) * 255 / 100) #define PCT_TO_SERVO(X) ((X) * 180 / 100) - // Laser/Cutter operation mode enum CutterMode : int8_t { CUTTER_MODE_ERROR = -1, diff --git a/Marlin/src/module/stepper/trinamic.cpp b/Marlin/src/module/stepper/trinamic.cpp index 383c02fd608c1..12605bf830de1 100644 --- a/Marlin/src/module/stepper/trinamic.cpp +++ b/Marlin/src/module/stepper/trinamic.cpp @@ -980,7 +980,7 @@ void reset_trinamic_drivers() { #define TMC_SWSERIAL_CONFLICT_MSG(A) STRINGIFY(A) "_SLAVE_ADDRESS conflicts with another driver using the same " STRINGIFY(A) "_SERIAL_RX_PIN or " STRINGIFY(A) "_SERIAL_TX_PIN" #define SA_NO_TMC_SW_C(A) static_assert(1 >= count_tmc_sw_serial_matches(TMC_SW_DETAIL_ARGS(A), 0, COUNT(sanity_tmc_sw_details)), TMC_SWSERIAL_CONFLICT_MSG(A)); - MAPLIST(SA_NO_TMC_SW_C, ALL_AXIS_NAMES) + MAP(SA_NO_TMC_SW_C, ALL_AXIS_NAMES) #endif #endif // HAS_TRINAMIC_CONFIG From 3441e917bc4652ad226cef874db9cf818e734fae Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Mon, 18 Jul 2022 21:12:27 -0400 Subject: [PATCH 23/27] =?UTF-8?q?=F0=9F=9A=B8=20Machine-relative=20Z=5FSTE?= =?UTF-8?q?PPER=5FALIGN=5FXY=20(#24261)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration_adv.h | 9 ++++++--- Marlin/src/gcode/calibrate/G34_M422.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index c38e14c63566f..ed280bf9d9e14 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -923,9 +923,12 @@ */ //#define Z_STEPPER_AUTO_ALIGN #if ENABLED(Z_STEPPER_AUTO_ALIGN) - // Define probe X and Y positions for Z1, Z2 [, Z3 [, Z4]] - // If not defined, probe limits will be used. - // Override with 'M422 S X Y' + /** + * Define probe X and Y positions for Z1, Z2 [, Z3 [, Z4]] + * These positions are machine-relative and do not shift with the M206 home offset! + * If not defined, probe limits will be used. + * Override with 'M422 S X Y'. + */ //#define Z_STEPPER_ALIGN_XY { { 10, 190 }, { 100, 10 }, { 190, 190 } } /** diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index d68207885d393..8cf652cd8411c 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -224,13 +224,15 @@ void GcodeSuite::G34() { // Safe clearance even on an incline if ((iteration == 0 || i > 0) && z_probe > current_position.z) do_blocking_move_to_z(z_probe); + xy_pos_t &ppos = z_stepper_align.xy[iprobe]; + if (DEBUGGING(LEVELING)) - DEBUG_ECHOLNPGM_P(PSTR("Probing X"), z_stepper_align.xy[iprobe].x, SP_Y_STR, z_stepper_align.xy[iprobe].y); + DEBUG_ECHOLNPGM_P(PSTR("Probing X"), ppos.x, SP_Y_STR, ppos.y); // Probe a Z height for each stepper. // Probing sanity check is disabled, as it would trigger even in normal cases because // current_position.z has been manually altered in the "dirty trick" above. - const float z_probed_height = probe.probe_at_point(z_stepper_align.xy[iprobe], raise_after, 0, true, false); + const float z_probed_height = probe.probe_at_point(DIFF_TERN(HAS_HOME_OFFSET, ppos, xy_pos_t(home_offset)), raise_after, 0, true, false); if (isnan(z_probed_height)) { SERIAL_ECHOLNPGM("Probing failed"); LCD_MESSAGE(MSG_LCD_PROBING_FAILED); From 39f6ae0e3c774f080326697f49068e1303255c16 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Fri, 15 Jul 2022 15:43:43 -0700 Subject: [PATCH 24/27] =?UTF-8?q?=F0=9F=93=9D=20Update=20board=20MCU=20com?= =?UTF-8?q?ments=20(#24486)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/boards.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 42423f8c7963a..55cab84ec9473 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -333,14 +333,14 @@ #define BOARD_BTT_SKR_E3_DIP 4029 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE) #define BOARD_BTT_SKR_CR6 4030 // BigTreeTech SKR CR6 v1.0 (STM32F103RE) #define BOARD_JGAURORA_A5S_A1 4031 // JGAurora A5S A1 (STM32F103ZE) -#define BOARD_FYSETC_AIO_II 4032 // FYSETC AIO_II -#define BOARD_FYSETC_CHEETAH 4033 // FYSETC Cheetah -#define BOARD_FYSETC_CHEETAH_V12 4034 // FYSETC Cheetah V1.2 -#define BOARD_LONGER3D_LK 4035 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VE +#define BOARD_FYSETC_AIO_II 4032 // FYSETC AIO_II (STM32F103RC) +#define BOARD_FYSETC_CHEETAH 4033 // FYSETC Cheetah (STM32F103RC) +#define BOARD_FYSETC_CHEETAH_V12 4034 // FYSETC Cheetah V1.2 (STM32F103RC) +#define BOARD_LONGER3D_LK 4035 // Longer3D LK1/2 - Alfawise U20/U20+/U30 (STM32F103VE) #define BOARD_CCROBOT_MEEB_3DP 4036 // ccrobot-online.com MEEB_3DP (STM32F103RC) -#define BOARD_CHITU3D_V5 4037 // Chitu3D TronXY X5SA V5 Board -#define BOARD_CHITU3D_V6 4038 // Chitu3D TronXY X5SA V6 Board -#define BOARD_CHITU3D_V9 4039 // Chitu3D TronXY X5SA V9 Board +#define BOARD_CHITU3D_V5 4037 // Chitu3D TronXY X5SA V5 Board (STM32F103ZE) +#define BOARD_CHITU3D_V6 4038 // Chitu3D TronXY X5SA V6 Board (STM32F103ZE) +#define BOARD_CHITU3D_V9 4039 // Chitu3D TronXY X5SA V9 Board (STM32F103ZE) #define BOARD_CREALITY_V4 4040 // Creality v4.x (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V422 4041 // Creality v4.2.2 (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V423 4042 // Creality v4.2.3 (STM32F103RC / STM32F103RE) @@ -397,7 +397,7 @@ #define BOARD_BTT_GTR_V1_0 4214 // BigTreeTech GTR v1.0 (STM32F407IGT) #define BOARD_BTT_OCTOPUS_V1_0 4215 // BigTreeTech Octopus v1.0 (STM32F446ZE) #define BOARD_BTT_OCTOPUS_V1_1 4216 // BigTreeTech Octopus v1.1 (STM32F446ZE) -#define BOARD_BTT_OCTOPUS_PRO_V1_0 4217 // BigTreeTech Octopus Pro v1.0 (STM32F446ZE/STM32F429ZG) +#define BOARD_BTT_OCTOPUS_PRO_V1_0 4217 // BigTreeTech Octopus Pro v1.0 (STM32F446ZE / STM32F429ZG) #define BOARD_LERDGE_K 4218 // Lerdge K (STM32F407ZG) #define BOARD_LERDGE_S 4219 // Lerdge S (STM32F407VE) #define BOARD_LERDGE_X 4220 // Lerdge X (STM32F407VE) @@ -410,13 +410,13 @@ #define BOARD_MKS_ROBIN_PRO_V2 4227 // MKS Robin Pro V2 (STM32F407VE) #define BOARD_MKS_ROBIN_NANO_V3 4228 // MKS Robin Nano V3 (STM32F407VG) #define BOARD_MKS_ROBIN_NANO_V3_1 4229 // MKS Robin Nano V3.1 (STM32F407VE) -#define BOARD_MKS_MONSTER8_V1 4230 // MKS Monster8 V1 (STM32F407VG) -#define BOARD_MKS_MONSTER8_V2 4231 // MKS Monster8 V2 (STM32F407VG) +#define BOARD_MKS_MONSTER8_V1 4230 // MKS Monster8 V1 (STM32F407VE) +#define BOARD_MKS_MONSTER8_V2 4231 // MKS Monster8 V2 (STM32F407VE) #define BOARD_ANET_ET4 4232 // ANET ET4 V1.x (STM32F407VG) #define BOARD_ANET_ET4P 4233 // ANET ET4P V1.x (STM32F407VG) -#define BOARD_FYSETC_CHEETAH_V20 4234 // FYSETC Cheetah V2.0 -#define BOARD_TH3D_EZBOARD_V2 4235 // TH3D EZBoard v2.0 -#define BOARD_OPULO_LUMEN_REV3 4236 // Opulo Lumen PnP Controller REV3 (STM32F407VE/VG) +#define BOARD_FYSETC_CHEETAH_V20 4234 // FYSETC Cheetah V2.0 (STM32F401RC) +#define BOARD_TH3D_EZBOARD_V2 4235 // TH3D EZBoard v2.0 (STM32F405RG) +#define BOARD_OPULO_LUMEN_REV3 4236 // Opulo Lumen PnP Controller REV3 (STM32F407VE / STM32F407VG) #define BOARD_MKS_ROBIN_NANO_V1_3_F4 4237 // MKS Robin Nano V1.3 and MKS Robin Nano-S V1.3 (STM32F407VE) #define BOARD_MKS_EAGLE 4238 // MKS Eagle (STM32F407VE) #define BOARD_ARTILLERY_RUBY 4239 // Artillery Ruby (STM32F401RC) From 78789ee11df33ed456adaccc89ab9af0895abc1b Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed, 20 Jul 2022 10:32:08 +1200 Subject: [PATCH 25/27] =?UTF-8?q?=F0=9F=93=BA=20SKR=5FMINI=5FSCREEN=5FADAP?= =?UTF-8?q?TER=20for=20BTT=20SKR=20Mini=20E3=20V3=20(#24521)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h | 240 +++++++++++------- 1 file changed, 147 insertions(+), 93 deletions(-) diff --git a/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h b/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h index 7dbd4f40b63f3..956cb71f832bc 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h @@ -75,10 +75,6 @@ #define POWER_LOSS_PIN PC12 // Power Loss Detection: PWR-DET #endif -#ifndef NEOPIXEL_PIN - #define NEOPIXEL_PIN PA8 // LED driving pin -#endif - #ifndef PS_ON_PIN #define PS_ON_PIN PC13 // Power Supply Control #endif @@ -153,8 +149,16 @@ * ------ * EXP1 */ +#define EXP1_01_PIN PB5 #define EXP1_02_PIN PA15 +#define EXP1_03_PIN PA9 +#define EXP1_04_PIN -1 +#define EXP1_05_PIN PA10 +#define EXP1_06_PIN PB9 +#define EXP1_07_PIN PB8 #define EXP1_08_PIN PD6 +#define EXP1_09_PIN -1 +#define EXP1_10_PIN -1 #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI /** @@ -176,93 +180,135 @@ #define BEEPER_PIN EXP1_02_PIN #define BTN_EN1 EXP1_08_PIN - #define BTN_EN2 PB8 - #define BTN_ENC PB5 + #define BTN_EN2 EXP1_07_PIN + #define BTN_ENC EXP1_01_PIN #elif HAS_WIRED_LCD - #if ENABLED(CR10_STOCKDISPLAY) - - #define BEEPER_PIN PB5 - #define BTN_ENC EXP1_02_PIN - - #define BTN_EN1 PA9 - #define BTN_EN2 PA10 - - #define LCD_PINS_RS PB8 - #define LCD_PINS_ENABLE EXP1_08_PIN - #define LCD_PINS_D4 PB9 - - #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD! - - #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING - #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #if ENABLED(SKR_MINI_SCREEN_ADAPTER) + /** https://github.com/VoronDesign/Voron-Hardware/tree/master/SKR-Mini_Screen_Adaptor/SRK%20Mini%20E3%20V3.0 + * + * SKR Mini E3 V3.0 SKR Mini Screen Adaptor + * ------ ------ + * 5V | 1 2 | GND MISO | 1 2 | SCK + * CS | 3 4 | SCK (EN1) PA10 | 3 4 | -- + * MOSI | 5 6 | MISO (EN2) PA9 5 6 | MOSI + * 3V3 | 7 8 | GND -- | 7 8 | -- + * ------ GND | 9 10| RESET (Kill) + * SPI ------ + * EXP2 + * + * ------ ------ + * PB5 | 1 2 | PA15 -- | 1 2 | PB5 (BTN_ENC) + * PA9 | 3 4 | RESET (LCD CS) PB8 | 3 4 | PD6 (LCD_A0) + * PA10 5 6 | PB9 (RESET) PB9 5 6 | PA15 (DIN) + * PB8 | 7 8 | PD6 -- | 7 8 | -- + * GND | 9 10| 5V GND | 9 10| 5V + * ------ ------ + * EXP1 EXP1 + */ + #if ENABLED(FYSETC_MINI_12864_2_1) + #define BTN_ENC EXP1_01_PIN + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN + #define BEEPER_PIN -1 + #define LCD_RESET_PIN EXP1_06_PIN + #define DOGLCD_CS EXP1_07_PIN + #define DOGLCD_A0 EXP1_08_PIN + #define DOGLCD_SCK PA5 + #define DOGLCD_MOSI PA7 + + #define FORCE_SOFT_SPI + #define LCD_BACKLIGHT_PIN -1 + #define NEOPIXEL_PIN EXP1_02_PIN + #else + #error "Only CR10_FYSETC_MINI_12864_2_1 and compatibles are currently supported on the BIGTREE_SKR_MINI_E3 with SKR_MINI_SCREEN_ADAPTER" #endif - #define LCD_PINS_RS PB9 - #define LCD_PINS_ENABLE EXP1_02_PIN - #define LCD_PINS_D4 PB8 - #define LCD_PINS_D5 PA10 - #define LCD_PINS_D6 PA9 - #define LCD_PINS_D7 PB5 - #define ADC_KEYPAD_PIN PA1 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! - - #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + #else - #define BTN_ENC EXP1_02_PIN - #define BTN_EN1 PA9 - #define BTN_EN2 PA10 + #if ENABLED(CR10_STOCKDISPLAY) - #define DOGLCD_CS PB8 - #define DOGLCD_A0 PB9 - #define DOGLCD_SCK PB5 - #define DOGLCD_MOSI EXP1_08_PIN + #define BEEPER_PIN EXP1_01_PIN + #define BTN_ENC EXP1_02_PIN - #define FORCE_SOFT_SPI - #define LCD_BACKLIGHT_PIN -1 + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN - #elif IS_TFTGLCD_PANEL + #define LCD_PINS_RS EXP1_07_PIN + #define LCD_PINS_ENABLE EXP1_08_PIN + #define LCD_PINS_D4 EXP1_06_PIN - #if ENABLED(TFTGLCD_PANEL_SPI) + #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD! #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING - #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #error "CAUTION! ZONESTAR_LCD requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" #endif - /** - * TFTGLCD_PANEL_SPI display pinout - * - * Board Display - * ------ ------ - * (BEEPER) PB6 | 1 2 | PB5 (SD_DET) 5V | 1 2 | GND - * RESET | 3 4 | PA9 (MOD_RESET) -- | 3 4 | (SD_DET) - * PB9 5 6 | PA10 (SD_CS) (MOSI) | 5 6 | -- - * PB7 | 7 8 | PB8 (LCD_CS) (SD_CS) | 7 8 | (LCD_CS) - * GND | 9 10 | 5V (SCK) | 9 10 | (MISO) - * ------ ------ - * EXP1 EXP1 - * - * Needs custom cable: - * - * Board Display - * - * EXP1-1 ----------- EXP1-10 - * EXP1-2 ----------- EXP1-9 - * SPI1-4 ----------- EXP1-6 - * EXP1-4 ----------- FREE - * SPI1-3 ----------- EXP1-2 - * EXP1-6 ----------- EXP1-4 - * EXP1-7 ----------- FREE - * EXP1-8 ----------- EXP1-3 - * SPI1-1 ----------- EXP1-1 - * EXP1-10 ----------- EXP1-7 - */ + #define LCD_PINS_RS EXP1_06_PIN + #define LCD_PINS_ENABLE EXP1_02_PIN + #define LCD_PINS_D4 EXP1_07_PIN + #define LCD_PINS_D5 EXP1_05_PIN + #define LCD_PINS_D6 EXP1_03_PIN + #define LCD_PINS_D7 EXP1_01_PIN + #define ADC_KEYPAD_PIN PA1 // Repurpose servo pin for ADC - CONNECTING TO 5V WILL DAMAGE THE BOARD! + + #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + + #define BTN_ENC EXP1_02_PIN + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN + + #define DOGLCD_CS EXP1_07_PIN + #define DOGLCD_A0 EXP1_06_PIN + #define DOGLCD_SCK EXP1_01_PIN + #define DOGLCD_MOSI EXP1_08_PIN + + #define FORCE_SOFT_SPI + #define LCD_BACKLIGHT_PIN -1 + + #elif IS_TFTGLCD_PANEL + + #if ENABLED(TFTGLCD_PANEL_SPI) + + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif + + /** + * TFTGLCD_PANEL_SPI display pinout + * + * Board Display + * ------ ------ + * (BEEPER) PB6 | 1 2 | PB5 (SD_DET) 5V |10 9 | GND + * RESET | 3 4 | PA9 (MOD_RESET) -- | 8 7 | (SD_DET) + * PB9 5 6 | PA10 (SD_CS) (MOSI) | 6 5 | -- + * PB7 | 7 8 | PB8 (LCD_CS) (SD_CS) | 4 3 | (LCD_CS) + * GND | 9 10 | 5V (SCK) | 2 1 | (MISO) + * ------ ------ + * EXP1 EXP1 + * + * Needs custom cable: + * + * Board Display + * + * EXP1-10 ----------- EXP1-10 5V + * EXP1-9 ------------ EXP1-9 GND + * SPI1-4 ------------ EXP1-6 MOSI + * EXP1-7 ------------ n/c + * SPI1-3 ------------ EXP1-2 SCK + * EXP1-5 ------------ EXP1-4 SD_CS + * EXP1-4 ------------ n/c + * EXP1-3 ------------ EXP1-3 LCD_CS + * SPI1-1 ------------ EXP1-1 MISO + * EXP1-1 ------------ EXP1-7 SD_DET + */ + + #define TFTGLCD_CS EXP1_03_PIN - #define TFTGLCD_CS PA9 - - #endif + #endif - #elif ENABLED(FYSETC_MINI_12864_2_1) + #elif ENABLED(FYSETC_MINI_12864_2_1) #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING #error "CAUTION! FYSETC_MINI_12864_2_1 and clones require wiring modifications. See 'pins_BTT_SKR_MINI_E3_V3_0.h' for details. Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning" @@ -294,22 +340,24 @@ * Check the index/notch position twice!!! * On BTT boards pins from IDC10 connector are numbered in unusual order. */ - #define BTN_ENC EXP1_02_PIN - #define BTN_EN1 PB9 - #define BTN_EN2 PB5 - #define BEEPER_PIN -1 + #define BTN_ENC EXP1_02_PIN + #define BTN_EN1 EXP1_06_PIN + #define BTN_EN2 EXP1_01_PIN + #define BEEPER_PIN -1 - #define DOGLCD_CS PA9 - #define DOGLCD_A0 PA10 - #define DOGLCD_SCK PB8 - #define DOGLCD_MOSI PD6 + #define DOGLCD_CS EXP1_03_PIN + #define DOGLCD_A0 EXP1_05_PIN + #define DOGLCD_SCK EXP1_07_PIN + #define DOGLCD_MOSI EXP1_08_PIN - #define FORCE_SOFT_SPI - #define LCD_BACKLIGHT_PIN -1 + #define FORCE_SOFT_SPI + #define LCD_BACKLIGHT_PIN -1 - #else - #error "Only CR10_STOCKDISPLAY, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, MKS_MINI_12864, FYSETC_MINI_12864_2_1, and TFTGLCD_PANEL_(SPI|I2C) are currently supported on the BIGTREE_SKR_MINI_E3." - #endif + #else + #error "Only CR10_STOCKDISPLAY, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, MKS_MINI_12864, FYSETC_MINI_12864_2_1, and TFTGLCD_PANEL_(SPI|I2C) are currently supported on the BIGTREE_SKR_MINI_E3." + #endif + + #endif // SKR_MINI_SCREEN_ADAPTER #endif // HAS_WIRED_LCD @@ -352,9 +400,8 @@ #define BEEPER_PIN EXP1_02_PIN - #define CLCD_MOD_RESET PA9 - #define CLCD_SPI_CS PB8 - + #define CLCD_MOD_RESET EXP1_03_PIN + #define CLCD_SPI_CS EXP1_07_PIN #endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050 // @@ -368,8 +415,8 @@ #if SD_CONNECTION_IS(ONBOARD) #define SD_DETECT_PIN PC3 #elif SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL) - #define SD_DETECT_PIN PB5 - #define SD_SS_PIN PA10 + #define SD_DETECT_PIN EXP1_01_PIN + #define SD_SS_PIN EXP1_05_PIN #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "SD CUSTOM_CABLE is not compatible with SKR Mini E3." #endif @@ -383,3 +430,10 @@ #define SD_SCK_PIN PA5 #define SD_MISO_PIN PA6 #define SD_MOSI_PIN PA7 + +// +// Default NEOPIXEL_PIN +// +#ifndef NEOPIXEL_PIN + #define NEOPIXEL_PIN PA8 // LED driving pin +#endif From 5ccaf1d233b443c7155d76ad8f7456145af08bc2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 10 Jul 2022 22:00:10 -0500 Subject: [PATCH 26/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Add?= =?UTF-8?q?=20Sim=20debug=20with=20lldb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/PlatformIO/debugging/launch.json | 19 ++++++++--- ini/native.ini | 34 ++++++++++++++----- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/buildroot/share/PlatformIO/debugging/launch.json b/buildroot/share/PlatformIO/debugging/launch.json index 583d860eb36c7..f9936ebcedf9c 100644 --- a/buildroot/share/PlatformIO/debugging/launch.json +++ b/buildroot/share/PlatformIO/debugging/launch.json @@ -25,15 +25,26 @@ "svdFile": "${env:HOME}/.platformio/platforms/ststm32@12.1.1/misc/svd/STM32F40x.svd", }, { - "name": "Debug Sim", + "name": "Launch Sim (ggdb)", "request": "launch", "type": "cppdbg", "cwd": "${workspaceRoot}", - //"program": ".pio/build/simulator_linux_debug/MarlinSimulator", - //"program": ".pio/build/simulator_windows/MarlinSimulator", - "program": ".pio/build/simulator_macos_debug/MarlinSimulator", + "program": "${workspaceRoot}/.pio/build/simulator_macos_debug/debug/MarlinSimulator", + //"program": "${workspaceRoot}/.pio/build/simulator_linux_debug/MarlinSimulator", + //"program": "${workspaceRoot}/.pio/build/simulator_windows/MarlinSimulator", "miDebuggerPath": "/opt/local/bin/ggdb", "MIMode": "gdb" + }, + { + "name": "Launch Sim (lldb)", + "request": "launch", + "type": "cppdbg", + "cwd": "${workspaceRoot}", + "program": "${workspaceRoot}/.pio/build/simulator_macos_debug/debug/MarlinSimulator", + //"program": "${workspaceRoot}/.pio/build/simulator_linux_debug/MarlinSimulator", + //"program": "${workspaceRoot}/.pio/build/simulator_windows/MarlinSimulator", + //"targetArchitecture": "arm64", + "MIMode": "lldb" } ] } diff --git a/ini/native.ini b/ini/native.ini index 693a985d4e92b..1905559fd0605 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -63,20 +63,36 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags} # # Simulator for macOS (MacPorts) # -# sudo port install gcc11 gdb glm libsdl2 libsdl2_net freetype -# sudo port install ld64 @3_3 +ld64_xcode + +# +# MacPorts: +# sudo port install gcc11 glm libsdl2 libsdl2_net # # cd /opt/local/bin # sudo rm -f gcc g++ cc # sudo ln -s gcc-mp-11 gcc ; sudo ln -s g++-mp-11 g++ ; sudo ln -s g++ cc -# This step may be obsolete: -# sudo port uninstall ld64 ld64-latest -# -# cd - +# cd - +# rehash # # Use 'sudo port install mesa' to get a if no Xcode is installed. # If Xcode is installed be sure to run `xcode-select --install` first. # +#================================================================================== +# +# Homebrew: +# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +# +# brew install gcc@12 glm sdl2 sdl2_net +# +# cd /opt/homebrew/bin +# sudo rm -f gcc g++ cc +# sudo ln -s gcc-12 gcc ; sudo ln -s g++-12 g++ ; sudo ln -s g++ cc +# cd - +# +# Use 'brew install mesa' to get a if no Xcode is installed. +# If Xcode is installed be sure to run `xcode-select --install` first. +# + [simulator_macos] build_unflags = -lGL -fstack-protector-strong build_flags = @@ -110,7 +126,7 @@ custom_gcc = g++ # pacman -S --needed base-devel mingw-w64-x86_64-toolchain mingw64/mingw-w64-x86_64-glm mingw64/mingw-w64-x86_64-SDL2 mingw64/mingw-w64-x86_64-SDL2_net mingw-w64-x86_64-dlfcn # [env:simulator_windows] -extends = simulator_common +extends = simulator_common build_src_flags = ${simulator_common.build_src_flags} -fpermissive -build_flags = ${simulator_common.build_flags} ${simulator_common.debug_build_flags} -IC:\\msys64\\mingw64\\include\\SDL2 -fno-stack-protector -Wl,-subsystem,windows -ldl -lmingw32 -lSDL2main -lSDL2 -lSDL2_net -lopengl32 -lssp -build_type = debug +build_flags = ${simulator_common.build_flags} ${simulator_common.debug_build_flags} -IC:\\msys64\\mingw64\\include\\SDL2 -fno-stack-protector -Wl,-subsystem,windows -ldl -lmingw32 -lSDL2main -lSDL2 -lSDL2_net -lopengl32 -lssp +build_type = debug From 4b8175c8f8a67bec9b000d354c9bf8c2f5ca37ab Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 29 Jul 2022 05:00:07 -0500 Subject: [PATCH 27/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fix?= =?UTF-8?q?=20and=20improve=20build=5Fall=5Fexamples?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/bin/build_all_examples | 115 +++++++++++++++++------------- buildroot/bin/build_example | 9 +++ buildroot/bin/mftest | 2 +- buildroot/bin/use_example_configs | 1 - buildroot/share/git/firstpush | 2 +- buildroot/share/git/mfdoc | 2 +- buildroot/share/git/mfpr | 2 +- buildroot/share/git/mfprep | 2 +- buildroot/share/git/mfpub | 2 +- 9 files changed, 82 insertions(+), 55 deletions(-) diff --git a/buildroot/bin/build_all_examples b/buildroot/bin/build_all_examples index cb1a41abae1f4..eb661de3c40b9 100755 --- a/buildroot/bin/build_all_examples +++ b/buildroot/bin/build_all_examples @@ -1,20 +1,20 @@ #!/usr/bin/env bash # -# build_all_examples base_branch [resume_point] +# Usage: # -# build_all_examples [-b|--branch=] - Branch to fetch from Configurations repo -# [-c|--continue] - Continue the paused build -# [-d|--debug] - Print extra debug output -# [-i|--ini] - Archive ini/json/yml files in the temp config folder -# [-l|--limit=#] - Limit the number of builds in this run -# [-n|--nobuild] - Don't actually build anything. -# [-r|--resume=] - Start at some config in the filesystem order -# [-s|--skip] - Do the thing +# build_all_examples [-b|--branch=] +# [-c|--continue] +# [-d|--debug] +# [-i|--ini] +# [-l|--limit=#] +# [-n|--nobuild] +# [-r|--resume=] +# [-s|--skip] # # build_all_examples [...] branch [resume-from] # -. mfutil +set -e GITREPO=https://github.com/MarlinFirmware/Configurations.git STAT_FILE=./.pio/.buildall @@ -26,15 +26,39 @@ which git 1>/dev/null 2>&1 || { echo "git not found! Please install it."; exit ; SED=$(command -v gsed 2>/dev/null || command -v sed 2>/dev/null) [[ -z "$SED" ]] && { echo "No sed found, please install sed" ; exit 1 ; } +SELF=`basename "$0"` +HERE=`dirname "$0"` + +# Check if called in the right location +[[ -e "Marlin/src" ]] || { echo -e "This script must be called from a Marlin working copy with:\n ./buildroot/bin/$SELF $1" ; exit ; } + +perror() { echo -e "$0: \033[0;31m$1 -- $2\033[0m" ; } +bugout() { ((DEBUG)) && echo -e "\033[0;32m$1\033[0m" ; } + +usage() { echo " +Usage: $SELF [-b|--branch=] [-d|--debug] [-i|--ini] [-r|--resume=] + $SELF [-b|--branch=] [-d|--debug] [-i|--ini] [-c|--continue] + $SELF [-b|--branch=] [-d|--debug] [-i|--ini] [-s|--skip] + $SELF [-b|--branch=] [-d|--debug] [-n|--nobuild] + $SELF [...] branch [resume-point] +" +} + +# Assume the most recent configs +BRANCH=import-2.0.x +unset FIRST_CONF +EXIT_USAGE= +LIMIT=1000 + while getopts 'b:cdhil:nqr:sv-:' OFLAG; do case "${OFLAG}" in b) BRANCH=$OPTARG ; bugout "Branch: $BRANCH" ;; r) FIRST_CONF="$OPTARG" ; bugout "Resume: $FIRST_CONF" ;; c) CONTINUE=1 ; bugout "Continue" ;; s) CONTSKIP=1 ; bugout "Continue, skipping" ;; - i) COPY_INI=1 ; bugout "Archive INI/JSON/YML files" ;; + i) CREATE_INI=1 ; bugout "Generate an INI file" ;; h) EXIT_USAGE=1 ; break ;; - l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;; + l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT configs" ;; d|v) DEBUG=1 ; bugout "Debug ON" ;; n) DRYRUN=1 ; bugout "Dry Run" ;; -) IFS="=" read -r ONAM OVAL <<< "$OPTARG" @@ -43,8 +67,8 @@ while getopts 'b:cdhil:nqr:sv-:' OFLAG; do resume) FIRST_CONF="$OVAL" ; bugout "Resume: $FIRST_CONF" ;; continue) CONTINUE=1 ; bugout "Continue" ;; skip) CONTSKIP=2 ; bugout "Continue, skipping" ;; - limit) LIMIT=$OVAL ; bugout "Limit to $LIMIT build(s)" ;; - ini) COPY_INI=1 ; bugout "Archive INI/JSON/YML files" ;; + limit) LIMIT=$OVAL ; bugout "Limit to $LIMIT configs" ;; + ini) CREATE_INI=1 ; bugout "Generate an INI file" ;; help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;; debug) DEBUG=1 ; bugout "Debug ON" ;; nobuild) DRYRUN=1 ; bugout "Dry Run" ;; @@ -55,42 +79,35 @@ while getopts 'b:cdhil:nqr:sv-:' OFLAG; do esac done -# Check if called in the right location -[[ -e "Marlin/src" ]] || { echo -e "This script must be called from a Marlin working copy with:\n ./buildroot/bin/$SELF $1" ; exit ; } +# Extra arguments count as BRANCH, FIRST_CONF +shift $((OPTIND - 1)) +[[ $# > 0 ]] && { BRANCH=$1 ; shift 1 ; bugout "BRANCH=$BRANCH" ; } +[[ $# > 0 ]] && { FIRST_CONF=$1 ; shift 1 ; bugout "FIRST_CONF=$FIRST_CONF" ; } +[[ $# > 0 ]] && { EXIT_USAGE=2 ; echo "too many arguments" ; } -if [[ $# -lt 1 || $# -gt 2 ]]; then - echo "Usage: $SELF base_branch [resume_point] - base_branch - Configuration branch to download and build - resume_point - Configuration path to start from" - exit -fi +((EXIT_USAGE)) && { usage ; let EXIT_USAGE-- ; exit $EXIT_USAGE ; } -echo "This script downloads all Configurations and builds Marlin with each one." +echo "This script downloads each Configuration and attempts to build it." echo "On failure the last-built configs will be left in your working copy." echo "Restore your configs with 'git checkout -f' or 'git reset --hard HEAD'." -unset BRANCH -unset FIRST_CONF if [[ -f "$STAT_FILE" ]]; then IFS='*' read BRANCH FIRST_CONF <"$STAT_FILE" fi # If -c is given start from the last attempted build -if [[ $1 == '-c' ]]; then +if ((CONTINUE)); then if [[ -z $BRANCH || -z $FIRST_CONF ]]; then echo "Nothing to continue" exit fi -elif [[ $1 == '-s' ]]; then +elif ((CONTSKIP)); then if [[ -n $BRANCH && -n $FIRST_CONF ]]; then SKIP_CONF=1 else echo "Nothing to skip" exit fi -else - BRANCH=${1:-"import-2.0.x"} - FIRST_CONF=$2 fi # Check if the current repository has unmerged changes @@ -121,47 +138,49 @@ IFS=' CONF_TREE=$( ls -d "$TMP"/config/examples/*/ "$TMP"/config/examples/*/*/ "$TMP"/config/examples/*/*/*/ "$TMP"/config/examples/*/*/*/*/ | grep -vE ".+\.(\w+)$" ) DOSKIP=0 for CONF in $CONF_TREE ; do + # Get a config's directory name DIR=$( echo $CONF | sed "s|$TMP/config/examples/||" ) + # If looking for a config, skip others [[ $FIRST_CONF ]] && [[ $FIRST_CONF != $DIR && "$FIRST_CONF/" != $DIR ]] && continue # Once found, stop looking unset FIRST_CONF + # If skipping, don't build the found one [[ $SKIP_CONF ]] && { unset SKIP_CONF ; continue ; } + # ...if skipping, don't build this one compgen -G "${CONF}Con*.h" > /dev/null || continue - # Build or print build command for --nobuild + # Remember where we are in case of failure + echo "${BRANCH}*${DIR}" >"$STAT_FILE" + + # Build or pretend to build if [[ $DRYRUN ]]; then - echo -e "\033[0;32m[DRYRUN] build_example internal \"$TMP\" \"$DIR\"\033[0m" + echo "[DRYRUN] build_example internal \"$TMP\" \"$DIR\"" else - # Remember where we are in case of failure - echo "${BRANCH}*${DIR}" >"$STAT_FILE" - # Build folder is unknown so delete all report files - if [[ $COPY_INI ]]; then - IFIND='find ./.pio/build/ -name "config.ini" -o -name "schema.json" -o -name "schema.yml"' - $IFIND -exec rm "{}" \; - fi - ((DEBUG)) && echo "\"$HERE/build_example\" internal \"$TMP\" \"$DIR\"" - "$HERE/build_example" internal "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; } - # Build folder is unknown so copy all report files - [[ $COPY_INI ]] && $IFIND -exec cp "{}" "$CONF" \; + # Build folder is unknown so delete all "config.ini" files + [[ $CREATE_INI ]] && find ./.pio/build/ -name "config.ini" -exec rm "{}" \; + ((DEBUG)) && echo "\"$HERE/build_example\" \"internal\" \"$TMP\" \"$DIR\"" + "$HERE/build_example" "internal" "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; } + # Build folder is unknown so copy any "config.ini" + [[ $CREATE_INI ]] && find ./.pio/build/ -name "config.ini" -exec cp "{}" "$CONF" \; fi - ((--LIMIT)) || { echo "Limit reached" ; PAUSE=1 ; break ; } + ((LIMIT--)) || { echo "Limit reached" ; break ; } done -# Delete the build state if not paused early -[[ $PAUSE ]] || rm "$STAT_FILE" +# Delete the build state +rm "$STAT_FILE" # Delete the temp folder if not preserving generated INI files if [[ -e "$TMP/config/examples" ]]; then - if [[ $COPY_INI ]]; then + if [[ $CREATE_INI ]]; then OPEN=$( which gnome-open xdg-open open | head -n1 ) $OPEN "$TMP" - elif [[ ! $PAUSE ]]; then + else rm -rf "$TMP" fi fi diff --git a/buildroot/bin/build_example b/buildroot/bin/build_example index cff8ea253e622..a1e4fbacbd37e 100755 --- a/buildroot/bin/build_example +++ b/buildroot/bin/build_example @@ -22,6 +22,15 @@ cp "$SUB"/Configuration_adv.h Marlin/ 2>/dev/null cp "$SUB"/_Bootscreen.h Marlin/ 2>/dev/null cp "$SUB"/_Statusscreen.h Marlin/ 2>/dev/null +set -e + +# Strip #error lines from Configuration.h +SED=$(which gsed sed | head -n1) +IFS=$'\n'; set -f +$SED -i~ -e "20,30{/#error/d}" Marlin/Configuration.h +rm Marlin/Configuration.h~ +unset IFS; set +f + echo "Building the firmware now..." HERE=`dirname "$0"` $HERE/mftest -s -a -n1 || { echo "Failed"; exit 1; } diff --git a/buildroot/bin/mftest b/buildroot/bin/mftest index edb4068546be4..8a4f3afd4f3eb 100755 --- a/buildroot/bin/mftest +++ b/buildroot/bin/mftest @@ -3,7 +3,7 @@ # mftest Select a test to apply and build # mftest -b [#] Build the auto-detected environment # mftest -u [#] Upload the auto-detected environment -# mftest [name] [index] [-y] Set config options and optionally build a test +# mftest -tname -n# [-y] Set config options and optionally build a test # [[ -d Marlin/src ]] || { echo "Please 'cd' to the Marlin repo root." ; exit 1 ; } diff --git a/buildroot/bin/use_example_configs b/buildroot/bin/use_example_configs index 1fdab1de6c5ba..de2edc24680c4 100755 --- a/buildroot/bin/use_example_configs +++ b/buildroot/bin/use_example_configs @@ -3,7 +3,6 @@ # use_example_configs [repo:]configpath # # Examples: -# use_example_configs # use_example_configs Creality/CR-10/CrealityV1 # use_example_configs release-2.0.9.4:Creality/CR-10/CrealityV1 # diff --git a/buildroot/share/git/firstpush b/buildroot/share/git/firstpush index 9a68fc5afde8d..db025f6c52cf8 100755 --- a/buildroot/share/git/firstpush +++ b/buildroot/share/git/firstpush @@ -16,7 +16,7 @@ BRANCH=${INFO[5]} git push --set-upstream origin HEAD:$BRANCH -OPEN=$(echo $(which gnome-open xdg-open open) | awk '{ print $1 }') +OPEN=$( which gnome-open xdg-open open | head -n1 ) URL="https://github.com/$FORK/$REPO/commits/$BRANCH" if [ -z "$OPEN" ]; then diff --git a/buildroot/share/git/mfdoc b/buildroot/share/git/mfdoc index ce214190164fe..29f0ec6873f4f 100755 --- a/buildroot/share/git/mfdoc +++ b/buildroot/share/git/mfdoc @@ -17,7 +17,7 @@ BRANCH=${INFO[5]} opensite() { URL="http://127.0.0.1:4000/" - OPEN=$(echo $(which gnome-open xdg-open open) | awk '{ print $1 }') + OPEN=$( which gnome-open xdg-open open | head -n1 ) if [ -z "$OPEN" ]; then echo "Can't find a tool to open the URL:" echo $URL diff --git a/buildroot/share/git/mfpr b/buildroot/share/git/mfpr index 230bd2886cf4b..c5eb4522c7994 100755 --- a/buildroot/share/git/mfpr +++ b/buildroot/share/git/mfpr @@ -23,7 +23,7 @@ OLDBRANCH=${INFO[5]} # See if it's been pushed yet if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi -OPEN=$(echo $(which gnome-open xdg-open open) | awk '{ print $1 }') +OPEN=$( which gnome-open xdg-open open | head -n1 ) URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1" if [ -z "$OPEN" ]; then diff --git a/buildroot/share/git/mfprep b/buildroot/share/git/mfprep index 6a8850286153f..b50d71db536ac 100755 --- a/buildroot/share/git/mfprep +++ b/buildroot/share/git/mfprep @@ -18,7 +18,7 @@ DRYRUN=0 TAG1=$1 TAG2=${2:-"HEAD"} -DEST=2.1.x +DEST=2.0.x # Validate that the required tags exist diff --git a/buildroot/share/git/mfpub b/buildroot/share/git/mfpub index 6a912e5515b0d..6ffe627b925af 100755 --- a/buildroot/share/git/mfpub +++ b/buildroot/share/git/mfpub @@ -45,7 +45,7 @@ git clean -d -f opensite() { URL="$1" - OPEN=$(echo $(which gnome-open xdg-open open) | awk '{ print $1 }') + OPEN=$( which gnome-open xdg-open open | head -n1 ) if [ -z "$OPEN" ]; then echo "Can't find a tool to open the URL:" echo $URL