Adjustable XY_FREQUENCY_LIMIT (#17583)
This commit is contained in:
@ -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)
|
||||
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:
|
||||
|
||||
@ -375,23 +392,12 @@ class Planner {
|
||||
#endif
|
||||
|
||||
#if ENABLED(DISABLE_INACTIVE_EXTRUDER)
|
||||
/**
|
||||
* Counters to manage disabling inactive extruders
|
||||
*/
|
||||
// Counters to manage disabling inactive extruders
|
||||
static uint8_t g_uc_extruder_last_move[EXTRUDERS];
|
||||
#endif // DISABLE_INACTIVE_EXTRUDER
|
||||
|
||||
#ifdef XY_FREQUENCY_LIMIT
|
||||
// Used for the frequency limit
|
||||
#define MAX_FREQ_TIME_US (uint32_t)(1000000.0 / XY_FREQUENCY_LIMIT)
|
||||
// Old direction bits. Used for speed calculations
|
||||
static unsigned char old_direction_bits;
|
||||
// Segment times (in µs). Used for speed calculations
|
||||
static xy_ulong_t axis_segment_time_us[3];
|
||||
#endif
|
||||
|
||||
#if HAS_SPI_LCD
|
||||
volatile static uint32_t block_buffer_runtime_us; //Theoretical block buffer runtime in µs
|
||||
volatile static uint32_t block_buffer_runtime_us; // Theoretical block buffer runtime in µs
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
Reference in New Issue
Block a user