From 211073913873b18edd209ed9569d157c931d5497 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 31 Oct 2020 16:12:35 -0500 Subject: [PATCH 1/4] Cutter enable inline at full power Co-Authored-By: Luu Lac <45380455+shitcreek@users.noreply.github.com> --- Marlin/src/feature/spindle_laser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/feature/spindle_laser.h b/Marlin/src/feature/spindle_laser.h index 15ff661c73..e8db3aa608 100644 --- a/Marlin/src/feature/spindle_laser.h +++ b/Marlin/src/feature/spindle_laser.h @@ -235,7 +235,7 @@ public: // Inline modes of all other functions; all enable planner inline power control static inline void set_inline_enabled(const bool enable) { if (enable) - inline_power(cpwr_to_upwr(SPEED_POWER_STARTUP)); + inline_power(255); else { isReady = false; unitPower = menuPower = 0; From 24c525900500b164b5165af127c6f39accf69c3a Mon Sep 17 00:00:00 2001 From: Julien Lirochon Date: Sat, 31 Oct 2020 19:45:10 +0100 Subject: [PATCH 2/4] Fix SpindleLaser::cpwr_to_pct() maths (#19970) --- Marlin/src/feature/spindle_laser.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/feature/spindle_laser.h b/Marlin/src/feature/spindle_laser.h index e8db3aa608..9d21c96fb9 100644 --- a/Marlin/src/feature/spindle_laser.h +++ b/Marlin/src/feature/spindle_laser.h @@ -46,14 +46,14 @@ class SpindleLaser { public: static constexpr float - min_pct = round(TERN(CUTTER_POWER_RELATIVE, 0, (100 * float(SPEED_POWER_MIN) / TERN(SPINDLE_FEATURE, float(SPEED_POWER_MAX), 100)))), - max_pct = round(TERN(SPINDLE_FEATURE, 100, float(SPEED_POWER_MAX))); + min_pct = TERN(CUTTER_POWER_RELATIVE, 0, TERN(SPINDLE_FEATURE, round(100.0f * (SPEED_POWER_MIN) / (SPEED_POWER_MAX)), SPEED_POWER_MIN))), + max_pct = TERN(SPINDLE_FEATURE, 100, SPEED_POWER_MAX); static const inline uint8_t pct_to_ocr(const float pct) { return uint8_t(PCT_TO_PWM(pct)); } // cpower = configured values (ie SPEED_POWER_MAX) static const inline uint8_t cpwr_to_pct(const cutter_cpower_t cpwr) { // configured value to pct - return unitPower ? round(100 * (cpwr - SPEED_POWER_FLOOR) / (SPEED_POWER_MAX - SPEED_POWER_FLOOR)) : 0; + return unitPower ? round(100.0f * (cpwr - (SPEED_POWER_FLOOR)) / (SPEED_POWER_MAX - (SPEED_POWER_FLOOR))) : 0; } // Convert a configured value (cpower)(ie SPEED_POWER_STARTUP) to unit power (upwr, upower), From 368a581de94c1dfc249a841db76aeb998cbcc977 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 31 Oct 2020 16:28:33 -0500 Subject: [PATCH 3/4] Cutter power cleanup --- Marlin/src/feature/spindle_laser.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Marlin/src/feature/spindle_laser.h b/Marlin/src/feature/spindle_laser.h index 9d21c96fb9..50e92fe663 100644 --- a/Marlin/src/feature/spindle_laser.h +++ b/Marlin/src/feature/spindle_laser.h @@ -39,24 +39,27 @@ #ifndef SPEED_POWER_INTERCEPT #define SPEED_POWER_INTERCEPT 0 #endif -#define SPEED_POWER_FLOOR TERN(CUTTER_POWER_RELATIVE, SPEED_POWER_MIN, 0) // #define _MAP(N,S1,S2,D1,D2) ((N)*_MAX((D2)-(D1),0)/_MAX((S2)-(S1),1)+(D1)) class SpindleLaser { public: static constexpr float - min_pct = TERN(CUTTER_POWER_RELATIVE, 0, TERN(SPINDLE_FEATURE, round(100.0f * (SPEED_POWER_MIN) / (SPEED_POWER_MAX)), SPEED_POWER_MIN))), + min_pct = TERN(CUTTER_POWER_RELATIVE, 0, TERN(SPINDLE_FEATURE, round(100.0f * (SPEED_POWER_MIN) / (SPEED_POWER_MAX)), SPEED_POWER_MIN)), max_pct = TERN(SPINDLE_FEATURE, 100, SPEED_POWER_MAX); static const inline uint8_t pct_to_ocr(const float pct) { return uint8_t(PCT_TO_PWM(pct)); } - // cpower = configured values (ie SPEED_POWER_MAX) - static const inline uint8_t cpwr_to_pct(const cutter_cpower_t cpwr) { // configured value to pct - return unitPower ? round(100.0f * (cpwr - (SPEED_POWER_FLOOR)) / (SPEED_POWER_MAX - (SPEED_POWER_FLOOR))) : 0; + // cpower = configured values (e.g., SPEED_POWER_MAX) + + // Convert configured power range to a percentage + static const inline uint8_t cpwr_to_pct(const cutter_cpower_t cpwr) { + constexpr cutter_cpower_t power_floor = TERN(CUTTER_POWER_RELATIVE, SPEED_POWER_MIN, 0), + power_range = SPEED_POWER_MAX - power_floor; + return unitPower ? round(100.0f * (cpwr - power_floor) / power_range) : 0; } - // Convert a configured value (cpower)(ie SPEED_POWER_STARTUP) to unit power (upwr, upower), + // Convert a cpower (e.g., SPEED_POWER_STARTUP) to unit power (upwr, upower), // which can be PWM, Percent, or RPM (rel/abs). static const inline cutter_power_t cpwr_to_upwr(const cutter_cpower_t cpwr) { // STARTUP power to Unit power const cutter_power_t upwr = ( From da60dcbf2ef50f41aa1afca24a44da30b0101150 Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 31 Oct 2020 21:54:31 +0000 Subject: [PATCH 4/4] Fix Chiron probe low point (#19962) --- Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft_defs.h b/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft_defs.h index f5000611a7..af030df580 100644 --- a/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft_defs.h +++ b/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft_defs.h @@ -54,7 +54,7 @@ #define MAX_PATH_LEN 16 * MAX_FOLDER_DEPTH // Maximum number of characters in a SD file path #define AC_HEATER_FAULT_VALIDATION_TIME 5 // number of 1/2 second loops before signalling a heater fault -#define AC_LOWEST_MESHPOINT_VAL -7.00 // The lowest value you can set for a single mesh point offset +#define AC_LOWEST_MESHPOINT_VAL Z_PROBE_LOW_POINT // The lowest value you can set for a single mesh point offset // TFT panel commands #define AC_msg_sd_card_inserted PSTR("J00")