From ab0173b7e6843f1a6328658e2de742b3bc52ce1b Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Sun, 2 Jun 2024 15:45:19 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20ExtUI:=20Shaping,=20Probing=20li?= =?UTF-8?q?mits=20(#26754)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/HAL.h | 2 +- Marlin/src/HAL/AVR/MarlinSerial.cpp | 2 +- Marlin/src/HAL/AVR/MarlinSerial.h | 2 +- Marlin/src/HAL/LPC1768/HAL.h | 2 +- Marlin/src/HAL/STM32/HAL.h | 2 +- Marlin/src/HAL/STM32F1/HAL.h | 2 +- Marlin/src/gcode/probe/G30.cpp | 2 +- Marlin/src/lcd/extui/ui_api.cpp | 19 +++++++++++++++++++ Marlin/src/lcd/extui/ui_api.h | 9 +++++++++ 9 files changed, 35 insertions(+), 7 deletions(-) diff --git a/Marlin/src/HAL/AVR/HAL.h b/Marlin/src/HAL/AVR/HAL.h index 3c883b645c..d131985916 100644 --- a/Marlin/src/HAL/AVR/HAL.h +++ b/Marlin/src/HAL/AVR/HAL.h @@ -141,7 +141,7 @@ typedef Servo hal_servo_t; #error "LCD_SERIAL_PORT must be from 0 to 3." #endif #define LCD_SERIAL lcdSerial - #if HAS_DGUS_LCD + #if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI) #define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free() #endif #endif diff --git a/Marlin/src/HAL/AVR/MarlinSerial.cpp b/Marlin/src/HAL/AVR/MarlinSerial.cpp index 986462437c..dabcfb5239 100644 --- a/Marlin/src/HAL/AVR/MarlinSerial.cpp +++ b/Marlin/src/HAL/AVR/MarlinSerial.cpp @@ -629,7 +629,7 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser); template class MarlinSerial< LCDSerialCfg >; MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser); - #if HAS_DGUS_LCD + #if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI) template typename MarlinSerial::ring_buffer_pos_t MarlinSerial::get_tx_buffer_free() { const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send. diff --git a/Marlin/src/HAL/AVR/MarlinSerial.h b/Marlin/src/HAL/AVR/MarlinSerial.h index a40730e0a8..609aac5f4a 100644 --- a/Marlin/src/HAL/AVR/MarlinSerial.h +++ b/Marlin/src/HAL/AVR/MarlinSerial.h @@ -205,7 +205,7 @@ static ring_buffer_pos_t available(); static void write(const uint8_t c); static void flushTX(); - #if HAS_DGUS_LCD + #if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI) static ring_buffer_pos_t get_tx_buffer_free(); #endif diff --git a/Marlin/src/HAL/LPC1768/HAL.h b/Marlin/src/HAL/LPC1768/HAL.h index ab28e06eb8..c3c984c76e 100644 --- a/Marlin/src/HAL/LPC1768/HAL.h +++ b/Marlin/src/HAL/LPC1768/HAL.h @@ -100,7 +100,7 @@ extern DefaultSerial1 USBSerial; #else #error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB." #endif - #if HAS_DGUS_LCD + #if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI) #define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.available() #endif #endif diff --git a/Marlin/src/HAL/STM32/HAL.h b/Marlin/src/HAL/STM32/HAL.h index 276f031685..9c74a95ff0 100644 --- a/Marlin/src/HAL/STM32/HAL.h +++ b/Marlin/src/HAL/STM32/HAL.h @@ -112,7 +112,7 @@ #else #error "LCD_SERIAL_PORT must be from 1 to 9, or -1 for Native USB." #endif - #if HAS_DGUS_LCD + #if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI) #define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite() #endif #endif diff --git a/Marlin/src/HAL/STM32F1/HAL.h b/Marlin/src/HAL/STM32F1/HAL.h index 41c91e200f..007bf83b09 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -138,7 +138,7 @@ #define LCD_SERIAL MSERIAL(1) // dummy port static_assert(false, "LCD_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.") #endif - #if HAS_DGUS_LCD + #if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI) #define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite() #endif #endif diff --git a/Marlin/src/gcode/probe/G30.cpp b/Marlin/src/gcode/probe/G30.cpp index 3ce37bed05..e736a99ec8 100644 --- a/Marlin/src/gcode/probe/G30.cpp +++ b/Marlin/src/gcode/probe/G30.cpp @@ -34,7 +34,7 @@ #include "../../feature/probe_temp_comp.h" #endif -#if ANY(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) +#if ANY(DWIN_CREALITY_LCD_JYERSUI, EXTENSIBLE_UI) #define VERBOSE_SINGLE_PROBE #endif diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 5c7246d4cd..29f9b34fe4 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -765,6 +765,24 @@ namespace ExtUI { } #endif + #if HAS_SHAPING + float getShapingZeta(const axis_t axis) { + return stepper.get_shaping_damping_ratio(AxisEnum(axis)); + } + void setShapingZeta(const float zeta, const axis_t axis) { + if (!WITHIN(zeta, 0, 1)) return; + stepper.set_shaping_damping_ratio(AxisEnum(axis), zeta); + } + float getShapingFrequency(const axis_t axis) { + return stepper.get_shaping_frequency(AxisEnum(axis)); + } + void setShapingFrequency(const float freq, const axis_t axis) { + constexpr float min_freq = float(uint32_t(STEPPER_TIMER_RATE) / 2) / shaping_time_t(-2); + if (freq == 0.0f || freq > min_freq) + stepper.set_shaping_frequency(AxisEnum(axis), freq); + } + #endif + #if HAS_JUNCTION_DEVIATION float getJunctionDeviation_mm() { return planner.junction_deviation_mm; } @@ -933,6 +951,7 @@ namespace ExtUI { #if HAS_BED_PROBE float getProbeOffset_mm(const axis_t axis) { return probe.offset.pos[axis]; } void setProbeOffset_mm(const_float_t val, const axis_t axis) { probe.offset.pos[axis] = val; } + probe_limits_t getBedProbeLimits() { return probe_limits_t({ probe.min_x(), probe.min_y(), probe.max_x(), probe.max_y() }); } #endif #if ENABLED(BACKLASH_GCODE) diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 7065e21f8f..638f8d88b8 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -74,6 +74,7 @@ namespace ExtUI { #if ENABLED(MPC_AUTOTUNE) enum mpcresult_t : uint8_t { MPC_STARTED, MPC_TEMP_ERROR, MPC_INTERRUPTED, MPC_DONE }; #endif + struct probe_limits_t { float xmin, ymin, xmax, ymax; }; constexpr uint8_t extruderCount = EXTRUDERS; constexpr uint8_t hotendCount = HOTENDS; @@ -327,6 +328,13 @@ namespace ExtUI { void setLinearAdvance_mm_mm_s(const_float_t, const extruder_t); #endif + #if HAS_SHAPING + float getShapingZeta(const axis_t); + void setShapingZeta(const float, const axis_t); + float getShapingFrequency(const axis_t); + void setShapingFrequency(const float, const axis_t); + #endif + // JD or Jerk Control #if HAS_JUNCTION_DEVIATION float getJunctionDeviation_mm(); @@ -367,6 +375,7 @@ namespace ExtUI { #if HAS_BED_PROBE float getProbeOffset_mm(const axis_t); void setProbeOffset_mm(const_float_t, const axis_t); + probe_limits_t getBedProbeLimits(); #endif // Backlash Control