From d2753a6dd52f9075aed16fb676c8201fda2861d6 Mon Sep 17 00:00:00 2001 From: studiodyne Date: Sat, 25 Apr 2020 09:40:25 +0200 Subject: [PATCH] Update & fixes XY_FREQUENCY_LIMIT --- Marlin/Configuration_adv.h | 4 ++-- Marlin/src/lcd/language/language_en.h | 1 - Marlin/src/lcd/language/language_fr.h | 3 +-- Marlin/src/module/planner.cpp | 2 +- Marlin/src/module/planner.h | 33 ++++++++++++++------------- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index ed64b691521c..32cb653167ae 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -790,9 +790,9 @@ * See http://hydraraptor.blogspot.com/2010/12/frequency-limit.html * Use M201 F G to change limits at runtime. */ -//#define XY_FREQUENCY_LIMIT 10 // (Hz) Maximum frequency of small zigzag infill moves. Set with M201 F. +#define XY_FREQUENCY_LIMIT 10 // (Hz) Maximum frequency of small zigzag infill moves. Set with M201 F. #ifdef XY_FREQUENCY_LIMIT - #define XY_FREQUENCY_MIN_PERCENT 25 // (percent) Minimum FR percentage to apply. Set with M201 G. + #define XY_FREQUENCY_MIN_PERCENT 5 // (percent) Minimum FR percentage to apply. Set with M201 G. #endif // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 4a5a46609a65..afbaf7593d92 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -303,7 +303,6 @@ namespace Language_en { PROGMEM Language_Str MSG_A_TRAVEL = _UxGT("A-Travel"); PROGMEM Language_Str MSG_XY_FREQUENCY_LIMIT = _UxGT("Frequency max"); PROGMEM Language_Str MSG_XY_FREQUENCY_FEEDRATE = _UxGT("Feed min"); - PROGMEM Language_Str MSG_XY_FREQUENCY_LENGTH = _UxGT("long min"); PROGMEM Language_Str MSG_STEPS_PER_MM = _UxGT("Steps/mm"); PROGMEM Language_Str MSG_A_STEPS = LCD_STR_A _UxGT("steps/mm"); PROGMEM Language_Str MSG_B_STEPS = LCD_STR_B _UxGT("steps/mm"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index 6bba617500e6..3daac87a2835 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -263,8 +263,7 @@ namespace Language_fr { PROGMEM Language_Str MSG_A_RETRACT = _UxGT("Acc.rétraction"); PROGMEM Language_Str MSG_A_TRAVEL = _UxGT("Acc.course"); PROGMEM Language_Str MSG_XY_FREQUENCY_LIMIT = _UxGT("Fréquence max"); - PROGMEM Language_Str MSG_XY_FREQUENCY_FEEDRATE = _UxGT("Feed min"); - PROGMEM Language_Str MSG_XY_FREQUENCY_LENGTH = _UxGT("long min"); + PROGMEM Language_Str MSG_XY_FREQUENCY_FEEDRATE = _UxGT("Vitesse min"); PROGMEM Language_Str MSG_STEPS_PER_MM = _UxGT("Pas/mm"); PROGMEM Language_Str MSG_A_STEPS = LCD_STR_A _UxGT(" pas/mm"); PROGMEM Language_Str MSG_B_STEPS = LCD_STR_B _UxGT(" pas/mm"); diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 2065421a02c6..c709f9479c24 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2097,7 +2097,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, if (segment_time_us < xy_freq_min_interval_us) { const int32_t least_xy_segment_time = _MIN(_MAX(xs0, xs1, xs2), _MAX(ys0, ys1, ys2)); if (least_xy_segment_time < xy_freq_min_interval_us) { - const float freq_xy_feedrate = (speed_factor * least_xy_segment_time) / xy_freq_min_interval_us; + float freq_xy_feedrate = (speed_factor * least_xy_segment_time) / xy_freq_min_interval_us; NOLESS(freq_xy_feedrate, xy_freq_min_speed_factor); NOMORE(speed_factor, freq_xy_feedrate); } diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index e3c215d1a2d2..a318d6bdce38 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -352,6 +352,23 @@ class Planner { #if ENABLED(SD_ABORT_ON_ENDSTOP_HIT) static bool abort_on_endstop_hit; #endif + #ifdef XY_FREQUENCY_LIMIT + static int8_t xy_freq_limit_hz; // Minimum XY frequency setting + static float xy_freq_min_speed_factor; // Minimum speed factor setting + static int32_t xy_freq_min_interval_us; // Minimum segment time based on xy_freq_limit_hz + static inline void refresh_frequency_limit() { + //xy_freq_min_interval_us = xy_freq_limit_hz ?: LROUND(1000000.0f / xy_freq_limit_hz); + if ( !xy_freq_limit_hz ) return ; + else xy_freq_min_interval_us = LROUND(1000000.0f / xy_freq_limit_hz); + } + static inline void set_min_speed_factor_u8(const uint8_t v255) { + xy_freq_min_speed_factor = float(ui8_to_percent(v255)) / 100; + } + static inline void set_frequency_limit(const uint8_t hz) { + xy_freq_limit_hz = constrain(hz, 0, 100); + refresh_frequency_limit(); + } + #endif private: @@ -379,22 +396,6 @@ class Planner { static uint8_t g_uc_extruder_last_move[EXTRUDERS]; #endif - #ifdef XY_FREQUENCY_LIMIT - static int8_t xy_freq_limit_hz; // Minimum XY frequency setting - static float xy_freq_min_speed_factor; // Minimum speed factor setting - static int32_t xy_freq_min_interval_us; // Minimum segment time based on xy_freq_limit_hz - static inline void refresh_frequency_limit() { - xy_freq_min_interval_us = xy_freq_limit_hz ?: LROUND(1000000.0f / xy_freq_limit_hz); - } - static inline void set_min_speed_factor_u8(const uint8_t v255) { - xy_freq_min_speed_factor = float(ui8_to_percent(v255)) / 100; - } - static inline void set_frequency_limit(const uint8_t hz) { - xy_freq_limit_hz = constrain(hz, 0, 100); - refresh_frequency_limit(); - } - #endif - #if HAS_SPI_LCD volatile static uint32_t block_buffer_runtime_us; // Theoretical block buffer runtime in µs #endif