From 5d515c3a2fac22b7adc0222f64aac6dbf7be7eed Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Tue, 24 Mar 2020 17:08:31 -0500 Subject: [PATCH 01/43] Adjust for timing shift on Max7219 displays on AVR's Something has shifted. The previous timing delays on the Max7219 debug displays is too tight without this correction. I suspect something has been optimized and roughly 50ns of needed setup and hold time has disappeared. This corrects the issue and the display results are clean again. --- Marlin/src/feature/max7219.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index 2ec23f019c..b37ba98e7e 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -121,7 +121,7 @@ uint8_t Max7219::suspended; // = 0; #define CRITICAL_SECTION_START() NOOP #define CRITICAL_SECTION_END() NOOP #else - #define SIG_DELAY() DELAY_NS(188) // Delay for 0.1875µs (16MHz AVR) or 0.15µs (20MHz AVR) + #define SIG_DELAY() DELAY_NS(250) // Delay for 0.1875µs (16MHz AVR) or 0.15µs (20MHz AVR) #endif void Max7219::error(const char * const func, const int32_t v1, const int32_t v2/*=-1*/) { From 075a86b076719e0d0cb3d390c71b590a6f3a3750 Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Tue, 24 Mar 2020 17:15:03 -0500 Subject: [PATCH 02/43] Update LCD timing on Formbot T-Rex 2+ machines The code is slightly more optimized than it used to be and this has caused the setup and hold times on the Formbot T-Rex 2+ machines to be insufficient. This change gives sufficient margin and the LCD Display is clean again. --- Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h b/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h index 8fa3686514..5176c699ee 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h @@ -21,6 +21,15 @@ */ #pragma once +/** + * Override default LCD timing for Formbot T-Rex 2+ machines. + * The long LCD cables and the routing near electrically noisy stepper motors + * requires a slightly longer setup and hold time on the signals. + */ +#define BOARD_ST7920_DELAY_1 DELAY_NS(200) +#define BOARD_ST7920_DELAY_2 DELAY_NS(200) +#define BOARD_ST7920_DELAY_3 DELAY_NS(200) + /** * Formbot pin assignments */ From 0aeee64cca2364be6025c58bbf1970ff4c77e710 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 25 Mar 2020 00:03:18 +0000 Subject: [PATCH 03/43] [cron] Bump distribution date (2020-03-25) --- Marlin/src/inc/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 5fc2211023..e9ac62d04f 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2020-03-24" + #define STRING_DISTRIBUTION_DATE "2020-03-25" #endif /** From 1986e1cdf851579958dc1fb245486cb2099582dc Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Tue, 24 Mar 2020 19:38:09 -0500 Subject: [PATCH 04/43] Allow PID_DEBUG to be turned on and off (#17284) M303 D will now toggle activation of PID_DEBUG output. This allows the debug capability to be built into the firmware, but turned on and off as needed. --- Marlin/Configuration.h | 2 +- Marlin/src/gcode/temp/M303.cpp | 16 ++++++++++++++++ Marlin/src/module/temperature.cpp | 18 ++++++------------ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index df99f8b676..77c077ed42 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -473,7 +473,7 @@ #if ENABLED(PIDTEMP) //#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM) //#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM) - //#define PID_DEBUG // Sends debug data to the serial port. + //#define PID_DEBUG // Sends debug data to the serial port. Use M303 D to toggle activation. //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders) diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index 63dcc3f4c4..ba119f0d41 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -38,7 +38,13 @@ * E (-1 for the bed) (default 0) * C Minimum 3. Default 5. * U with a non-zero value will apply the result to current settings + * D Toggles PID_DEBUG flag. No other action happens even if more parameters are specified. */ + +#if ENABLED(PID_DEBUG) + bool PID_Debug_Flag = 0; +#endif + void GcodeSuite::M303() { #if ENABLED(PIDTEMPBED) #define SI H_BED @@ -63,6 +69,16 @@ void GcodeSuite::M303() { const bool u = parser.boolval('U'); const int16_t temp = parser.celsiusval('S', e < 0 ? 70 : 150); + #if ENABLED(PID_DEBUG) + bool d = parser.boolval('D'); + if (d) { + PID_Debug_Flag = !PID_Debug_Flag; + SERIAL_ECHOPGM("PID Debug set to: "); + SERIAL_ECHOLN( PID_Debug_Flag ); + return; + } + #endif + #if DISABLED(BUSY_WHILE_HEATING) KEEPALIVE_STATE(NOT_BUSY); #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index f16a3af046..4e49fcfa24 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -830,6 +830,9 @@ void Temperature::min_temp_error(const heater_ind_t heater) { } #if HOTENDS + #if ENABLED(PID_DEBUG) + extern bool PID_Debug_Flag; + #endif float Temperature::get_pid_output_hotend(const uint8_t E_NAME) { const uint8_t ee = HOTEND_INDEX; @@ -911,24 +914,15 @@ void Temperature::min_temp_error(const heater_ind_t heater) { #endif // PID_OPENLOOP #if ENABLED(PID_DEBUG) - if (ee == active_extruder) { + if (ee == active_extruder && PID_Debug_Flag) { SERIAL_ECHO_START(); - SERIAL_ECHOPAIR( - STR_PID_DEBUG, ee, - STR_PID_DEBUG_INPUT, temp_hotend[ee].celsius, - STR_PID_DEBUG_OUTPUT, pid_output - ); + SERIAL_ECHOPAIR(STR_PID_DEBUG, ee, STR_PID_DEBUG_INPUT, temp_hotend[ee].celsius, STR_PID_DEBUG_OUTPUT, pid_output); #if DISABLED(PID_OPENLOOP) - { - SERIAL_ECHOPAIR( - STR_PID_DEBUG_PTERM, work_pid[ee].Kp, - STR_PID_DEBUG_ITERM, work_pid[ee].Ki, - STR_PID_DEBUG_DTERM, work_pid[ee].Kd + SERIAL_ECHOPAIR( STR_PID_DEBUG_PTERM, work_pid[ee].Kp, STR_PID_DEBUG_ITERM, work_pid[ee].Ki, STR_PID_DEBUG_DTERM, work_pid[ee].Kd #if ENABLED(PID_EXTRUSION_SCALING) , STR_PID_DEBUG_CTERM, work_pid[ee].Kc #endif ); - } #endif SERIAL_EOL(); } From f2ed18d150a070b5542b6113c8bea6e62a31ab02 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 25 Mar 2020 15:07:58 -0500 Subject: [PATCH 05/43] M303 followup - Put 'D' before other params for clean exit. - Use serial on/off for debug status. --- Marlin/Configuration.h | 2 +- Marlin/src/gcode/temp/M303.cpp | 35 ++++++++++++++++++---------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 77c077ed42..f02e69ee5a 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -473,7 +473,7 @@ #if ENABLED(PIDTEMP) //#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM) //#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM) - //#define PID_DEBUG // Sends debug data to the serial port. Use M303 D to toggle activation. + //#define PID_DEBUG // Sends debug data to the serial port. Use 'M303 D' to toggle activation. //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders) diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index ba119f0d41..657dd867ee 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -34,18 +34,31 @@ /** * M303: PID relay autotune * - * S sets the target temperature. (default 150C / 70C) - * E (-1 for the bed) (default 0) - * C Minimum 3. Default 5. - * U with a non-zero value will apply the result to current settings - * D Toggles PID_DEBUG flag. No other action happens even if more parameters are specified. + * S Set the target temperature. (Default: 150C / 70C) + * E Extruder number to tune, or -1 for the bed. (Default: E0) + * C Number of times to repeat the procedure. (Minimum: 3, Default: 5) + * U Flag to apply the result to the current PID values + * + * With PID_DEBUG: + * D Toggle PID debugging and EXIT without further action. */ #if ENABLED(PID_DEBUG) - bool PID_Debug_Flag = 0; + bool pid_debug_flag = 0; #endif void GcodeSuite::M303() { + + #if ENABLED(PID_DEBUG) + if (parser.seen('D')) { + pid_debug_flag = !pid_debug_flag; + SERIAL_ECHO_START(); + SERIAL_ECHOPGM("PID Debug "); + serialprintln_onoff(pid_debug_flag); + return; + } + #endif + #if ENABLED(PIDTEMPBED) #define SI H_BED #else @@ -69,16 +82,6 @@ void GcodeSuite::M303() { const bool u = parser.boolval('U'); const int16_t temp = parser.celsiusval('S', e < 0 ? 70 : 150); - #if ENABLED(PID_DEBUG) - bool d = parser.boolval('D'); - if (d) { - PID_Debug_Flag = !PID_Debug_Flag; - SERIAL_ECHOPGM("PID Debug set to: "); - SERIAL_ECHOLN( PID_Debug_Flag ); - return; - } - #endif - #if DISABLED(BUSY_WHILE_HEATING) KEEPALIVE_STATE(NOT_BUSY); #endif From c86ee574ec7495e926bdfa52d68571758fba7a59 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 25 Mar 2020 15:11:02 -0500 Subject: [PATCH 06/43] Drop old comment --- Marlin/src/feature/max7219.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index b37ba98e7e..a012aeb5fa 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -121,7 +121,7 @@ uint8_t Max7219::suspended; // = 0; #define CRITICAL_SECTION_START() NOOP #define CRITICAL_SECTION_END() NOOP #else - #define SIG_DELAY() DELAY_NS(250) // Delay for 0.1875µs (16MHz AVR) or 0.15µs (20MHz AVR) + #define SIG_DELAY() DELAY_NS(250) #endif void Max7219::error(const char * const func, const int32_t v1, const int32_t v2/*=-1*/) { From 4dea0200500bedb2c9dd9e90ad74cc9fd845edd9 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 26 Mar 2020 00:03:54 +0000 Subject: [PATCH 07/43] [cron] Bump distribution date (2020-03-26) --- Marlin/src/inc/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index e9ac62d04f..7025c695a1 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2020-03-25" + #define STRING_DISTRIBUTION_DATE "2020-03-26" #endif /** From adb6334ba031166e33f256344fc2b01e909cd99f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 25 Mar 2020 17:55:36 -0500 Subject: [PATCH 08/43] Use "dist" instead of "delta" for clarity --- Marlin/src/feature/backlash.cpp | 2 +- Marlin/src/module/motion.cpp | 9 ++-- Marlin/src/module/planner.cpp | 96 ++++++++++++++++----------------- Marlin/src/module/planner.h | 24 +++++---- 4 files changed, 68 insertions(+), 63 deletions(-) diff --git a/Marlin/src/feature/backlash.cpp b/Marlin/src/feature/backlash.cpp index 84cd0a85b7..bc33ae3185 100644 --- a/Marlin/src/feature/backlash.cpp +++ b/Marlin/src/feature/backlash.cpp @@ -113,7 +113,7 @@ void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const error_correction = 0; // Don't take up any backlash in this segment, as it would subtract steps } #endif - // Making a correction reduces the residual error and modifies delta_mm + // Making a correction reduces the residual error and adds block steps if (error_correction) { block->steps[axis] += ABS(error_correction); residual_error[axis] -= error_correction; diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 14da9b47e0..8ab96b9b08 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1292,12 +1292,14 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) { */ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t fr_mm_s=0.0) { + const feedRate_t real_fr_mm_s = fr_mm_s ?: homing_feedrate(axis); + if (DEBUGGING(LEVELING)) { DEBUG_ECHOPAIR(">>> do_homing_move(", axis_codes[axis], ", ", distance, ", "); if (fr_mm_s) DEBUG_ECHO(fr_mm_s); else - DEBUG_ECHOPAIR("[", homing_feedrate(axis), "]"); + DEBUG_ECHOPAIR("[", real_fr_mm_s, "]"); DEBUG_ECHOLNPGM(")"); } @@ -1331,7 +1333,6 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t #endif } - const feedRate_t real_fr_mm_s = fr_mm_s ?: homing_feedrate(axis); #if IS_SCARA // Tell the planner the axis is at 0 current_position[axis] = 0; @@ -1345,13 +1346,13 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t target[axis] = distance; #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - const xyze_float_t delta_mm_cart{0}; + const xyze_float_t cart_dist_mm{0}; #endif // Set delta/cartesian axes directly planner.buffer_segment(target #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - , delta_mm_cart + , cart_dist_mm #endif , real_fr_mm_s, active_extruder ); diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 3b2daf1812..c71a0f61cc 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1648,8 +1648,8 @@ bool Planner::_buffer_steps(const xyze_long_t &target #if HAS_POSITION_FLOAT , const xyze_pos_t &target_float #endif - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - , const xyze_float_t &delta_mm_cart + #if HAS_DIST_MM_ARG + , const xyze_float_t &cart_dist_mm #endif , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters ) { @@ -1666,8 +1666,8 @@ bool Planner::_buffer_steps(const xyze_long_t &target #if HAS_POSITION_FLOAT , target_float #endif - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - , delta_mm_cart + #if HAS_DIST_MM_ARG + , cart_dist_mm #endif , fr_mm_s, extruder, millimeters )) { @@ -1712,8 +1712,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #if HAS_POSITION_FLOAT , const xyze_pos_t &target_float #endif - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - , const xyze_float_t &delta_mm_cart + #if HAS_DIST_MM_ARG + , const xyze_float_t &cart_dist_mm #endif , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/ ) { @@ -1840,51 +1840,51 @@ bool Planner::_populate_block(block_t * const block, bool split_move, * So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head. * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed. */ - struct DeltaMM : abce_float_t { + struct DistanceMM : abce_float_t { #if IS_CORE xyz_pos_t head; #endif - } delta_mm; + } steps_dist_mm; #if IS_CORE #if CORE_IS_XY - delta_mm.head.x = da * steps_to_mm[A_AXIS]; - delta_mm.head.y = db * steps_to_mm[B_AXIS]; - delta_mm.z = dc * steps_to_mm[Z_AXIS]; - delta_mm.a = (da + db) * steps_to_mm[A_AXIS]; - delta_mm.b = CORESIGN(da - db) * steps_to_mm[B_AXIS]; + steps_dist_mm.head.x = da * steps_to_mm[A_AXIS]; + steps_dist_mm.head.y = db * steps_to_mm[B_AXIS]; + steps_dist_mm.z = dc * steps_to_mm[Z_AXIS]; + steps_dist_mm.a = (da + db) * steps_to_mm[A_AXIS]; + steps_dist_mm.b = CORESIGN(da - db) * steps_to_mm[B_AXIS]; #elif CORE_IS_XZ - delta_mm.head.x = da * steps_to_mm[A_AXIS]; - delta_mm.y = db * steps_to_mm[Y_AXIS]; - delta_mm.head.z = dc * steps_to_mm[C_AXIS]; - delta_mm.a = (da + dc) * steps_to_mm[A_AXIS]; - delta_mm.c = CORESIGN(da - dc) * steps_to_mm[C_AXIS]; + steps_dist_mm.head.x = da * steps_to_mm[A_AXIS]; + steps_dist_mm.y = db * steps_to_mm[Y_AXIS]; + steps_dist_mm.head.z = dc * steps_to_mm[C_AXIS]; + steps_dist_mm.a = (da + dc) * steps_to_mm[A_AXIS]; + steps_dist_mm.c = CORESIGN(da - dc) * steps_to_mm[C_AXIS]; #elif CORE_IS_YZ - delta_mm.x = da * steps_to_mm[X_AXIS]; - delta_mm.head.y = db * steps_to_mm[B_AXIS]; - delta_mm.head.z = dc * steps_to_mm[C_AXIS]; - delta_mm.b = (db + dc) * steps_to_mm[B_AXIS]; - delta_mm.c = CORESIGN(db - dc) * steps_to_mm[C_AXIS]; + steps_dist_mm.x = da * steps_to_mm[X_AXIS]; + steps_dist_mm.head.y = db * steps_to_mm[B_AXIS]; + steps_dist_mm.head.z = dc * steps_to_mm[C_AXIS]; + steps_dist_mm.b = (db + dc) * steps_to_mm[B_AXIS]; + steps_dist_mm.c = CORESIGN(db - dc) * steps_to_mm[C_AXIS]; #endif #else - delta_mm.a = da * steps_to_mm[A_AXIS]; - delta_mm.b = db * steps_to_mm[B_AXIS]; - delta_mm.c = dc * steps_to_mm[C_AXIS]; + steps_dist_mm.a = da * steps_to_mm[A_AXIS]; + steps_dist_mm.b = db * steps_to_mm[B_AXIS]; + steps_dist_mm.c = dc * steps_to_mm[C_AXIS]; #endif #if EXTRUDERS - delta_mm.e = esteps_float * steps_to_mm[E_AXIS_N(extruder)]; + steps_dist_mm.e = esteps_float * steps_to_mm[E_AXIS_N(extruder)]; #else - delta_mm.e = 0.0f; + steps_dist_mm.e = 0.0f; #endif #if ENABLED(LCD_SHOW_E_TOTAL) - e_move_accumulator += delta_mm.e; + e_move_accumulator += steps_dist_mm.e; #endif if (block->steps.a < MIN_STEPS_PER_SEGMENT && block->steps.b < MIN_STEPS_PER_SEGMENT && block->steps.c < MIN_STEPS_PER_SEGMENT) { block->millimeters = (0 #if EXTRUDERS - + ABS(delta_mm.e) + + ABS(steps_dist_mm.e) #endif ); } @@ -1894,13 +1894,13 @@ bool Planner::_populate_block(block_t * const block, bool split_move, else block->millimeters = SQRT( #if CORE_IS_XY - sq(delta_mm.head.x) + sq(delta_mm.head.y) + sq(delta_mm.z) + sq(steps_dist_mm.head.x) + sq(steps_dist_mm.head.y) + sq(steps_dist_mm.z) #elif CORE_IS_XZ - sq(delta_mm.head.x) + sq(delta_mm.y) + sq(delta_mm.head.z) + sq(steps_dist_mm.head.x) + sq(steps_dist_mm.y) + sq(steps_dist_mm.head.z) #elif CORE_IS_YZ - sq(delta_mm.x) + sq(delta_mm.head.y) + sq(delta_mm.head.z) + sq(steps_dist_mm.x) + sq(steps_dist_mm.head.y) + sq(steps_dist_mm.head.z) #else - sq(delta_mm.x) + sq(delta_mm.y) + sq(delta_mm.z) + sq(steps_dist_mm.x) + sq(steps_dist_mm.y) + sq(steps_dist_mm.z) #endif ); @@ -2071,7 +2071,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #if ENABLED(FILAMENT_WIDTH_SENSOR) if (extruder == FILAMENT_SENSOR_EXTRUDER_NUM) // Only for extruder with filament sensor - filwidth.advance_e(delta_mm.e); + filwidth.advance_e(steps_dist_mm.e); #endif // Calculate and limit speed in mm/sec @@ -2081,7 +2081,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, // Linear axes first with less logic LOOP_XYZ(i) { - current_speed[i] = delta_mm[i] * inverse_secs; + current_speed[i] = steps_dist_mm[i] * inverse_secs; const feedRate_t cs = ABS(current_speed[i]), max_fr = settings.max_feedrate_mm_s[i]; if (cs > max_fr) NOMORE(speed_factor, max_fr / cs); @@ -2090,7 +2090,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, // Limit speed on extruders, if any #if EXTRUDERS { - current_speed.e = delta_mm.e * inverse_secs; + current_speed.e = steps_dist_mm.e * inverse_secs; #if BOTH(MIXING_EXTRUDER, RETRACT_SYNC_MIXING) // Move all mixing extruders at the specified rate if (mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL) @@ -2308,10 +2308,10 @@ bool Planner::_populate_block(block_t * const block, bool split_move, static xyze_float_t prev_unit_vec; xyze_float_t unit_vec = - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - delta_mm_cart + #if HAS_DIST_MM_ARG + cart_dist_mm #else - { delta_mm.x, delta_mm.y, delta_mm.z, delta_mm.e } + { steps_dist_mm.x, steps_dist_mm.y, steps_dist_mm.z, steps_dist_mm.e } #endif ; unit_vec *= inverse_millimeters; @@ -2572,8 +2572,8 @@ void Planner::buffer_sync_block() { * millimeters - the length of the movement, if known */ bool Planner::buffer_segment(const float &a, const float &b, const float &c, const float &e - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - , const xyze_float_t &delta_mm_cart + #if HAS_DIST_MM_ARG + , const xyze_float_t &cart_dist_mm #endif , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/ ) { @@ -2651,8 +2651,8 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con #if HAS_POSITION_FLOAT , target_float #endif - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - , delta_mm_cart + #if HAS_DIST_MM_ARG + , cart_dist_mm #endif , fr_mm_s, extruder, millimeters ) @@ -2686,17 +2686,17 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con #if IS_KINEMATIC #if DISABLED(CLASSIC_JERK) - const xyze_pos_t delta_mm_cart = { + const xyze_pos_t cart_dist_mm = { rx - position_cart.x, ry - position_cart.y, rz - position_cart.z, e - position_cart.e }; #else - const xyz_pos_t delta_mm_cart = { rx - position_cart.x, ry - position_cart.y, rz - position_cart.z }; + const xyz_pos_t cart_dist_mm = { rx - position_cart.x, ry - position_cart.y, rz - position_cart.z }; #endif float mm = millimeters; if (mm == 0.0) - mm = (delta_mm_cart.x != 0.0 || delta_mm_cart.y != 0.0) ? delta_mm_cart.magnitude() : ABS(delta_mm_cart.z); + mm = (cart_dist_mm.x != 0.0 || cart_dist_mm.y != 0.0) ? cart_dist_mm.magnitude() : ABS(cart_dist_mm.z); // Cartesian XYZ to kinematic ABC, stored in global 'delta' inverse_kinematics(machine); @@ -2712,7 +2712,7 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con #endif if (buffer_segment(delta.a, delta.b, delta.c, machine.e #if DISABLED(CLASSIC_JERK) - , delta_mm_cart + , cart_dist_mm #endif , feedrate, extruder, mm )) { diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index ae104eb354..24c02c01c5 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -61,6 +61,10 @@ manual_feedrate_mm_s { _mf.x / 60.0f, _mf.y / 60.0f, _mf.z / 60.0f, _mf.e / 60.0f }; #endif +#if IS_KINEMATIC && DISABLED(CLASSIC_JERK) + #define HAS_DIST_MM_ARG 1 +#endif + enum BlockFlagBit : char { // Recalculate trapezoids on entry junction. For optimization. BLOCK_BIT_RECALCULATE, @@ -588,8 +592,8 @@ class Planner { #if HAS_POSITION_FLOAT , const xyze_pos_t &target_float #endif - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - , const xyze_float_t &delta_mm_cart + #if HAS_DIST_MM_ARG + , const xyze_float_t &cart_dist_mm #endif , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0 ); @@ -611,8 +615,8 @@ class Planner { #if HAS_POSITION_FLOAT , const xyze_pos_t &target_float #endif - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - , const xyze_float_t &delta_mm_cart + #if HAS_DIST_MM_ARG + , const xyze_float_t &cart_dist_mm #endif , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0 ); @@ -643,21 +647,21 @@ class Planner { * millimeters - the length of the movement, if known */ static bool buffer_segment(const float &a, const float &b, const float &c, const float &e - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - , const xyze_float_t &delta_mm_cart + #if HAS_DIST_MM_ARG + , const xyze_float_t &cart_dist_mm #endif , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0 ); FORCE_INLINE static bool buffer_segment(abce_pos_t &abce - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - , const xyze_float_t &delta_mm_cart + #if HAS_DIST_MM_ARG + , const xyze_float_t &cart_dist_mm #endif , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0 ) { return buffer_segment(abce.a, abce.b, abce.c, abce.e - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) - , delta_mm_cart + #if HAS_DIST_MM_ARG + , cart_dist_mm #endif , fr_mm_s, extruder, millimeters); } From 0175189c34807733c2230d36e470a713a8186d49 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 25 Mar 2020 19:17:50 -0500 Subject: [PATCH 09/43] Allow G2_PWM to be slimmer --- Marlin/src/HAL/DUE/fastio/G2_PWM.cpp | 147 +++++++++++++++------- Marlin/src/module/configuration_store.cpp | 2 +- 2 files changed, 105 insertions(+), 44 deletions(-) diff --git a/Marlin/src/HAL/DUE/fastio/G2_PWM.cpp b/Marlin/src/HAL/DUE/fastio/G2_PWM.cpp index fd2c6ccf97..672932f56c 100644 --- a/Marlin/src/HAL/DUE/fastio/G2_PWM.cpp +++ b/Marlin/src/HAL/DUE/fastio/G2_PWM.cpp @@ -46,6 +46,31 @@ #include "G2_PWM.h" +#if PIN_EXISTS(MOTOR_CURRENT_PWM_X) + #define G2_PWM_X 1 +#else + #define G2_PWM_X 0 +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) + #define G2_PWM_Y 1 +#else + #define G2_PWM_Y 0 +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) + #define G2_PWM_Z 1 +#else + #define G2_PWM_Z 0 +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_E) + #define G2_PWM_E 1 +#else + #define G2_PWM_E 0 +#endif +#define G2_MASK_X(V) (G2_PWM_X * (V)) +#define G2_MASK_Y(V) (G2_PWM_Y * (V)) +#define G2_MASK_Z(V) (G2_PWM_Z * (V)) +#define G2_MASK_E(V) (G2_PWM_E * (V)) + volatile uint32_t *SODR_A = &PIOA->PIO_SODR, *SODR_B = &PIOB->PIO_SODR, *CODR_A = &PIOA->PIO_CODR, @@ -55,10 +80,18 @@ PWM_map ISR_table[NUM_PWMS] = PWM_MAP_INIT; void Stepper::digipot_init() { - OUT_WRITE(MOTOR_CURRENT_PWM_X_PIN, 0); // init pins - OUT_WRITE(MOTOR_CURRENT_PWM_Y_PIN, 0); - OUT_WRITE(MOTOR_CURRENT_PWM_Z_PIN, 0); - OUT_WRITE(MOTOR_CURRENT_PWM_E_PIN, 0); + #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) + OUT_WRITE(MOTOR_CURRENT_PWM_X_PIN, 0); // init pins + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) + OUT_WRITE(MOTOR_CURRENT_PWM_Y_PIN, 0); + #endif + #if G2_PWM_Z + OUT_WRITE(MOTOR_CURRENT_PWM_Z_PIN, 0); + #endif + #if G2_PWM_E + OUT_WRITE(MOTOR_CURRENT_PWM_E_PIN, 0); + #endif #define WPKEY (0x50574D << 8) // “PWM” in ASCII #define WPCMD_DIS_SW 0 // command to disable Write Protect SW @@ -71,30 +104,51 @@ void Stepper::digipot_init() { PWM->PWM_WPCR = WPKEY | WPRG_ALL | WPCMD_DIS_SW; // enable setting of all PWM registers PWM->PWM_CLK = PWM_CLOCK_F; // enable CLK_A and set it to 1MHz, leave CLK_B disabled PWM->PWM_CH_NUM[0].PWM_CMR = 0b1011; // set channel 0 to Clock A input & to left aligned - PWM->PWM_CH_NUM[1].PWM_CMR = 0b1011; // set channel 1 to Clock A input & to left aligned - PWM->PWM_CH_NUM[2].PWM_CMR = 0b1011; // set channel 2 to Clock A input & to left aligned - PWM->PWM_CH_NUM[3].PWM_CMR = 0b1011; // set channel 3 to Clock A input & to left aligned - PWM->PWM_CH_NUM[4].PWM_CMR = 0b1011; // set channel 4 to Clock A input & to left aligned + if (G2_PWM_X) PWM->PWM_CH_NUM[1].PWM_CMR = 0b1011; // set channel 1 to Clock A input & to left aligned + if (G2_PWM_Y) PWM->PWM_CH_NUM[2].PWM_CMR = 0b1011; // set channel 2 to Clock A input & to left aligned + if (G2_PWM_Z) PWM->PWM_CH_NUM[3].PWM_CMR = 0b1011; // set channel 3 to Clock A input & to left aligned + if (G2_PWM_E) PWM->PWM_CH_NUM[4].PWM_CMR = 0b1011; // set channel 4 to Clock A input & to left aligned PWM->PWM_CH_NUM[0].PWM_CPRD = PWM_PERIOD_US; // set channel 0 Period PWM->PWM_IER2 = PWM_IER1_CHID0; // generate interrupt when counter0 overflows - PWM->PWM_IER2 = PWM_IER2_CMPM0 | PWM_IER2_CMPM1 | PWM_IER2_CMPM2 | PWM_IER2_CMPM3 | PWM_IER2_CMPM4; // generate interrupt on compare event + PWM->PWM_IER2 = PWM_IER2_CMPM0 + | G2_MASK_X(PWM_IER2_CMPM1) + | G2_MASK_Y(PWM_IER2_CMPM2) + | G2_MASK_Z(PWM_IER2_CMPM3) + | G2_MASK_E(PWM_IER2_CMPM4) + ; // generate interrupt on compare event - PWM->PWM_CMP[1].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0])); // interrupt when counter0 == CMPV - used to set Motor 1 PWM inactive - PWM->PWM_CMP[2].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0])); // interrupt when counter0 == CMPV - used to set Motor 2 PWM inactive - PWM->PWM_CMP[3].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[1])); // interrupt when counter0 == CMPV - used to set Motor 3 PWM inactive - PWM->PWM_CMP[4].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[2])); // interrupt when counter0 == CMPV - used to set Motor 4 PWM inactive + if (G2_PWM_X) PWM->PWM_CMP[1].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0])); // interrupt when counter0 == CMPV - used to set Motor 1 PWM inactive + if (G2_PWM_Y) PWM->PWM_CMP[2].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0])); // interrupt when counter0 == CMPV - used to set Motor 2 PWM inactive + if (G2_PWM_Z) PWM->PWM_CMP[3].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[1])); // interrupt when counter0 == CMPV - used to set Motor 3 PWM inactive + if (G2_PWM_E) PWM->PWM_CMP[4].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[2])); // interrupt when counter0 == CMPV - used to set Motor 4 PWM inactive - PWM->PWM_CMP[1].PWM_CMPM = 0x0001; // enable compare event - PWM->PWM_CMP[2].PWM_CMPM = 0x0001; // enable compare event - PWM->PWM_CMP[3].PWM_CMPM = 0x0001; // enable compare event - PWM->PWM_CMP[4].PWM_CMPM = 0x0001; // enable compare event + if (G2_PWM_X) PWM->PWM_CMP[1].PWM_CMPM = 0x0001; // enable compare event + if (G2_PWM_Y) PWM->PWM_CMP[2].PWM_CMPM = 0x0001; // enable compare event + if (G2_PWM_Z) PWM->PWM_CMP[3].PWM_CMPM = 0x0001; // enable compare event + if (G2_PWM_E) PWM->PWM_CMP[4].PWM_CMPM = 0x0001; // enable compare event - PWM->PWM_SCM = PWM_SCM_UPDM_MODE0 | PWM_SCM_SYNC0 | PWM_SCM_SYNC1 | PWM_SCM_SYNC2 | PWM_SCM_SYNC3 | PWM_SCM_SYNC4; // sync 1-4 with 0, use mode 0 for updates + PWM->PWM_SCM = PWM_SCM_UPDM_MODE0 | PWM_SCM_SYNC0 + | G2_MASK_X(PWM_SCM_SYNC1) + | G2_MASK_Y(PWM_SCM_SYNC2) + | G2_MASK_Z(PWM_SCM_SYNC3) + | G2_MASK_E(PWM_SCM_SYNC4) + ; // sync 1-4 with 0, use mode 0 for updates - PWM->PWM_ENA = PWM_ENA_CHID0 | PWM_ENA_CHID1 | PWM_ENA_CHID2 | PWM_ENA_CHID3 | PWM_ENA_CHID4; // enable the channels used by G2 - PWM->PWM_IER1 = PWM_IER1_CHID0 | PWM_IER1_CHID1 | PWM_IER1_CHID2 | PWM_IER1_CHID3 | PWM_IER1_CHID4; // enable interrupts for the channels used by G2 + PWM->PWM_ENA = PWM_ENA_CHID0 + | G2_MASK_X(PWM_ENA_CHID1) + | G2_MASK_Y(PWM_ENA_CHID2) + | G2_MASK_Z(PWM_ENA_CHID3) + | G2_MASK_E(PWM_ENA_CHID4) + ; // enable channels used by G2 + + PWM->PWM_IER1 = PWM_IER1_CHID0 + | G2_MASK_X(PWM_IER1_CHID1) + | G2_MASK_Y(PWM_IER1_CHID2) + | G2_MASK_Z(PWM_IER1_CHID3) + | G2_MASK_E(PWM_IER1_CHID4) + ; // enable interrupts for channels used by G2 NVIC_EnableIRQ(PWM_IRQn); // Enable interrupt handler NVIC_SetPriority(PWM_IRQn, NVIC_EncodePriority(0, 10, 0)); // normal priority for PWM module (can stand some jitter on the Vref signals) @@ -105,20 +159,27 @@ void Stepper::digipot_current(const uint8_t driver, const int16_t current) { if (!(PWM->PWM_CH_NUM[0].PWM_CPRD == PWM_PERIOD_US)) digipot_init(); // Init PWM system if needed switch (driver) { - case 0: PWM->PWM_CMP[1].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update X & Y - PWM->PWM_CMP[2].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); - PWM->PWM_CMP[1].PWM_CMPMUPD = 0x0001; // enable compare event - PWM->PWM_CMP[2].PWM_CMPMUPD = 0x0001; // enable compare event - PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle - break; - case 1: PWM->PWM_CMP[3].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update Z - PWM->PWM_CMP[3].PWM_CMPMUPD = 0x0001; // enable compare event - PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle - break; - default:PWM->PWM_CMP[4].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update E - PWM->PWM_CMP[4].PWM_CMPMUPD = 0x0001; // enable compare event - PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle - break; + case 0: + if (G2_PWM_X) PWM->PWM_CMP[1].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update X & Y + if (G2_PWM_Y) PWM->PWM_CMP[2].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); + if (G2_PWM_X) PWM->PWM_CMP[1].PWM_CMPMUPD = 0x0001; // enable compare event + if (G2_PWM_Y) PWM->PWM_CMP[2].PWM_CMPMUPD = 0x0001; // enable compare event + if (G2_PWM_X || G2_PWM_Y) PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle + break; + case 1: + if (G2_PWM_Z) { + PWM->PWM_CMP[3].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update Z + PWM->PWM_CMP[3].PWM_CMPMUPD = 0x0001; // enable compare event + PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle + } + break; + default: + if (G2_PWM_E) { + PWM->PWM_CMP[4].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update E + PWM->PWM_CMP[4].PWM_CMPMUPD = 0x0001; // enable compare event + PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle + } + break; } } @@ -127,17 +188,17 @@ volatile uint32_t PWM_ISR1_STATUS, PWM_ISR2_STATUS; void PWM_Handler() { PWM_ISR1_STATUS = PWM->PWM_ISR1; PWM_ISR2_STATUS = PWM->PWM_ISR2; - if (PWM_ISR1_STATUS & PWM_IER1_CHID0) { // CHAN_0 interrupt - *ISR_table[0].set_register = ISR_table[0].write_mask; // set X to active - *ISR_table[1].set_register = ISR_table[1].write_mask; // set Y to active - *ISR_table[2].set_register = ISR_table[2].write_mask; // set Z to active - *ISR_table[3].set_register = ISR_table[3].write_mask; // set E to active + if (PWM_ISR1_STATUS & PWM_IER1_CHID0) { // CHAN_0 interrupt + if (G2_PWM_X) *ISR_table[0].set_register = ISR_table[0].write_mask; // set X to active + if (G2_PWM_Y) *ISR_table[1].set_register = ISR_table[1].write_mask; // set Y to active + if (G2_PWM_Z) *ISR_table[2].set_register = ISR_table[2].write_mask; // set Z to active + if (G2_PWM_E) *ISR_table[3].set_register = ISR_table[3].write_mask; // set E to active } else { - if (PWM_ISR2_STATUS & PWM_IER2_CMPM1) *ISR_table[0].clr_register = ISR_table[0].write_mask; // set X to inactive - if (PWM_ISR2_STATUS & PWM_IER2_CMPM2) *ISR_table[1].clr_register = ISR_table[1].write_mask; // set Y to inactive - if (PWM_ISR2_STATUS & PWM_IER2_CMPM3) *ISR_table[2].clr_register = ISR_table[2].write_mask; // set Z to inactive - if (PWM_ISR2_STATUS & PWM_IER2_CMPM4) *ISR_table[3].clr_register = ISR_table[3].write_mask; // set E to inactive + if (G2_PWM_X && (PWM_ISR2_STATUS & PWM_IER2_CMPM1)) *ISR_table[0].clr_register = ISR_table[0].write_mask; // set X to inactive + if (G2_PWM_Y && (PWM_ISR2_STATUS & PWM_IER2_CMPM2)) *ISR_table[1].clr_register = ISR_table[1].write_mask; // set Y to inactive + if (G2_PWM_Z && (PWM_ISR2_STATUS & PWM_IER2_CMPM3)) *ISR_table[2].clr_register = ISR_table[2].write_mask; // set Z to inactive + if (G2_PWM_E && (PWM_ISR2_STATUS & PWM_IER2_CMPM4)) *ISR_table[3].clr_register = ISR_table[3].write_mask; // set E to inactive } return; } diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 4b7946c6a9..803095811e 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -2696,7 +2696,7 @@ void MarlinSettings::reset() { #if HAS_MOTOR_CURRENT_PWM constexpr uint32_t tmp_motor_current_setting[3] = PWM_MOTOR_CURRENT; - for (uint8_t q = 3; q--;) + LOOP_L_N(q, 3) stepper.digipot_current(q, (stepper.motor_current_setting[q] = tmp_motor_current_setting[q])); #endif From dd6781217a1571c31124cc5c331a0c39de1ce4fe Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 25 Mar 2020 19:21:48 -0500 Subject: [PATCH 10/43] motion.cpp: HAS_DIST_MM_ARG --- Marlin/src/module/motion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 8ab96b9b08..e47727b3ec 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1345,13 +1345,13 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t planner.set_machine_position_mm(target); target[axis] = distance; - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) + #if HAS_DIST_MM_ARG const xyze_float_t cart_dist_mm{0}; #endif // Set delta/cartesian axes directly planner.buffer_segment(target - #if IS_KINEMATIC && DISABLED(CLASSIC_JERK) + #if HAS_DIST_MM_ARG , cart_dist_mm #endif , real_fr_mm_s, active_extruder From 5ec1a8bb2b0708c3f94f162e71621f662554ce6f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 25 Mar 2020 14:51:22 -0500 Subject: [PATCH 11/43] Fix M0 unused var warning --- Marlin/src/gcode/lcd/M0_M1.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 2176693209..20ce55bd78 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -56,9 +56,11 @@ void GcodeSuite::M0_M1() { planner.synchronize(); - const bool seenQ = parser.seen('Q'); - #if HAS_LEDS_OFF_FLAG - if (seenQ) printerEventLEDs.onPrintCompleted(); // Change LED color for Print Completed + #if HAS_LCD_MENU || HAS_LEDS_OFF_FLAG + const bool seenQ = parser.seen('Q'); + #if HAS_LEDS_OFF_FLAG + if (seenQ) printerEventLEDs.onPrintCompleted(); // Change LED color for Print Completed + #endif #endif #if HAS_LCD_MENU From 5c150c0c941d9ab3fd140e0a837dff40432acca3 Mon Sep 17 00:00:00 2001 From: Acenotass <44540957+Acenotass@users.noreply.github.com> Date: Thu, 26 Mar 2020 08:04:57 +0600 Subject: [PATCH 12/43] Update Russian language (#17290) --- Marlin/src/lcd/language/language_ru.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 82c91c6502..a7c971e8c7 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -222,6 +222,11 @@ namespace Language_ru { PROGMEM Language_Str MSG_FAN_SPEED_N = _UxGT("Кулер ~"); PROGMEM Language_Str MSG_EXTRA_FAN_SPEED = _UxGT("Кулер доп."); PROGMEM Language_Str MSG_EXTRA_FAN_SPEED_N = _UxGT("Кулер доп. ~"); + PROGMEM Language_Str MSG_CONTROLLER_FAN = _UxGT("Обдув платы"); + PROGMEM Language_Str MSG_CONTROLLER_FAN_IDLE_SPEED = _UxGT("Обороты простоя"); + PROGMEM Language_Str MSG_CONTROLLER_FAN_AUTO_ON = _UxGT("Автовключение"); + PROGMEM Language_Str MSG_CONTROLLER_FAN_SPEED = _UxGT("Рабочие обороты"); + PROGMEM Language_Str MSG_CONTROLLER_FAN_DURATION = _UxGT("Простой после"); PROGMEM Language_Str MSG_FLOW = _UxGT("Поток"); PROGMEM Language_Str MSG_FLOW_N = _UxGT("Поток ~"); PROGMEM Language_Str MSG_CONTROL = _UxGT("Настройки"); From 8122468a361cf9fd25261dc04fa82a9ce1796644 Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Thu, 26 Mar 2020 03:05:36 +0100 Subject: [PATCH 13/43] Update Italian language (#17293) --- Marlin/src/lcd/language/language_it.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index ae4dd813ea..8d8112d523 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -245,6 +245,11 @@ namespace Language_it { PROGMEM Language_Str MSG_STORED_FAN_N = _UxGT("Ventola mem. ~"); // Max 15 characters PROGMEM Language_Str MSG_EXTRA_FAN_SPEED = _UxGT("Extra vel.vent."); // Max 15 characters PROGMEM Language_Str MSG_EXTRA_FAN_SPEED_N = _UxGT("Extra v.vent. ~"); // Max 15 characters + PROGMEM Language_Str MSG_CONTROLLER_FAN = _UxGT("Controller vent."); + PROGMEM Language_Str MSG_CONTROLLER_FAN_IDLE_SPEED = _UxGT("Vel. inattivo"); + PROGMEM Language_Str MSG_CONTROLLER_FAN_AUTO_ON = _UxGT("Modo autom."); + PROGMEM Language_Str MSG_CONTROLLER_FAN_SPEED = _UxGT("Vel. attivo"); + PROGMEM Language_Str MSG_CONTROLLER_FAN_DURATION = _UxGT("Tempo inattivo"); PROGMEM Language_Str MSG_FLOW = _UxGT("Flusso"); PROGMEM Language_Str MSG_FLOW_N = _UxGT("Flusso ~"); PROGMEM Language_Str MSG_CONTROL = _UxGT("Controllo"); @@ -312,6 +317,9 @@ namespace Language_it { PROGMEM Language_Str MSG_LOAD_EEPROM = _UxGT("Carica impostazioni"); PROGMEM Language_Str MSG_RESTORE_DEFAULTS = _UxGT("Ripristina imp."); PROGMEM Language_Str MSG_INIT_EEPROM = _UxGT("Inizializza EEPROM"); + PROGMEM Language_Str MSG_ERR_EEPROM_CRC = _UxGT("Err: CRC EEPROM"); + PROGMEM Language_Str MSG_ERR_EEPROM_INDEX = _UxGT("Err: Indice EEPROM"); + PROGMEM Language_Str MSG_ERR_EEPROM_VERSION = _UxGT("Err: Versione EEPROM"); PROGMEM Language_Str MSG_MEDIA_UPDATE = _UxGT("Aggiorna media"); PROGMEM Language_Str MSG_RESET_PRINTER = _UxGT("Resetta stampante"); PROGMEM Language_Str MSG_REFRESH = LCD_STR_REFRESH _UxGT("Aggiorna"); From d6a4c3079dc261b94aeccfc5f2031b589744bc67 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 25 Mar 2020 20:47:27 -0500 Subject: [PATCH 14/43] Tweak ui.finish_status --- Marlin/src/lcd/ultralcd.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 1cb23baa25..7ff1440559 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -524,7 +524,7 @@ void MarlinUI::status_screen() { #if PROGRESS_MSG_EXPIRE > 0 // Handle message expire - if (expire_status_ms > 0) { + if (expire_status_ms) { // Expire the message if a job is active and the bar has ticks if (get_progress_percent() > 2 && !print_job_timer.isPaused()) { @@ -1337,15 +1337,19 @@ void MarlinUI::update() { UNUSED(persist); #endif + #if ENABLED(LCD_PROGRESS_BAR) || BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) + const millis_t ms = millis(); + #endif + #if ENABLED(LCD_PROGRESS_BAR) - progress_bar_ms = millis(); + progress_bar_ms = ms; #if PROGRESS_MSG_EXPIRE > 0 - expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE; + expire_status_ms = persist ? 0 : ms + PROGRESS_MSG_EXPIRE; #endif #endif #if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) - next_filament_display = millis() + 5000UL; // Show status message for 5s + next_filament_display = ms + 5000UL; // Show status message for 5s #endif #if HAS_SPI_LCD && ENABLED(STATUS_MESSAGE_SCROLLING) From 54a12ee1d6557d820fb353a318525aebd7f6c082 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 25 Mar 2020 17:20:23 -0500 Subject: [PATCH 15/43] Tweak eeprom storage type --- Marlin/src/module/configuration_store.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 803095811e..129e207d29 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -1231,7 +1231,7 @@ void MarlinSettings::postprocess() { #if HAS_MOTOR_CURRENT_PWM EEPROM_WRITE(stepper.motor_current_setting); #else - const xyz_ulong_t no_current{0}; + const uint32_t no_current[3] = { 0 }; EEPROM_WRITE(no_current); #endif } From 98ef161bfe7545afda2c1ab432aeb420637eedde Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 27 Mar 2020 00:03:27 +0000 Subject: [PATCH 16/43] [cron] Bump distribution date (2020-03-27) --- Marlin/src/inc/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 7025c695a1..afbb5cf3c8 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2020-03-26" + #define STRING_DISTRIBUTION_DATE "2020-03-27" #endif /** From 3655e240f5796a84d4e89b3524484e37091efad2 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Fri, 27 Mar 2020 17:06:39 -0400 Subject: [PATCH 17/43] Fix SD finished ExtUI / host action (#17285) --- Marlin/src/MarlinCore.cpp | 5 +++-- Marlin/src/gcode/lcd/M0_M1.cpp | 22 +++++++++++----------- Marlin/src/inc/Conditionals_adv.h | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 0ea1a22fd8..7adc8272ea 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -423,7 +423,8 @@ void startOrResumeJob() { switch (card.sdprinting_done_state) { case 1: - did_state = print_job_timer.duration() < 60 || queue.enqueue_one_P(PSTR("M31")); + if (print_job_timer.duration() > 60) + did_state = queue.enqueue_one_P(PSTR("M31")); break; case 2: @@ -437,7 +438,7 @@ void startOrResumeJob() { break; case 4: // Display "Click to Continue..." - #if HAS_RESUME_CONTINUE // 30 min timeout with LCD, 1 min without + #if HAS_LEDS_OFF_FLAG // 30 min timeout with LCD, 1 min without did_state = queue.enqueue_one_P( print_job_timer.duration() < 60 ? PSTR("M0Q1P1") : PSTR("M0Q1S" TERN(HAS_LCD_MENU, "1800", "60")) ); diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 20ce55bd78..43b39226f7 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -56,11 +56,11 @@ void GcodeSuite::M0_M1() { planner.synchronize(); - #if HAS_LCD_MENU || HAS_LEDS_OFF_FLAG + #if HAS_LEDS_OFF_FLAG const bool seenQ = parser.seen('Q'); - #if HAS_LEDS_OFF_FLAG - if (seenQ) printerEventLEDs.onPrintCompleted(); // Change LED color for Print Completed - #endif + if (seenQ) printerEventLEDs.onPrintCompleted(); // Change LED color for Print Completed + #else + constexpr bool seenQ = false; #endif #if HAS_LCD_MENU @@ -75,12 +75,12 @@ void GcodeSuite::M0_M1() { } #elif ENABLED(EXTENSIBLE_UI) - - if (parser.string_arg) - ExtUI::onUserConfirmRequired(parser.string_arg); // Can this take an SRAM string?? - else - ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT)); - + if (!seenQ) { + if (parser.string_arg) + ExtUI::onUserConfirmRequired(parser.string_arg); // Can this take an SRAM string?? + else + ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT)); + } #else if (parser.string_arg) { @@ -94,7 +94,7 @@ void GcodeSuite::M0_M1() { wait_for_user = true; #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? PSTR("M1 Stop") : PSTR("M0 Stop"), CONTINUE_STR); + if (!seenQ) host_prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? PSTR("M1 Stop") : PSTR("M0 Stop"), CONTINUE_STR); #endif if (ms > 0) ms += millis(); // wait until this time for a click diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 09de5d89d7..a52ae1af29 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -93,7 +93,7 @@ #if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #define HAS_SOFTWARE_ENDSTOPS 1 #endif -#if ANY(EXTENSIBLE_UI, NEWPANEL, EMERGENCY_PARSER) +#if ANY(EXTENSIBLE_UI, NEWPANEL, EMERGENCY_PARSER, HAS_ADC_BUTTONS) #define HAS_RESUME_CONTINUE 1 #endif From 129b270628781eae776764e63fd514553e6c2204 Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Fri, 27 Mar 2020 23:29:17 +0100 Subject: [PATCH 18/43] QSPI EEPROM for SAMD51 (#17292) --- ...persistent_store_eeprom.cpp => eeprom.cpp} | 2 +- Marlin/src/HAL/DUE/EepromEmulation.cpp | 2 +- ...persistent_store_eeprom.cpp => eeprom.cpp} | 2 +- Marlin/src/HAL/DUE/inc/Conditionals_post.h | 2 +- ...sistent_store_impl.cpp => eeprom_impl.cpp} | 2 +- Marlin/src/HAL/ESP32/inc/Conditionals_post.h | 2 +- ...sistent_store_impl.cpp => eeprom_impl.cpp} | 2 +- .../{persistent_store_api.h => eeprom_api.h} | 2 +- ...stent_store_flash.cpp => eeprom_flash.cpp} | 2 +- ...ent_store_sdcard.cpp => eeprom_sdcard.cpp} | 2 +- .../src/HAL/LPC1768/inc/Conditionals_post.h | 2 +- Marlin/src/HAL/SAMD51/QSPIFlash.cpp | 78 +++++++++++ Marlin/src/HAL/SAMD51/QSPIFlash.h | 51 +++++++ Marlin/src/HAL/SAMD51/eeprom.cpp | 66 +++++++++ Marlin/src/HAL/SAMD51/eeprom_flash.cpp | 96 +++++++++++++ Marlin/src/HAL/SAMD51/eeprom_qspi.cpp | 71 ++++++++++ Marlin/src/HAL/SAMD51/inc/Conditionals_post.h | 4 +- .../HAL/SAMD51/persistent_store_eeprom.cpp | 129 ------------------ ...stent_store_flash.cpp => eeprom_flash.cpp} | 2 +- ...sistent_store_impl.cpp => eeprom_impl.cpp} | 12 +- ...ent_store_sdcard.cpp => eeprom_sdcard.cpp} | 2 +- Marlin/src/HAL/STM32/inc/Conditionals_post.h | 2 +- ...persistent_store_eeprom.cpp => eeprom.cpp} | 6 +- ...stent_store_flash.cpp => eeprom_flash.cpp} | 7 +- ...ent_store_sdcard.cpp => eeprom_sdcard.cpp} | 3 +- ...persistent_store_eeprom.cpp => eeprom.cpp} | 2 +- .../HAL/STM32_F4_F7/inc/Conditionals_post.h | 2 +- ...sistent_store_impl.cpp => eeprom_impl.cpp} | 2 +- .../HAL/TEENSY31_32/inc/Conditionals_post.h | 2 +- ...persistent_store_eeprom.cpp => eeprom.cpp} | 2 +- ...ersistent_store_api.cpp => eeprom_api.cpp} | 2 +- .../{persistent_store_api.h => eeprom_api.h} | 0 Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 2 +- Marlin/src/inc/Conditionals_post.h | 11 +- .../screens/interface_settings_screen.cpp | 2 +- Marlin/src/module/configuration_store.cpp | 2 +- Marlin/src/module/configuration_store.h | 2 +- Marlin/src/module/printcounter.cpp | 2 +- Marlin/src/module/printcounter.h | 4 +- Marlin/src/pins/samd/pins_RAMPS_144.h | 3 +- platformio.ini | 1 + 41 files changed, 413 insertions(+), 179 deletions(-) rename Marlin/src/HAL/AVR/{persistent_store_eeprom.cpp => eeprom.cpp} (97%) rename Marlin/src/HAL/DUE/{persistent_store_eeprom.cpp => eeprom.cpp} (98%) rename Marlin/src/HAL/ESP32/{persistent_store_impl.cpp => eeprom_impl.cpp} (97%) rename Marlin/src/HAL/LINUX/{persistent_store_impl.cpp => eeprom_impl.cpp} (98%) rename Marlin/src/HAL/LPC1768/{persistent_store_api.h => eeprom_api.h} (95%) rename Marlin/src/HAL/LPC1768/{persistent_store_flash.cpp => eeprom_flash.cpp} (99%) rename Marlin/src/HAL/LPC1768/{persistent_store_sdcard.cpp => eeprom_sdcard.cpp} (99%) create mode 100644 Marlin/src/HAL/SAMD51/QSPIFlash.cpp create mode 100644 Marlin/src/HAL/SAMD51/QSPIFlash.h create mode 100644 Marlin/src/HAL/SAMD51/eeprom.cpp create mode 100644 Marlin/src/HAL/SAMD51/eeprom_flash.cpp create mode 100644 Marlin/src/HAL/SAMD51/eeprom_qspi.cpp delete mode 100644 Marlin/src/HAL/SAMD51/persistent_store_eeprom.cpp rename Marlin/src/HAL/STM32/{persistent_store_flash.cpp => eeprom_flash.cpp} (99%) rename Marlin/src/HAL/STM32/{persistent_store_impl.cpp => eeprom_impl.cpp} (91%) rename Marlin/src/HAL/STM32/{persistent_store_sdcard.cpp => eeprom_sdcard.cpp} (98%) rename Marlin/src/HAL/STM32F1/{persistent_store_eeprom.cpp => eeprom.cpp} (95%) rename Marlin/src/HAL/STM32F1/{persistent_store_flash.cpp => eeprom_flash.cpp} (95%) rename Marlin/src/HAL/STM32F1/{persistent_store_sdcard.cpp => eeprom_sdcard.cpp} (98%) rename Marlin/src/HAL/STM32_F4_F7/{persistent_store_eeprom.cpp => eeprom.cpp} (98%) rename Marlin/src/HAL/TEENSY31_32/{persistent_store_impl.cpp => eeprom_impl.cpp} (97%) rename Marlin/src/HAL/TEENSY35_36/{persistent_store_eeprom.cpp => eeprom.cpp} (98%) rename Marlin/src/HAL/shared/{persistent_store_api.cpp => eeprom_api.cpp} (96%) rename Marlin/src/HAL/shared/{persistent_store_api.h => eeprom_api.h} (100%) diff --git a/Marlin/src/HAL/AVR/persistent_store_eeprom.cpp b/Marlin/src/HAL/AVR/eeprom.cpp similarity index 97% rename from Marlin/src/HAL/AVR/persistent_store_eeprom.cpp rename to Marlin/src/HAL/AVR/eeprom.cpp index 1ae37f892a..ee416b7a12 100644 --- a/Marlin/src/HAL/AVR/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/AVR/eeprom.cpp @@ -25,7 +25,7 @@ #if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" bool PersistentStore::access_start() { return true; } bool PersistentStore::access_finish() { return true; } diff --git a/Marlin/src/HAL/DUE/EepromEmulation.cpp b/Marlin/src/HAL/DUE/EepromEmulation.cpp index f1ae224bfc..66af50cfd2 100644 --- a/Marlin/src/HAL/DUE/EepromEmulation.cpp +++ b/Marlin/src/HAL/DUE/EepromEmulation.cpp @@ -57,7 +57,7 @@ #if ENABLED(FLASH_EEPROM_EMULATION) #include "../shared/Marduino.h" -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" #define EEPROMSize 4096 #define PagesPerGroup 128 diff --git a/Marlin/src/HAL/DUE/persistent_store_eeprom.cpp b/Marlin/src/HAL/DUE/eeprom.cpp similarity index 98% rename from Marlin/src/HAL/DUE/persistent_store_eeprom.cpp rename to Marlin/src/HAL/DUE/eeprom.cpp index fbdc760e45..ec9ef51ffc 100644 --- a/Marlin/src/HAL/DUE/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/DUE/eeprom.cpp @@ -27,7 +27,7 @@ #if ENABLED(EEPROM_SETTINGS) #include "../../inc/MarlinConfig.h" -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" #if !defined(E2END) && ENABLED(FLASH_EEPROM_EMULATION) #define E2END 0xFFF // Default to Flash emulated EEPROM size (EepromEmulation_Due.cpp) diff --git a/Marlin/src/HAL/DUE/inc/Conditionals_post.h b/Marlin/src/HAL/DUE/inc/Conditionals_post.h index b52462f6d8..8a305009ce 100644 --- a/Marlin/src/HAL/DUE/inc/Conditionals_post.h +++ b/Marlin/src/HAL/DUE/inc/Conditionals_post.h @@ -21,7 +21,7 @@ */ #pragma once -#if USE_EMULATED_EEPROM +#if USE_FALLBACK_EEPROM #undef SRAM_EEPROM_EMULATION #undef SDCARD_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION diff --git a/Marlin/src/HAL/ESP32/persistent_store_impl.cpp b/Marlin/src/HAL/ESP32/eeprom_impl.cpp similarity index 97% rename from Marlin/src/HAL/ESP32/persistent_store_impl.cpp rename to Marlin/src/HAL/ESP32/eeprom_impl.cpp index 7113b68412..dbfee14055 100644 --- a/Marlin/src/HAL/ESP32/persistent_store_impl.cpp +++ b/Marlin/src/HAL/ESP32/eeprom_impl.cpp @@ -26,7 +26,7 @@ #if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION) -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" #include "EEPROM.h" #define EEPROM_SIZE 4096 diff --git a/Marlin/src/HAL/ESP32/inc/Conditionals_post.h b/Marlin/src/HAL/ESP32/inc/Conditionals_post.h index e51b55698e..11603c9ef4 100644 --- a/Marlin/src/HAL/ESP32/inc/Conditionals_post.h +++ b/Marlin/src/HAL/ESP32/inc/Conditionals_post.h @@ -22,6 +22,6 @@ #pragma once // If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation -#if ENABLED(EEPROM_SETTINGS) && NONE(USE_REAL_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION) +#if ENABLED(EEPROM_SETTINGS) && NONE(USE_WIRED_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION) #define SDCARD_EEPROM_EMULATION #endif diff --git a/Marlin/src/HAL/LINUX/persistent_store_impl.cpp b/Marlin/src/HAL/LINUX/eeprom_impl.cpp similarity index 98% rename from Marlin/src/HAL/LINUX/persistent_store_impl.cpp rename to Marlin/src/HAL/LINUX/eeprom_impl.cpp index 660ecd56f1..4745f05673 100644 --- a/Marlin/src/HAL/LINUX/persistent_store_impl.cpp +++ b/Marlin/src/HAL/LINUX/eeprom_impl.cpp @@ -26,7 +26,7 @@ #if ENABLED(EEPROM_SETTINGS) -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" #include #define LINUX_EEPROM_SIZE (E2END + 1) diff --git a/Marlin/src/HAL/LPC1768/persistent_store_api.h b/Marlin/src/HAL/LPC1768/eeprom_api.h similarity index 95% rename from Marlin/src/HAL/LPC1768/persistent_store_api.h rename to Marlin/src/HAL/LPC1768/eeprom_api.h index 55a58fde1d..f874eac58a 100644 --- a/Marlin/src/HAL/LPC1768/persistent_store_api.h +++ b/Marlin/src/HAL/LPC1768/eeprom_api.h @@ -21,6 +21,6 @@ */ #pragma once -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" #define FLASH_EEPROM_EMULATION diff --git a/Marlin/src/HAL/LPC1768/persistent_store_flash.cpp b/Marlin/src/HAL/LPC1768/eeprom_flash.cpp similarity index 99% rename from Marlin/src/HAL/LPC1768/persistent_store_flash.cpp rename to Marlin/src/HAL/LPC1768/eeprom_flash.cpp index e166858d64..9225807480 100644 --- a/Marlin/src/HAL/LPC1768/persistent_store_flash.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom_flash.cpp @@ -40,7 +40,7 @@ #if ENABLED(FLASH_EEPROM_EMULATION) -#include "persistent_store_api.h" +#include "eeprom_api.h" extern "C" { #include diff --git a/Marlin/src/HAL/LPC1768/persistent_store_sdcard.cpp b/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp similarity index 99% rename from Marlin/src/HAL/LPC1768/persistent_store_sdcard.cpp rename to Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp index aa61938b02..d982bd6268 100644 --- a/Marlin/src/HAL/LPC1768/persistent_store_sdcard.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp @@ -26,7 +26,7 @@ #if ENABLED(SDCARD_EEPROM_EMULATION) -#include "persistent_store_api.h" +#include "eeprom_api.h" #include #include diff --git a/Marlin/src/HAL/LPC1768/inc/Conditionals_post.h b/Marlin/src/HAL/LPC1768/inc/Conditionals_post.h index a8d102e865..490cfd50e8 100644 --- a/Marlin/src/HAL/LPC1768/inc/Conditionals_post.h +++ b/Marlin/src/HAL/LPC1768/inc/Conditionals_post.h @@ -21,6 +21,6 @@ */ #pragma once -#if USE_EMULATED_EEPROM && NONE(SDCARD_EEPROM_EMULATION, SRAM_EEPROM_EMULATION) +#if USE_FALLBACK_EEPROM && NONE(SDCARD_EEPROM_EMULATION, SRAM_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #endif diff --git a/Marlin/src/HAL/SAMD51/QSPIFlash.cpp b/Marlin/src/HAL/SAMD51/QSPIFlash.cpp new file mode 100644 index 0000000000..76a3329707 --- /dev/null +++ b/Marlin/src/HAL/SAMD51/QSPIFlash.cpp @@ -0,0 +1,78 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(QSPI_EEPROM) + +#include "QSPIFlash.h" + +#define INVALID_ADDR 0xffffffff +#define SECTOR_OF(a) (a & ~(SFLASH_SECTOR_SIZE - 1)) +#define OFFSET_OF(a) (a & (SFLASH_SECTOR_SIZE - 1)) + +Adafruit_SPIFlashBase * QSPIFlash::_flashBase = nullptr; +uint8_t QSPIFlash::_buf[SFLASH_SECTOR_SIZE]; +uint32_t QSPIFlash::_addr = INVALID_ADDR; + +void QSPIFlash::begin() { + if (_flashBase != nullptr) return; + + _flashBase = new Adafruit_SPIFlashBase(new Adafruit_FlashTransport_QSPI()); + _flashBase->begin(NULL); +} + +size_t QSPIFlash::size() { + return _flashBase->size(); +} + +uint8_t QSPIFlash::readByte(const uint32_t address) { + if (SECTOR_OF(address) == _addr) return _buf[OFFSET_OF(address)]; + + return _flashBase->read8(address); +} + +void QSPIFlash::writeByte(const uint32_t address, const uint8_t value) { + uint32_t const sector_addr = SECTOR_OF(address); + + // Page changes, flush old and update new cache + if (sector_addr != _addr) { + flush(); + _addr = sector_addr; + + // read a whole page from flash + _flashBase->readBuffer(sector_addr, _buf, SFLASH_SECTOR_SIZE); + } + + _buf[OFFSET_OF(address)] = value; +} + +void QSPIFlash::flush() { + if (_addr == INVALID_ADDR) return; + + _flashBase->eraseSector(_addr / SFLASH_SECTOR_SIZE); + _flashBase->writeBuffer(_addr, _buf, SFLASH_SECTOR_SIZE); + + _addr = INVALID_ADDR; +} + +#endif // QSPI_EEPROM diff --git a/Marlin/src/HAL/SAMD51/QSPIFlash.h b/Marlin/src/HAL/SAMD51/QSPIFlash.h new file mode 100644 index 0000000000..7f75286ebf --- /dev/null +++ b/Marlin/src/HAL/SAMD51/QSPIFlash.h @@ -0,0 +1,51 @@ +/** + * @file QSPIFlash.h + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Ha Thach and Dean Miller for Adafruit Industries LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * Derived from Adafruit_SPIFlash class with no SdFat references + * + */ + +#pragma once + +#include "Adafruit_SPIFlashBase.h" + +// This class extends Adafruit_SPIFlashBase by adding caching support. +// +// This class will use 4096 Bytes of RAM as a block cache. +class QSPIFlash { + public: + static void begin(); + static size_t size(); + static uint8_t readByte(const uint32_t address); + static void writeByte(const uint32_t address, const uint8_t v); + static void flush(); + + private: + static Adafruit_SPIFlashBase * _flashBase; + static uint8_t _buf[SFLASH_SECTOR_SIZE]; + static uint32_t _addr; +}; + +extern QSPIFlash qspi; diff --git a/Marlin/src/HAL/SAMD51/eeprom.cpp b/Marlin/src/HAL/SAMD51/eeprom.cpp new file mode 100644 index 0000000000..e167515bff --- /dev/null +++ b/Marlin/src/HAL/SAMD51/eeprom.cpp @@ -0,0 +1,66 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifdef __SAMD51__ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(EEPROM_SETTINGS) && NONE(QSPI_EEPROM, FLASH_EEPROM_EMULATION) + +#include "../shared/eeprom_api.h" + +size_t PersistentStore::capacity() { return E2END + 1; } + +bool PersistentStore::access_start() { return true; } +bool PersistentStore::access_finish() { return true; } + +bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { + while (size--) { + const uint8_t v = *value; + uint8_t * const p = (uint8_t * const)pos; + if (v != eeprom_read_byte(p)) { + eeprom_write_byte(p, v); + delay(2); + if (eeprom_read_byte(p) != v) { + SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); + return true; + } + } + crc16(crc, &v, 1); + pos++; + value++; + } + return false; +} + +bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { + while (size--) { + uint8_t c = eeprom_read_byte((uint8_t*)pos); + if (writing) *value = c; + crc16(crc, &c, 1); + pos++; + value++; + } + return false; +} + +#endif // EEPROM_SETTINGS && !(QSPI_EEPROM || FLASH_EEPROM_EMULATION) +#endif // __SAMD51__ diff --git a/Marlin/src/HAL/SAMD51/eeprom_flash.cpp b/Marlin/src/HAL/SAMD51/eeprom_flash.cpp new file mode 100644 index 0000000000..fd8973369a --- /dev/null +++ b/Marlin/src/HAL/SAMD51/eeprom_flash.cpp @@ -0,0 +1,96 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifdef __SAMD51__ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(FLASH_EEPROM_EMULATION) + +#include "../shared/eeprom_api.h" + +#define NVMCTRL_CMD(c) do{ \ + SYNC(!NVMCTRL->STATUS.bit.READY); \ + NVMCTRL->INTFLAG.bit.DONE = true; \ + NVMCTRL->CTRLB.reg = c | NVMCTRL_CTRLB_CMDEX_KEY; \ + SYNC(NVMCTRL->INTFLAG.bit.DONE); \ + }while(0) +#define NVMCTRL_FLUSH() do{ \ + if (NVMCTRL->SEESTAT.bit.LOAD) \ + NVMCTRL_CMD(NVMCTRL_CTRLB_CMD_SEEFLUSH); \ + }while(0) + +size_t PersistentStore::capacity() { + const uint8_t psz = NVMCTRL->SEESTAT.bit.PSZ, + sblk = NVMCTRL->SEESTAT.bit.SBLK; + + return (!psz && !sblk) ? 0 + : (psz <= 2) ? (0x200 << psz) + : (sblk == 1 || psz == 3) ? 4096 + : (sblk == 2 || psz == 4) ? 8192 + : (sblk <= 4 || psz == 5) ? 16384 + : (sblk >= 9 && psz == 7) ? 65536 + : 32768; +} + +bool PersistentStore::access_start() { + NVMCTRL->SEECFG.reg = NVMCTRL_SEECFG_WMODE_BUFFERED; // Buffered mode and segment reallocation active + if (NVMCTRL->SEESTAT.bit.RLOCK) + NVMCTRL_CMD(NVMCTRL_CTRLB_CMD_USEE); // Unlock E2P data write access + return true; +} + +bool PersistentStore::access_finish() { + NVMCTRL_FLUSH(); + if (!NVMCTRL->SEESTAT.bit.LOCK) + NVMCTRL_CMD(NVMCTRL_CTRLB_CMD_LSEE); // Lock E2P data write access + return true; +} + +bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { + while (size--) { + const uint8_t v = *value; + SYNC(NVMCTRL->SEESTAT.bit.BUSY); + if (NVMCTRL->INTFLAG.bit.SEESFULL) + NVMCTRL_FLUSH(); // Next write will trigger a sector reallocation. I need to flush 'pagebuffer' + ((volatile uint8_t *)SEEPROM_ADDR)[pos] = v; + SYNC(!NVMCTRL->INTFLAG.bit.SEEWRC); + crc16(crc, &v, 1); + pos++; + value++; + } + return false; +} + +bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { + while (size--) { + SYNC(NVMCTRL->SEESTAT.bit.BUSY); + uint8_t c = ((volatile uint8_t *)SEEPROM_ADDR)[pos]; + if (writing) *value = c; + crc16(crc, &c, 1); + pos++; + value++; + } + return false; +} + +#endif // FLASH_EEPROM_EMULATION +#endif // __SAMD51__ diff --git a/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp b/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp new file mode 100644 index 0000000000..c6aa383f9f --- /dev/null +++ b/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp @@ -0,0 +1,71 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#ifdef __SAMD51__ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(QSPI_EEPROM) + +#include "../shared/eeprom_api.h" + +#include "QSPIFlash.h" + +static bool initialized; + +size_t PersistentStore::capacity() { return qspi.size(); } + +bool PersistentStore::access_start() { + if (!initialized) { + qspi.begin(); + initialized = true; + } + return true; +} + +bool PersistentStore::access_finish() { + qspi.flush(); + return true; +} + +bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { + while (size--) { + const uint8_t v = *value; + qspi.writeByte(pos, v); + crc16(crc, &v, 1); + pos++; + value++; + } + return false; +} + +bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { + while (size--) { + uint8_t c = qspi.readByte(pos); + if (writing) *value = c; + crc16(crc, &c, 1); + pos++; + value++; + } + return false; +} + +#endif // QSPI_EEPROM +#endif // __SAMD51__ diff --git a/Marlin/src/HAL/SAMD51/inc/Conditionals_post.h b/Marlin/src/HAL/SAMD51/inc/Conditionals_post.h index b52462f6d8..490cfd50e8 100644 --- a/Marlin/src/HAL/SAMD51/inc/Conditionals_post.h +++ b/Marlin/src/HAL/SAMD51/inc/Conditionals_post.h @@ -21,8 +21,6 @@ */ #pragma once -#if USE_EMULATED_EEPROM - #undef SRAM_EEPROM_EMULATION - #undef SDCARD_EEPROM_EMULATION +#if USE_FALLBACK_EEPROM && NONE(SDCARD_EEPROM_EMULATION, SRAM_EEPROM_EMULATION) #define FLASH_EEPROM_EMULATION #endif diff --git a/Marlin/src/HAL/SAMD51/persistent_store_eeprom.cpp b/Marlin/src/HAL/SAMD51/persistent_store_eeprom.cpp deleted file mode 100644 index 6b7326bb25..0000000000 --- a/Marlin/src/HAL/SAMD51/persistent_store_eeprom.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifdef __SAMD51__ - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(EEPROM_SETTINGS) - -#include "../shared/persistent_store_api.h" - -#if ENABLED(FLASH_EEPROM_EMULATION) - #define NVMCTRL_CMD(c) do{ \ - SYNC(!NVMCTRL->STATUS.bit.READY); \ - NVMCTRL->INTFLAG.bit.DONE = true; \ - NVMCTRL->CTRLB.reg = c | NVMCTRL_CTRLB_CMDEX_KEY; \ - SYNC(NVMCTRL->INTFLAG.bit.DONE); \ - }while(0) - #define NVMCTRL_FLUSH() do{ \ - if (NVMCTRL->SEESTAT.bit.LOAD) \ - NVMCTRL_CMD(NVMCTRL_CTRLB_CMD_SEEFLUSH); \ - }while(0) -#endif - -bool PersistentStore::access_start() { - #if ENABLED(FLASH_EEPROM_EMULATION) - NVMCTRL->SEECFG.reg = NVMCTRL_SEECFG_WMODE_BUFFERED; // Buffered mode and segment reallocation active - #endif - - return true; -} - -bool PersistentStore::access_finish() { - #if ENABLED(FLASH_EEPROM_EMULATION) - NVMCTRL_FLUSH(); - if (!NVMCTRL->SEESTAT.bit.LOCK) - NVMCTRL_CMD(NVMCTRL_CTRLB_CMD_LSEE); // Lock E2P data write access - #endif - - return true; -} - -bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { - #if ENABLED(FLASH_EEPROM_EMULATION) - if (NVMCTRL->SEESTAT.bit.RLOCK) - NVMCTRL_CMD(NVMCTRL_CTRLB_CMD_USEE); // Unlock E2P data write access - #endif - - while (size--) { - const uint8_t v = *value; - #if ENABLED(FLASH_EEPROM_EMULATION) - SYNC(NVMCTRL->SEESTAT.bit.BUSY); - if (NVMCTRL->INTFLAG.bit.SEESFULL) - NVMCTRL_FLUSH(); // Next write will trigger a sector reallocation. I need to flush 'pagebuffer' - ((volatile uint8_t *)SEEPROM_ADDR)[pos] = v; - SYNC(!NVMCTRL->INTFLAG.bit.SEEWRC); - #else - uint8_t * const p = (uint8_t * const)pos; - if (v != eeprom_read_byte(p)) { - eeprom_write_byte(p, v); - delay(2); - if (eeprom_read_byte(p) != v) { - SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); - return true; - } - } - #endif - crc16(crc, &v, 1); - pos++; - value++; - } - return false; -} - -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { - while (size--) { - uint8_t c; - #if ENABLED(FLASH_EEPROM_EMULATION) - SYNC(NVMCTRL->SEESTAT.bit.BUSY); - c = ((volatile uint8_t *)SEEPROM_ADDR)[pos]; - #else - c = eeprom_read_byte((uint8_t*)pos); - #endif - if (writing) *value = c; - crc16(crc, &c, 1); - pos++; - value++; - } - return false; -} - -size_t PersistentStore::capacity() { - #if ENABLED(FLASH_EEPROM_EMULATION) - const uint8_t psz = NVMCTRL->SEESTAT.bit.PSZ, - sblk = NVMCTRL->SEESTAT.bit.SBLK; - - if (!psz && !sblk) return 0; - else if (psz <= 2) return (0x200 << psz); - else if (sblk == 1 || psz == 3) return 4096; - else if (sblk == 2 || psz == 4) return 8192; - else if (sblk <= 4 || psz == 5) return 16384; - else if (sblk >= 9 && psz == 7) return 65536; - else return 32768; - #else - return E2END + 1; - #endif -} - -#endif // EEPROM_SETTINGS - -#endif // __SAMD51__ diff --git a/Marlin/src/HAL/STM32/persistent_store_flash.cpp b/Marlin/src/HAL/STM32/eeprom_flash.cpp similarity index 99% rename from Marlin/src/HAL/STM32/persistent_store_flash.cpp rename to Marlin/src/HAL/STM32/eeprom_flash.cpp index 80ef901ceb..39012f8205 100644 --- a/Marlin/src/HAL/STM32/persistent_store_flash.cpp +++ b/Marlin/src/HAL/STM32/eeprom_flash.cpp @@ -27,7 +27,7 @@ #if BOTH(EEPROM_SETTINGS, FLASH_EEPROM_EMULATION) -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" // Only STM32F4 can support wear leveling at this time diff --git a/Marlin/src/HAL/STM32/persistent_store_impl.cpp b/Marlin/src/HAL/STM32/eeprom_impl.cpp similarity index 91% rename from Marlin/src/HAL/STM32/persistent_store_impl.cpp rename to Marlin/src/HAL/STM32/eeprom_impl.cpp index d9538741dd..cd0f93e8d8 100644 --- a/Marlin/src/HAL/STM32/persistent_store_impl.cpp +++ b/Marlin/src/HAL/STM32/eeprom_impl.cpp @@ -24,9 +24,9 @@ #include "../../inc/MarlinConfig.h" -#if EITHER(USE_REAL_EEPROM, SRAM_EEPROM_EMULATION) +#if EITHER(USE_WIRED_EEPROM, SRAM_EEPROM_EMULATION) -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" bool PersistentStore::access_start() { return true; @@ -41,7 +41,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui uint8_t v = *value; // Save to either external EEPROM, program flash or Backup SRAM - #if USE_REAL_EEPROM + #if USE_WIRED_EEPROM // EEPROM has only ~100,000 write cycles, // so only write bytes that have changed! uint8_t * const p = (uint8_t * const)pos; @@ -68,7 +68,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t do { // Read from either external EEPROM, program flash or Backup SRAM const uint8_t c = ( - #if USE_REAL_EEPROM + #if USE_WIRED_EEPROM eeprom_read_byte((uint8_t*)pos) #else (*(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos))) @@ -85,7 +85,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t size_t PersistentStore::capacity() { return ( - #if USE_REAL_EEPROM + #if USE_WIRED_EEPROM E2END + 1 #else 4096 // 4kB @@ -93,5 +93,5 @@ size_t PersistentStore::capacity() { ); } -#endif // USE_REAL_EEPROM || SRAM_EEPROM_EMULATION +#endif // USE_WIRED_EEPROM || SRAM_EEPROM_EMULATION #endif // ARDUINO_ARCH_STM32 && !STM32GENERIC diff --git a/Marlin/src/HAL/STM32/persistent_store_sdcard.cpp b/Marlin/src/HAL/STM32/eeprom_sdcard.cpp similarity index 98% rename from Marlin/src/HAL/STM32/persistent_store_sdcard.cpp rename to Marlin/src/HAL/STM32/eeprom_sdcard.cpp index c5afc557e9..2b89c21b89 100644 --- a/Marlin/src/HAL/STM32/persistent_store_sdcard.cpp +++ b/Marlin/src/HAL/STM32/eeprom_sdcard.cpp @@ -30,7 +30,7 @@ #if ENABLED(SDCARD_EEPROM_EMULATION) -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" #ifndef E2END #define E2END 0xFFF // 4KB diff --git a/Marlin/src/HAL/STM32/inc/Conditionals_post.h b/Marlin/src/HAL/STM32/inc/Conditionals_post.h index e51b55698e..11603c9ef4 100644 --- a/Marlin/src/HAL/STM32/inc/Conditionals_post.h +++ b/Marlin/src/HAL/STM32/inc/Conditionals_post.h @@ -22,6 +22,6 @@ #pragma once // If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation -#if ENABLED(EEPROM_SETTINGS) && NONE(USE_REAL_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION) +#if ENABLED(EEPROM_SETTINGS) && NONE(USE_WIRED_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION) #define SDCARD_EEPROM_EMULATION #endif diff --git a/Marlin/src/HAL/STM32F1/persistent_store_eeprom.cpp b/Marlin/src/HAL/STM32F1/eeprom.cpp similarity index 95% rename from Marlin/src/HAL/STM32F1/persistent_store_eeprom.cpp rename to Marlin/src/HAL/STM32F1/eeprom.cpp index 1b3714c56d..ed5d50cbde 100644 --- a/Marlin/src/HAL/STM32F1/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom.cpp @@ -22,9 +22,9 @@ #include "../../inc/MarlinConfig.h" -#if USE_REAL_EEPROM +#if USE_WIRED_EEPROM -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" bool PersistentStore::access_start() { #if ENABLED(SPI_EEPROM) @@ -73,5 +73,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t size_t PersistentStore::capacity() { return E2END + 1; } -#endif // USE_REAL_EEPROM +#endif // USE_WIRED_EEPROM #endif // __STM32F1__ diff --git a/Marlin/src/HAL/STM32F1/persistent_store_flash.cpp b/Marlin/src/HAL/STM32F1/eeprom_flash.cpp similarity index 95% rename from Marlin/src/HAL/STM32F1/persistent_store_flash.cpp rename to Marlin/src/HAL/STM32F1/eeprom_flash.cpp index 3d6a3b4591..9c81730465 100644 --- a/Marlin/src/HAL/STM32F1/persistent_store_flash.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom_flash.cpp @@ -31,10 +31,9 @@ #include "../../inc/MarlinConfig.h" -// This is for EEPROM emulation in flash -#if BOTH(EEPROM_SETTINGS, FLASH_EEPROM_EMULATION) +#if ENABLED(FLASH_EEPROM_EMULATION) -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" #include #include @@ -108,5 +107,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin size_t PersistentStore::capacity() { return EEPROM_SIZE; } -#endif // EEPROM_SETTINGS && EEPROM FLASH +#endif // FLASH_EEPROM_EMULATION #endif // __STM32F1__ diff --git a/Marlin/src/HAL/STM32F1/persistent_store_sdcard.cpp b/Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp similarity index 98% rename from Marlin/src/HAL/STM32F1/persistent_store_sdcard.cpp rename to Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp index 8b5d89ad83..7894e69787 100644 --- a/Marlin/src/HAL/STM32F1/persistent_store_sdcard.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp @@ -31,7 +31,7 @@ #if ENABLED(SDCARD_EEPROM_EMULATION) -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" #ifndef E2END #define E2END 0xFFF // 4KB @@ -101,5 +101,4 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin size_t PersistentStore::capacity() { return HAL_EEPROM_SIZE; } #endif // SDCARD_EEPROM_EMULATION - #endif // __STM32F1__ diff --git a/Marlin/src/HAL/STM32_F4_F7/persistent_store_eeprom.cpp b/Marlin/src/HAL/STM32_F4_F7/eeprom.cpp similarity index 98% rename from Marlin/src/HAL/STM32_F4_F7/persistent_store_eeprom.cpp rename to Marlin/src/HAL/STM32_F4_F7/eeprom.cpp index 2ffbc609ec..b957aae6a8 100644 --- a/Marlin/src/HAL/STM32_F4_F7/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/STM32_F4_F7/eeprom.cpp @@ -27,7 +27,7 @@ #if ENABLED(EEPROM_SETTINGS) -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" bool PersistentStore::access_start() { return true; } bool PersistentStore::access_finish() { return true; } diff --git a/Marlin/src/HAL/STM32_F4_F7/inc/Conditionals_post.h b/Marlin/src/HAL/STM32_F4_F7/inc/Conditionals_post.h index 5a190342ac..d21624955e 100644 --- a/Marlin/src/HAL/STM32_F4_F7/inc/Conditionals_post.h +++ b/Marlin/src/HAL/STM32_F4_F7/inc/Conditionals_post.h @@ -22,7 +22,7 @@ #pragma once #if ENABLED(EEPROM_SETTINGS) && defined(STM32F7) - #undef USE_REAL_EEPROM + #undef USE_WIRED_EEPROM #undef SRAM_EEPROM_EMULATION #undef SDCARD_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION diff --git a/Marlin/src/HAL/TEENSY31_32/persistent_store_impl.cpp b/Marlin/src/HAL/TEENSY31_32/eeprom_impl.cpp similarity index 97% rename from Marlin/src/HAL/TEENSY31_32/persistent_store_impl.cpp rename to Marlin/src/HAL/TEENSY31_32/eeprom_impl.cpp index 6a179cd962..96499d4f19 100644 --- a/Marlin/src/HAL/TEENSY31_32/persistent_store_impl.cpp +++ b/Marlin/src/HAL/TEENSY31_32/eeprom_impl.cpp @@ -22,7 +22,7 @@ #if ENABLED(EEPROM_SETTINGS) -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" bool PersistentStore::access_start() { return true; } bool PersistentStore::access_finish() { return true; } diff --git a/Marlin/src/HAL/TEENSY31_32/inc/Conditionals_post.h b/Marlin/src/HAL/TEENSY31_32/inc/Conditionals_post.h index e51b55698e..11603c9ef4 100644 --- a/Marlin/src/HAL/TEENSY31_32/inc/Conditionals_post.h +++ b/Marlin/src/HAL/TEENSY31_32/inc/Conditionals_post.h @@ -22,6 +22,6 @@ #pragma once // If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation -#if ENABLED(EEPROM_SETTINGS) && NONE(USE_REAL_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION) +#if ENABLED(EEPROM_SETTINGS) && NONE(USE_WIRED_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION) #define SDCARD_EEPROM_EMULATION #endif diff --git a/Marlin/src/HAL/TEENSY35_36/persistent_store_eeprom.cpp b/Marlin/src/HAL/TEENSY35_36/eeprom.cpp similarity index 98% rename from Marlin/src/HAL/TEENSY35_36/persistent_store_eeprom.cpp rename to Marlin/src/HAL/TEENSY35_36/eeprom.cpp index 32b215ee6e..c66a45e2a5 100644 --- a/Marlin/src/HAL/TEENSY35_36/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/TEENSY35_36/eeprom.cpp @@ -27,7 +27,7 @@ #if ENABLED(EEPROM_SETTINGS) -#include "../shared/persistent_store_api.h" +#include "../shared/eeprom_api.h" #include bool PersistentStore::access_start() { return true; } diff --git a/Marlin/src/HAL/shared/persistent_store_api.cpp b/Marlin/src/HAL/shared/eeprom_api.cpp similarity index 96% rename from Marlin/src/HAL/shared/persistent_store_api.cpp rename to Marlin/src/HAL/shared/eeprom_api.cpp index 735fa4278b..d8839e3d9d 100644 --- a/Marlin/src/HAL/shared/persistent_store_api.cpp +++ b/Marlin/src/HAL/shared/eeprom_api.cpp @@ -24,7 +24,7 @@ #if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) - #include "persistent_store_api.h" + #include "eeprom_api.h" PersistentStore persistentStore; #endif diff --git a/Marlin/src/HAL/shared/persistent_store_api.h b/Marlin/src/HAL/shared/eeprom_api.h similarity index 100% rename from Marlin/src/HAL/shared/persistent_store_api.h rename to Marlin/src/HAL/shared/eeprom_api.h diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 1ac036e5bc..217d894543 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -27,7 +27,7 @@ #include "../bedlevel.h" #include "../../../MarlinCore.h" - #include "../../../HAL/shared/persistent_store_api.h" + #include "../../../HAL/shared/eeprom_api.h" #include "../../../libs/hex_print_routines.h" #include "../../../module/configuration_store.h" #include "../../../lcd/ultralcd.h" diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index ebc77b9383..d9db986466 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -35,16 +35,19 @@ #define HAS_LINEAR_E_JERK 1 #endif -// If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation +// Determine which type of 'EEPROM' is in use #if ENABLED(EEPROM_SETTINGS) - #if NONE(FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SDCARD_EEPROM_EMULATION) && EITHER(I2C_EEPROM, SPI_EEPROM) - #define USE_REAL_EEPROM 1 + // EEPROM type may be defined by compile flags, configs, HALs, or pins + // Set additional flags to let HALs choose in their Conditionals_post.h + #if NONE(FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SDCARD_EEPROM_EMULATION) && ANY(I2C_EEPROM, SPI_EEPROM, QSPI_EEPROM) + #define USE_WIRED_EEPROM 1 #else - #define USE_EMULATED_EEPROM 1 + #define USE_FALLBACK_EEPROM 1 #endif #else #undef I2C_EEPROM #undef SPI_EEPROM + #undef QSPI_EEPROM #undef SDCARD_EEPROM_EMULATION #undef SRAM_EEPROM_EMULATION #undef FLASH_EEPROM_EMULATION diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp index 61875c52f1..3de03579e4 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp @@ -252,7 +252,7 @@ void InterfaceSettingsScreen::loadSettings(const char *buff) { } #ifdef ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE - #include "../../../../../HAL/shared/persistent_store_api.h" + #include "../../../../../HAL/shared/eeprom_api.h" bool restoreEEPROM() { uint8_t data[ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE]; diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 129e207d29..d80fe50195 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -57,7 +57,7 @@ #include "../MarlinCore.h" #if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) - #include "../HAL/shared/persistent_store_api.h" + #include "../HAL/shared/eeprom_api.h" #endif #include "probe.h" diff --git a/Marlin/src/module/configuration_store.h b/Marlin/src/module/configuration_store.h index a2c8d97dfa..f2e84c9664 100644 --- a/Marlin/src/module/configuration_store.h +++ b/Marlin/src/module/configuration_store.h @@ -24,7 +24,7 @@ #include "../inc/MarlinConfig.h" #if ENABLED(EEPROM_SETTINGS) - #include "../HAL/shared/persistent_store_api.h" + #include "../HAL/shared/eeprom_api.h" #endif class MarlinSettings { diff --git a/Marlin/src/module/printcounter.cpp b/Marlin/src/module/printcounter.cpp index 4b4d4b60ad..3623c88a13 100644 --- a/Marlin/src/module/printcounter.cpp +++ b/Marlin/src/module/printcounter.cpp @@ -35,7 +35,7 @@ Stopwatch print_job_timer; // Global Print Job Timer instance #include "printcounter.h" #include "../MarlinCore.h" -#include "../HAL/shared/persistent_store_api.h" +#include "../HAL/shared/eeprom_api.h" #if HAS_BUZZER && SERVICE_WARNING_BUZZES > 0 #include "../libs/buzzer.h" diff --git a/Marlin/src/module/printcounter.h b/Marlin/src/module/printcounter.h index 261cdf058b..39a237cc44 100644 --- a/Marlin/src/module/printcounter.h +++ b/Marlin/src/module/printcounter.h @@ -28,7 +28,7 @@ // Print debug messages with M111 S2 //#define DEBUG_PRINTCOUNTER -#if USE_REAL_EEPROM +#if USE_WIRED_EEPROM // round up address to next page boundary (assuming 32 byte pages) #define STATS_EEPROM_ADDRESS 0x40 #else @@ -57,7 +57,7 @@ class PrintCounter: public Stopwatch { private: typedef Stopwatch super; - #if USE_REAL_EEPROM || defined(CPU_32_BIT) + #if USE_WIRED_EEPROM || defined(CPU_32_BIT) typedef uint32_t eeprom_address_t; #else typedef uint16_t eeprom_address_t; diff --git a/Marlin/src/pins/samd/pins_RAMPS_144.h b/Marlin/src/pins/samd/pins_RAMPS_144.h index b7d5172e0d..f02a8b86bd 100644 --- a/Marlin/src/pins/samd/pins_RAMPS_144.h +++ b/Marlin/src/pins/samd/pins_RAMPS_144.h @@ -44,8 +44,9 @@ // // EEPROM // -#define E2END 0x7FFF // 32Kb (24lc256) +//#define QSPI_EEPROM // Use AGCM4 onboard QSPI EEPROM (Uses 4K of RAM) #define I2C_EEPROM // EEPROM on I2C-0 +#define E2END 0x7FFF // 32K (24lc256) // // Limit Switches diff --git a/platformio.ini b/platformio.ini index 2f3e86c316..13808d299a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -792,6 +792,7 @@ build_unflags = -std=gnu++11 src_filter = ${common.default_src_filter} + lib_deps = ${common.lib_deps} SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip + Adafruit_SPIFlash=https://github.com/adafruit/Adafruit_SPIFlash/archive/master.zip debug_tool = jlink # From bed41af868f352bc0ca72b0b6936a97420c64ecf Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Fri, 27 Mar 2020 18:30:17 -0400 Subject: [PATCH 19/43] Fix Stepper PWM menu (#17298) --- Marlin/src/lcd/menu/menu_advanced.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 1577e59fc1..f2327b75e5 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -84,7 +84,7 @@ void menu_cancelobject(); START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); #define EDIT_CURRENT_PWM(LABEL,I) EDIT_ITEM_P(long5, PSTR(LABEL), &stepper.motor_current_setting[I], 100, 2000, stepper.refresh_motor_power) - #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) + #if ANY_PIN(MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y) EDIT_CURRENT_PWM(STR_X STR_Y, 0); #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) From 8752fbd92c8edcd777b6a2afe54f4d70d3fc4d85 Mon Sep 17 00:00:00 2001 From: Mathias Rasmussen Date: Fri, 27 Mar 2020 23:38:28 +0100 Subject: [PATCH 20/43] Store case light brightness in EEPROM (#17307) --- Marlin/src/module/configuration_store.cpp | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index d80fe50195..2ecc9299c9 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -127,6 +127,11 @@ void M710_report(const bool forReplay); #endif +#define HAS_CASE_LIGHT_BRIGHTNESS (ENABLED(CASE_LIGHT_MENU) && DISABLED(CASE_LIGHT_NO_BRIGHTNESS)) +#if HAS_CASE_LIGHT_BRIGHTNESS + #include "../feature/caselight.h" +#endif + #pragma pack(push, 1) // No padding between variables typedef struct { uint16_t X, Y, Z, X2, Y2, Z2, Z3, Z4, E0, E1, E2, E3, E4, E5; } tmc_stepper_current_t; @@ -376,6 +381,13 @@ typedef struct SettingsDataStruct { uint8_t extui_data[ExtUI::eeprom_data_size]; #endif + // + // HAS_CASE_LIGHT_BRIGHTNESS + // + #if HAS_CASE_LIGHT_BRIGHTNESS + uint8_t case_light_brightness; + #endif + } SettingsData; //static_assert(sizeof(SettingsData) <= E2END + 1, "EEPROM too small to contain SettingsData!"); @@ -441,6 +453,10 @@ void MarlinSettings::postprocess() { planner.recalculate_max_e_jerk(); #endif + #if HAS_CASE_LIGHT_BRIGHTNESS + update_case_light(); + #endif + // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm // and init stepper.count[], planner.position[] with current_position planner.refresh_positioning(); @@ -1309,6 +1325,13 @@ void MarlinSettings::postprocess() { } #endif + // + // Case Light Brightness + // + #if HAS_CASE_LIGHT_BRIGHTNESS + EEPROM_WRITE(case_light_brightness); + #endif + // // Validate CRC and Data Size // @@ -2163,6 +2186,14 @@ void MarlinSettings::postprocess() { } #endif + // + // Case Light Brightness + // + #if HAS_CASE_LIGHT_BRIGHTNESS + _FIELD_TEST(case_light_brightness); + EEPROM_READ(case_light_brightness); + #endif + eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET)); if (eeprom_error) { DEBUG_ECHO_START(); @@ -2458,6 +2489,14 @@ void MarlinSettings::reset() { ExtUI::onFactoryReset(); #endif + // + // Case Light Brightness + // + + #if HAS_CASE_LIGHT_BRIGHTNESS + case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS; + #endif + // // Magnetic Parking Extruder // From e71b25a555e869338723fa17799bcb9d4ea44fbe Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 28 Mar 2020 00:03:16 +0000 Subject: [PATCH 21/43] [cron] Bump distribution date (2020-03-28) --- Marlin/src/inc/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index afbb5cf3c8..9978e3e6d3 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2020-03-27" + #define STRING_DISTRIBUTION_DATE "2020-03-28" #endif /** From de648bfdc1de5b3b3bb93e39d4337c3f9bff1211 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Fri, 27 Mar 2020 22:08:47 -0400 Subject: [PATCH 22/43] Add Funmat HT V4.0 board support (#17305) Co-authored-by: Scott Lahteine --- Marlin/src/core/boards.h | 1 + Marlin/src/pins/mega/pins_INTAMSYS40.h | 152 +++++++++++++++++++++++ Marlin/src/pins/pins.h | 2 + Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h | 16 +-- 4 files changed, 163 insertions(+), 8 deletions(-) create mode 100644 Marlin/src/pins/mega/pins_INTAMSYS40.h diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 86107f7d86..30c2d3eb87 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -144,6 +144,7 @@ #define BOARD_LEAPFROG_XEED2015 1321 // Leapfrog Xeed 2015 #define BOARD_PICA_REVB 1322 // PICA Shield (original version) #define BOARD_PICA 1323 // PICA Shield (rev C or later) +#define BOARD_INTAMSYS40 1324 // Intamsys 4.0 (Funmat HT) // // ATmega1281, ATmega2561 diff --git a/Marlin/src/pins/mega/pins_INTAMSYS40.h b/Marlin/src/pins/mega/pins_INTAMSYS40.h new file mode 100644 index 0000000000..c688823ddf --- /dev/null +++ b/Marlin/src/pins/mega/pins_INTAMSYS40.h @@ -0,0 +1,152 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Intamsys Funmat HT V4.0 Mainboard + * 4988 Drivers Tested + * 2208 version exists and may or may not work + */ + +#ifndef __AVR_ATmega2560__ + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" +#endif + +#define BOARD_INFO_NAME "Intamsys 4.0" + +// +// Servos +// +#define SERVO0_PIN 12 // Uses High Temp Present Jumper Pin + +// +// Limit Switches +// +#define X_STOP_PIN 22 +#define Y_STOP_PIN 26 +#define Z_MIN_PIN 29 +#define Z_MAX_PIN 69 + +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN 69 +#endif + +#define FIL_RUNOUT_PIN 10 + +// +// Steppers +// +#define X_STEP_PIN 25 +#define X_DIR_PIN 23 +#define X_ENABLE_PIN 27 // 44 + +#define Y_STEP_PIN 32 // 33 +#define Y_DIR_PIN 33 // 31, 32 +#define Y_ENABLE_PIN 31 // 32 + +#define Z_STEP_PIN 35 // 35 +#define Z_DIR_PIN 36 +#define Z_ENABLE_PIN 34 // 34 + +#define E0_STEP_PIN 42 +#define E0_DIR_PIN 43 +#define E0_ENABLE_PIN 37 + +#define E1_STEP_PIN 49 +#define E1_DIR_PIN 47 +#define E1_ENABLE_PIN 48 + +#define MOTOR_CURRENT_PWM_X_PIN 11 +#define MOTOR_CURRENT_PWM_Y_PIN 44 +#define MOTOR_CURRENT_PWM_Z_PIN 45 +#define MOTOR_CURRENT_PWM_E_PIN 46 + +// Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range +#ifndef MOTOR_CURRENT_PWM_RANGE + #define MOTOR_CURRENT_PWM_RANGE 2000 +#endif +#define DEFAULT_PWM_MOTOR_CURRENT { 1300, 1300, 1250 } + +// +// Temperature Sensors +// +#define TEMP_0_PIN 8 // Analog Input D62 +#define TEMP_BED_PIN 10 // Analog Input D64 + +#define TEMP_CHAMBER_PIN 9 // Analog Input D63 + +// +// Heaters / Fans +// +#define HEATER_0_PIN 2 // PWM +#define HEATER_BED_PIN 4 // PWM +#define HEATER_CHAMBER_PIN 3 // PWM +#define FAN_PIN 7 // PWM + +// +// Misc. Functions +// +#define SDSS 53 +#define SD_DETECT_PIN 39 + +#if ENABLED(CASE_LIGHT_ENABLE) + #define CASE_LIGHT_PIN 8 +#endif + +#if ENABLED(PSU_CONTROL) + #define PS_ON_PIN 38 // UPS Module +#endif + +// +// LCD Controller +// + +#define BEEPER_PIN 18 + +#if HAS_SPI_LCD + #define LCD_PINS_RS 20 + #define LCD_PINS_ENABLE 30 + #define LCD_PINS_D4 14 + #define LCD_PINS_D5 21 + #define LCD_PINS_D6 5 + #define LCD_PINS_D7 6 + #define BTN_EN1 40 + #define BTN_EN2 41 + #define BTN_ENC 19 +#endif + +///////////////////// SPARE HEADERS ////////////// + +/** + * + * J25 + * 1 D54 + * 2 D55 + * 3 D56 + * 4 D57 + * 5 D58 + * 6 D59 + * 7 D60 + * 8 D61 + +Hotend High Temp Connected : D12 +*/ diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index b43ba1cbc6..5de75a1f0e 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -258,6 +258,8 @@ #include "mega/pins_PICA.h" // ATmega2560 env:mega2560 #elif MB(PICA_REVB) #include "mega/pins_PICAOLD.h" // ATmega2560 env:mega2560 +#elif MB(INTAMSYS40) + #include "mega/pins_INTAMSYS40.h" // ATmega2560 env:mega2560 // // ATmega1281, ATmega2561 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h index 2f2881ee3f..a8c6d30eb4 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h @@ -178,14 +178,14 @@ //#define E4_HARDWARE_SERIAL Serial1 // Unused servo pins may be repurposed with SoftwareSerialM - //#define X_SERIAL_TX_PIN PF8 // SERVO3_PIN - //#define Y_SERIAL_TX_PIN PF9 // SERVO2_PIN - //#define Z_SERIAL_TX_PIN PA1 // SERVO1_PIN - //#define E0_SERIAL_TX_PIN PC3 // SERVO0_PIN - //#define X_SERIAL_RX_PIN X_SERIAL_TX_PIN - //#define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN - //#define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN - //#define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN + //#define X_SERIAL_TX_PIN PF8 // SERVO3_PIN + //#define Y_SERIAL_TX_PIN PF9 // SERVO2_PIN + //#define Z_SERIAL_TX_PIN PA1 // SERVO1_PIN + //#define E0_SERIAL_TX_PIN PC3 // SERVO0_PIN + //#define X_SERIAL_RX_PIN X_SERIAL_TX_PIN + //#define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN + //#define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + //#define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN // Reduce baud rate for software serial reliability #if HAS_TMC_SW_SERIAL From 53fe572bbdfe4d51e420f6d002197cee533e17fd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 27 Mar 2020 22:00:27 -0500 Subject: [PATCH 23/43] Limited backlash editing with Core kinematics (#17281) --- Marlin/src/gcode/calibrate/G28.cpp | 20 ++-- Marlin/src/gcode/calibrate/G425.cpp | 144 +++++++++++++++----------- Marlin/src/gcode/calibrate/M425.cpp | 6 +- Marlin/src/inc/Conditionals_post.h | 13 +++ Marlin/src/inc/MarlinConfig.h | 3 +- Marlin/src/lcd/menu/menu_backlash.cpp | 6 +- 6 files changed, 114 insertions(+), 78 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 4603c76967..fafce9a896 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -255,28 +255,28 @@ void GcodeSuite::G28() { #define HAS_HOMING_CURRENT (HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(X2) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Y2)) #if HAS_HOMING_CURRENT - auto debug_current = [](const char * const s, const int16_t a, const int16_t b){ - DEBUG_ECHO(s); DEBUG_ECHOLNPAIR(" current: ", a, " -> ", b); + auto debug_current = [](PGM_P const s, const int16_t a, const int16_t b){ + serialprintPGM(s); DEBUG_ECHOLNPAIR(" current: ", a, " -> ", b); }; #if HAS_CURRENT_HOME(X) const int16_t tmc_save_current_X = stepperX.getMilliamps(); stepperX.rms_current(X_CURRENT_HOME); - if (DEBUGGING(LEVELING)) debug_current("X", tmc_save_current_X, X_CURRENT_HOME); + if (DEBUGGING(LEVELING)) debug_current(PSTR("X"), tmc_save_current_X, X_CURRENT_HOME); #endif #if HAS_CURRENT_HOME(X2) const int16_t tmc_save_current_X2 = stepperX2.getMilliamps(); stepperX2.rms_current(X2_CURRENT_HOME); - if (DEBUGGING(LEVELING)) debug_current("X2", tmc_save_current_X2, X2_CURRENT_HOME); + if (DEBUGGING(LEVELING)) debug_current(PSTR("X2"), tmc_save_current_X2, X2_CURRENT_HOME); #endif #if HAS_CURRENT_HOME(Y) const int16_t tmc_save_current_Y = stepperY.getMilliamps(); stepperY.rms_current(Y_CURRENT_HOME); - if (DEBUGGING(LEVELING)) debug_current("Y", tmc_save_current_Y, Y_CURRENT_HOME); + if (DEBUGGING(LEVELING)) debug_current(PSTR("Y"), tmc_save_current_Y, Y_CURRENT_HOME); #endif #if HAS_CURRENT_HOME(Y2) const int16_t tmc_save_current_Y2 = stepperY2.getMilliamps(); stepperY2.rms_current(Y2_CURRENT_HOME); - if (DEBUGGING(LEVELING)) debug_current("Y2", tmc_save_current_Y2, Y2_CURRENT_HOME); + if (DEBUGGING(LEVELING)) debug_current(PSTR("Y2"), tmc_save_current_Y2, Y2_CURRENT_HOME); #endif #endif @@ -345,12 +345,8 @@ void GcodeSuite::G28() { #endif // Home Y (before X) - #if ENABLED(HOME_Y_BEFORE_X) - - if (doY || (doX && ENABLED(CODEPENDENT_XY_HOMING))) - homeaxis(Y_AXIS); - - #endif + if (ENABLED(HOME_Y_BEFORE_X) && (doY || (ENABLED(CODEPENDENT_XY_HOMING) && doX))) + homeaxis(Y_AXIS); // Home X if (doX || (doY && ENABLED(CODEPENDENT_XY_HOMING) && DISABLED(HOME_Y_BEFORE_X))) { diff --git a/Marlin/src/gcode/calibrate/G425.cpp b/Marlin/src/gcode/calibrate/G425.cpp index 69fb29165d..42c56fe51d 100644 --- a/Marlin/src/gcode/calibrate/G425.cpp +++ b/Marlin/src/gcode/calibrate/G425.cpp @@ -37,6 +37,21 @@ #include "../../module/endstops.h" #include "../../feature/bedlevel/bedlevel.h" +#if !AXIS_CAN_CALIBRATE(X) + #undef CALIBRATION_MEASURE_LEFT + #undef CALIBRATION_MEASURE_RIGHT +#endif + +#if !AXIS_CAN_CALIBRATE(Y) + #undef CALIBRATION_MEASURE_FRONT + #undef CALIBRATION_MEASURE_BACK +#endif + +#if !AXIS_CAN_CALIBRATE(Z) + #undef CALIBRATION_MEASURE_AT_TOP_EDGES +#endif + + /** * G425 backs away from the calibration object by various distances * depending on the confidence level: @@ -207,42 +222,52 @@ inline float measure(const AxisEnum axis, const int dir, const bool stop_state, inline void probe_side(measurements_t &m, const float uncertainty, const side_t side, const bool probe_top_at_edge=false) { const xyz_float_t dimensions = CALIBRATION_OBJECT_DIMENSIONS; AxisEnum axis; - float dir; + float dir = 1; park_above_object(m, uncertainty); switch (side) { - case TOP: { - const float measurement = measure(Z_AXIS, -1, true, &m.backlash[TOP], uncertainty); - m.obj_center.z = measurement - dimensions.z / 2; - m.obj_side[TOP] = measurement; - return; - } - case RIGHT: axis = X_AXIS; dir = -1; break; - case FRONT: axis = Y_AXIS; dir = 1; break; - case LEFT: axis = X_AXIS; dir = 1; break; - case BACK: axis = Y_AXIS; dir = -1; break; + #if AXIS_CAN_CALIBRATE(Z) + case TOP: { + const float measurement = measure(Z_AXIS, -1, true, &m.backlash[TOP], uncertainty); + m.obj_center.z = measurement - dimensions.z / 2; + m.obj_side[TOP] = measurement; + return; + } + #endif + #if AXIS_CAN_CALIBRATE(X) + case LEFT: axis = X_AXIS; break; + case RIGHT: axis = X_AXIS; dir = -1; break; + #endif + #if AXIS_CAN_CALIBRATE(Y) + case FRONT: axis = Y_AXIS; break; + case BACK: axis = Y_AXIS; dir = -1; break; + #endif default: return; } if (probe_top_at_edge) { - // Probe top nearest the side we are probing - current_position[axis] = m.obj_center[axis] + (-dir) * (dimensions[axis] / 2 - m.nozzle_outer_dimension[axis]); - calibration_move(); - m.obj_side[TOP] = measure(Z_AXIS, -1, true, &m.backlash[TOP], uncertainty); - m.obj_center.z = m.obj_side[TOP] - dimensions.z / 2; + #if AXIS_CAN_CALIBRATE(Z) + // Probe top nearest the side we are probing + current_position[axis] = m.obj_center[axis] + (-dir) * (dimensions[axis] / 2 - m.nozzle_outer_dimension[axis]); + calibration_move(); + m.obj_side[TOP] = measure(Z_AXIS, -1, true, &m.backlash[TOP], uncertainty); + m.obj_center.z = m.obj_side[TOP] - dimensions.z / 2; + #endif } - // Move to safe distance to the side of the calibration object - current_position[axis] = m.obj_center[axis] + (-dir) * (dimensions[axis] / 2 + m.nozzle_outer_dimension[axis] / 2 + uncertainty); - calibration_move(); + if (AXIS_CAN_CALIBRATE(X) && axis == X_AXIS || AXIS_CAN_CALIBRATE(Y) && axis == Y_AXIS) { + // Move to safe distance to the side of the calibration object + current_position[axis] = m.obj_center[axis] + (-dir) * (dimensions[axis] / 2 + m.nozzle_outer_dimension[axis] / 2 + uncertainty); + calibration_move(); - // Plunge below the side of the calibration object and measure - current_position.z = m.obj_side[TOP] - CALIBRATION_NOZZLE_TIP_HEIGHT * 0.7; - calibration_move(); - const float measurement = measure(axis, dir, true, &m.backlash[side], uncertainty); - m.obj_center[axis] = measurement + dir * (dimensions[axis] / 2 + m.nozzle_outer_dimension[axis] / 2); - m.obj_side[side] = measurement; + // Plunge below the side of the calibration object and measure + current_position.z = m.obj_side[TOP] - (CALIBRATION_NOZZLE_TIP_HEIGHT) * 0.7f; + calibration_move(); + const float measurement = measure(axis, dir, true, &m.backlash[side], uncertainty); + m.obj_center[axis] = measurement + dir * (dimensions[axis] / 2 + m.nozzle_outer_dimension[axis] / 2); + m.obj_side[side] = measurement; + } } /** @@ -252,7 +277,7 @@ inline void probe_side(measurements_t &m, const float uncertainty, const side_t * uncertainty in - How far away from the calibration object to begin probing */ inline void probe_sides(measurements_t &m, const float uncertainty) { - #ifdef CALIBRATION_MEASURE_AT_TOP_EDGES + #if ENABLED(CALIBRATION_MEASURE_AT_TOP_EDGES) constexpr bool probe_top_at_edge = true; #else // Probing at the exact center only works if the center is flat. Probing on a washer @@ -261,18 +286,18 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { probe_side(m, uncertainty, TOP); #endif - #ifdef CALIBRATION_MEASURE_RIGHT + #if ENABLED(CALIBRATION_MEASURE_RIGHT) probe_side(m, uncertainty, RIGHT, probe_top_at_edge); #endif - #ifdef CALIBRATION_MEASURE_FRONT + #if ENABLED(CALIBRATION_MEASURE_FRONT) probe_side(m, uncertainty, FRONT, probe_top_at_edge); #endif - #ifdef CALIBRATION_MEASURE_LEFT + #if ENABLED(CALIBRATION_MEASURE_LEFT) probe_side(m, uncertainty, LEFT, probe_top_at_edge); #endif - #ifdef CALIBRATION_MEASURE_BACK + #if ENABLED(CALIBRATION_MEASURE_BACK) probe_side(m, uncertainty, BACK, probe_top_at_edge); #endif @@ -313,7 +338,9 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { #if ENABLED(CALIBRATION_REPORTING) inline void report_measured_faces(const measurements_t &m) { SERIAL_ECHOLNPGM("Sides:"); - SERIAL_ECHOLNPAIR(" Top: ", m.obj_side[TOP]); + #if AXIS_CAN_CALIBRATE(Z) + SERIAL_ECHOLNPAIR(" Top: ", m.obj_side[TOP]); + #endif #if ENABLED(CALIBRATION_MEASURE_LEFT) SERIAL_ECHOLNPAIR(" Left: ", m.obj_side[LEFT]); #endif @@ -343,19 +370,25 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { inline void report_measured_backlash(const measurements_t &m) { SERIAL_ECHOLNPGM("Backlash:"); - #if ENABLED(CALIBRATION_MEASURE_LEFT) - SERIAL_ECHOLNPAIR(" Left: ", m.backlash[LEFT]); + #if AXIS_CAN_CALIBRATE(X) + #if ENABLED(CALIBRATION_MEASURE_LEFT) + SERIAL_ECHOLNPAIR(" Left: ", m.backlash[LEFT]); + #endif + #if ENABLED(CALIBRATION_MEASURE_RIGHT) + SERIAL_ECHOLNPAIR(" Right: ", m.backlash[RIGHT]); + #endif #endif - #if ENABLED(CALIBRATION_MEASURE_RIGHT) - SERIAL_ECHOLNPAIR(" Right: ", m.backlash[RIGHT]); + #if AXIS_CAN_CALIBRATE(Y) + #if ENABLED(CALIBRATION_MEASURE_FRONT) + SERIAL_ECHOLNPAIR(" Front: ", m.backlash[FRONT]); + #endif + #if ENABLED(CALIBRATION_MEASURE_BACK) + SERIAL_ECHOLNPAIR(" Back: ", m.backlash[BACK]); + #endif #endif - #if ENABLED(CALIBRATION_MEASURE_FRONT) - SERIAL_ECHOLNPAIR(" Front: ", m.backlash[FRONT]); + #if AXIS_CAN_CALIBRATE(Z) + SERIAL_ECHOLNPAIR(" Top: ", m.backlash[TOP]); #endif - #if ENABLED(CALIBRATION_MEASURE_BACK) - SERIAL_ECHOLNPAIR(" Back: ", m.backlash[BACK]); - #endif - SERIAL_ECHOLNPAIR(" Top: ", m.backlash[TOP]); SERIAL_EOL(); } @@ -369,7 +402,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { #if HAS_Y_CENTER SERIAL_ECHOLNPAIR_P(SP_Y_STR, m.pos_error.y); #endif - SERIAL_ECHOLNPAIR_P(SP_Z_STR, m.pos_error.z); + if (AXIS_CAN_CALIBRATE(Z)) SERIAL_ECHOLNPAIR_P(SP_Z_STR, m.pos_error.z); SERIAL_EOL(); } @@ -417,6 +450,7 @@ inline void calibrate_backlash(measurements_t &m, const float uncertainty) { probe_sides(m, uncertainty); #if ENABLED(BACKLASH_GCODE) + #if HAS_X_CENTER backlash.distance_mm.x = (m.backlash[LEFT] + m.backlash[RIGHT]) / 2; #elif ENABLED(CALIBRATION_MEASURE_LEFT) @@ -433,18 +467,18 @@ inline void calibrate_backlash(measurements_t &m, const float uncertainty) { backlash.distance_mm.y = m.backlash[BACK]; #endif - backlash.distance_mm.z = m.backlash[TOP]; + if (AXIS_CAN_CALIBRATE(Z)) backlash.distance_mm.z = m.backlash[TOP]; #endif } #if ENABLED(BACKLASH_GCODE) // Turn on backlash compensation and move in all - // directions to take up any backlash + // allowed directions to take up any backlash { // New scope for TEMPORARY_BACKLASH_CORRECTION TEMPORARY_BACKLASH_CORRECTION(all_on); TEMPORARY_BACKLASH_SMOOTHING(0.0f); - const xyz_float_t move = { 3, 3, 3 }; + const xyz_float_t move = { AXIS_CAN_CALIBRATE(X) * 3, AXIS_CAN_CALIBRATE(Y) * 3, AXIS_CAN_CALIBRATE(Z) * 3 }; current_position += move; calibration_move(); current_position -= move; calibration_move(); } @@ -482,26 +516,18 @@ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const // Adjust the hotend offset #if HAS_HOTEND_OFFSET - #if HAS_X_CENTER - hotend_offset[extruder].x += m.pos_error.x; - #endif - #if HAS_Y_CENTER - hotend_offset[extruder].y += m.pos_error.y; - #endif - hotend_offset[extruder].z += m.pos_error.z; + if (ENABLED(HAS_X_CENTER) && AXIS_CAN_CALIBRATE(X)) hotend_offset[extruder].x += m.pos_error.x; + if (ENABLED(HAS_Y_CENTER) && AXIS_CAN_CALIBRATE(Y)) hotend_offset[extruder].y += m.pos_error.y; + if (AXIS_CAN_CALIBRATE(Z)) hotend_offset[extruder].z += m.pos_error.z; normalize_hotend_offsets(); #endif // Correct for positional error, so the object // is at the known actual spot planner.synchronize(); - #if HAS_X_CENTER - update_measurements(m, X_AXIS); - #endif - #if HAS_Y_CENTER - update_measurements(m, Y_AXIS); - #endif - update_measurements(m, Z_AXIS); + if (ENABLED(HAS_X_CENTER) && AXIS_CAN_CALIBRATE(X)) update_measurements(m, X_AXIS); + if (ENABLED(HAS_Y_CENTER) && AXIS_CAN_CALIBRATE(Y)) update_measurements(m, Y_AXIS); + if (AXIS_CAN_CALIBRATE(Z)) update_measurements(m, Z_AXIS); sync_plan_position(); } diff --git a/Marlin/src/gcode/calibrate/M425.cpp b/Marlin/src/gcode/calibrate/M425.cpp index 41c80daf7c..980152a4b1 100644 --- a/Marlin/src/gcode/calibrate/M425.cpp +++ b/Marlin/src/gcode/calibrate/M425.cpp @@ -47,7 +47,7 @@ void GcodeSuite::M425() { bool noArgs = true; LOOP_XYZ(a) { - if (parser.seen(XYZ_CHAR(a))) { + if (CAN_CALIBRATE(a) && parser.seen(XYZ_CHAR(a))) { planner.synchronize(); backlash.distance_mm[a] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(AxisEnum(a)); noArgs = false; @@ -74,7 +74,7 @@ void GcodeSuite::M425() { SERIAL_ECHOLNPGM("active:"); SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)"); SERIAL_ECHOPGM(" Backlash Distance (mm): "); - LOOP_XYZ(a) { + LOOP_XYZ(a) if (CAN_CALIBRATE(a)) { SERIAL_CHAR(' ', XYZ_CHAR(a)); SERIAL_ECHO(backlash.distance_mm[a]); SERIAL_EOL(); @@ -87,7 +87,7 @@ void GcodeSuite::M425() { #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) SERIAL_ECHOPGM(" Average measured backlash (mm):"); if (backlash.has_any_measurement()) { - LOOP_XYZ(a) if (backlash.has_measurement(AxisEnum(a))) { + LOOP_XYZ(a) if (CAN_CALIBRATE(a) && backlash.has_measurement(AxisEnum(a))) { SERIAL_CHAR(' ', XYZ_CHAR(a)); SERIAL_ECHO(backlash.get_measurement(AxisEnum(a))); } diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index d9db986466..9ea298f02d 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -139,6 +139,19 @@ #define CORESIGN(n) (ANY(COREYX, COREZX, COREZY) ? (-(n)) : (n)) #endif +// Calibration codes only for non-core axes +#if EITHER(BACKLASH_GCODE, CALIBRATION_GCODE) + #if IS_CORE + #define X_AXIS_INDEX 0 + #define Y_AXIS_INDEX 1 + #define Z_AXIS_INDEX 2 + #define CAN_CALIBRATE(A,B) (A##_AXIS_INDEX == B##_INDEX) + #else + #define CAN_CALIBRATE(...) 1 + #endif +#endif +#define AXIS_CAN_CALIBRATE(A) CAN_CALIBRATE(A,NORMAL_AXIS) + /** * No adjustable bed on non-cartesians */ diff --git a/Marlin/src/inc/MarlinConfig.h b/Marlin/src/inc/MarlinConfig.h index d32506702e..c1655015e0 100644 --- a/Marlin/src/inc/MarlinConfig.h +++ b/Marlin/src/inc/MarlinConfig.h @@ -35,11 +35,12 @@ #include "Conditionals_post.h" #include HAL_PATH(../HAL, inc/Conditionals_post.h) +#include "../core/types.h" // Ahead of sanity-checks + #include "SanityCheck.h" #include HAL_PATH(../HAL, inc/SanityCheck.h) // Include all core headers -#include "../core/types.h" #include "../core/language.h" #include "../core/utility.h" #include "../core/serial.h" diff --git a/Marlin/src/lcd/menu/menu_backlash.cpp b/Marlin/src/lcd/menu/menu_backlash.cpp index ad9c51d4cf..720694bfff 100644 --- a/Marlin/src/lcd/menu/menu_backlash.cpp +++ b/Marlin/src/lcd/menu/menu_backlash.cpp @@ -39,9 +39,9 @@ void menu_backlash() { EDIT_ITEM_FAST(percent, MSG_BACKLASH_CORRECTION, &backlash.correction, all_off, all_on); #define EDIT_BACKLASH_DISTANCE(N) EDIT_ITEM_FAST(float43, MSG_BACKLASH_##N, &backlash.distance_mm[_AXIS(N)], 0.0f, 9.9f); - EDIT_BACKLASH_DISTANCE(A); - EDIT_BACKLASH_DISTANCE(B); - EDIT_BACKLASH_DISTANCE(C); + if (AXIS_CAN_CALIBRATE(A)) EDIT_BACKLASH_DISTANCE(A); + if (AXIS_CAN_CALIBRATE(B)) EDIT_BACKLASH_DISTANCE(B); + if (AXIS_CAN_CALIBRATE(C)) EDIT_BACKLASH_DISTANCE(C); #ifdef BACKLASH_SMOOTHING_MM EDIT_ITEM_FAST(float43, MSG_BACKLASH_SMOOTHING, &backlash.smoothing_mm, 0.0f, 9.9f); From a84990961a62e4190cfac10b500ce9c693896e83 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 28 Mar 2020 01:19:43 -0500 Subject: [PATCH 24/43] Simplify TWIBus debug --- Marlin/src/feature/twibus.cpp | 56 +++++++++++------------------------ Marlin/src/feature/twibus.h | 7 +++-- 2 files changed, 22 insertions(+), 41 deletions(-) diff --git a/Marlin/src/feature/twibus.cpp b/Marlin/src/feature/twibus.cpp index 60d78018a2..9dbb1deb4f 100644 --- a/Marlin/src/feature/twibus.cpp +++ b/Marlin/src/feature/twibus.cpp @@ -49,37 +49,27 @@ void TWIBus::address(const uint8_t adr) { addr = adr; - #if ENABLED(DEBUG_TWIBUS) - debug(PSTR("address"), adr); - #endif + debug(PSTR("address"), adr); } void TWIBus::addbyte(const char c) { if (buffer_s >= COUNT(buffer)) return; buffer[buffer_s++] = c; - #if ENABLED(DEBUG_TWIBUS) - debug(PSTR("addbyte"), c); - #endif + debug(PSTR("addbyte"), c); } void TWIBus::addbytes(char src[], uint8_t bytes) { - #if ENABLED(DEBUG_TWIBUS) - debug(PSTR("addbytes"), bytes); - #endif + debug(PSTR("addbytes"), bytes); while (bytes--) addbyte(*src++); } void TWIBus::addstring(char str[]) { - #if ENABLED(DEBUG_TWIBUS) - debug(PSTR("addstring"), str); - #endif + debug(PSTR("addstring"), str); while (char c = *str++) addbyte(c); } void TWIBus::send() { - #if ENABLED(DEBUG_TWIBUS) - debug(PSTR("send"), addr); - #endif + debug(PSTR("send"), addr); Wire.beginTransmission(I2C_ADDRESS(addr)); Wire.write(buffer, buffer_s); @@ -89,21 +79,21 @@ void TWIBus::send() { } // static -void TWIBus::echoprefix(uint8_t bytes, const char prefix[], uint8_t adr) { +void TWIBus::echoprefix(uint8_t bytes, const char pref[], uint8_t adr) { SERIAL_ECHO_START(); - serialprintPGM(prefix); + serialprintPGM(pref); SERIAL_ECHOPAIR(": from:", adr, " bytes:", bytes, " data:"); } // static -void TWIBus::echodata(uint8_t bytes, const char prefix[], uint8_t adr) { - echoprefix(bytes, prefix, adr); +void TWIBus::echodata(uint8_t bytes, const char pref[], uint8_t adr) { + echoprefix(bytes, pref, adr); while (bytes-- && Wire.available()) SERIAL_CHAR(Wire.read()); SERIAL_EOL(); } -void TWIBus::echobuffer(const char prefix[], uint8_t adr) { - echoprefix(buffer_s, prefix, adr); +void TWIBus::echobuffer(const char pref[], uint8_t adr) { + echoprefix(buffer_s, pref, adr); LOOP_L_N(i, buffer_s) SERIAL_CHAR(buffer[i]); SERIAL_EOL(); } @@ -111,15 +101,11 @@ void TWIBus::echobuffer(const char prefix[], uint8_t adr) { bool TWIBus::request(const uint8_t bytes) { if (!addr) return false; - #if ENABLED(DEBUG_TWIBUS) - debug(PSTR("request"), bytes); - #endif + debug(PSTR("request"), bytes); // requestFrom() is a blocking function if (Wire.requestFrom(addr, bytes) == 0) { - #if ENABLED(DEBUG_TWIBUS) - debug("request fail", addr); - #endif + debug("request fail", addr); return false; } @@ -127,9 +113,7 @@ bool TWIBus::request(const uint8_t bytes) { } void TWIBus::relay(const uint8_t bytes) { - #if ENABLED(DEBUG_TWIBUS) - debug(PSTR("relay"), bytes); - #endif + debug(PSTR("relay"), bytes); if (request(bytes)) echodata(bytes, PSTR("i2c-reply"), addr); @@ -141,9 +125,7 @@ uint8_t TWIBus::capture(char *dst, const uint8_t bytes) { while (count < bytes && Wire.available()) dst[count++] = Wire.read(); - #if ENABLED(DEBUG_TWIBUS) - debug(PSTR("capture"), count); - #endif + debug(PSTR("capture"), count); return count; } @@ -156,16 +138,12 @@ void TWIBus::flush() { #if I2C_SLAVE_ADDRESS > 0 void TWIBus::receive(uint8_t bytes) { - #if ENABLED(DEBUG_TWIBUS) - debug(PSTR("receive"), bytes); - #endif + debug(PSTR("receive"), bytes); echodata(bytes, PSTR("i2c-receive"), 0); } void TWIBus::reply(char str[]/*=nullptr*/) { - #if ENABLED(DEBUG_TWIBUS) - debug(PSTR("reply"), str); - #endif + debug(PSTR("reply"), str); if (str) { reset(); diff --git a/Marlin/src/feature/twibus.h b/Marlin/src/feature/twibus.h index faf9eb38cf..2c1b20da51 100644 --- a/Marlin/src/feature/twibus.h +++ b/Marlin/src/feature/twibus.h @@ -223,7 +223,6 @@ class TWIBus { #endif #if ENABLED(DEBUG_TWIBUS) - /** * @brief Prints a debug message * @details Prints a simple debug message "TWIBus::function: value" @@ -233,6 +232,10 @@ class TWIBus { static void debug(const char func[], char c); static void debug(const char func[], char adr[]); static inline void debug(const char func[], uint8_t v) { debug(func, (uint32_t)v); } - + #else + static inline void debug(const char[], uint32_t) {} + static inline void debug(const char[], char) {} + static inline void debug(const char[], char[]) {} + static inline void debug(const char[], uint8_t) {} #endif }; From 747b964295118d425ad41cd7593dae48ccf9f14f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 28 Mar 2020 03:18:53 -0500 Subject: [PATCH 25/43] Clean up user-wait, SD completion (#17315) --- Marlin/Configuration_adv.h | 4 + Marlin/src/MarlinCore.cpp | 69 ++++-------- Marlin/src/MarlinCore.h | 2 + Marlin/src/feature/mmu2/mmu2.cpp | 3 +- Marlin/src/feature/pause.cpp | 8 +- Marlin/src/gcode/gcode.cpp | 6 +- Marlin/src/gcode/gcode.h | 4 + Marlin/src/gcode/lcd/M0_M1.cpp | 51 +++------ Marlin/src/gcode/sd/M1001.cpp | 109 +++++++++++++++++++ Marlin/src/lcd/language/language_en.h | 1 + Marlin/src/lcd/menu/menu_delta_calibrate.cpp | 4 +- Marlin/src/lcd/ultralcd.cpp | 22 ++-- Marlin/src/module/probe.cpp | 10 +- Marlin/src/sd/cardreader.cpp | 3 +- Marlin/src/sd/cardreader.h | 1 - 15 files changed, 179 insertions(+), 118 deletions(-) create mode 100644 Marlin/src/gcode/sd/M1001.cpp diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 370fbaf6ec..00f89662c7 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1049,6 +1049,10 @@ #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") + #if ENABLED(PRINTER_EVENT_LEDS) + #define PE_LEDS_COMPLETED_TIME (30*60) // (seconds) Time to keep the LED "done" color before restoring normal illumination + #endif + /** * Continue after Power-Loss (Creality3D) * diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 7adc8272ea..8130affe30 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -210,6 +210,24 @@ bool wait_for_heatup = true; // For M0/M1, this flag may be cleared (by M108) to exit the wait-for-user loop #if HAS_RESUME_CONTINUE bool wait_for_user; // = false; + + void wait_for_user_response(millis_t ms/*=0*/, const bool no_sleep/*=false*/) { + #if DISABLED(ADVANCED_PAUSE_FEATURE) + UNUSED(no_sleep); + #endif + KEEPALIVE_STATE(PAUSED_FOR_USER); + wait_for_user = true; + if (ms) ms += millis(); // expire time + while (wait_for_user && !(ms && ELAPSED(millis(), ms))) { + idle( + #if ENABLED(ADVANCED_PAUSE_FEATURE) + no_sleep + #endif + ); + } + wait_for_user = false; + } + #endif // Inactivity shutdown @@ -418,53 +436,8 @@ void startOrResumeJob() { } inline void finishSDPrinting() { - - bool did_state = true; - switch (card.sdprinting_done_state) { - - case 1: - if (print_job_timer.duration() > 60) - did_state = queue.enqueue_one_P(PSTR("M31")); - break; - - case 2: - did_state = queue.enqueue_one_P(PSTR("M77")); - break; - - case 3: - #if ENABLED(LCD_SET_PROGRESS_MANUALLY) - ui.set_progress_done(); - #endif - break; - - case 4: // Display "Click to Continue..." - #if HAS_LEDS_OFF_FLAG // 30 min timeout with LCD, 1 min without - did_state = queue.enqueue_one_P( - print_job_timer.duration() < 60 ? PSTR("M0Q1P1") : PSTR("M0Q1S" TERN(HAS_LCD_MENU, "1800", "60")) - ); - #endif - break; - - case 5: - #if ENABLED(POWER_LOSS_RECOVERY) - recovery.purge(); - #endif - - #if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND) - planner.finish_and_disable(); - #endif - - #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) - ui.reselect_last_file(); - #endif - - SERIAL_ECHOLNPGM(STR_FILE_PRINTED); - - default: - did_state = false; - card.sdprinting_done_state = 0; - } - if (did_state) ++card.sdprinting_done_state; + if (queue.enqueue_one_P(PSTR("M1001"))) + marlin_state = MF_RUNNING; } #endif // SDSUPPORT @@ -1209,7 +1182,7 @@ void loop() { #if ENABLED(SDSUPPORT) card.checkautostart(); if (card.flag.abort_sd_printing) abortSDPrinting(); - if (card.sdprinting_done_state) finishSDPrinting(); + if (marlin_state == MF_SD_COMPLETE) finishSDPrinting(); #endif queue.advance(); diff --git a/Marlin/src/MarlinCore.h b/Marlin/src/MarlinCore.h index 3bce72ab80..e6678c5b18 100644 --- a/Marlin/src/MarlinCore.h +++ b/Marlin/src/MarlinCore.h @@ -83,6 +83,7 @@ enum MarlinState : uint8_t { MF_PAUSED = _BV(1), MF_WAITING = _BV(2), MF_STOPPED = _BV(3), + MF_SD_COMPLETE = _BV(4), MF_KILLED = _BV(7) }; @@ -98,6 +99,7 @@ extern bool wait_for_heatup; #if HAS_RESUME_CONTINUE extern bool wait_for_user; + void wait_for_user_response(millis_t ms=0, const bool no_sleep=false); #endif // Inactivity shutdown timer diff --git a/Marlin/src/feature/mmu2/mmu2.cpp b/Marlin/src/feature/mmu2/mmu2.cpp index 2df34176da..4506883f46 100644 --- a/Marlin/src/feature/mmu2/mmu2.cpp +++ b/Marlin/src/feature/mmu2/mmu2.cpp @@ -707,14 +707,13 @@ void MMU2::filament_runout() { if (recover) { LCD_MESSAGEPGM(MSG_MMU2_EJECT_RECOVER); BUZZ(200, 404); - wait_for_user = true; #if ENABLED(HOST_PROMPT_SUPPORT) host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), CONTINUE_STR); #endif #if ENABLED(EXTENSIBLE_UI) ExtUI::onUserConfirmRequired_P(PSTR("MMU2 Eject Recover")); #endif - while (wait_for_user) idle(); + wait_for_user_response(); BUZZ(200, 404); BUZZ(200, 404); diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index fb69803ee7..de73163cbd 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -184,7 +184,6 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l #endif KEEPALIVE_STATE(PAUSED_FOR_USER); - wait_for_user = true; // LCD click or M108 will clear this #if ENABLED(HOST_PROMPT_SUPPORT) const char tool = '0' #if NUM_RUNOUT_SENSORS > 1 @@ -246,13 +245,13 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_PURGE); #endif - wait_for_user = true; #if ENABLED(HOST_PROMPT_SUPPORT) host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR); #endif #if ENABLED(EXTENSIBLE_UI) ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging...")); #endif + wait_for_user = true; // A click or M108 breaks the purge_length loop for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count) do_pause_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE); wait_for_user = false; @@ -508,13 +507,13 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep // Wait for filament insert by user and press button KEEPALIVE_STATE(PAUSED_FOR_USER); - wait_for_user = true; // LCD click or M108 will clear this #if ENABLED(HOST_PROMPT_SUPPORT) host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Nozzle Parked"), CONTINUE_STR); #endif #if ENABLED(EXTENSIBLE_UI) ExtUI::onUserConfirmRequired_P(PSTR("Nozzle Parked")); #endif + wait_for_user = true; // LCD click or M108 will clear this while (wait_for_user) { #if HAS_BUZZER filament_change_beep(max_beep_count); @@ -540,8 +539,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep ExtUI::onUserConfirmRequired_P(PSTR("HeaterTimeout")); #endif - // Wait for LCD click or M108 - while (wait_for_user) idle_no_sleep(); + wait_for_user_response(0, true); // Wait for LCD click or M108 #if ENABLED(HOST_PROMPT_SUPPORT) host_prompt_do(PROMPT_INFO, PSTR("Reheating")); diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 1ce1e3d5cb..1f9d710bb4 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -857,7 +857,11 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { #if ENABLED(POWER_LOSS_RECOVERY) case 413: M413(); break; // M413: Enable/disable/query Power-Loss Recovery - case 1000: M1000(); break; // M1000: Resume from power-loss + case 1000: M1000(); break; // M1000: [INTERNAL] Resume from power-loss + #endif + + #if ENABLED(SDSUPPORT) + case 1001: M1001(); break; // M1001: [INTERNAL] Handle SD completion #endif #if ENABLED(MAX7219_GCODE) diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index c1024ac440..8e5d054d99 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -968,6 +968,10 @@ private: static void M1000(); #endif + #if ENABLED(SDSUPPORT) + static void M1001(); + #endif + #if ENABLED(MAX7219_GCODE) static void M7219(); #endif diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 43b39226f7..190023b090 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -24,23 +24,19 @@ #if HAS_RESUME_CONTINUE -#include "../gcode.h" -#include "../../module/planner.h" - #include "../../inc/MarlinConfig.h" +#include "../gcode.h" + +#include "../../module/planner.h" // for synchronize() +#include "../../MarlinCore.h" // for wait_for_user_response() + #if HAS_LCD_MENU #include "../../lcd/ultralcd.h" -#endif - -#if ENABLED(EXTENSIBLE_UI) +#elif ENABLED(EXTENSIBLE_UI) #include "../../lcd/extui/ui_api.h" #endif -#if HAS_LEDS_OFF_FLAG - #include "../../feature/leds/printer_event_leds.h" -#endif - #if ENABLED(HOST_PROMPT_SUPPORT) #include "../../feature/host_actions.h" #endif @@ -56,18 +52,11 @@ void GcodeSuite::M0_M1() { planner.synchronize(); - #if HAS_LEDS_OFF_FLAG - const bool seenQ = parser.seen('Q'); - if (seenQ) printerEventLEDs.onPrintCompleted(); // Change LED color for Print Completed - #else - constexpr bool seenQ = false; - #endif - #if HAS_LCD_MENU if (parser.string_arg) ui.set_status(parser.string_arg, true); - else if (!seenQ) { + else { LCD_MESSAGEPGM(MSG_USERWAIT); #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 ui.reset_progress_bar_timeout(); @@ -75,12 +64,10 @@ void GcodeSuite::M0_M1() { } #elif ENABLED(EXTENSIBLE_UI) - if (!seenQ) { - if (parser.string_arg) - ExtUI::onUserConfirmRequired(parser.string_arg); // Can this take an SRAM string?? - else - ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT)); - } + if (parser.string_arg) + ExtUI::onUserConfirmRequired(parser.string_arg); // Can this take an SRAM string?? + else + ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT)); #else if (parser.string_arg) { @@ -90,25 +77,15 @@ void GcodeSuite::M0_M1() { #endif - KEEPALIVE_STATE(PAUSED_FOR_USER); - wait_for_user = true; - #if ENABLED(HOST_PROMPT_SUPPORT) - if (!seenQ) host_prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? PSTR("M1 Stop") : PSTR("M0 Stop"), CONTINUE_STR); + host_prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? PSTR("M1 Stop") : PSTR("M0 Stop"), CONTINUE_STR); #endif - if (ms > 0) ms += millis(); // wait until this time for a click - while (wait_for_user && (ms == 0 || PENDING(millis(), ms))) idle(); - - #if HAS_LEDS_OFF_FLAG - printerEventLEDs.onResumeAfterWait(); - #endif + wait_for_user_response(ms); #if HAS_LCD_MENU - if (!seenQ) ui.reset_status(); + ui.reset_status(); #endif - - wait_for_user = false; } #endif // HAS_RESUME_CONTINUE diff --git a/Marlin/src/gcode/sd/M1001.cpp b/Marlin/src/gcode/sd/M1001.cpp new file mode 100644 index 0000000000..4261b57f97 --- /dev/null +++ b/Marlin/src/gcode/sd/M1001.cpp @@ -0,0 +1,109 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDSUPPORT) + +#include "../gcode.h" +#include "../../module/printcounter.h" + +#if EITHER(LCD_SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE) + #include "../../lcd/ultralcd.h" +#endif + +#if ENABLED(POWER_LOSS_RECOVERY) + #include "../../feature/powerloss.h" +#endif + +#if HAS_LEDS_OFF_FLAG + #include "../../feature/leds/printer_event_leds.h" +#endif + +#if ENABLED(EXTENSIBLE_UI) + #include "../../lcd/extui/ui_api.h" +#endif + +#if ENABLED(HOST_ACTION_COMMANDS) + #include "../../feature/host_actions.h" +#endif + +#if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND) + #include "../../module/planner.h" +#endif + +#ifndef PE_LEDS_COMPLETED_TIME + #define PE_LEDS_COMPLETED_TIME (30*60) +#endif + +/** + * M1001: Execute actions for SD print completion + */ +void GcodeSuite::M1001() { + + // Report total print time + const bool long_print = print_job_timer.duration() > 60; + if (long_print) gcode.process_subcommands_now_P(PSTR("M31")); + + // Stop the print job timer + gcode.process_subcommands_now_P(PSTR("M77")); + + // Set the progress bar "done" state + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) + ui.set_progress_done(); + #endif + + // Purge the recovery file + #if ENABLED(POWER_LOSS_RECOVERY) + recovery.purge(); + #endif + + // Announce SD file completion + SERIAL_ECHOLNPGM(STR_FILE_PRINTED); + + // Update the status LED color + #if HAS_LEDS_OFF_FLAG + if (long_print) { + printerEventLEDs.onPrintCompleted(); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE)); + #endif + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR); + #endif + wait_for_user_response(1000UL * TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30)); + printerEventLEDs.onResumeAfterWait(); + } + #endif + + // Wait for the queue to empty (and "clean"), inject SD_FINISHED_RELEASECOMMAND + #if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND) + planner.finish_and_disable(); + #endif + + // Re-select the last printed file in the UI + #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) + ui.reselect_last_file(); + #endif +} + +#endif // SDSUPPORT diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 75c13de9c7..8fa22e2c71 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -352,6 +352,7 @@ namespace Language_en { PROGMEM Language_Str MSG_PRINT_PAUSED = _UxGT("Print Paused"); PROGMEM Language_Str MSG_PRINTING = _UxGT("Printing..."); PROGMEM Language_Str MSG_PRINT_ABORTED = _UxGT("Print Aborted"); + PROGMEM Language_Str MSG_PRINT_DONE = _UxGT("Print Done"); PROGMEM Language_Str MSG_NO_MOVE = _UxGT("No Move."); PROGMEM Language_Str MSG_KILLED = _UxGT("KILLED. "); PROGMEM Language_Str MSG_STOPPED = _UxGT("STOPPED. "); diff --git a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp index a27e2c9726..ac80870ac8 100644 --- a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp +++ b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp @@ -61,16 +61,14 @@ void _man_probe_pt(const xy_pos_t &xy) { float lcd_probe_pt(const xy_pos_t &xy) { _man_probe_pt(xy); - KEEPALIVE_STATE(PAUSED_FOR_USER); ui.defer_status_screen(); - wait_for_user = true; #if ENABLED(HOST_PROMPT_SUPPORT) host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Delta Calibration in progress"), CONTINUE_STR); #endif #if ENABLED(EXTENSIBLE_UI) ExtUI::onUserConfirmRequired_P(PSTR("Delta Calibration in progress")); #endif - while (wait_for_user) idle(); + wait_for_user_response(); ui.goto_previous_screen_no_defer(); return current_position.z; } diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 7ff1440559..bbcb678dd8 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -776,6 +776,13 @@ void MarlinUI::update() { // If the action button is pressed... static bool wait_for_unclick; // = false + auto do_click = [&]{ + wait_for_unclick = true; // - Set debounce flag to ignore continous clicks + lcd_clicked = !wait_for_user && !no_reentry; // - Keep the click if not waiting for a user-click + wait_for_user = false; // - Any click clears wait for user + quick_feedback(); // - Always make a click sound + }; + #if ENABLED(TOUCH_BUTTONS) if (touch_buttons) { RESET_STATUS_TIMEOUT(); @@ -796,12 +803,8 @@ void MarlinUI::update() { } } } - else if (!wait_for_unclick && (buttons & EN_C)) { // OK button, if not waiting for a debounce release: - wait_for_unclick = true; // - Set debounce flag to ignore continous clicks - lcd_clicked = !wait_for_user && !no_reentry; // - Keep the click if not waiting for a user-click - wait_for_user = false; // - Any click clears wait for user - quick_feedback(); // - Always make a click sound - } + else if (!wait_for_unclick && (buttons & EN_C)) // OK button, if not waiting for a debounce release: + do_click(); } else // keep wait_for_unclick value @@ -810,12 +813,7 @@ void MarlinUI::update() { { // Integrated LCD click handling via button_pressed if (!external_control && button_pressed()) { - if (!wait_for_unclick) { // If not waiting for a debounce release: - wait_for_unclick = true; // - Set debounce flag to ignore continous clicks - lcd_clicked = !wait_for_user && !no_reentry; // - Keep the click if not waiting for a user-click - wait_for_user = false; // - Any click clears wait for user - quick_feedback(); // - Always make a click sound - } + if (!wait_for_unclick) do_click(); // Handle the click } else wait_for_unclick = false; diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 962c230775..6e3f2baa66 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -134,12 +134,10 @@ xyz_pos_t Probe::offset; // Initialized by settings.load() LCD_MESSAGEPGM(MSG_MANUAL_DEPLOY_TOUCHMI); ui.return_to_status(); - KEEPALIVE_STATE(PAUSED_FOR_USER); - wait_for_user = true; // LCD click or M108 will clear this #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Deploy TouchMI probe."), CONTINUE_STR); + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Deploy TouchMI"), CONTINUE_STR); #endif - while (wait_for_user) idle(); + wait_for_user_response(); ui.reset_status(); ui.goto_screen(prev_screen); @@ -297,15 +295,13 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { serialprintPGM(ds_str); SERIAL_EOL(); - KEEPALIVE_STATE(PAUSED_FOR_USER); - wait_for_user = true; #if ENABLED(HOST_PROMPT_SUPPORT) host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), CONTINUE_STR); #endif #if ENABLED(EXTENSIBLE_UI) ExtUI::onUserConfirmRequired_P(PSTR("Stow Probe")); #endif - while (wait_for_user) idle(); + wait_for_user_response(); ui.reset_status(); } while( diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index aadd355afd..80e94b88b5 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -49,7 +49,6 @@ // public: card_flags_t CardReader::flag; -uint8_t CardReader::sdprinting_done_state; char CardReader::filename[FILENAME_LENGTH], CardReader::longFilename[LONG_FILENAME_LENGTH]; int8_t CardReader::autostart_index; @@ -1089,7 +1088,7 @@ void CardReader::fileHasFinished() { presort(); #endif - sdprinting_done_state = 1; + marlin_state = MF_SD_COMPLETE; } } diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 749ece01d3..955a8b69b3 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -49,7 +49,6 @@ typedef struct { class CardReader { public: - static uint8_t sdprinting_done_state; static card_flags_t flag; // Flags (above) static char filename[FILENAME_LENGTH], // DOS 8.3 filename of the selected item longFilename[LONG_FILENAME_LENGTH]; // Long name of the selected item From 2f7e5cf7ddd04ae0474f104dd1b712b480fe692c Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Sat, 28 Mar 2020 09:53:04 -0500 Subject: [PATCH 26/43] Fix typo... --- Marlin/src/libs/numtostr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/libs/numtostr.cpp b/Marlin/src/libs/numtostr.cpp index ac82bf16f1..1ed315ae07 100644 --- a/Marlin/src/libs/numtostr.cpp +++ b/Marlin/src/libs/numtostr.cpp @@ -312,7 +312,7 @@ const char* ftostr52sign(const float &f) { // Convert signed float to string with +12.345 format const char* ftostr53sign(const float &f) { - long i = (f * 1000 + (f < 0 ? -5: 5)) / 10; + long i = (f * 10000 + (f < 0 ? -5: 5)) / 10; conv[0] = MINUSOR(i, '+'); conv[1] = DIGIMOD(i, 10000); conv[2] = DIGIMOD(i, 1000); From fc74c6a7b6646cf608f96bdf362a136eb306415e Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 29 Mar 2020 00:03:23 +0000 Subject: [PATCH 27/43] [cron] Bump distribution date (2020-03-29) --- Marlin/src/inc/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 9978e3e6d3..0a2599294a 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2020-03-28" + #define STRING_DISTRIBUTION_DATE "2020-03-29" #endif /** From b35dc5f0b41dc592dbce29682cf617afc652f11f Mon Sep 17 00:00:00 2001 From: oscarsan1 Date: Sun, 29 Mar 2020 19:37:12 +0200 Subject: [PATCH 28/43] Fix Trigorilla 1.4 missing spaces --- Marlin/src/pins/ramps/pins_TRIGORILLA_14.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h index dcf5ff5a0a..9016028055 100644 --- a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h +++ b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h @@ -66,13 +66,13 @@ #define RAMPS_D8_PIN TRIGORILLA_FAN0_PIN #else // EEB - #define RAMPS_D8_PINTRIGORILLA_HEATER_BED_PIN + #define RAMPS_D8_PIN TRIGORILLA_HEATER_BED_PIN #define FAN_PIN TRIGORILLA_FAN0_PIN // Override pin 4 in pins_RAMPS.h #endif #elif TEMP_SENSOR_BED // EFB (Anycubic Kossel default) #define RAMPS_D9_PIN TRIGORILLA_FAN0_PIN - #define RAMPS_D8_PINTRIGORILLA_HEATER_BED_PIN + #define RAMPS_D8_PIN TRIGORILLA_HEATER_BED_PIN #else // EFF #define RAMPS_D9_PIN TRIGORILLA_FAN1_PIN @@ -83,7 +83,7 @@ #define FAN1_PIN TRIGORILLA_FAN1_PIN #endif #define FAN2_PIN TRIGORILLA_FAN2_PIN -#define ORIG_E0_AUTO_FAN_PINTRIGORILLA_FAN2_PIN // Used in Anycubic Kossel example config +#define ORIG_E0_AUTO_FAN_PIN TRIGORILLA_FAN2_PIN // Used in Anycubic Kossel example config #include "pins_RAMPS.h" From add34aa286bbcbd081aff4a25055505759f3e9f1 Mon Sep 17 00:00:00 2001 From: thisiskeithb Date: Sat, 28 Mar 2020 06:49:59 -0700 Subject: [PATCH 29/43] Fix STM32F1 USB Composite Dependency Co-authored-by: Lord-Quake --- platformio.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index 13808d299a..4e801713a0 100644 --- a/platformio.ini +++ b/platformio.ini @@ -301,7 +301,7 @@ extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py src_filter = ${common.default_src_filter} + lib_deps = ${common.lib_deps} SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip - USBComposite_stm32f1@==0.91 + USBComposite for STM32F1@==0.91 lib_ignore = Adafruit NeoPixel, SPI monitor_speed = 115200 @@ -316,7 +316,7 @@ extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py src_filter = ${common.default_src_filter} + lib_deps = ${common.lib_deps} SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip - USBComposite_stm32f1@==0.91 + USBComposite for STM32F1@==0.91 lib_ignore = Adafruit NeoPixel, SPI monitor_speed = 115200 @@ -332,7 +332,7 @@ extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py src_filter = ${common.default_src_filter} + lib_deps = ${common.lib_deps} SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip - USBComposite_stm32f1@==0.91 + USBComposite for STM32F1@==0.91 lib_ignore = Adafruit NeoPixel, SPI monitor_speed = 115200 @@ -348,7 +348,7 @@ extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py src_filter = ${common.default_src_filter} + lib_deps = ${common.lib_deps} SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip - USBComposite_stm32f1@==0.91 + USBComposite for STM32F1@==0.91 lib_ignore = Adafruit NeoPixel, SPI monitor_speed = 115200 From fc11e7217460056473f91dfb7dd574884319f567 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 29 Mar 2020 16:10:55 -0500 Subject: [PATCH 30/43] Fix extra unskew call Fixes #17264 --- Marlin/src/module/planner.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index c71a0f61cc..e1a050a459 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1519,10 +1519,6 @@ void Planner::check_axes_activity() { #endif } - - #if ENABLED(SKEW_CORRECTION) - unskew(raw); - #endif } #endif // HAS_LEVELING From 765a9f3471b8a6b67c23f79cc6965e2f795f284a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 29 Mar 2020 16:26:55 -0500 Subject: [PATCH 31/43] do_pause_e_move => unscaled_e_move --- Marlin/src/feature/pause.cpp | 31 +++++++++--------------- Marlin/src/feature/pause.h | 2 -- Marlin/src/gcode/feature/camera/M240.cpp | 10 ++------ Marlin/src/lcd/language/language_fr.h | 4 +-- Marlin/src/module/motion.cpp | 13 ++++++++++ Marlin/src/module/motion.h | 2 ++ Marlin/src/module/tool_change.cpp | 6 ++--- 7 files changed, 33 insertions(+), 35 deletions(-) diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index de73163cbd..9c615b6ff8 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -134,15 +134,6 @@ static bool ensure_safe_temperature(const PauseMode mode=PAUSE_MODE_SAME) { return thermalManager.wait_for_hotend(active_extruder); } -void do_pause_e_move(const float &length, const feedRate_t &fr_mm_s) { - #if HAS_FILAMENT_SENSOR - runout.reset(); - #endif - current_position.e += length / planner.e_factor[active_extruder]; - line_to_current_position(fr_mm_s); - planner.synchronize(); -} - /** * Load filament into the hotend * @@ -217,7 +208,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l #endif // Slow Load filament - if (slow_load_length) do_pause_e_move(slow_load_length, FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE); + if (slow_load_length) unscaled_e_move(slow_load_length, FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE); // Fast Load Filament if (fast_load_length) { @@ -226,7 +217,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l planner.settings.retract_acceleration = FILAMENT_CHANGE_FAST_LOAD_ACCEL; #endif - do_pause_e_move(fast_load_length, FILAMENT_CHANGE_FAST_LOAD_FEEDRATE); + unscaled_e_move(fast_load_length, FILAMENT_CHANGE_FAST_LOAD_FEEDRATE); #if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0 planner.settings.retract_acceleration = saved_acceleration; @@ -253,7 +244,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l #endif wait_for_user = true; // A click or M108 breaks the purge_length loop for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count) - do_pause_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE); + unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE); wait_for_user = false; #else @@ -266,7 +257,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l #endif // Extrude filament to get into hotend - do_pause_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE); + unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE); } #if ENABLED(HOST_PROMPT_SUPPORT) @@ -331,13 +322,13 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, #endif // Retract filament - do_pause_e_move(-(FILAMENT_UNLOAD_PURGE_RETRACT) * mix_multiplier, (PAUSE_PARK_RETRACT_FEEDRATE) * mix_multiplier); + unscaled_e_move(-(FILAMENT_UNLOAD_PURGE_RETRACT) * mix_multiplier, (PAUSE_PARK_RETRACT_FEEDRATE) * mix_multiplier); // Wait for filament to cool safe_delay(FILAMENT_UNLOAD_PURGE_DELAY); // Quickly purge - do_pause_e_move((FILAMENT_UNLOAD_PURGE_RETRACT + FILAMENT_UNLOAD_PURGE_LENGTH) * mix_multiplier, + unscaled_e_move((FILAMENT_UNLOAD_PURGE_RETRACT + FILAMENT_UNLOAD_PURGE_LENGTH) * mix_multiplier, (FILAMENT_UNLOAD_PURGE_FEEDRATE) * mix_multiplier); // Unload filament @@ -346,7 +337,7 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, planner.settings.retract_acceleration = FILAMENT_CHANGE_UNLOAD_ACCEL; #endif - do_pause_e_move(unload_length * mix_multiplier, (FILAMENT_CHANGE_UNLOAD_FEEDRATE) * mix_multiplier); + unscaled_e_move(unload_length * mix_multiplier, (FILAMENT_CHANGE_UNLOAD_FEEDRATE) * mix_multiplier); #if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0 planner.settings.retract_acceleration = saved_acceleration; @@ -436,7 +427,7 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float // Initial retract before move to filament change position if (retract && thermalManager.hotEnoughToExtrude(active_extruder)) - do_pause_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE); + unscaled_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE); // Park the nozzle by moving up by z_lift and then moving to (x_pos, y_pos) if (!axes_need_homing()) @@ -631,11 +622,11 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le #if ENABLED(FWRETRACT) // If retracted before goto pause if (fwretract.retracted[active_extruder]) - do_pause_e_move(-fwretract.settings.retract_length, fwretract.settings.retract_feedrate_mm_s); + unscaled_e_move(-fwretract.settings.retract_length, fwretract.settings.retract_feedrate_mm_s); #endif // If resume_position is negative - if (resume_position.e < 0) do_pause_e_move(resume_position.e, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE)); + if (resume_position.e < 0) unscaled_e_move(resume_position.e, feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE)); // Move XY to starting position, then Z do_blocking_move_to_xy(resume_position, feedRate_t(NOZZLE_PARK_XY_FEEDRATE)); @@ -644,7 +635,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le do_blocking_move_to_z(resume_position.z, feedRate_t(NOZZLE_PARK_Z_FEEDRATE)); #if ADVANCED_PAUSE_RESUME_PRIME != 0 - do_pause_e_move(ADVANCED_PAUSE_RESUME_PRIME, feedRate_t(ADVANCED_PAUSE_PURGE_FEEDRATE)); + unscaled_e_move(ADVANCED_PAUSE_RESUME_PRIME, feedRate_t(ADVANCED_PAUSE_PURGE_FEEDRATE)); #endif // Now all extrusion positions are resumed and ready to be confirmed diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index 5ac67a565c..f1c8eed4d3 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -83,8 +83,6 @@ extern uint8_t did_pause_print; #define DXC_PASS #endif -void do_pause_e_move(const float &length, const feedRate_t &fr_mm_s); - bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length=0, const bool show_lcd=false DXC_PARAMS); void wait_for_confirmation(const bool is_reload=false, const int8_t max_beep_count=0 DXC_PARAMS); diff --git a/Marlin/src/gcode/feature/camera/M240.cpp b/Marlin/src/gcode/feature/camera/M240.cpp index 3c045a7e68..33ef9bf1a1 100644 --- a/Marlin/src/gcode/feature/camera/M240.cpp +++ b/Marlin/src/gcode/feature/camera/M240.cpp @@ -48,14 +48,8 @@ #ifdef PHOTO_RETRACT_MM inline void e_move_m240(const float length, const feedRate_t &fr_mm_s) { - if (length && thermalManager.hotEnoughToExtrude(active_extruder)) { - #if ENABLED(ADVANCED_PAUSE_FEATURE) - do_pause_e_move(length, fr_mm_s); - #else - current_position.e += length / planner.e_factor[active_extruder]; - line_to_current_position(fr_mm_s); - #endif - } + if (length && thermalManager.hotEnoughToExtrude(active_extruder)) + unscaled_e_move(length, fr_mm_s); } #endif diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index ffa12f39fe..e691d26ab4 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -93,7 +93,7 @@ namespace Language_fr { PROGMEM Language_Str MSG_SWITCH_PS_ON = _UxGT("Allumer alim."); PROGMEM Language_Str MSG_SWITCH_PS_OFF = _UxGT("Eteindre alim."); PROGMEM Language_Str MSG_EXTRUDE = _UxGT("Extrusion"); - PROGMEM Language_Str MSG_RETRACT = _UxGT("Rétraction"); + PROGMEM Language_Str MSG_RETRACT = _UxGT("Rétractation"); PROGMEM Language_Str MSG_MOVE_AXIS = _UxGT("Déplacer un axe"); PROGMEM Language_Str MSG_BED_LEVELING = _UxGT("Régler Niv. lit"); PROGMEM Language_Str MSG_LEVEL_BED = _UxGT("Niveau du lit"); @@ -317,7 +317,7 @@ namespace Language_fr { PROGMEM Language_Str MSG_NO_MOVE = _UxGT("Moteurs bloqués"); PROGMEM Language_Str MSG_KILLED = _UxGT("KILLED"); PROGMEM Language_Str MSG_STOPPED = _UxGT("STOPPÉ"); - PROGMEM Language_Str MSG_CONTROL_RETRACT = _UxGT("Rétraction mm"); + PROGMEM Language_Str MSG_CONTROL_RETRACT = _UxGT("Rétractation mm"); PROGMEM Language_Str MSG_CONTROL_RETRACT_SWAP = _UxGT("Ech. rétr. mm"); PROGMEM Language_Str MSG_CONTROL_RETRACTF = _UxGT("Vit. rétract°"); PROGMEM Language_Str MSG_CONTROL_RETRACT_ZHOP = _UxGT("Saut Z mm"); diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index e47727b3ec..834da3ad35 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -55,6 +55,10 @@ #include "../lcd/ultralcd.h" #endif +#if HAS_FILAMENT_SENSOR + #include "../feature/runout.h" +#endif + #if ENABLED(SENSORLESS_HOMING) #include "../feature/tmc_util.h" #endif @@ -332,6 +336,15 @@ void line_to_current_position(const feedRate_t &fr_mm_s/*=feedrate_mm_s*/) { planner.buffer_line(current_position, fr_mm_s, active_extruder); } +void unscaled_e_move(const float &length, const feedRate_t &fr_mm_s) { + #if HAS_FILAMENT_SENSOR + runout.reset(); + #endif + current_position.e += length / planner.e_factor[active_extruder]; + line_to_current_position(fr_mm_s); + planner.synchronize(); +} + #if IS_KINEMATIC /** diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index f6a75a91a7..4d1ab3bab8 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -184,6 +184,8 @@ void sync_plan_position_e(); */ void line_to_current_position(const feedRate_t &fr_mm_s=feedrate_mm_s); +void unscaled_e_move(const float &length, const feedRate_t &fr_mm_s); + void prepare_line_to_destination(); void _internal_move_to_destination(const feedRate_t &fr_mm_s=0.0f diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 0d91669973..2471581c8c 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -856,7 +856,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { } else { #if ENABLED(ADVANCED_PAUSE_FEATURE) - do_pause_e_move(-toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.retract_speed)); + unscaled_e_move(-toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.retract_speed)); #else current_position.e -= toolchange_settings.swap_length / planner.e_factor[old_tool]; planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.retract_speed), old_tool); @@ -991,8 +991,8 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) if (should_swap && !too_cold) { #if ENABLED(ADVANCED_PAUSE_FEATURE) - do_pause_e_move(toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.prime_speed)); - do_pause_e_move(toolchange_settings.extra_prime, ADVANCED_PAUSE_PURGE_FEEDRATE); + unscaled_e_move(toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.prime_speed)); + unscaled_e_move(toolchange_settings.extra_prime, ADVANCED_PAUSE_PURGE_FEEDRATE); #else current_position.e += toolchange_settings.swap_length / planner.e_factor[new_tool]; planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.prime_speed), new_tool); From d029a098107334aec718c62adf82817b34950f3f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 29 Mar 2020 17:14:06 -0500 Subject: [PATCH 32/43] Minor HAL cleanup --- Marlin/src/HAL/LPC1768/main.cpp | 2 +- Marlin/src/HAL/STM32/SoftwareSerial.h | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Marlin/src/HAL/LPC1768/main.cpp b/Marlin/src/HAL/LPC1768/main.cpp index fb7394344e..d7b05dce9d 100644 --- a/Marlin/src/HAL/LPC1768/main.cpp +++ b/Marlin/src/HAL/LPC1768/main.cpp @@ -90,7 +90,7 @@ void HAL_init() { //debug_frmwrk_init(); //_DBG("\n\nDebug running\n"); - // Initialise the SD card chip select pins as soon as possible + // Initialize the SD card chip select pins as soon as possible #if PIN_EXISTS(SS) OUT_WRITE(SS_PIN, HIGH); #endif diff --git a/Marlin/src/HAL/STM32/SoftwareSerial.h b/Marlin/src/HAL/STM32/SoftwareSerial.h index 3799701cfe..504bd6979b 100644 --- a/Marlin/src/HAL/STM32/SoftwareSerial.h +++ b/Marlin/src/HAL/STM32/SoftwareSerial.h @@ -29,9 +29,7 @@ * The latest version of this library can always be found at * http://arduiniana.org. */ - -#ifndef SOFTWARESERIAL_H -#define SOFTWARESERIAL_H +#pragma once #include @@ -64,7 +62,6 @@ class SoftwareSerial : public Stream { uint32_t delta_start = 0; // static data - static bool initialised; static HardwareTimer timer; static const IRQn_Type timer_interrupt_number; static uint32_t timer_interrupt_priority; @@ -91,7 +88,7 @@ class SoftwareSerial : public Stream { public: // public methods - SoftwareSerial(uint16_t receivePin, uint16_t transmitPin, bool inverse_logic = false); + SoftwareSerial(uint16_t receivePin, uint16_t transmitPin, bool inverse_logic=false); virtual ~SoftwareSerial(); void begin(long speed); bool listen(); @@ -115,5 +112,3 @@ class SoftwareSerial : public Stream { using Print::write; }; - -#endif // SOFTWARESERIAL_H From 223aa5cc4efdab1ad987e490abe2e3020a7b211e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 29 Mar 2020 17:20:01 -0500 Subject: [PATCH 33/43] No unscaled_e_move for CNC --- Marlin/src/module/motion.cpp | 18 ++++++++++-------- Marlin/src/module/motion.h | 4 +++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 834da3ad35..1cc0a04712 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -336,14 +336,16 @@ void line_to_current_position(const feedRate_t &fr_mm_s/*=feedrate_mm_s*/) { planner.buffer_line(current_position, fr_mm_s, active_extruder); } -void unscaled_e_move(const float &length, const feedRate_t &fr_mm_s) { - #if HAS_FILAMENT_SENSOR - runout.reset(); - #endif - current_position.e += length / planner.e_factor[active_extruder]; - line_to_current_position(fr_mm_s); - planner.synchronize(); -} +#if EXTRUDERS + void unscaled_e_move(const float &length, const feedRate_t &fr_mm_s) { + #if HAS_FILAMENT_SENSOR + runout.reset(); + #endif + current_position.e += length / planner.e_factor[active_extruder]; + line_to_current_position(fr_mm_s); + planner.synchronize(); + } +#endif #if IS_KINEMATIC diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 4d1ab3bab8..e504f187f9 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -184,7 +184,9 @@ void sync_plan_position_e(); */ void line_to_current_position(const feedRate_t &fr_mm_s=feedrate_mm_s); -void unscaled_e_move(const float &length, const feedRate_t &fr_mm_s); +#if EXTRUDERS + void unscaled_e_move(const float &length, const feedRate_t &fr_mm_s); +#endif void prepare_line_to_destination(); From 9b886c2ad460d93324f9e1a016fefdbbb2e35445 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 29 Mar 2020 18:12:06 -0500 Subject: [PATCH 34/43] Load balance some tests --- Marlin/src/pins/rambo/pins_RAMBO.h | 11 +++++++++ Marlin/src/pins/ramps/pins_RAMPS.h | 8 +++--- buildroot/share/tests/mega2560-tests | 37 ---------------------------- buildroot/share/tests/rambo-tests | 35 ++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 41 deletions(-) diff --git a/Marlin/src/pins/rambo/pins_RAMBO.h b/Marlin/src/pins/rambo/pins_RAMBO.h index 0a443cc19a..dec72b8ea7 100644 --- a/Marlin/src/pins/rambo/pins_RAMBO.h +++ b/Marlin/src/pins/rambo/pins_RAMBO.h @@ -72,6 +72,10 @@ #define Z_MIN_PROBE_PIN 30 #endif +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 5 +#endif + // // Steppers // @@ -153,6 +157,13 @@ #define SPINDLE_LASER_ENA_PIN 31 // Pullup! #define SPINDLE_DIR_PIN 32 +// +// SPI for Max6675 or Max31855 Thermocouple +// +#ifndef MAX6675_SS_PIN + #define MAX6675_SS_PIN 32 // SPINDLE_DIR_PIN / STAT_LED_BLUE_PIN +#endif + // // M7/M8/M9 - Coolant Control // diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index 050932773e..ffe7f7bb1e 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -169,11 +169,11 @@ #define TEMP_BED_PIN 14 // Analog Input #endif +// // SPI for Max6675 or Max31855 Thermocouple -#if DISABLED(SDSUPPORT) - #define MAX6675_SS_PIN 66 // Don't use 53 if using Display/SD card -#else - #define MAX6675_SS_PIN 66 // Don't use 49 (SD_DETECT_PIN) +// +#ifndef MAX6675_SS_PIN + #define MAX6675_SS_PIN 66 // Don't use 53 if using Display/SD card (SDSS) or 49 (SD_DETECT_PIN) #endif // diff --git a/buildroot/share/tests/mega2560-tests b/buildroot/share/tests/mega2560-tests index 0bedfd5a73..884ea8be4a 100755 --- a/buildroot/share/tests/mega2560-tests +++ b/buildroot/share/tests/mega2560-tests @@ -12,43 +12,6 @@ set -e #restore_configs #exec_test $1 $2 "Default Configuration" -# -# Test 2 extruders (one MAX6675) and heated bed on basic RAMPS 1.4 -# Test a "Fix Mounted" Probe with Safe Homing, some arc options, -# linear bed leveling, M48, leveling debug, and firmware retraction. -# -restore_configs -opt_set MOTHERBOARD BOARD_RAMPS_14_EEB -opt_set EXTRUDERS 2 -opt_set TEMP_SENSOR_0 -2 -opt_set TEMP_SENSOR_1 1 -opt_set TEMP_SENSOR_BED 2 -opt_set TEMP_SENSOR_PROBE 1 -opt_add TEMP_PROBE_PIN 12 -opt_set TEMP_SENSOR_CHAMBER 3 -opt_add HEATER_CHAMBER_PIN 45 -opt_set GRID_MAX_POINTS_X 16 -opt_set FANMUX0_PIN 53 -opt_disable USE_WATCHDOG -opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST \ - FIX_MOUNTED_PROBE Z_SAFE_HOMING CODEPENDENT_XY_HOMING PIDTEMPBED \ - PROBING_HEATERS_OFF PROBING_FANS_OFF PROBING_STEPPERS_OFF WAIT_FOR_BED_HEATER \ - EEPROM_SETTINGS SDSUPPORT SD_REPRINT_LAST_SELECTED_FILE BINARY_FILE_TRANSFER \ - BLINKM PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN LED_CONTROL_MENU \ - NEOPIXEL_LED CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_MENU \ - PID_PARAMS_PER_HOTEND PID_AUTOTUNE_MENU PID_EDIT_MENU LCD_SHOW_E_TOTAL \ - PRINTCOUNTER SERVICE_NAME_1 SERVICE_INTERVAL_1 LEVEL_BED_CORNERS \ - NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR FILAMENT_RUNOUT_DISTANCE_MM \ - ADVANCED_PAUSE_FEATURE FILAMENT_LOAD_UNLOAD_GCODES FILAMENT_UNLOAD_ALL_EXTRUDERS \ - AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DISTINCT_E_FACTORS \ - SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE \ - BACKLASH_COMPENSATION BACKLASH_GCODE BAUD_RATE_GCODE BEZIER_CURVE_SUPPORT \ - FWRETRACT ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \ - PSU_CONTROL AUTO_POWER_CONTROL POWER_LOSS_RECOVERY POWER_LOSS_PIN POWER_LOSS_STATE \ - SLOW_PWM_HEATERS THERMAL_PROTECTION_CHAMBER LIN_ADVANCE EXTRA_LIN_ADVANCE_K \ - HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT PINS_DEBUGGING MAX7219_DEBUG M114_DETAIL -exec_test $1 $2 "RAMPS | EXTRUDERS 2 | CHAR LCD + SD | FIX Probe | ABL-Linear | Advanced Pause | PLR | LEDs ..." - # # Test a probeless build of AUTO_BED_LEVELING_UBL, with lots of extruders # diff --git a/buildroot/share/tests/rambo-tests b/buildroot/share/tests/rambo-tests index 3f741fcba6..8092059627 100644 --- a/buildroot/share/tests/rambo-tests +++ b/buildroot/share/tests/rambo-tests @@ -33,5 +33,40 @@ opt_enable USE_XMAX_PLUG USE_YMAX_PLUG USE_ZMAX_PLUG \ opt_disable MIN_SOFTWARE_ENDSTOP_Z MAX_SOFTWARE_ENDSTOPS exec_test $1 $2 "Rambo CNC Configuration" +# +# Lots of options - Formerly the first Mega2560 test +# +restore_configs +opt_set MOTHERBOARD BOARD_RAMBO +opt_set EXTRUDERS 2 +opt_set TEMP_SENSOR_0 -2 +opt_set TEMP_SENSOR_1 1 +opt_set TEMP_SENSOR_BED 2 +opt_set TEMP_SENSOR_PROBE 1 +opt_add TEMP_PROBE_PIN 12 +opt_set TEMP_SENSOR_CHAMBER 3 +opt_add HEATER_CHAMBER_PIN 45 +opt_set GRID_MAX_POINTS_X 16 +opt_set FANMUX0_PIN 53 +opt_disable USE_WATCHDOG +opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST \ + FIX_MOUNTED_PROBE Z_SAFE_HOMING CODEPENDENT_XY_HOMING PIDTEMPBED \ + PROBING_HEATERS_OFF PROBING_FANS_OFF PROBING_STEPPERS_OFF WAIT_FOR_BED_HEATER \ + EEPROM_SETTINGS SDSUPPORT SD_REPRINT_LAST_SELECTED_FILE BINARY_FILE_TRANSFER \ + BLINKM PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN LED_CONTROL_MENU \ + NEOPIXEL_LED CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_MENU \ + PID_PARAMS_PER_HOTEND PID_AUTOTUNE_MENU PID_EDIT_MENU LCD_SHOW_E_TOTAL \ + PRINTCOUNTER SERVICE_NAME_1 SERVICE_INTERVAL_1 LEVEL_BED_CORNERS \ + NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR FILAMENT_RUNOUT_DISTANCE_MM \ + ADVANCED_PAUSE_FEATURE FILAMENT_LOAD_UNLOAD_GCODES FILAMENT_UNLOAD_ALL_EXTRUDERS \ + AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DISTINCT_E_FACTORS \ + SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE \ + BACKLASH_COMPENSATION BACKLASH_GCODE BAUD_RATE_GCODE BEZIER_CURVE_SUPPORT \ + FWRETRACT ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \ + PSU_CONTROL AUTO_POWER_CONTROL POWER_LOSS_RECOVERY POWER_LOSS_PIN POWER_LOSS_STATE \ + SLOW_PWM_HEATERS THERMAL_PROTECTION_CHAMBER LIN_ADVANCE EXTRA_LIN_ADVANCE_K \ + HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT PINS_DEBUGGING MAX7219_DEBUG M114_DETAIL +exec_test $1 $2 "RAMBO | EXTRUDERS 2 | CHAR LCD + SD | FIX Probe | ABL-Linear | Advanced Pause | PLR | LEDs ..." + # clean up restore_configs From 747a4bb62360cd6bd44557f117e83140c7cb940c Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 30 Mar 2020 00:03:19 +0000 Subject: [PATCH 35/43] [cron] Bump distribution date (2020-03-30) --- Marlin/src/inc/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 0a2599294a..7f5c59aeef 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2020-03-29" + #define STRING_DISTRIBUTION_DATE "2020-03-30" #endif /** From 0ea26d538bfb883bed57c005a6c0c3a365c31acc Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 31 Mar 2020 00:03:22 +0000 Subject: [PATCH 36/43] [cron] Bump distribution date (2020-03-31) --- Marlin/src/inc/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 7f5c59aeef..33b9bbfbea 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2020-03-30" + #define STRING_DISTRIBUTION_DATE "2020-03-31" #endif /** From 96ab16a9dd7167840d9c9a871c43c60bdc7c6b15 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 31 Mar 2020 12:36:59 -0500 Subject: [PATCH 37/43] Pulldown for all FastIO headers Co-Authored-By: borsegbr --- Marlin/src/HAL/AVR/fastio.h | 4 ++-- Marlin/src/HAL/DUE/fastio.h | 2 +- Marlin/src/HAL/ESP32/fastio.h | 2 +- Marlin/src/HAL/LPC1768/fastio.h | 2 +- Marlin/src/HAL/SAMD51/fastio.h | 4 ++-- Marlin/src/HAL/TEENSY31_32/fastio.h | 3 ++- Marlin/src/HAL/TEENSY35_36/fastio.h | 3 ++- .../ftdi_eve_touch_ui/ftdi_eve_lib/compat.h | 21 ++++++++++--------- 8 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Marlin/src/HAL/AVR/fastio.h b/Marlin/src/HAL/AVR/fastio.h index 2246a0f9d0..a45e0f2beb 100644 --- a/Marlin/src/HAL/AVR/fastio.h +++ b/Marlin/src/HAL/AVR/fastio.h @@ -98,9 +98,9 @@ #define SET_INPUT(IO) _SET_INPUT(IO) #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _WRITE(IO, HIGH); }while(0) +#define SET_INPUT_PULLDOWN SET_INPUT #define SET_OUTPUT(IO) _SET_OUTPUT(IO) - -#define SET_PWM(IO) SET_OUTPUT(IO) +#define SET_PWM SET_OUTPUT #define IS_INPUT(IO) _IS_INPUT(IO) #define IS_OUTPUT(IO) _IS_OUTPUT(IO) diff --git a/Marlin/src/HAL/DUE/fastio.h b/Marlin/src/HAL/DUE/fastio.h index 6f1f8d8bf2..01abd82049 100644 --- a/Marlin/src/HAL/DUE/fastio.h +++ b/Marlin/src/HAL/DUE/fastio.h @@ -166,7 +166,7 @@ // Set pin as output (wrapper) - reads the pin and sets the output to that value #define SET_OUTPUT(IO) _SET_OUTPUT(IO) // Set pin as PWM -#define SET_PWM(IO) SET_OUTPUT(IO) +#define SET_PWM SET_OUTPUT // Check if pin is an input #define IS_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0) diff --git a/Marlin/src/HAL/ESP32/fastio.h b/Marlin/src/HAL/ESP32/fastio.h index 9c4efaee9d..09930194d6 100644 --- a/Marlin/src/HAL/ESP32/fastio.h +++ b/Marlin/src/HAL/ESP32/fastio.h @@ -56,7 +56,7 @@ #define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0) // Set pin as PWM -#define SET_PWM(IO) SET_OUTPUT(IO) +#define SET_PWM SET_OUTPUT // Set pin as output and init #define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0) diff --git a/Marlin/src/HAL/LPC1768/fastio.h b/Marlin/src/HAL/LPC1768/fastio.h index 48de5b8fa0..8e8e66db72 100644 --- a/Marlin/src/HAL/LPC1768/fastio.h +++ b/Marlin/src/HAL/LPC1768/fastio.h @@ -104,7 +104,7 @@ /// set pin as output wrapper - reads the pin and sets the output to that value #define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0) // set pin as PWM -#define SET_PWM(IO) SET_OUTPUT(IO) +#define SET_PWM SET_OUTPUT /// check if pin is an input wrapper #define IS_INPUT(IO) _IS_INPUT(IO) diff --git a/Marlin/src/HAL/SAMD51/fastio.h b/Marlin/src/HAL/SAMD51/fastio.h index f6a2675de0..d3b3dc1f63 100644 --- a/Marlin/src/HAL/SAMD51/fastio.h +++ b/Marlin/src/HAL/SAMD51/fastio.h @@ -100,9 +100,9 @@ PORT->Group[port].DIRCLR.reg = MASK(pin); \ }while(0) // Set pin as PWM (push pull) -#define SET_PWM(IO) SET_OUTPUT(IO) +#define SET_PWM SET_OUTPUT // Set pin as PWM (open drain) -#define SET_PWM_OD(IO) SET_OUTPUT_OD(IO) +#define SET_PWM_OD SET_OUTPUT_OD // check if pin is an output #define IS_OUTPUT(IO) ((PORT->Group[(EPortType)GET_SAMD_PORT(IO)].DIR.reg & MASK(GET_SAMD_PIN(IO))) \ diff --git a/Marlin/src/HAL/TEENSY31_32/fastio.h b/Marlin/src/HAL/TEENSY31_32/fastio.h index 8547fe2b7a..e74920d493 100644 --- a/Marlin/src/HAL/TEENSY31_32/fastio.h +++ b/Marlin/src/HAL/TEENSY31_32/fastio.h @@ -76,8 +76,9 @@ #define SET_INPUT(IO) _SET_INPUT(IO) #define SET_INPUT_PULLUP(IO) _SET_INPUT_PULLUP(IO) +#define SET_INPUT_PULLDOWN SET_INPUT #define SET_OUTPUT(IO) _SET_OUTPUT(IO) -#define SET_PWM(IO) SET_OUTPUT(IO) +#define SET_PWM SET_OUTPUT #define IS_INPUT(IO) _IS_INPUT(IO) #define IS_OUTPUT(IO) _IS_OUTPUT(IO) diff --git a/Marlin/src/HAL/TEENSY35_36/fastio.h b/Marlin/src/HAL/TEENSY35_36/fastio.h index 8547fe2b7a..e74920d493 100644 --- a/Marlin/src/HAL/TEENSY35_36/fastio.h +++ b/Marlin/src/HAL/TEENSY35_36/fastio.h @@ -76,8 +76,9 @@ #define SET_INPUT(IO) _SET_INPUT(IO) #define SET_INPUT_PULLUP(IO) _SET_INPUT_PULLUP(IO) +#define SET_INPUT_PULLDOWN SET_INPUT #define SET_OUTPUT(IO) _SET_OUTPUT(IO) -#define SET_PWM(IO) SET_OUTPUT(IO) +#define SET_PWM SET_OUTPUT #define IS_INPUT(IO) _IS_INPUT(IO) #define IS_OUTPUT(IO) _IS_OUTPUT(IO) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h index ef2b23a3a2..3023a1c6bc 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h @@ -176,11 +176,12 @@ #undef MAKE_ARDUINO_PINS } // namespace fast_io - #define SET_INPUT(pin) fast_io::pin::set_input() - #define SET_INPUT_PULLUP(pin) fast_io::pin::set_input(); fast_io::pin::set_high() - #define SET_OUTPUT(pin) fast_io::pin::set_output() - #define READ(pin) fast_io::pin::read() - #define WRITE(pin, value) fast_io::pin::write(value) + #define SET_INPUT(pin) fast_io::pin::set_input() + #define SET_INPUT_PULLUP(pin) do{ fast_io::pin::set_input(); fast_io::pin::set_high(); }while(0) + #define SET_INPUT_PULLDOWN SET_INPUT + #define SET_OUTPUT(pin) fast_io::pin::set_output() + #define READ(pin) fast_io::pin::read() + #define WRITE(pin, value) fast_io::pin::write(value) #ifndef pgm_read_word_far #define pgm_read_word_far pgm_read_word @@ -195,11 +196,11 @@ #endif #define SERIAL_ECHO_START() - #define SERIAL_ECHOLNPGM(str) Serial.println(F(str)) - #define SERIAL_ECHOPGM(str) Serial.print(F(str)) - #define SERIAL_ECHO_MSG(str) Serial.println(str) - #define SERIAL_ECHOLNPAIR(str, val) {Serial.print(F(str)); Serial.println(val);} - #define SERIAL_ECHOPAIR(str, val) {Serial.print(F(str)); Serial.print(val);} + #define SERIAL_ECHOLNPGM(str) Serial.println(F(str)) + #define SERIAL_ECHOPGM(str) Serial.print(F(str)) + #define SERIAL_ECHO_MSG(str) Serial.println(str) + #define SERIAL_ECHOLNPAIR(str, val) do{ Serial.print(F(str)); Serial.println(val); }while(0) + #define SERIAL_ECHOPAIR(str, val) do{ Serial.print(F(str)); Serial.print(val); }while(0) #define safe_delay delay From 528907cb1604ae2f5c8807e7512e2ea1a98289bf Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 31 Mar 2020 12:50:30 -0500 Subject: [PATCH 38/43] Additional TERN macros --- Marlin/src/core/macros.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index bcee642368..899baf7359 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -194,6 +194,9 @@ #define DISABLED(V...) DO(DIS,&&,V) #define TERN(O,A,B) _TERN(_ENA_1(O),B,A) // OPTION converted to '0' or '1' +#define TERN0(O,A) _TERN(_ENA_1(O),0,A) // OPTION converted to A or '0' +#define TERN1(O,A) _TERN(_ENA_1(O),1,A) // OPTION converted to A or '1' +#define TERN_(O,A) _TERN(_ENA_1(O),,A) // OPTION converted to A or '' #define _TERN(E,V...) __TERN(_CAT(T_,E),V) // Prepend 'T_' to get 'T_0' or 'T_1' #define __TERN(T,V...) ___TERN(_CAT(_NO,T),V) // Prepend '_NO' to get '_NOT_0' or '_NOT_1' #define ___TERN(P,V...) THIRD(P,V) // If first argument has a comma, A. Else B. From e0e87ca19a57dc42e9eb5e22d044b8f3c1116544 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 31 Mar 2020 12:49:36 -0500 Subject: [PATCH 39/43] Fix last arc segment Co-Authored-By: ellensp --- Marlin/src/gcode/motion/G2_G3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index b11b1136b6..b0fb299ab2 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -236,7 +236,7 @@ void plan_arc( planner.apply_leveling(raw); #endif - planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, seg_length + planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, 0 #if ENABLED(SCARA_FEEDRATE_SCALING) , inv_duration #endif From ac0a7f2281a5c0df22a3df3fe83d4f112739bbe0 Mon Sep 17 00:00:00 2001 From: Eric Ptak Date: Tue, 31 Mar 2020 20:59:08 +0200 Subject: [PATCH 40/43] Fix Fysetc stm32flash usage (#17331) --- buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py index 1aeaa4d700..67a75f5b47 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py @@ -30,7 +30,7 @@ if platform.get_package_dir("tool-stm32duino") != None: env.Replace( UPLOADER=UPLOAD_TOOL, - UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr $UPLOAD_PORT -R -w \"" + join("$BUILD_DIR","${PROGNAME}.hex")+"\"") + UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr -R -b 115200 -g 0x8000000 -w \"" + join("$BUILD_DIR","${PROGNAME}.hex")+"\"" + " $UPLOAD_PORT") ) # Python callback From c759729478b7b41a4f6d276380249dd482e24bb8 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 31 Mar 2020 21:13:20 +0200 Subject: [PATCH 41/43] STM32F1: Restore M43 build support (#17336) --- Marlin/src/gcode/config/M43.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 2c28da62fb..baf5efb137 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -67,7 +67,11 @@ inline void toggle_pins() { else { watchdog_refresh(); report_pin_state_extended(pin, ignore_protection, true, PSTR("Pulsing ")); - const bool prior_mode = GET_PINMODE(pin); + #ifdef __STM32F1__ + const auto prior_mode = _GET_MODE(i); + #else + const bool prior_mode = GET_PINMODE(pin); + #endif #if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO if (pin == TEENSY_E2) { SET_OUTPUT(TEENSY_E2); @@ -96,7 +100,11 @@ inline void toggle_pins() { watchdog_refresh(); } } - pinMode(pin, prior_mode); + #ifdef __STM32F1__ + _SET_MODE(i, prior_mode); + #else + pinMode(pin, prior_mode); + #endif } SERIAL_EOL(); } From d83ad6f321af6511d35e0396776f557195fcba9f Mon Sep 17 00:00:00 2001 From: Marcio T Date: Tue, 31 Mar 2020 13:22:04 -0600 Subject: [PATCH 42/43] Improve / fix FTDI EVE Touch UI (#17338) - Fix timeout and debugging string - Fix check for whether `LCD_TIMEOUT_TO_STATUS` is valid - Fix incorrect debugging message - Make capitalization of callbacks consistent. - Allow Touch UI to use hardware SPI on Einsy boards - Move print stats to About Printer page. - More generic about screen with GPL license. - Add missing handler for power loss event - Less code duplication on status screen and main/advanced menu; more legible - Reorganize advanced and main menu to add more features - Hide home Z button when using Z_SAFE_HOMING - Fix compilation errors when certain features enabled - Fix missing labels in UI - Improve color scheme - Add new preheat menus - Fix incorrect rendering of Marlin logo on boot - Add Level X Axis and Auto calibrate buttons --- Marlin/src/gcode/feature/powerloss/M1000.cpp | 2 +- Marlin/src/gcode/temp/M303.cpp | 2 +- .../ftdi_eve_lib/basic/spi.cpp | 11 + .../ftdi_eve_lib/extended/event_loop.cpp | 2 +- .../ftdi_eve_touch_ui/language/language_en.h | 14 +- .../lib/ftdi_eve_touch_ui/marlin_events.cpp | 8 +- .../lib/ftdi_eve_touch_ui/pin_mappings.h | 15 +- .../screens/about_screen.cpp | 76 +++--- .../screens/advanced_settings_menu.cpp | 156 ++++++------ .../base_numeric_adjustment_screen.cpp | 12 +- .../ftdi_eve_touch_ui/screens/base_screen.cpp | 8 +- .../screens/bio_advanced_settings.cpp | 2 +- .../screens/bio_confirm_home_e.cpp | 12 +- .../screens/bio_confirm_home_xyz.cpp | 10 +- .../screens/bio_main_menu.cpp | 4 +- .../ftdi_eve_touch_ui/screens/boot_screen.cpp | 14 +- .../screens/change_filament_screen.cpp | 3 +- .../screens/interface_settings_screen.cpp | 10 +- .../screens/interface_sounds_screen.cpp | 2 +- .../ftdi_eve_touch_ui/screens/main_menu.cpp | 165 +++++++------ .../screens/preheat_menu.cpp | 83 +++++++ .../screens/preheat_timer_screen.cpp | 3 - .../lib/ftdi_eve_touch_ui/screens/screens.cpp | 1 + .../lib/ftdi_eve_touch_ui/screens/screens.h | 9 +- .../screens/status_screen.cpp | 226 +++++++++--------- .../lib/ftdi_eve_touch_ui/theme/colors.h | 210 +++++++++------- .../theme/marlin_bootscreen_landscape.h | 4 +- .../theme/marlin_bootscreen_portrait.h | 4 +- Marlin/src/lcd/extui/ui_api.h | 4 +- Marlin/src/lcd/extui_dgus_lcd.cpp | 6 +- Marlin/src/lcd/extui_example.cpp | 4 +- Marlin/src/lcd/extui_malyan_lcd.cpp | 2 +- Marlin/src/lcd/language/language_en.h | 3 + Marlin/src/module/temperature.cpp | 10 +- 34 files changed, 632 insertions(+), 465 deletions(-) create mode 100644 Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_menu.cpp diff --git a/Marlin/src/gcode/feature/powerloss/M1000.cpp b/Marlin/src/gcode/feature/powerloss/M1000.cpp index ea2c6e3dab..8d8cdc7557 100644 --- a/Marlin/src/gcode/feature/powerloss/M1000.cpp +++ b/Marlin/src/gcode/feature/powerloss/M1000.cpp @@ -63,7 +63,7 @@ void GcodeSuite::M1000() { #if HAS_LCD_MENU ui.goto_screen(menu_job_recovery); #elif ENABLED(EXTENSIBLE_UI) - ExtUI::OnPowerLossResume(); + ExtUI::onPowerLossResume(); #else SERIAL_ECHO_MSG("Resume requires LCD."); #endif diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index 657dd867ee..358a1436b1 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -73,7 +73,7 @@ void GcodeSuite::M303() { if (!WITHIN(e, SI, EI)) { SERIAL_ECHOLNPGM(STR_PID_BAD_EXTRUDER_NUM); #if ENABLED(EXTENSIBLE_UI) - ExtUI::OnPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM); + ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM); #endif return; } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.cpp index 7f666be45b..6621ea3cbf 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.cpp @@ -38,6 +38,11 @@ namespace FTDI { SET_OUTPUT(CLCD_SPI_CS); WRITE(CLCD_SPI_CS, 1); + #ifdef CLCD_SPI_EXTRA_CS + SET_OUTPUT(CLCD_SPI_EXTRA_CS); + WRITE(CLCD_SPI_EXTRA_CS, 1); + #endif + #ifdef SPI_FLASH_SS SET_OUTPUT(SPI_FLASH_SS); WRITE(SPI_FLASH_SS, 1); @@ -111,12 +116,18 @@ namespace FTDI { ::SPI.beginTransaction(spi_settings); #endif WRITE(CLCD_SPI_CS, 0); + #ifdef CLCD_SPI_EXTRA_CS + WRITE(CLCD_SPI_EXTRA_CS, 0); + #endif delayMicroseconds(1); } // CLCD SPI - Chip Deselect void SPI::spi_ftdi_deselect() { WRITE(CLCD_SPI_CS, 1); + #ifdef CLCD_SPI_EXTRA_CS + WRITE(CLCD_SPI_EXTRA_CS, 1); + #endif #ifndef CLCD_USE_SOFT_SPI ::SPI.endTransaction(); #endif diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/event_loop.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/event_loop.cpp index f0f693bfd8..b338758ed1 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/event_loop.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/event_loop.cpp @@ -191,7 +191,7 @@ namespace FTDI { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("Touch end: ", tag); + SERIAL_ECHOLNPAIR("Touch end: ", pressed_tag); #endif const uint8_t saved_pressed_tag = pressed_tag; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h index e59e1d9468..ebd60aed31 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h @@ -70,13 +70,15 @@ namespace Language_en { PROGMEM Language_Str MSG_PRINT_FINISHED = u8"Print finished"; PROGMEM Language_Str MSG_PRINT_ERROR = u8"Print error"; PROGMEM Language_Str MSG_ABOUT_TOUCH_PANEL_1 = u8"Color Touch Panel"; - PROGMEM Language_Str MSG_ABOUT_TOUCH_PANEL_2 = u8"Portions " COPYRIGHT_SIGN " 2019 Aleph Objects, Inc.\n" - "Portions " COPYRIGHT_SIGN " 2019 Cocoa Press"; - PROGMEM Language_Str MSG_FIRMWARE_FOR_TOOLHEAD = u8"Firmware for toolhead:\n%s\n\n"; + PROGMEM Language_Str MSG_ABOUT_TOUCH_PANEL_2 = WEBSITE_URL; + PROGMEM Language_Str MSG_LICENSE = u8"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 the Free Software Foundation, either version 3 " + "of the License, or (at your option) any later version.\n\nTo view a copy of the GNU General " + "Public License, go to the following location: http://www.gnu.org/licenses."; PROGMEM Language_Str MSG_RUNOUT_1 = u8"Runout 1"; PROGMEM Language_Str MSG_RUNOUT_2 = u8"Runout 2"; PROGMEM Language_Str MSG_DISPLAY_MENU = u8"Display"; - PROGMEM Language_Str MSG_INTERFACE_SETTINGS = u8"Interface Settings"; + PROGMEM Language_Str MSG_INTERFACE = u8"Interface"; PROGMEM Language_Str MSG_MEASURE_AUTOMATICALLY = u8"Measure automatically"; PROGMEM Language_Str MSG_H_OFFSET = u8"H Offset"; PROGMEM Language_Str MSG_V_OFFSET = u8"V Offset"; @@ -129,7 +131,7 @@ namespace Language_en { PROGMEM Language_Str MSG_SOUND_VOLUME = u8"Sound volume"; PROGMEM Language_Str MSG_SCREEN_LOCK = u8"Screen lock"; PROGMEM Language_Str MSG_BOOT_SCREEN = u8"Boot screen"; - PROGMEM Language_Str MSG_INTERFACE_SOUNDS = u8"Interface Sounds"; + PROGMEM Language_Str MSG_SOUNDS = u8"Sounds"; PROGMEM Language_Str MSG_CLICK_SOUNDS = u8"Click sounds"; PROGMEM Language_Str MSG_EEPROM_RESTORED = u8"Settings restored from backup"; PROGMEM Language_Str MSG_EEPROM_RESET = u8"Settings restored to default"; @@ -144,12 +146,12 @@ namespace Language_en { PROGMEM Language_Str MSG_TOUCH_CALIBRATION_START = u8"Release to begin screen calibration"; PROGMEM Language_Str MSG_TOUCH_CALIBRATION_PROMPT = u8"Touch the dots to calibrate"; + PROGMEM Language_Str MSG_AUTOLEVEL_X_AXIS = u8"Level X Axis"; #ifdef TOUCH_UI_LULZBOT_BIO PROGMEM Language_Str MSG_MOVE_TO_HOME = u8"Move to Home"; PROGMEM Language_Str MSG_RAISE_PLUNGER = u8"Raise Plunger"; PROGMEM Language_Str MSG_RELEASE_XY_AXIS = u8"Release X and Y Axis"; - PROGMEM Language_Str MSG_AUTOLEVEL_X_AXIS = u8"Auto-level X Axis"; PROGMEM Language_Str MSG_BED_TEMPERATURE = u8"Bed Temperature"; PROGMEM Language_Str MSG_HOME_XYZ_WARNING = u8"About to move to home position. Ensure the top and the bed of the printer are clear.\n\nContinue?"; PROGMEM Language_Str MSG_HOME_E_WARNING = u8"About to re-home plunger and auto-level. Remove syringe prior to proceeding.\n\nContinue?"; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp index 96845d4065..bed32cc606 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp @@ -131,8 +131,14 @@ namespace ExtUI { } #endif + #if ENABLED(POWER_LOSS_RECOVERY) + void onPowerLossResume() { + // Called on resume from power-loss + } + #endif + #if HAS_PID_HEATING - void OnPidTuning(const result_t rst) { + void onPidTuning(const result_t rst) { // Called for temperature PID tuning result SERIAL_ECHOLNPAIR("OnPidTuning:", rst); switch (rst) { diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/pin_mappings.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/pin_mappings.h index 548c6c7439..b5b0f22e11 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/pin_mappings.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/pin_mappings.h @@ -129,12 +129,13 @@ * 9 GND GND GND --> GND * 10 5V 5V 5V --> KILL [3] * - * [1] This configuration is not compatible with the - * EinsyRetro 1.1a because there is a level shifter - * on MISO enabled by SD/USB chip select. + * [1] This configuration allows daisy-chaining of the + * display and SD/USB on EXP2, except for [2] * - * [2] This configuration allows daisy-chaining of the - * display and SD/USB on EXP2. + * [2] The Ultimachine Einsy boards have a level shifter + * on MISO enabled by SD_CSEL chip select, hence it + * is not possible to run both the display and the + * SD/USB on EXP2. * * [3] Archim Rambo provides 5V on this pin. On any other * board, divert this wire from the ribbon cable and @@ -148,4 +149,8 @@ #define CLCD_SPI_CS BTN_EN1 #define CLCD_MOD_RESET BTN_EN2 + + #if MB(EINSY_RAMBO, EINSY_RETRO) && DISABLED(SDSUPPORT) + #define CLCD_SPI_EXTRA_CS SDSS + #endif #endif diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp index afd4402fc1..70acc09071 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp @@ -27,7 +27,7 @@ #include "screens.h" #define GRID_COLS 4 -#define GRID_ROWS 9 +#define GRID_ROWS 7 using namespace FTDI; using namespace Theme; @@ -45,7 +45,32 @@ void AboutScreen::onRedraw(draw_mode_t) { .cmd(COLOR_RGB(bg_text_enabled)) .tag(0); - draw_text_box(cmd, BTN_POS(1,2), BTN_SIZE(4,1), + #define HEADING_POS BTN_POS(1,2), BTN_SIZE(4,1) + #define FW_VERS_POS BTN_POS(1,3), BTN_SIZE(4,1) + #define FW_INFO_POS BTN_POS(1,4), BTN_SIZE(4,1) + #define LICENSE_POS BTN_POS(1,5), BTN_SIZE(4,2) + #define STATS_POS BTN_POS(1,7), BTN_SIZE(2,1) + #define BACK_POS BTN_POS(3,7), BTN_SIZE(2,1) + + #define _INSET_POS(x,y,w,h) x + w/10, y, w - w/5, h + #define INSET_POS(pos) _INSET_POS(pos) + + char about_str[ + strlen_P(GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2)) + + strlen_P(TOOLHEAD_NAME) + 1 + ]; + #ifdef TOOLHEAD_NAME + // If MSG_ABOUT_TOUCH_PANEL_2 has %s, substitute in the toolhead name. + // But this is optional, so squelch the compiler warning here. + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wformat-extra-args" + sprintf_P(about_str, GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2), TOOLHEAD_NAME); + #pragma GCC diagnostic pop + #else + strcpy_P(about_str, GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2)); + #endif + + draw_text_box(cmd, HEADING_POS, #ifdef CUSTOM_MACHINE_NAME F(CUSTOM_MACHINE_NAME) #else @@ -53,42 +78,29 @@ void AboutScreen::onRedraw(draw_mode_t) { #endif , OPT_CENTER, font_xlarge ); + draw_text_box(cmd, FW_VERS_POS, progmem_str(getFirmwareName_str()), OPT_CENTER, font_medium); + draw_text_box(cmd, FW_INFO_POS, about_str, OPT_CENTER, font_medium); + draw_text_box(cmd, INSET_POS(LICENSE_POS), GET_TEXT_F(MSG_LICENSE), OPT_CENTER, font_tiny); - #ifdef TOOLHEAD_NAME - char about_str[ - strlen_P(GET_TEXT(FIRMWARE_FOR_TOOLHEAD)) + - strlen_P(TOOLHEAD_NAME) + - strlen_P(GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2)) + 1 - ]; - - sprintf_P(about_str, GET_TEXT(MSG_FIRMWARE_FOR_TOOLHEAD), TOOLHEAD_NAME); - strcat_P (about_str, GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2)); - #endif - - cmd.tag(2); - draw_text_box(cmd, BTN_POS(1,3), BTN_SIZE(4,3), - #ifdef TOOLHEAD_NAME - about_str - #else - GET_TEXT_F(MSG_ABOUT_TOUCH_PANEL_2) - #endif - , OPT_CENTER, font_medium - ); - - cmd.tag(0); - draw_text_box(cmd, BTN_POS(1,6), BTN_SIZE(4,2), progmem_str(getFirmwareName_str()), OPT_CENTER, font_medium); - - cmd.font(font_medium).colors(action_btn).tag(1).button(BTN_POS(2,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_OKAY)); + cmd.font(font_medium) + .colors(normal_btn) + .tag(2).button(STATS_POS, GET_TEXT_F(MSG_INFO_STATS_MENU)) + .colors(action_btn) + .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); } bool AboutScreen::onTouchEnd(uint8_t tag) { switch (tag) { - case 1: GOTO_PREVIOUS(); return true; -#if ENABLED(TOUCH_UI_DEVELOPER_MENU) - case 2: GOTO_SCREEN(DeveloperMenu); return true; -#endif - default: return false; + case 1: GOTO_PREVIOUS(); break; + #if ENABLED(PRINTCOUNTER) + case 2: GOTO_SCREEN(StatisticsScreen); break; + #endif + #if ENABLED(TOUCH_UI_DEVELOPER_MENU) + case 3: GOTO_SCREEN(DeveloperMenu); break; + #endif + default: return false; } + return true; } #endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp index 6029382838..57137c5d4a 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp @@ -37,127 +37,116 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .cmd(CLEAR(true,true,true)); } + #ifdef TOUCH_UI_PORTRAIT + #if HAS_CASE_LIGHT || ENABLED(SENSORLESS_HOMING) + #define GRID_ROWS 9 + #else + #define GRID_ROWS 8 + #endif + #define GRID_COLS 2 + #define RESTORE_DEFAULTS_POS BTN_POS(1,1), BTN_SIZE(2,1) + #define DISPLAY_POS BTN_POS(1,2), BTN_SIZE(1,1) + #define INTERFACE_POS BTN_POS(2,2), BTN_SIZE(1,1) + #define ZPROBE_ZOFFSET_POS BTN_POS(1,3), BTN_SIZE(1,1) + #define STEPS_PER_MM_POS BTN_POS(2,3), BTN_SIZE(1,1) + #define FILAMENT_POS BTN_POS(1,4), BTN_SIZE(1,1) + #define VELOCITY_POS BTN_POS(2,4), BTN_SIZE(1,1) + #define TMC_CURRENT_POS BTN_POS(1,5), BTN_SIZE(1,1) + #define ACCELERATION_POS BTN_POS(2,5), BTN_SIZE(1,1) + #define ENDSTOPS_POS BTN_POS(1,6), BTN_SIZE(1,1) + #define JERK_POS BTN_POS(2,6), BTN_SIZE(1,1) + #define OFFSETS_POS BTN_POS(1,7), BTN_SIZE(1,1) + #define BACKLASH_POS BTN_POS(2,7), BTN_SIZE(1,1) + #define CASE_LIGHT_POS BTN_POS(1,8), BTN_SIZE(1,1) + #define TMC_HOMING_THRS_POS BTN_POS(2,8), BTN_SIZE(1,1) + #if HAS_CASE_LIGHT || ENABLED(SENSORLESS_HOMING) + #define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1) + #else + #define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1) + #endif + #else + #define GRID_ROWS 6 + #define GRID_COLS 3 + #define ZPROBE_ZOFFSET_POS BTN_POS(1,1), BTN_SIZE(1,1) + #define CASE_LIGHT_POS BTN_POS(1,4), BTN_SIZE(1,1) + #define STEPS_PER_MM_POS BTN_POS(2,1), BTN_SIZE(1,1) + #define TMC_CURRENT_POS BTN_POS(3,1), BTN_SIZE(1,1) + #define TMC_HOMING_THRS_POS BTN_POS(3,2), BTN_SIZE(1,1) + #define BACKLASH_POS BTN_POS(3,3), BTN_SIZE(1,1) + #define FILAMENT_POS BTN_POS(1,3), BTN_SIZE(1,1) + #define ENDSTOPS_POS BTN_POS(3,4), BTN_SIZE(1,1) + #define DISPLAY_POS BTN_POS(3,5), BTN_SIZE(1,1) + #define INTERFACE_POS BTN_POS(1,5), BTN_SIZE(2,1) + #define RESTORE_DEFAULTS_POS BTN_POS(1,6), BTN_SIZE(2,1) + #define VELOCITY_POS BTN_POS(2,2), BTN_SIZE(1,1) + #define ACCELERATION_POS BTN_POS(2,3), BTN_SIZE(1,1) + #define JERK_POS BTN_POS(2,4), BTN_SIZE(1,1) + #define OFFSETS_POS BTN_POS(1,2), BTN_SIZE(1,1) + #define BACK_POS BTN_POS(3,6), BTN_SIZE(1,1) + #endif + if (what & FOREGROUND) { CommandProcessor cmd; cmd.colors(normal_btn) .font(Theme::font_medium) - #ifdef TOUCH_UI_PORTRAIT - #define GRID_ROWS 10 - #define GRID_COLS 2 .enabled( #if HAS_BED_PROBE 1 #endif ) - .tag(2) .button( BTN_POS(1,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_ZPROBE_ZOFFSET)) + .tag(2) .button( ZPROBE_ZOFFSET_POS, GET_TEXT_F(MSG_ZPROBE_ZOFFSET)) .enabled( #if HAS_CASE_LIGHT 1 #endif ) - .tag(16).button( BTN_POS(1,6), BTN_SIZE(1,1), GET_TEXT_F(MSG_CASE_LIGHT)) - .tag(3) .button( BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_STEPS_PER_MM)) + .tag(16).button( CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT)) + .tag(3) .button( STEPS_PER_MM_POS, GET_TEXT_F(MSG_STEPS_PER_MM)) .enabled( #if HAS_TRINAMIC_CONFIG 1 #endif ) - .tag(13).button( BTN_POS(1,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_TMC_CURRENT)) + .tag(13).button( TMC_CURRENT_POS, GET_TEXT_F(MSG_TMC_CURRENT)) .enabled( - #if HAS_TRINAMIC_CONFIG + #if ENABLED(SENSORLESS_HOMING) 1 #endif ) - .tag(14).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_TMC_HOMING_THRS)) + .tag(14).button( TMC_HOMING_THRS_POS, GET_TEXT_F(MSG_TMC_HOMING_THRS)) .enabled( #if HOTENDS > 1 1 #endif ) - .tag(4) .button( BTN_POS(1,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_OFFSETS_MENU)) + .tag(4) .button( OFFSETS_POS, GET_TEXT_F(MSG_OFFSETS_MENU)) .enabled( #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) 1 #endif ) - .tag(11).button( BTN_POS(1,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_FILAMENT)) - .tag(12).button( BTN_POS(1,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_LCD_ENDSTOPS)) - .tag(15).button( BTN_POS(2,6), BTN_SIZE(1,1), GET_TEXT_F(MSG_DISPLAY_MENU)) - .tag(9) .button( BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_INTERFACE_SETTINGS)) - .tag(10).button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_RESTORE_DEFAULTS)) - .tag(5) .button( BTN_POS(2,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_VELOCITY)) - .tag(6) .button( BTN_POS(2,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_ACCELERATION)) - #if DISABLED(CLASSIC_JERK) - .tag(7) .button( BTN_POS(2,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_JUNCTION_DEVIATION)) - #else - .tag(7) .button( BTN_POS(2,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_JERK)) - #endif + .tag(11).button( FILAMENT_POS, GET_TEXT_F(MSG_FILAMENT)) + .tag(12).button( ENDSTOPS_POS, GET_TEXT_F(MSG_LCD_ENDSTOPS)) + .tag(15).button( DISPLAY_POS, GET_TEXT_F(MSG_DISPLAY_MENU)) + .tag(9) .button( INTERFACE_POS, GET_TEXT_F(MSG_INTERFACE)) + .tag(10).button( RESTORE_DEFAULTS_POS, GET_TEXT_F(MSG_RESTORE_DEFAULTS)) + .tag(5) .button( VELOCITY_POS, GET_TEXT_F(MSG_VELOCITY)) + .tag(6) .button( ACCELERATION_POS, GET_TEXT_F(MSG_ACCELERATION)) + .tag(7) .button( JERK_POS, GET_TEXT_F( + #if DISABLED(CLASSIC_JERK) + MSG_JUNCTION_DEVIATION + #else + JERK_POS + #endif + )) .enabled( #if ENABLED(BACKLASH_GCODE) 1 #endif ) - .tag(8).button( BTN_POS(2,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_BACKLASH)) + .tag(8).button( BACKLASH_POS, GET_TEXT_F(MSG_BACKLASH)) .colors(action_btn) - .tag(1) .button( BTN_POS(1,10), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); - #undef GRID_COLS - #undef GRID_ROWS - #else - #define GRID_ROWS 6 - #define GRID_COLS 3 - .enabled( - #if HAS_BED_PROBE - 1 - #endif - ) - .tag(2) .button( BTN_POS(1,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_ZPROBE_ZOFFSET)) - .enabled( - #if HAS_CASE_LIGHT - 1 - #endif - ) - .tag(16).button( BTN_POS(1,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_CASE_LIGHT)) - .enabled(1) - .tag(3) .button( BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_STEPS_PER_MM)) - .enabled( - #if HAS_TRINAMIC_CONFIG - 1 - #endif - ) - .tag(13).button( BTN_POS(3,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_TMC_CURRENT)) - .enabled( - #if HAS_TRINAMIC_CONFIG - 1 - #endif - ) - .tag(14).button( BTN_POS(3,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_TMC_HOMING_THRS)) - .enabled( - #if ENABLED(BACKLASH_GCODE) - 1 - #endif - ) - .tag(8).button( BTN_POS(3,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_BACKLASH)) - .enabled( - #if HOTENDS > 1 - 1 - #endif - ) - .tag(4) .button( BTN_POS(1,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_OFFSETS_MENU)) - .tag(12).button( BTN_POS(3,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_LCD_ENDSTOPS)) - .tag(5) .button( BTN_POS(2,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_VELOCITY)) - .tag(6) .button( BTN_POS(2,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_ACCELERATION)) - #if DISABLED(CLASSIC_JERK) - .tag(7) .button( BTN_POS(2,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_JUNCTION_DEVIATION)) - #else - .tag(7) .button( BTN_POS(2,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_JERK)) - #endif - .tag(11).button( BTN_POS(1,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_FILAMENT)) - .tag(15).button( BTN_POS(3,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_DISPLAY_MENU)) - .tag(9) .button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_INTERFACE_SETTINGS)) - .tag(10).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_RESTORE_DEFAULTS)) - .colors(action_btn) - .tag(1) .button( BTN_POS(3,6), BTN_SIZE(1,1), GET_TEXT_F(MSG_BACK)); - #endif + .tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK)); } } @@ -191,6 +180,8 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { case 12: GOTO_SCREEN(EndstopStatesScreen); break; #if HAS_TRINAMIC_CONFIG case 13: GOTO_SCREEN(StepperCurrentScreen); break; + #endif + #if ENABLED(SENSORLESS_HOMING) case 14: GOTO_SCREEN(StepperBumpSensitivityScreen); break; #endif case 15: GOTO_SCREEN(DisplayTuningScreen); break; @@ -201,5 +192,4 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { } return true; } - #endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp index 97e399a403..3e3f1d48a2 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp @@ -345,10 +345,14 @@ void BaseNumericAdjustmentScreen::widgets_t::home_buttons(uint8_t tag) { } cmd.font(LAYOUT_FONT); - _button(cmd, tag+0, BTN_POS(5,_line), BTN_SIZE(2,1), GET_TEXT_F(MSG_AXIS_X)); - _button(cmd, tag+1, BTN_POS(7,_line), BTN_SIZE(2,1), GET_TEXT_F(MSG_AXIS_Y)); - _button(cmd, tag+2, BTN_POS(9,_line), BTN_SIZE(2,1), GET_TEXT_F(MSG_AXIS_Z)); - _button(cmd, tag+3, BTN_POS(11,_line), BTN_SIZE(3,1), GET_TEXT_F(MSG_AXIS_ALL)); + _button(cmd, tag+0, BTN_POS(5,_line), BTN_SIZE(2,1), GET_TEXT_F(MSG_AXIS_X)); + _button(cmd, tag+1, BTN_POS(7,_line), BTN_SIZE(2,1), GET_TEXT_F(MSG_AXIS_Y)); + #if DISABLED(Z_SAFE_HOMING) + _button(cmd, tag+2, BTN_POS(9,_line), BTN_SIZE(2,1), GET_TEXT_F(MSG_AXIS_Z)); + _button(cmd, tag+3, BTN_POS(11,_line), BTN_SIZE(3,1), GET_TEXT_F(MSG_AXIS_ALL)); + #else + _button(cmd, tag+3, BTN_POS(9,_line), BTN_SIZE(3,1), GET_TEXT_F(MSG_AXIS_ALL)); + #endif _line++; } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_screen.cpp index 77cadabcd7..7e88b7883a 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_screen.cpp @@ -46,7 +46,7 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t return false; } - #ifdef LCD_TIMEOUT_TO_STATUS + #if LCD_TIMEOUT_TO_STATUS if (EventLoop::get_pressed_tag() != 0) { reset_menu_timeout(); } @@ -66,7 +66,7 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t } void BaseScreen::onIdle() { - #ifdef LCD_TIMEOUT_TO_STATUS + #if LCD_TIMEOUT_TO_STATUS if ((millis() - last_interaction) > LCD_TIMEOUT_TO_STATUS) { reset_menu_timeout(); #if ENABLED(TOUCH_UI_DEBUG) @@ -78,12 +78,12 @@ void BaseScreen::onIdle() { } void BaseScreen::reset_menu_timeout() { - #ifdef LCD_TIMEOUT_TO_STATUS + #if LCD_TIMEOUT_TO_STATUS last_interaction = millis(); #endif } -#ifdef LCD_TIMEOUT_TO_STATUS +#if LCD_TIMEOUT_TO_STATUS uint32_t BaseScreen::last_interaction; #endif diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp index 6c9f74f93f..ed8bcee557 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp @@ -85,7 +85,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { #endif ) .tag(12) .button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_LINEAR_ADVANCE)) - .tag(13) .button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_INTERFACE_SETTINGS)) + .tag(13) .button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_INTERFACE)) .tag(14) .button( BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_RESTORE_DEFAULTS)) .colors(action_btn) .tag(1). button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_e.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_e.cpp index a3254bae9a..79a6112e4f 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_e.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_e.cpp @@ -36,11 +36,13 @@ void BioConfirmHomeE::onRedraw(draw_mode_t) { bool BioConfirmHomeE::onTouchEnd(uint8_t tag) { switch (tag) { case 1: - SpinnerDialogBox::enqueueAndWait_P(F( - "G28 E\n" - AXIS_LEVELING_COMMANDS "\n" - PARK_AND_RELEASE_COMMANDS - )); + #if defined(AXIS_LEVELING_COMMANDS) && defined(PARK_AND_RELEASE_COMMANDS) + SpinnerDialogBox::enqueueAndWait_P(F( + "G28 E\n" + AXIS_LEVELING_COMMANDS "\n" + PARK_AND_RELEASE_COMMANDS + )); + #endif current_screen.forget(); break; case 2: diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_xyz.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_xyz.cpp index 883a446b3e..3ae2d680ce 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_xyz.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_xyz.cpp @@ -36,10 +36,12 @@ void BioConfirmHomeXYZ::onRedraw(draw_mode_t) { bool BioConfirmHomeXYZ::onTouchEnd(uint8_t tag) { switch (tag) { case 1: - SpinnerDialogBox::enqueueAndWait_P(F( - "G28\n" - PARK_AND_RELEASE_COMMANDS - )); + #ifdef PARK_AND_RELEASE_COMMANDS + SpinnerDialogBox::enqueueAndWait_P(F( + "G28\n" + PARK_AND_RELEASE_COMMANDS + )); + #endif current_screen.forget(); break; case 2: diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_main_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_main_menu.cpp index 40ed8479ee..1f6aa45c17 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_main_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_main_menu.cpp @@ -51,7 +51,7 @@ void MainMenu::onRedraw(draw_mode_t what) { .tag(4).button( BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXT_F(MSG_RELEASE_XY_AXIS)) .tag(5).button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS)) .tag(6).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_BED_TEMPERATURE)) - .tag(7).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_INTERFACE_SETTINGS)) + .tag(7).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_INTERFACE)) .tag(8).button( BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_ADVANCED_SETTINGS)) .tag(9).button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_INFO_MENU)) .colors(action_btn) @@ -72,7 +72,9 @@ bool MainMenu::onTouchEnd(uint8_t tag) { case 2: GOTO_SCREEN(BioConfirmHomeXYZ); break; case 3: SpinnerDialogBox::enqueueAndWait_P(e_homed ? F("G0 E0 F120") : F("G112")); break; case 4: StatusScreen::unlockMotors(); break; + #ifdef AXIS_LEVELING_COMMANDS case 5: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break; + #endif case 6: GOTO_SCREEN(TemperatureScreen); break; case 7: GOTO_SCREEN(InterfaceSettingsScreen); break; case 8: GOTO_SCREEN(AdvancedSettingsMenu); break; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.cpp index 996c12cf23..5e022b58e7 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.cpp @@ -80,12 +80,14 @@ void BootScreen::onIdle() { SpinnerDialogBox::hide(); } - if (UIData::animations_enabled()) { - // If there is a startup video in the flash SPI, play - // that, otherwise show a static splash screen. - if (!MediaPlayerScreen::playBootMedia()) - showSplashScreen(); - } + #if DISABLED(TOUCH_UI_NO_BOOTSCREEN) + if (UIData::animations_enabled()) { + // If there is a startup video in the flash SPI, play + // that, otherwise show a static splash screen. + if (!MediaPlayerScreen::playBootMedia()) + showSplashScreen(); + } + #endif StatusScreen::loadBitmaps(); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp index 2d1e0d6627..2b5963fdf6 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp @@ -111,6 +111,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { if (what & BACKGROUND) { cmd.cmd(CLEAR_COLOR_RGB(bg_color)) .cmd(CLEAR(true,true,true)) + .cmd(COLOR_RGB(bg_text_enabled)) .tag(0) #ifdef TOUCH_UI_PORTRAIT .font(font_large) @@ -119,7 +120,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { #endif .text(BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_EXTRUDER_SELECTION)) #ifdef TOUCH_UI_PORTRAIT - .text(BTN_POS(1,7), BTN_SIZE(1,1), F("")) + .text(BTN_POS(1,7), BTN_SIZE(1,1), GET_TEXT_F(MSG_CURRENT_TEMPERATURE)) #else .text(BTN_POS(3,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_CURRENT_TEMPERATURE)) .font(font_small) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp index 3de03579e4..4e165aa448 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp @@ -69,7 +69,7 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) { .cmd(COLOR_RGB(bg_text_enabled)) .tag(0) .font(font_medium) - .text(BTN_POS(1,1), BTN_SIZE(4,1), GET_TEXT_F(MSG_INTERFACE_SETTINGS)) + .text(BTN_POS(1,1), BTN_SIZE(4,1), GET_TEXT_F(MSG_INTERFACE)) #undef EDGE_R #define EDGE_R 30 .font(font_small) @@ -77,7 +77,9 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) { .text(BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(MSG_LCD_BRIGHTNESS), OPT_RIGHTX | OPT_CENTERY) .text(BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_SOUND_VOLUME), OPT_RIGHTX | OPT_CENTERY) .text(BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXT_F(MSG_SCREEN_LOCK), OPT_RIGHTX | OPT_CENTERY); + #if DISABLED(TOUCH_UI_NO_BOOTSCREEN) cmd.text(BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_BOOT_SCREEN), OPT_RIGHTX | OPT_CENTERY); + #endif #undef EDGE_R } @@ -95,16 +97,18 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) { .tag(3).slider(BTN_POS(3,3), BTN_SIZE(2,1), screen_data.InterfaceSettingsScreen.volume, 0xFF) .colors(ui_toggle) .tag(4).toggle2(BTN_POS(3,4), BTN_SIZE(w,1), GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), LockScreen::is_enabled()) + #if DISABLED(TOUCH_UI_NO_BOOTSCREEN) .tag(5).toggle2(BTN_POS(3,5), BTN_SIZE(w,1), GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), UIData::animations_enabled()) + #endif #undef EDGE_R #define EDGE_R 0 #ifdef TOUCH_UI_PORTRAIT .colors(normal_btn) - .tag(6).button (BTN_POS(1,6), BTN_SIZE(4,1), GET_TEXT_F(MSG_INTERFACE_SOUNDS)) + .tag(6).button (BTN_POS(1,6), BTN_SIZE(4,1), GET_TEXT_F(MSG_SOUNDS)) .colors(action_btn) .tag(1).button (BTN_POS(1,7), BTN_SIZE(4,1), GET_TEXT_F(MSG_BACK)); #else - .tag(6).button (BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_INTERFACE_SOUNDS)) + .tag(6).button (BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_SOUNDS)) .colors(action_btn) .tag(1).button (BTN_POS(3,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); #endif diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp index 57f520e8ab..48fae863a7 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp @@ -71,7 +71,7 @@ void InterfaceSoundsScreen::onRedraw(draw_mode_t what) { #define GRID_ROWS 9 .font(font_medium) - .text(BTN_POS(1,1), BTN_SIZE(4,1), GET_TEXT_F(MSG_INTERFACE_SOUNDS)) + .text(BTN_POS(1,1), BTN_SIZE(4,1), GET_TEXT_F(MSG_SOUNDS)) #undef EDGE_R #define EDGE_R 30 .font(font_small) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.cpp index 016996e265..5d165edef0 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.cpp @@ -37,81 +37,89 @@ void MainMenu::onRedraw(draw_mode_t what) { .cmd(CLEAR(true,true,true)); } + #ifdef TOUCH_UI_PORTRAIT + #define GRID_ROWS 8 + #define GRID_COLS 2 + #define ABOUT_PRINTER_POS BTN_POS(1,1), BTN_SIZE(2,1) + #define ADVANCED_SETTINGS_POS BTN_POS(1,2), BTN_SIZE(2,1) + #define FILAMENTCHANGE_POS BTN_POS(1,3), BTN_SIZE(2,1) + #define TEMPERATURE_POS BTN_POS(1,4), BTN_SIZE(2,1) + #define MOVE_AXIS_POS BTN_POS(1,5), BTN_SIZE(1,1) + #define DISABLE_STEPPERS_POS BTN_POS(2,5), BTN_SIZE(1,1) + #define AUTO_HOME_POS BTN_POS(1,6), BTN_SIZE(1,1) + #define CLEAN_NOZZLE_POS BTN_POS(2,6), BTN_SIZE(1,1) + #define LEVEL_BED_POS BTN_POS(1,7), BTN_SIZE(1,1) + #define LEVEL_AXIS_POS BTN_POS(2,7), BTN_SIZE(1,1) + #define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1) + #else + #define GRID_ROWS 6 + #define GRID_COLS 2 + #define ADVANCED_SETTINGS_POS BTN_POS(1,1), BTN_SIZE(1,1) + #define ABOUT_PRINTER_POS BTN_POS(2,1), BTN_SIZE(1,1) + #define AUTO_HOME_POS BTN_POS(1,2), BTN_SIZE(1,1) + #define CLEAN_NOZZLE_POS BTN_POS(2,2), BTN_SIZE(1,1) + #define MOVE_AXIS_POS BTN_POS(1,3), BTN_SIZE(1,1) + #define DISABLE_STEPPERS_POS BTN_POS(2,3), BTN_SIZE(1,1) + #define TEMPERATURE_POS BTN_POS(1,4), BTN_SIZE(1,1) + #define FILAMENTCHANGE_POS BTN_POS(2,4), BTN_SIZE(1,1) + #define LEVEL_BED_POS BTN_POS(1,5), BTN_SIZE(1,1) + #define LEVEL_AXIS_POS BTN_POS(2,5), BTN_SIZE(1,1) + #define BACK_POS BTN_POS(1,6), BTN_SIZE(2,1) + #endif + if (what & FOREGROUND) { CommandProcessor cmd; cmd.colors(normal_btn) .font(Theme::font_medium) - #ifdef TOUCH_UI_PORTRAIT - #define GRID_ROWS 8 - #define GRID_COLS 2 - .tag(2).button( BTN_POS(1,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_AUTO_HOME)) - .enabled( - #if ENABLED(NOZZLE_CLEAN_FEATURE) - 1 - #endif + .tag(2).button( AUTO_HOME_POS, GET_TEXT_F(MSG_AUTO_HOME)) + .enabled( + #if ANY(NOZZLE_CLEAN_FEATURE, TOUCH_UI_COCOA_PRESS) + 1 + #endif + ) + .tag(3).button( CLEAN_NOZZLE_POS, GET_TEXT_F( + #if ENABLED(TOUCH_UI_COCOA_PRESS) + MSG_PREHEAT_1 + #else + MSG_CLEAN_NOZZLE + #endif + )) + .tag(4).button( MOVE_AXIS_POS, GET_TEXT_F(MSG_MOVE_AXIS)) + .tag(5).button( DISABLE_STEPPERS_POS, GET_TEXT_F(MSG_DISABLE_STEPPERS)) + .tag(6).button( TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE)) + .enabled( + #if DISABLED(TOUCH_UI_LULZBOT_BIO) + 1 + #endif + ) + .tag(7).button( FILAMENTCHANGE_POS, GET_TEXT_F( + #if ENABLED(TOUCH_UI_COCOA_PRESS) + MSG_CASE_LIGHT + #else + MSG_FILAMENTCHANGE + #endif + )) + .tag(8).button( ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS)) + .enabled( + #ifdef PRINTCOUNTER + 1 + #endif ) - .tag(3).button( BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_CLEAN_NOZZLE)) - .tag(4).button( BTN_POS(1,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_MOVE_AXIS)) - .tag(5).button( BTN_POS(2,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_DISABLE_STEPPERS)) - .tag(6).button( BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_TEMPERATURE)) - .enabled( - #if NONE(TOUCH_UI_LULZBOT_BIO, TOUCH_UI_COCOA_PRESS) - 1 - #endif + .enabled( + #ifdef AXIS_LEVELING_COMMANDS + 1 + #endif ) - .tag(7).button( BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXT_F(MSG_FILAMENTCHANGE)) - .tag(8).button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_ADVANCED_SETTINGS)) - .enabled( - #ifdef PRINTCOUNTER - 1 - #endif + .tag(9).button( LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS)) + .enabled( + #ifdef HAS_LEVELING + 1 + #endif ) - .tag(9).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_INFO_STATS_MENU)) - .tag(10).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_INFO_MENU)) - .colors(action_btn) - .tag(1).button( BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); - #undef GRID_COLS - #undef GRID_ROWS - #else - #define GRID_ROWS 5 - #define GRID_COLS 2 - .tag(2).button( BTN_POS(1,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_AUTO_HOME)) - #if ENABLED(TOUCH_UI_COCOA_PRESS) - .tag(3).button( BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_PREHEAT_1)) - #else - .enabled( - #if ENABLED(NOZZLE_CLEAN_FEATURE) - 1 - #endif - ) - .tag(3).button( BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_CLEAN_NOZZLE)) - #endif - .tag(4).button( BTN_POS(1,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_MOVE_AXIS)) - .tag(5).button( BTN_POS(2,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_DISABLE_STEPPERS)) - .tag(6).button( BTN_POS(1,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_TEMPERATURE)) - #if ENABLED(TOUCH_UI_COCOA_PRESS) - .tag(7).button( BTN_POS(2,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_CASE_LIGHT)) - #else - .enabled( - #if DISABLED(TOUCH_UI_LULZBOT_BIO) - 1 - #endif - ) - .tag(7).button( BTN_POS(2,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_FILAMENTCHANGE)) - #endif - .tag(8).button( BTN_POS(1,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_ADVANCED_SETTINGS)) - .enabled( - #ifdef PRINTCOUNTER - 1 - #endif - ) - .tag(9).button( BTN_POS(2,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_INFO_STATS_MENU)) - .tag(10).button( BTN_POS(1,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_INFO_MENU)) - .colors(action_btn) - .tag(1).button( BTN_POS(2,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_BACK)); - #undef GRID_COLS - #undef GRID_ROWS - #endif + .tag(10).button( LEVEL_BED_POS, GET_TEXT_F(MSG_LEVEL_BED)) + .tag(11).button( ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU)) + .colors(action_btn) + .tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK)); } } @@ -122,23 +130,32 @@ bool MainMenu::onTouchEnd(uint8_t tag) { case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; case 2: SpinnerDialogBox::enqueueAndWait_P(F("G28")); break; #if ENABLED(TOUCH_UI_COCOA_PRESS) - case 3: GOTO_SCREEN(PreheatTimerScreen); break; + case 3: GOTO_SCREEN(PreheatMenu); break; #elif ENABLED(NOZZLE_CLEAN_FEATURE) case 3: injectCommands_P(PSTR("G12")); GOTO_SCREEN(StatusScreen); break; #endif case 4: GOTO_SCREEN(MoveAxisScreen); break; case 5: injectCommands_P(PSTR("M84")); break; case 6: GOTO_SCREEN(TemperatureScreen); break; - #if ENABLED(TOUCH_UI_COCOA_PRESS) + #if ENABLED(TOUCH_UI_COCOA_PRESS) && HAS_CASE_LIGHT case 7: GOTO_SCREEN(CaseLightScreen); break; #else case 7: GOTO_SCREEN(ChangeFilamentScreen); break; #endif case 8: GOTO_SCREEN(AdvancedSettingsMenu); break; -#if ENABLED(PRINTCOUNTER) - case 9: GOTO_SCREEN(StatisticsScreen); break; -#endif - case 10: GOTO_SCREEN(AboutScreen); break; + #ifdef AXIS_LEVELING_COMMANDS + case 9: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break; + #endif + #ifdef HAS_LEVELING + case 10: SpinnerDialogBox::enqueueAndWait_P(F( + #ifdef BED_LEVELING_COMMANDS + BED_LEVELING_COMMANDS + #else + "G29" + #endif + )); break; + #endif + case 11: GOTO_SCREEN(AboutScreen); break; default: return false; } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_menu.cpp new file mode 100644 index 0000000000..f0b5dd887b --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_menu.cpp @@ -0,0 +1,83 @@ +/******************** + * preheat_menu.cpp * + ********************/ + +/**************************************************************************** + * Written By Marcio Teixeira 2020 - Cocoa Press * + * * + * 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 * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#include "../config.h" + +#if ENABLED(TOUCH_UI_FTDI_EVE) && defined(TOUCH_UI_COCOA_PRESS) + +#include "screens.h" + +using namespace FTDI; +using namespace ExtUI; +using namespace Theme; + +void PreheatMenu::onRedraw(draw_mode_t what) { + if (what & BACKGROUND) { + CommandProcessor cmd; + cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) + .cmd(CLEAR(true,true,true)) + .tag(0); + } + + #define GRID_ROWS 3 + #define GRID_COLS 2 + + if (what & FOREGROUND) { + CommandProcessor cmd; + cmd.cmd(COLOR_RGB(bg_text_enabled)) + .font(Theme::font_medium) + .text ( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_PREHEAT_1)) + .colors(normal_btn) + .tag(2).button( BTN_POS(1,2), BTN_SIZE(1,1), F("Dark Chocolate")) + .tag(3).button( BTN_POS(2,2), BTN_SIZE(1,1), F("Milk Chocolate")) + .tag(4).button( BTN_POS(1,3), BTN_SIZE(1,1), F("White Chocolate")) + .colors(action_btn) + .tag(1) .button( BTN_POS(2,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_BACK)); + } +} + +bool PreheatMenu::onTouchEnd(uint8_t tag) { + switch (tag) { + case 1: GOTO_PREVIOUS(); break; + case 2: + #ifdef COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_SCRIPT + injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_SCRIPT)); + #endif + GOTO_SCREEN(PreheatTimerScreen); + break; + case 3: + #ifdef COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_SCRIPT + injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_SCRIPT)); + #endif + GOTO_SCREEN(PreheatTimerScreen); + break; + case 4: + #ifdef COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_SCRIPT + injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_SCRIPT)); + #endif + GOTO_SCREEN(PreheatTimerScreen); + break; + default: return false; + } + return true; +} + +#endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_timer_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_timer_screen.cpp index 0a24c30082..7d68ae2d67 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_timer_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_timer_screen.cpp @@ -77,9 +77,6 @@ void PreheatTimerScreen::draw_interaction_buttons(draw_mode_t what) { void PreheatTimerScreen::onEntry() { screen_data.PreheatTimerScreen.start_ms = millis(); - #ifdef COCOA_PRESS_PREHEAT_SCRIPT - injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_SCRIPT)); - #endif } void PreheatTimerScreen::onRedraw(draw_mode_t what) { diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp index 69c1cf1420..ce75462040 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp @@ -105,6 +105,7 @@ SCREEN_TABLE { DECL_SCREEN(BioConfirmHomeE), #endif #if ENABLED(TOUCH_UI_COCOA_PRESS) + DECL_SCREEN(PreheatMenu), DECL_SCREEN(PreheatTimerScreen), #endif #if ENABLED(TOUCH_UI_DEVELOPER_MENU) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h index 02c5b14831..346d122a0f 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h @@ -76,6 +76,7 @@ enum { PRINTING_SCREEN_CACHE, #endif #if ENABLED(TOUCH_UI_COCOA_PRESS) + PREHEAT_MENU_CACHE, PREHEAT_TIMER_SCREEN_CACHE, #endif CHANGE_FILAMENT_SCREEN_CACHE, @@ -99,7 +100,7 @@ enum { class BaseScreen : public UIScreen { protected: - #ifdef LCD_TIMEOUT_TO_STATUS + #if LCD_TIMEOUT_TO_STATUS static uint32_t last_interaction; #endif @@ -314,6 +315,12 @@ class StatusScreen : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); + }; + class PreheatTimerScreen : public BaseScreen, public CachedScreen { private: static uint16_t secondsRemaining(); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp index e71f200a35..98d0bba759 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp @@ -33,9 +33,9 @@ using namespace FTDI; using namespace Theme; #ifdef TOUCH_UI_PORTRAIT - #define GRID_ROWS 8 + #define GRID_ROWS 8 #else - #define GRID_ROWS 8 + #define GRID_ROWS 8 #endif void StatusScreen::draw_axis_position(draw_mode_t what) { @@ -43,41 +43,41 @@ void StatusScreen::draw_axis_position(draw_mode_t what) { #define GRID_COLS 3 + #ifdef TOUCH_UI_PORTRAIT + #define X_LBL_POS BTN_POS(1,5), BTN_SIZE(1,1) + #define Y_LBL_POS BTN_POS(1,6), BTN_SIZE(1,1) + #define Z_LBL_POS BTN_POS(1,7), BTN_SIZE(1,1) + #define X_VAL_POS BTN_POS(2,5), BTN_SIZE(2,1) + #define Y_VAL_POS BTN_POS(2,6), BTN_SIZE(2,1) + #define Z_VAL_POS BTN_POS(2,7), BTN_SIZE(2,1) + #else + #define X_LBL_POS BTN_POS(1,5), BTN_SIZE(1,1) + #define Y_LBL_POS BTN_POS(2,5), BTN_SIZE(1,1) + #define Z_LBL_POS BTN_POS(3,5), BTN_SIZE(1,1) + #define X_VAL_POS BTN_POS(1,6), BTN_SIZE(1,1) + #define Y_VAL_POS BTN_POS(2,6), BTN_SIZE(1,1) + #define Z_VAL_POS BTN_POS(3,6), BTN_SIZE(1,1) + #endif + + #define _UNION_POS(x1,y1,w1,h1,x2,y2,w2,h2) x1,y1,max(x1+w1,x2+w2)-x1,max(y1+h1,y2+h2)-y1 + #define UNION_POS(p1, p2) _UNION_POS(p1, p2) + if (what & BACKGROUND) { cmd.tag(6) - #ifdef TOUCH_UI_PORTRAIT - .fgcolor(Theme::axis_label) - .font(Theme::font_large) - .button( BTN_POS(1,5), BTN_SIZE(2,1), F(""), OPT_FLAT) - .button( BTN_POS(1,6), BTN_SIZE(2,1), F(""), OPT_FLAT) - .button( BTN_POS(1,7), BTN_SIZE(2,1), F(""), OPT_FLAT) - - .font(Theme::font_small) - .text ( BTN_POS(1,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_AXIS_X)) - .text ( BTN_POS(1,6), BTN_SIZE(1,1), GET_TEXT_F(MSG_AXIS_Y)) - .text ( BTN_POS(1,7), BTN_SIZE(1,1), GET_TEXT_F(MSG_AXIS_Z)) - - .font(Theme::font_medium) - .fgcolor(Theme::x_axis) .button( BTN_POS(2,5), BTN_SIZE(2,1), F(""), OPT_FLAT) - .fgcolor(Theme::y_axis) .button( BTN_POS(2,6), BTN_SIZE(2,1), F(""), OPT_FLAT) - .fgcolor(Theme::z_axis) .button( BTN_POS(2,7), BTN_SIZE(2,1), F(""), OPT_FLAT); - #else - .fgcolor(Theme::axis_label) - .font(Theme::font_large) - .button( BTN_POS(1,5), BTN_SIZE(1,2), F(""), OPT_FLAT) - .button( BTN_POS(2,5), BTN_SIZE(1,2), F(""), OPT_FLAT) - .button( BTN_POS(3,5), BTN_SIZE(1,2), F(""), OPT_FLAT) - - .font(Theme::font_small) - .text ( BTN_POS(1,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_AXIS_X)) - .text ( BTN_POS(2,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_AXIS_Y)) - .text ( BTN_POS(3,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_AXIS_Z)) - .font(Theme::font_medium) - - .fgcolor(Theme::x_axis) .button( BTN_POS(1,6), BTN_SIZE(1,1), F(""), OPT_FLAT) - .fgcolor(Theme::y_axis) .button( BTN_POS(2,6), BTN_SIZE(1,1), F(""), OPT_FLAT) - .fgcolor(Theme::z_axis) .button( BTN_POS(3,6), BTN_SIZE(1,1), F(""), OPT_FLAT); - #endif + .fgcolor(Theme::axis_label) + .font(Theme::font_large) + .button( UNION_POS(X_LBL_POS, X_VAL_POS), F(""), OPT_FLAT) + .button( UNION_POS(Y_LBL_POS, Y_VAL_POS), F(""), OPT_FLAT) + .button( UNION_POS(Z_LBL_POS, Z_VAL_POS), F(""), OPT_FLAT) + .font(Theme::font_medium) + .fgcolor(Theme::x_axis) .button( X_VAL_POS, F(""), OPT_FLAT) + .fgcolor(Theme::y_axis) .button( Y_VAL_POS, F(""), OPT_FLAT) + .fgcolor(Theme::z_axis) .button( Z_VAL_POS, F(""), OPT_FLAT) + .font(Theme::font_small) + .text ( X_LBL_POS, GET_TEXT_F(MSG_AXIS_X)) + .text ( Y_LBL_POS, GET_TEXT_F(MSG_AXIS_Y)) + .text ( Z_LBL_POS, GET_TEXT_F(MSG_AXIS_Z)) + .colors(normal_btn); } if (what & FOREGROUND) { @@ -101,16 +101,11 @@ void StatusScreen::draw_axis_position(draw_mode_t what) { else strcpy_P(z_str, PSTR("?")); - cmd.tag(6).font(Theme::font_medium) - #ifdef TOUCH_UI_PORTRAIT - .text ( BTN_POS(2,5), BTN_SIZE(2,1), x_str) - .text ( BTN_POS(2,6), BTN_SIZE(2,1), y_str) - .text ( BTN_POS(2,7), BTN_SIZE(2,1), z_str); - #else - .text ( BTN_POS(1,6), BTN_SIZE(1,1), x_str) - .text ( BTN_POS(2,6), BTN_SIZE(1,1), y_str) - .text ( BTN_POS(3,6), BTN_SIZE(1,1), z_str); - #endif + cmd.tag(6) + .font(Theme::font_medium) + .text ( X_VAL_POS, x_str) + .text ( Y_VAL_POS, y_str) + .text ( Z_VAL_POS, z_str); } #undef GRID_COLS @@ -125,49 +120,49 @@ void StatusScreen::draw_axis_position(draw_mode_t what) { void StatusScreen::draw_temperature(draw_mode_t what) { using namespace Theme; + #define TEMP_RECT_1 BTN_POS(1,1), BTN_SIZE(4,2) + #define TEMP_RECT_2 BTN_POS(1,1), BTN_SIZE(8,1) + #define NOZ_1_POS BTN_POS(1,1), BTN_SIZE(4,1) + #define NOZ_2_POS BTN_POS(5,1), BTN_SIZE(4,1) + #define BED_POS BTN_POS(1,2), BTN_SIZE(4,1) + #define FAN_POS BTN_POS(5,2), BTN_SIZE(4,1) + + #define _ICON_POS(x,y,w,h) x, y, w/4, h + #define _TEXT_POS(x,y,w,h) x + w/4, y, w - w/4, h + #define ICON_POS(pos) _ICON_POS(pos) + #define TEXT_POS(pos) _TEXT_POS(pos) + CommandProcessor cmd; if (what & BACKGROUND) { cmd.font(Theme::font_small) - #ifdef TOUCH_UI_PORTRAIT .tag(5) - .fgcolor(temp) .button( BTN_POS(1,1), BTN_SIZE(4,2), F(""), OPT_FLAT) - .button( BTN_POS(1,1), BTN_SIZE(8,1), F(""), OPT_FLAT) - .fgcolor(fan_speed) .button( BTN_POS(5,2), BTN_SIZE(4,1), F(""), OPT_FLAT) - .tag(0) - .fgcolor(progress) .button( BTN_POS(1,3), BTN_SIZE(4,1), F(""), OPT_FLAT) - .button( BTN_POS(5,3), BTN_SIZE(4,1), F(""), OPT_FLAT); - #else - .tag(5) - .fgcolor(temp) .button( BTN_POS(1,1), BTN_SIZE(4,2), F(""), OPT_FLAT) - .button( BTN_POS(1,1), BTN_SIZE(8,1), F(""), OPT_FLAT) - .fgcolor(fan_speed) .button( BTN_POS(5,2), BTN_SIZE(4,1), F(""), OPT_FLAT) - .tag(0) - .fgcolor(progress) .button( BTN_POS(9,1), BTN_SIZE(4,1), F(""), OPT_FLAT) - .button( BTN_POS(9,2), BTN_SIZE(4,1), F(""), OPT_FLAT); - #endif + .fgcolor(temp) .button( TEMP_RECT_1, F(""), OPT_FLAT) + .button( TEMP_RECT_2, F(""), OPT_FLAT) + .fgcolor(fan_speed).button( FAN_POS, F(""), OPT_FLAT) + .tag(0); // Draw Extruder Bitmap on Extruder Temperature Button cmd.tag(5) - .cmd(BITMAP_SOURCE(Extruder_Icon_Info)) - .cmd(BITMAP_LAYOUT(Extruder_Icon_Info)) - .cmd(BITMAP_SIZE (Extruder_Icon_Info)) - .icon (BTN_POS(1,1), BTN_SIZE(1,1), Extruder_Icon_Info, icon_scale) - .icon (BTN_POS(5,1), BTN_SIZE(1,1), Extruder_Icon_Info, icon_scale); + .cmd (BITMAP_SOURCE(Extruder_Icon_Info)) + .cmd (BITMAP_LAYOUT(Extruder_Icon_Info)) + .cmd (BITMAP_SIZE (Extruder_Icon_Info)) + .icon(ICON_POS(NOZ_1_POS), Extruder_Icon_Info, icon_scale) + .icon(ICON_POS(NOZ_2_POS), Extruder_Icon_Info, icon_scale); // Draw Bed Heat Bitmap on Bed Heat Button - cmd.cmd(BITMAP_SOURCE(Bed_Heat_Icon_Info)) - .cmd(BITMAP_LAYOUT(Bed_Heat_Icon_Info)) - .cmd(BITMAP_SIZE (Bed_Heat_Icon_Info)) - .icon (BTN_POS(1,2), BTN_SIZE(1,1), Bed_Heat_Icon_Info, icon_scale); + cmd.cmd (BITMAP_SOURCE(Bed_Heat_Icon_Info)) + .cmd (BITMAP_LAYOUT(Bed_Heat_Icon_Info)) + .cmd (BITMAP_SIZE (Bed_Heat_Icon_Info)) + .icon(ICON_POS(BED_POS), Bed_Heat_Icon_Info, icon_scale); // Draw Fan Percent Bitmap on Bed Heat Button - cmd.cmd(BITMAP_SOURCE(Fan_Icon_Info)) - .cmd(BITMAP_LAYOUT(Fan_Icon_Info)) - .cmd(BITMAP_SIZE (Fan_Icon_Info)) - .icon (BTN_POS(5,2), BTN_SIZE(1,1), Fan_Icon_Info, icon_scale); + cmd.cmd (BITMAP_SOURCE(Fan_Icon_Info)) + .cmd (BITMAP_LAYOUT(Fan_Icon_Info)) + .cmd (BITMAP_SIZE (Fan_Icon_Info)) + .icon(ICON_POS(FAN_POS), Fan_Icon_Info, icon_scale); #ifdef TOUCH_UI_USE_UTF8 load_utf8_bitmaps(cmd); // Restore font bitmap handles @@ -212,10 +207,10 @@ void StatusScreen::draw_temperature(draw_mode_t what) { cmd.tag(5) .font(font_medium) - .text(BTN_POS(2,1), BTN_SIZE(3,1), e0_str) - .text(BTN_POS(6,1), BTN_SIZE(3,1), e1_str) - .text(BTN_POS(2,2), BTN_SIZE(3,1), bed_str) - .text(BTN_POS(6,2), BTN_SIZE(3,1), fan_str); + .text(TEXT_POS(NOZ_1_POS), e0_str) + .text(TEXT_POS(NOZ_2_POS), e1_str) + .text(TEXT_POS(BED_POS), bed_str) + .text(TEXT_POS(FAN_POS), fan_str); } } @@ -225,15 +220,18 @@ void StatusScreen::draw_progress(draw_mode_t what) { CommandProcessor cmd; + #if ENABLED(TOUCH_UI_PORTRAIT) + #define TIME_POS BTN_POS(1,3), BTN_SIZE(4,1) + #define PROGRESS_POS BTN_POS(5,3), BTN_SIZE(4,1) + #else + #define TIME_POS BTN_POS(9,1), BTN_SIZE(4,1) + #define PROGRESS_POS BTN_POS(9,2), BTN_SIZE(4,1) + #endif + if (what & BACKGROUND) { cmd.tag(0).font(font_medium) - #ifdef TOUCH_UI_PORTRAIT - .fgcolor(progress) .button(BTN_POS(1,3), BTN_SIZE(4,1), F(""), OPT_FLAT) - .button(BTN_POS(5,3), BTN_SIZE(4,1), F(""), OPT_FLAT); - #else - .fgcolor(progress) .button(BTN_POS(9,1), BTN_SIZE(4,1), F(""), OPT_FLAT) - .button(BTN_POS(9,2), BTN_SIZE(4,1), F(""), OPT_FLAT); - #endif + .fgcolor(progress).button(TIME_POS, F(""), OPT_FLAT) + .button(PROGRESS_POS, F(""), OPT_FLAT); } if (what & FOREGROUND) { @@ -248,13 +246,8 @@ void StatusScreen::draw_progress(draw_mode_t what) { sprintf_P(progress_str, PSTR("%-3d %%"), getProgress_percent() ); cmd.font(font_medium) - #ifdef TOUCH_UI_PORTRAIT - .tag(0).text(BTN_POS(1,3), BTN_SIZE(4,1), time_str) - .text(BTN_POS(5,3), BTN_SIZE(4,1), progress_str); - #else - .tag(0).text(BTN_POS(9,1), BTN_SIZE(4,1), time_str) - .text(BTN_POS(9,2), BTN_SIZE(4,1), progress_str); - #endif + .tag(0).text(TIME_POS, time_str) + .text(PROGRESS_POS, progress_str); } } @@ -266,6 +259,14 @@ void StatusScreen::draw_interaction_buttons(draw_mode_t what) { if (what & FOREGROUND) { using namespace ExtUI; + #if ENABLED(TOUCH_UI_PORTRAIT) + #define MEDIA_BTN_POS BTN_POS(1,8), BTN_SIZE(2,1) + #define MENU_BTN_POS BTN_POS(3,8), BTN_SIZE(2,1) + #else + #define MEDIA_BTN_POS BTN_POS(1,7), BTN_SIZE(2,2) + #define MENU_BTN_POS BTN_POS(3,7), BTN_SIZE(2,2) + #endif + const bool has_media = isMediaInserted() && !isPrintingFromMedia(); CommandProcessor cmd; @@ -273,42 +274,29 @@ void StatusScreen::draw_interaction_buttons(draw_mode_t what) { .font(Theme::font_medium) .enabled(has_media) .colors(has_media ? action_btn : normal_btn) - .tag(3).button( - #ifdef TOUCH_UI_PORTRAIT - BTN_POS(1,8), BTN_SIZE(2,1), - #else - BTN_POS(1,7), BTN_SIZE(2,2), - #endif - isPrintingFromMedia() ? GET_TEXT_F(MSG_PRINTING) : GET_TEXT_F(MSG_BUTTON_MEDIA) - ).colors(!has_media ? action_btn : normal_btn) - #ifdef TOUCH_UI_PORTRAIT - .tag(4).button( BTN_POS(3,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_MENU)); - #else - .tag(4).button( BTN_POS(3,7), BTN_SIZE(2,2), GET_TEXT_F(MSG_BUTTON_MENU)); - #endif + .tag(3).button(MEDIA_BTN_POS, isPrintingFromMedia() ? GET_TEXT_F(MSG_PRINTING) : GET_TEXT_F(MSG_BUTTON_MEDIA)) + .colors(!has_media ? action_btn : normal_btn) + .tag(4).button( MENU_BTN_POS, GET_TEXT_F(MSG_BUTTON_MENU)); } #undef GRID_COLS } void StatusScreen::draw_status_message(draw_mode_t what, const char* message) { #define GRID_COLS 1 + + #if ENABLED(TOUCH_UI_PORTRAIT) + #define STATUS_POS BTN_POS(1,4), BTN_SIZE(1,1) + #else + #define STATUS_POS BTN_POS(1,3), BTN_SIZE(1,2) + #endif + if (what & BACKGROUND) { CommandProcessor cmd; cmd.fgcolor(Theme::status_msg) .tag(0) - #ifdef TOUCH_UI_PORTRAIT - .button( BTN_POS(1,4), BTN_SIZE(1,1), F(""), OPT_FLAT); - #else - .button( BTN_POS(1,3), BTN_SIZE(1,2), F(""), OPT_FLAT); - #endif + .button( STATUS_POS, F(""), OPT_FLAT); - draw_text_box(cmd, - #ifdef TOUCH_UI_PORTRAIT - BTN_POS(1,4), BTN_SIZE(1,1), - #else - BTN_POS(1,3), BTN_SIZE(1,2), - #endif - message, OPT_CENTER, font_large); + draw_text_box(cmd, STATUS_POS, message, OPT_CENTER, font_large); } #undef GRID_COLS } @@ -326,10 +314,10 @@ void StatusScreen::setStatusMessage(const char* message) { .cmd(CLEAR(true,true,true)); draw_temperature(BACKGROUND); - draw_progress(BACKGROUND); - draw_axis_position(BACKGROUND); draw_status_message(BACKGROUND, message); draw_interaction_buttons(BACKGROUND); + draw_progress(BACKGROUND); + draw_axis_position(BACKGROUND); storeBackground(); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/colors.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/colors.h index 933e91db80..e2770d8116 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/colors.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/colors.h @@ -24,121 +24,149 @@ #pragma once namespace Theme { - #ifdef TOUCH_UI_LULZBOT_BIO - // The Lulzbot Bio uses the color PANTONE 2175C on the case silkscreen. - // This translates to HSL(208°, 100%, 39%) as an accent color on the GUI. + #if ENABLED(TOUCH_UI_COCOA_THEME) + constexpr int accent_hue = 23; - constexpr int accent_hue = 208; - constexpr float accent_sat = 0.5; - - constexpr uint32_t logo_bg_rgb = 0xffffff; - constexpr uint32_t logo_fill_rgb = 0xffffff; - constexpr uint32_t logo_stroke_rgb = hsl_to_rgb(accent_hue, 1.0, 0.39); + // Browns and Oranges + constexpr uint32_t accent_color_1 = hsl_to_rgb(12.8,0.597,0.263); // Darkest + constexpr uint32_t accent_color_2 = hsl_to_rgb(12.8,0.597,0.263); + constexpr uint32_t accent_color_3 = hsl_to_rgb( 9.6,0.664,0.443); + constexpr uint32_t accent_color_4 = hsl_to_rgb(16.3,0.873,0.537); + constexpr uint32_t accent_color_5 = hsl_to_rgb(23.0,0.889,0.539); + constexpr uint32_t accent_color_6 = hsl_to_rgb(23.0,0.889,0.539); // Lightest #else - // The Lulzbot logo uses the color PANTONE 382c. - // This translates to HSL(68°, 68%, 52%) as an accent color on the GUI. + // Use linear accent colors - constexpr int accent_hue = 68; - constexpr float accent_sat = 0.68; + #if ANY(TOUCH_UI_ROYAL_THEME, TOUCH_UI_FROZEN_THEME) + // Dark blue accent colors + constexpr int accent_hue = 216; + constexpr float accent_sat = 0.7; + #else + // Green accent colors + constexpr int accent_hue = 68; + constexpr float accent_sat = 0.68; + #endif - constexpr uint32_t logo_bg_rgb = hsl_to_rgb(accent_hue, 0.77, 0.64); - constexpr uint32_t logo_fill_rgb = hsl_to_rgb(accent_hue, 0.68, 0.52); // Lulzbot Green - constexpr uint32_t logo_stroke_rgb = 0x000000; - #endif - - // Shades of accent color - - #ifdef TOUCH_UI_COCOA_PRESS - constexpr uint32_t accent_color_1 = hsl_to_rgb(12.8,0.597,0.263); // Darkest - constexpr uint32_t accent_color_2 = hsl_to_rgb(12.8,0.597,0.263); - constexpr uint32_t accent_color_3 = hsl_to_rgb( 9.6,0.664,0.443); - constexpr uint32_t accent_color_4 = hsl_to_rgb(16.3,0.873,0.537); - constexpr uint32_t accent_color_5 = hsl_to_rgb(23.0,0.889,0.539); - constexpr uint32_t accent_color_6 = hsl_to_rgb(23.0,0.889,0.539); // Lightest - #else - constexpr uint32_t accent_color_1 = hsl_to_rgb(accent_hue, accent_sat, 0.26); // Darkest - constexpr uint32_t accent_color_2 = hsl_to_rgb(accent_hue, accent_sat, 0.39); - constexpr uint32_t accent_color_3 = hsl_to_rgb(accent_hue, accent_sat, 0.52); - constexpr uint32_t accent_color_4 = hsl_to_rgb(accent_hue, accent_sat, 0.65); - constexpr uint32_t accent_color_5 = hsl_to_rgb(accent_hue, accent_sat, 0.78); - constexpr uint32_t accent_color_6 = hsl_to_rgb(accent_hue, accent_sat, 0.91); // Lightest + // Shades of accent color + constexpr uint32_t accent_color_0 = hsl_to_rgb(accent_hue, accent_sat, 0.15); // Darkest + constexpr uint32_t accent_color_1 = hsl_to_rgb(accent_hue, accent_sat, 0.26); + constexpr uint32_t accent_color_2 = hsl_to_rgb(accent_hue, accent_sat, 0.39); + constexpr uint32_t accent_color_3 = hsl_to_rgb(accent_hue, accent_sat, 0.52); + constexpr uint32_t accent_color_4 = hsl_to_rgb(accent_hue, accent_sat, 0.65); + constexpr uint32_t accent_color_5 = hsl_to_rgb(accent_hue, accent_sat, 0.78); + constexpr uint32_t accent_color_6 = hsl_to_rgb(accent_hue, accent_sat, 0.91); // Lightest #endif // Shades of gray - constexpr float gray_sat = 0.14; + constexpr float gray_sat = 0.14; + constexpr uint32_t gray_color_0 = hsl_to_rgb(accent_hue, gray_sat, 0.15); // Darkest + constexpr uint32_t gray_color_1 = hsl_to_rgb(accent_hue, gray_sat, 0.26); + constexpr uint32_t gray_color_2 = hsl_to_rgb(accent_hue, gray_sat, 0.39); + constexpr uint32_t gray_color_3 = hsl_to_rgb(accent_hue, gray_sat, 0.52); + constexpr uint32_t gray_color_4 = hsl_to_rgb(accent_hue, gray_sat, 0.65); + constexpr uint32_t gray_color_5 = hsl_to_rgb(accent_hue, gray_sat, 0.78); + constexpr uint32_t gray_color_6 = hsl_to_rgb(accent_hue, gray_sat, 0.91); // Lightest - constexpr uint32_t gray_color_1 = hsl_to_rgb(accent_hue, gray_sat, 0.26); // Darkest - constexpr uint32_t gray_color_2 = hsl_to_rgb(accent_hue, gray_sat, 0.39); - constexpr uint32_t gray_color_3 = hsl_to_rgb(accent_hue, gray_sat, 0.52); - constexpr uint32_t gray_color_4 = hsl_to_rgb(accent_hue, gray_sat, 0.65); - constexpr uint32_t gray_color_5 = hsl_to_rgb(accent_hue, gray_sat, 0.78); - constexpr uint32_t gray_color_6 = hsl_to_rgb(accent_hue, gray_sat, 0.91); // Lightest + #if ENABLED(TOUCH_UI_ROYAL_THEME) + constexpr uint32_t theme_darkest = accent_color_1; + constexpr uint32_t theme_dark = accent_color_4; - #if NONE(TOUCH_UI_LULZBOT_BIO, TOUCH_UI_COCOA_PRESS) - // Lulzbot TAZ Pro - constexpr uint32_t theme_darkest = gray_color_1; - constexpr uint32_t theme_dark = gray_color_2; + constexpr uint32_t bg_color = gray_color_0; + constexpr uint32_t axis_label = gray_color_1; - constexpr uint32_t bg_color = theme_darkest; - constexpr uint32_t bg_text_disabled = theme_dark; - constexpr uint32_t bg_text_enabled = 0xFFFFFF; - constexpr uint32_t bg_normal = theme_darkest; + constexpr uint32_t bg_text_enabled = accent_color_6; + constexpr uint32_t bg_text_disabled = gray_color_0; + constexpr uint32_t bg_normal = accent_color_4; + constexpr uint32_t fg_disabled = gray_color_0; + constexpr uint32_t fg_normal = accent_color_0; + constexpr uint32_t fg_action = accent_color_1; - constexpr uint32_t fg_normal = theme_dark; - constexpr uint32_t fg_action = accent_color_2; - constexpr uint32_t fg_disabled = theme_darkest; + constexpr uint32_t logo_bg_rgb = accent_color_1; + constexpr uint32_t logo_fill_rgb = accent_color_0; + constexpr uint32_t logo_stroke_rgb = accent_color_4; + #elif ANY(TOUCH_UI_COCOA_THEME, TOUCH_UI_FROZEN_THEME) + constexpr uint32_t theme_darkest = accent_color_1; + constexpr uint32_t theme_dark = accent_color_4; + + constexpr uint32_t bg_color = 0xFFFFFF; + constexpr uint32_t axis_label = gray_color_5; + + constexpr uint32_t bg_text_enabled = accent_color_1; + constexpr uint32_t bg_text_disabled = gray_color_1; + constexpr uint32_t bg_normal = accent_color_4; + constexpr uint32_t fg_disabled = gray_color_6; + constexpr uint32_t fg_normal = accent_color_1; + constexpr uint32_t fg_action = accent_color_4; + + constexpr uint32_t logo_bg_rgb = accent_color_5; + constexpr uint32_t logo_fill_rgb = accent_color_6; + constexpr uint32_t logo_stroke_rgb = accent_color_2; #else - // Lulzbot Bio - constexpr uint32_t theme_darkest = accent_color_1; - constexpr uint32_t theme_dark = accent_color_4; + constexpr uint32_t theme_darkest = gray_color_1; + constexpr uint32_t theme_dark = gray_color_2; - constexpr uint32_t bg_color = 0xFFFFFF; - constexpr uint32_t bg_text_disabled = gray_color_1; - constexpr uint32_t bg_text_enabled = accent_color_1; - constexpr uint32_t bg_normal = accent_color_4; + constexpr uint32_t bg_color = gray_color_1; + constexpr uint32_t axis_label = gray_color_2; - constexpr uint32_t fg_normal = accent_color_1; - constexpr uint32_t fg_action = accent_color_4; - constexpr uint32_t fg_disabled = gray_color_6; + constexpr uint32_t bg_text_enabled = 0xFFFFFF; + constexpr uint32_t bg_text_disabled = gray_color_2; + constexpr uint32_t bg_normal = gray_color_1; + constexpr uint32_t fg_disabled = gray_color_1; + constexpr uint32_t fg_normal = gray_color_2; + constexpr uint32_t fg_action = accent_color_2; - constexpr uint32_t shadow_rgb = gray_color_6; - constexpr uint32_t stroke_rgb = accent_color_1; - constexpr uint32_t fill_rgb = accent_color_3; - constexpr uint32_t syringe_rgb = accent_color_5; + constexpr uint32_t logo_bg_rgb = accent_color_4; + constexpr uint32_t logo_fill_rgb = accent_color_3; + constexpr uint32_t logo_stroke_rgb = 0x000000; #endif - constexpr uint32_t x_axis = 0xFF0000; - constexpr uint32_t y_axis = 0x00BB00; - constexpr uint32_t z_axis = 0x0000BF; - constexpr uint32_t e_axis = gray_color_2; - constexpr uint32_t feedrate = gray_color_2; - constexpr uint32_t other = gray_color_2; + constexpr uint32_t shadow_rgb = gray_color_6; + constexpr uint32_t stroke_rgb = accent_color_1; + constexpr uint32_t fill_rgb = accent_color_3; + constexpr uint32_t syringe_rgb = accent_color_5; + + #if ENABLED(TOUCH_UI_ROYAL_THEME) + constexpr uint32_t x_axis = hsl_to_rgb(0, 1.00, 0.26); + constexpr uint32_t y_axis = hsl_to_rgb(120, 1.00, 0.13); + constexpr uint32_t z_axis = hsl_to_rgb(240, 1.00, 0.10); + #else + constexpr uint32_t x_axis = hsl_to_rgb(0, 1.00, 0.5); + constexpr uint32_t y_axis = hsl_to_rgb(120, 1.00, 0.37); + constexpr uint32_t z_axis = hsl_to_rgb(240, 1.00, 0.37); + #endif + constexpr uint32_t e_axis = axis_label; + constexpr uint32_t feedrate = axis_label; + constexpr uint32_t other = axis_label; // Status screen - constexpr uint32_t progress = gray_color_2; - constexpr uint32_t status_msg = gray_color_2; - constexpr uint32_t fan_speed = 0x377198; - constexpr uint32_t temp = 0x892c78; - constexpr uint32_t axis_label = gray_color_2; + constexpr uint32_t progress = axis_label; + constexpr uint32_t status_msg = axis_label; + #if ENABLED(TOUCH_UI_ROYAL_THEME) + constexpr uint32_t fan_speed = hsl_to_rgb(240, 0.5, 0.13); + constexpr uint32_t temp = hsl_to_rgb(343, 1.0, 0.23); + #else + constexpr uint32_t fan_speed = hsl_to_rgb(204, 0.47, 0.41); + constexpr uint32_t temp = hsl_to_rgb(311, 0.51, 0.35); + #endif - constexpr uint32_t disabled_icon = gray_color_1; + constexpr uint32_t disabled_icon = gray_color_1; // Calibration Registers Screen - constexpr uint32_t transformA = 0x3010D0; - constexpr uint32_t transformB = 0x4010D0; - constexpr uint32_t transformC = 0x5010D0; - constexpr uint32_t transformD = 0x6010D0; - constexpr uint32_t transformE = 0x7010D0; - constexpr uint32_t transformF = 0x8010D0; - constexpr uint32_t transformVal = 0x104010; + constexpr uint32_t transformA = 0x3010D0; + constexpr uint32_t transformB = 0x4010D0; + constexpr uint32_t transformC = 0x5010D0; + constexpr uint32_t transformD = 0x6010D0; + constexpr uint32_t transformE = 0x7010D0; + constexpr uint32_t transformF = 0x8010D0; + constexpr uint32_t transformVal = 0x104010; - constexpr btn_colors disabled_btn = {.bg = bg_color, .grad = fg_disabled, .fg = fg_disabled, .rgb = fg_disabled }; - constexpr btn_colors normal_btn = {.bg = fg_action, .grad = 0xFFFFFF, .fg = fg_normal, .rgb = 0xFFFFFF }; - constexpr btn_colors action_btn = {.bg = bg_color, .grad = 0xFFFFFF, .fg = fg_action, .rgb = 0xFFFFFF }; - constexpr btn_colors red_btn = {.bg = 0xFF5555, .grad = 0xFFFFFF, .fg = 0xFF0000, .rgb = 0xFFFFFF }; - constexpr btn_colors ui_slider = {.bg = theme_darkest, .grad = 0xFFFFFF, .fg = theme_dark, .rgb = accent_color_3 }; - constexpr btn_colors ui_toggle = {.bg = theme_darkest, .grad = 0xFFFFFF, .fg = theme_dark, .rgb = 0xFFFFFF }; + constexpr btn_colors disabled_btn = {.bg = bg_color, .grad = fg_disabled, .fg = fg_disabled, .rgb = fg_disabled }; + constexpr btn_colors normal_btn = {.bg = fg_action, .grad = 0xFFFFFF, .fg = fg_normal, .rgb = 0xFFFFFF }; + constexpr btn_colors action_btn = {.bg = bg_color, .grad = 0xFFFFFF, .fg = fg_action, .rgb = 0xFFFFFF }; + constexpr btn_colors red_btn = {.bg = 0xFF5555, .grad = 0xFFFFFF, .fg = 0xFF0000, .rgb = 0xFFFFFF }; + constexpr btn_colors ui_slider = {.bg = theme_darkest, .grad = 0xFFFFFF, .fg = theme_dark, .rgb = accent_color_3 }; + constexpr btn_colors ui_toggle = {.bg = theme_darkest, .grad = 0xFFFFFF, .fg = theme_dark, .rgb = 0xFFFFFF }; // Temperature color scale diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/marlin_bootscreen_landscape.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/marlin_bootscreen_landscape.h index 5e01f0471c..a65cbea52a 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/marlin_bootscreen_landscape.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/marlin_bootscreen_landscape.h @@ -35,5 +35,5 @@ const PROGMEM uint16_t logo_stroke[] = {0xADF3, 0x546C, 0x419D, 0x546F, 0x3D05, #define LOGO_BACKGROUND logo_bg_rgb #define LOGO_PAINT_PATHS \ - LOGO_PAINT_PATH(logo_stroke_rgb, logo_stroke) \ - LOGO_PAINT_PATH(logo_fill_rgb, logo_fill) + LOGO_PAINT_PATH(logo_fill_rgb, logo_fill) \ + LOGO_PAINT_PATH(logo_stroke_rgb, logo_stroke) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/marlin_bootscreen_portrait.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/marlin_bootscreen_portrait.h index a5af7a14cd..a9c1d4049e 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/marlin_bootscreen_portrait.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/marlin_bootscreen_portrait.h @@ -35,5 +35,5 @@ const PROGMEM uint16_t logo_stroke[] = {0x3C19, 0x70C5, 0x371A, 0x7159, 0x3302, #define LOGO_BACKGROUND logo_bg_rgb #define LOGO_PAINT_PATHS \ - LOGO_PAINT_PATH(logo_stroke_rgb, logo_stroke) \ - LOGO_PAINT_PATH(logo_fill_rgb, logo_fill) + LOGO_PAINT_PATH(logo_fill_rgb, logo_fill) \ + LOGO_PAINT_PATH(logo_stroke_rgb, logo_stroke) diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 61fecaed46..01e0d1b7a3 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -341,10 +341,10 @@ namespace ExtUI { void onConfigurationStoreWritten(bool success); void onConfigurationStoreRead(bool success); #if ENABLED(POWER_LOSS_RECOVERY) - void OnPowerLossResume(); + void onPowerLossResume(); #endif #if HAS_PID_HEATING - void OnPidTuning(const result_t rst); + void onPidTuning(const result_t rst); #endif }; diff --git a/Marlin/src/lcd/extui_dgus_lcd.cpp b/Marlin/src/lcd/extui_dgus_lcd.cpp index 66a58f82dc..855d09033e 100644 --- a/Marlin/src/lcd/extui_dgus_lcd.cpp +++ b/Marlin/src/lcd/extui_dgus_lcd.cpp @@ -123,7 +123,7 @@ namespace ExtUI { } #if ENABLED(POWER_LOSS_RECOVERY) - void OnPowerLossResume() { + void onPowerLossResume() { // Called on resume from power-loss ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POWER_LOSS); } @@ -131,9 +131,9 @@ namespace ExtUI { #if HAS_PID_HEATING - void OnPidTuning(const result_t rst) { + void onPidTuning(const result_t rst) { // Called for temperature PID tuning result - SERIAL_ECHOLNPAIR("OnPidTuning:",rst); + SERIAL_ECHOLNPAIR("onPidTuning:",rst); switch(rst) { case PID_BAD_EXTRUDER_NUM: ScreenHandler.setstatusmessagePGM(PSTR(STR_PID_BAD_EXTRUDER_NUM)); diff --git a/Marlin/src/lcd/extui_example.cpp b/Marlin/src/lcd/extui_example.cpp index 741787dbe6..5c9a193ded 100644 --- a/Marlin/src/lcd/extui_example.cpp +++ b/Marlin/src/lcd/extui_example.cpp @@ -94,13 +94,13 @@ namespace ExtUI { } #if ENABLED(POWER_LOSS_RECOVERY) - void OnPowerLossResume() { + void onPowerLossResume() { // Called on resume from power-loss } #endif #if HAS_PID_HEATING - void OnPidTuning(const result_t rst) { + void onPidTuning(const result_t rst) { // Called for temperature PID tuning result } #endif diff --git a/Marlin/src/lcd/extui_malyan_lcd.cpp b/Marlin/src/lcd/extui_malyan_lcd.cpp index 0bb8060b07..ddb8b846cb 100644 --- a/Marlin/src/lcd/extui_malyan_lcd.cpp +++ b/Marlin/src/lcd/extui_malyan_lcd.cpp @@ -483,7 +483,7 @@ namespace ExtUI { void onLoadSettings(const char*) {} void onConfigurationStoreWritten(bool) {} void onConfigurationStoreRead(bool) {} - void OnPidTuning(const result_t) {} + void onPidTuning(const result_t) {} } #endif // MALYAN_LCD diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 8fa22e2c71..a52d9652ac 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -602,6 +602,9 @@ namespace Language_en { PROGMEM Language_Str MSG_BACKLASH_C = LCD_STR_C; PROGMEM Language_Str MSG_BACKLASH_CORRECTION = _UxGT("Correction"); PROGMEM Language_Str MSG_BACKLASH_SMOOTHING = _UxGT("Smoothing"); + + PROGMEM Language_Str MSG_LEVEL_X_AXIS = _UxGT("Level X Axis"); + PROGMEM Language_Str MSG_AUTO_CALIBRATE = _UxGT("Auto Calibrate"); } #if FAN_COUNT == 1 diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 4e49fcfa24..4018c7586c 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -411,7 +411,7 @@ volatile bool Temperature::raw_temps_ready = false; if (target > GHV(BED_MAXTEMP - 10, temp_range[heater].maxtemp - 15)) { SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); #if ENABLED(EXTENSIBLE_UI) - ExtUI::OnPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH); + ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH); #endif return; } @@ -527,7 +527,7 @@ volatile bool Temperature::raw_temps_ready = false; if (current_temp > target + MAX_OVERSHOOT_PID_AUTOTUNE) { SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); #if ENABLED(EXTENSIBLE_UI) - ExtUI::OnPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH); + ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH); #endif break; } @@ -572,7 +572,7 @@ volatile bool Temperature::raw_temps_ready = false; #endif if (((ms - t1) + (ms - t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) { #if ENABLED(EXTENSIBLE_UI) - ExtUI::OnPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT); + ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT); #endif SERIAL_ECHOLNPGM(STR_PID_TIMEOUT); break; @@ -623,7 +623,7 @@ volatile bool Temperature::raw_temps_ready = false; printerEventLEDs.onPidTuningDone(color); #endif #if ENABLED(EXTENSIBLE_UI) - ExtUI::OnPidTuning(ExtUI::result_t::PID_DONE); + ExtUI::onPidTuning(ExtUI::result_t::PID_DONE); #endif goto EXIT_M303; @@ -637,7 +637,7 @@ volatile bool Temperature::raw_temps_ready = false; printerEventLEDs.onPidTuningDone(color); #endif #if ENABLED(EXTENSIBLE_UI) - ExtUI::OnPidTuning(ExtUI::result_t::PID_DONE); + ExtUI::onPidTuning(ExtUI::result_t::PID_DONE); #endif EXIT_M303: From e7f020f3f208db23450c845a6c4b67d784a64058 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 31 Mar 2020 14:42:32 -0500 Subject: [PATCH 43/43] Shorten some internal pin names --- Marlin/src/pins/ramps/pins_TRIGORILLA_14.h | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h index 9016028055..f32f006e92 100644 --- a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h +++ b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h @@ -47,43 +47,43 @@ #endif // Labeled pins -#define TRIGORILLA_HEATER_BED_PIN 8 -#define TRIGORILLA_HEATER_0_PIN 10 -#define TRIGORILLA_HEATER_1_PIN 45 // Anycubic Kossel: Unused +#define TG_HEATER_BED_PIN 8 +#define TG_HEATER_0_PIN 10 +#define TG_HEATER_1_PIN 45 // Anycubic Kossel: Unused -#define TRIGORILLA_FAN0_PIN 9 // Anycubic Kossel: Usually the part cooling fan -#define TRIGORILLA_FAN1_PIN 7 // Anycubic Kossel: Unused -#define TRIGORILLA_FAN2_PIN 44 // Anycubic Kossel: Hotend fan +#define TG_FAN0_PIN 9 // Anycubic Kossel: Usually the part cooling fan +#define TG_FAN1_PIN 7 // Anycubic Kossel: Unused +#define TG_FAN2_PIN 44 // Anycubic Kossel: Hotend fan // Remap MOSFET pins to common usages: -#define RAMPS_D10_PIN TRIGORILLA_HEATER_0_PIN // HEATER_0_PIN is always RAMPS_D10_PIN in pins_RAMPS.h +#define RAMPS_D10_PIN TG_HEATER_0_PIN // HEATER_0_PIN is always RAMPS_D10_PIN in pins_RAMPS.h #if HOTENDS > 1 // EEF and EEB - #define RAMPS_D9_PIN TRIGORILLA_HEATER_1_PIN + #define RAMPS_D9_PIN TG_HEATER_1_PIN #if !TEMP_SENSOR_BED // EEF - #define RAMPS_D8_PIN TRIGORILLA_FAN0_PIN + #define RAMPS_D8_PIN TG_FAN0_PIN #else // EEB - #define RAMPS_D8_PIN TRIGORILLA_HEATER_BED_PIN - #define FAN_PIN TRIGORILLA_FAN0_PIN // Override pin 4 in pins_RAMPS.h + #define RAMPS_D8_PIN TG_HEATER_BED_PIN + #define FAN_PIN TG_FAN0_PIN // Override pin 4 in pins_RAMPS.h #endif #elif TEMP_SENSOR_BED // EFB (Anycubic Kossel default) - #define RAMPS_D9_PIN TRIGORILLA_FAN0_PIN - #define RAMPS_D8_PIN TRIGORILLA_HEATER_BED_PIN + #define RAMPS_D9_PIN TG_FAN0_PIN + #define RAMPS_D8_PIN TG_HEATER_BED_PIN #else // EFF - #define RAMPS_D9_PIN TRIGORILLA_FAN1_PIN - #define RAMPS_D8_PIN TRIGORILLA_FAN0_PIN + #define RAMPS_D9_PIN TG_FAN1_PIN + #define RAMPS_D8_PIN TG_FAN0_PIN #endif #if HOTENDS > 1 || TEMP_SENSOR_BED // EEF, EEB, EFB - #define FAN1_PIN TRIGORILLA_FAN1_PIN + #define FAN1_PIN TG_FAN1_PIN #endif -#define FAN2_PIN TRIGORILLA_FAN2_PIN -#define ORIG_E0_AUTO_FAN_PIN TRIGORILLA_FAN2_PIN // Used in Anycubic Kossel example config +#define FAN2_PIN TG_FAN2_PIN +#define ORIG_E0_AUTO_FAN_PIN TG_FAN2_PIN // Used in Anycubic Kossel example config #include "pins_RAMPS.h"