Skip to content

Commit

Permalink
🎨 HAS_SHAPING => HAS_ZV_SHAPING
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 10, 2023
1 parent b2dc434 commit a2390e5
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/input_shaping/M593.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "../../../inc/MarlinConfig.h"

#if HAS_SHAPING
#if HAS_ZV_SHAPING

#include "../../gcode.h"
#include "../../../module/stepper.h"
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 575: M575(); break; // M575: Set serial baudrate
#endif

#if HAS_SHAPING
#if HAS_ZV_SHAPING
case 593: M593(); break; // M593: Set Input Shaping parameters
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ class GcodeSuite {
static void M575();
#endif

#if HAS_SHAPING
#if HAS_ZV_SHAPING
static void M593();
static void M593_report(const bool forReplay=true);
#endif
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@

// Input shaping
#if EITHER(INPUT_SHAPING_X, INPUT_SHAPING_Y)
#define HAS_SHAPING 1
#define HAS_ZV_SHAPING 1
#endif

// Toolchange Event G-code
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -4513,7 +4513,7 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive.");
/**
* Input Shaping requirements
*/
#if HAS_SHAPING
#if HAS_ZV_SHAPING
#if ENABLED(DELTA)
#error "Input Shaping is not compatible with DELTA kinematics."
#elif ENABLED(SCARA)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Warnings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@
/**
* Input Shaping
*/
#if HAS_SHAPING && ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
#if HAS_ZV_SHAPING && ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
#warning "Input Shaping for CORE / MARKFORGED kinematic axes is still experimental."
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ float Planner::triggered_position_mm(const AxisEnum axis) {
bool Planner::busy() {
return (has_blocks_queued() || cleaning_buffer_counter
|| TERN0(EXTERNAL_CLOSED_LOOP_CONTROLLER, CLOSED_LOOP_WAITING())
|| TERN0(HAS_SHAPING, stepper.input_shaping_busy())
|| TERN0(HAS_ZV_SHAPING, stepper.input_shaping_busy())
);
}

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ void MarlinSettings::postprocess() {
//
// Input Shaping
///
#if HAS_SHAPING
#if HAS_ZV_SHAPING
#if ENABLED(INPUT_SHAPING_X)
EEPROM_WRITE(stepper.get_shaping_frequency(X_AXIS));
EEPROM_WRITE(stepper.get_shaping_damping_ratio(X_AXIS));
Expand Down Expand Up @@ -3429,7 +3429,7 @@ void MarlinSettings::reset() {
//
// Input Shaping
//
#if HAS_SHAPING
#if HAS_ZV_SHAPING
#if ENABLED(INPUT_SHAPING_X)
stepper.set_shaping_frequency(X_AXIS, SHAPING_FREQ_X);
stepper.set_shaping_damping_ratio(X_AXIS, SHAPING_ZETA_X);
Expand Down Expand Up @@ -3690,7 +3690,7 @@ void MarlinSettings::reset() {
//
// Input Shaping
//
TERN_(HAS_SHAPING, gcode.M593_report(forReplay));
TERN_(HAS_ZV_SHAPING, gcode.M593_report(forReplay));

//
// Linear Advance
Expand Down
18 changes: 9 additions & 9 deletions Marlin/src/module/stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ uint32_t Stepper::advance_divisor = 0,
bool Stepper::la_active = false;
#endif

#if HAS_SHAPING
#if HAS_ZV_SHAPING
shaping_time_t ShapingQueue::now = 0;
shaping_time_t ShapingQueue::times[shaping_echoes];
shaping_echo_axis_t ShapingQueue::echo_axes[shaping_echoes];
Expand Down Expand Up @@ -1494,7 +1494,7 @@ void Stepper::isr() {
// Enable ISRs to reduce USART processing latency
hal.isr_on();

TERN_(HAS_SHAPING, shaping_isr()); // Do Shaper stepping, if needed
TERN_(HAS_ZV_SHAPING, shaping_isr()); // Do Shaper stepping, if needed

if (!nextMainISR) pulse_phase_isr(); // 0 = Do coordinated axes Stepper pulses

Expand Down Expand Up @@ -1542,7 +1542,7 @@ void Stepper::isr() {
//

nextMainISR -= interval;
TERN_(HAS_SHAPING, ShapingQueue::decrement_delays(interval));
TERN_(HAS_ZV_SHAPING, ShapingQueue::decrement_delays(interval));
TERN_(LIN_ADVANCE, if (nextAdvanceISR != LA_ADV_NEVER) nextAdvanceISR -= interval);
TERN_(INTEGRATED_BABYSTEPPING, if (nextBabystepISR != BABYSTEP_NEVER) nextBabystepISR -= interval);

Expand Down Expand Up @@ -1663,7 +1663,7 @@ void Stepper::pulse_phase_isr() {
abort_current_block = false;
if (current_block) {
discard_current_block();
#if HAS_SHAPING
#if HAS_ZV_SHAPING
ShapingQueue::purge();
#if ENABLED(INPUT_SHAPING_X)
shaping_x.delta_error = 0;
Expand Down Expand Up @@ -1921,7 +1921,7 @@ void Stepper::pulse_phase_isr() {
#endif
#endif

#if HAS_SHAPING
#if HAS_ZV_SHAPING
// record an echo if a step is needed in the primary bresenham
const bool x_step = TERN0(INPUT_SHAPING_X, step_needed.x && shaping_x.enabled),
y_step = TERN0(INPUT_SHAPING_Y, step_needed.y && shaping_y.enabled);
Expand Down Expand Up @@ -2035,7 +2035,7 @@ void Stepper::pulse_phase_isr() {
} while (--events_to_do);
}

#if HAS_SHAPING
#if HAS_ZV_SHAPING

void Stepper::shaping_isr() {
AxisFlags step_needed{0};
Expand Down Expand Up @@ -2087,7 +2087,7 @@ void Stepper::pulse_phase_isr() {
}
}

#endif // HAS_SHAPING
#endif // HAS_ZV_SHAPING

// Calculate timer interval, with all limits applied.
hal_timer_t Stepper::calc_timer_interval(uint32_t step_rate) {
Expand Down Expand Up @@ -3108,7 +3108,7 @@ void Stepper::init() {
#endif
}

#if HAS_SHAPING
#if HAS_ZV_SHAPING

/**
* Calculate a fixed point factor to apply to the signal and its echo
Expand Down Expand Up @@ -3179,7 +3179,7 @@ void Stepper::init() {
return -1;
}

#endif // HAS_SHAPING
#endif // HAS_ZV_SHAPING

/**
* Set the stepper positions directly in steps
Expand Down
18 changes: 9 additions & 9 deletions Marlin/src/module/stepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
#endif

// Input shaping base time
#if HAS_SHAPING
#if HAS_ZV_SHAPING
#define ISR_SHAPING_BASE_CYCLES 180UL
#else
#define ISR_SHAPING_BASE_CYCLES 0UL
Expand Down Expand Up @@ -128,7 +128,7 @@
#endif

// Input shaping base time
#if HAS_SHAPING
#if HAS_ZV_SHAPING
#define ISR_SHAPING_BASE_CYCLES 290UL
#else
#define ISR_SHAPING_BASE_CYCLES 0UL
Expand Down Expand Up @@ -217,7 +217,7 @@
#define ISR_LOOP_CYCLES(R) ((ISR_LOOP_BASE_CYCLES + MIN_ISR_LOOP_CYCLES + MIN_STEPPER_PULSE_CYCLES) * ((1UL << R) - 1) + _MAX(MIN_ISR_LOOP_CYCLES, MIN_STEPPER_PULSE_CYCLES))

// Model input shaping as an extra loop call
#define ISR_SHAPING_LOOP_CYCLES(R) (TERN0(HAS_SHAPING, (ISR_LOOP_BASE_CYCLES + TERN0(INPUT_SHAPING_X, ISR_X_STEPPER_CYCLES) + TERN0(INPUT_SHAPING_Y, ISR_Y_STEPPER_CYCLES)) << R))
#define ISR_SHAPING_LOOP_CYCLES(R) (TERN0(HAS_ZV_SHAPING, (ISR_LOOP_BASE_CYCLES + TERN0(INPUT_SHAPING_X, ISR_X_STEPPER_CYCLES) + TERN0(INPUT_SHAPING_Y, ISR_Y_STEPPER_CYCLES)) << R))

// If linear advance is enabled, then it is handled separately
#if ENABLED(LIN_ADVANCE)
Expand Down Expand Up @@ -315,7 +315,7 @@ constexpr ena_mask_t enable_overlap[] = {

//static_assert(!any_enable_overlap(), "There is some overlap.");

#if HAS_SHAPING
#if HAS_ZV_SHAPING

#ifdef SHAPING_MAX_STEPRATE
constexpr float max_step_rate = SHAPING_MAX_STEPRATE;
Expand Down Expand Up @@ -463,7 +463,7 @@ constexpr ena_mask_t enable_overlap[] = {
int32_t last_block_end_pos = 0;
};

#endif // HAS_SHAPING
#endif // HAS_ZV_SHAPING

//
// Stepper class definition
Expand Down Expand Up @@ -577,7 +577,7 @@ class Stepper {
static bool bezier_2nd_half; // If Bézier curve has been initialized or not
#endif

#if HAS_SHAPING
#if HAS_ZV_SHAPING
#if ENABLED(INPUT_SHAPING_X)
static ShapeParams shaping_x;
#endif
Expand Down Expand Up @@ -646,7 +646,7 @@ class Stepper {
// The stepper block processing ISR phase
static hal_timer_t block_phase_isr();

#if HAS_SHAPING
#if HAS_ZV_SHAPING
static void shaping_isr();
#endif

Expand All @@ -669,7 +669,7 @@ class Stepper {
// Check if the given block is busy or not - Must not be called from ISR contexts
static bool is_block_busy(const block_t * const block);

#if HAS_SHAPING
#if HAS_ZV_SHAPING
// Check whether the stepper is processing any input shaping echoes
static bool input_shaping_busy() {
const bool was_on = hal.isr_state();
Expand Down Expand Up @@ -817,7 +817,7 @@ class Stepper {
set_directions();
}

#if HAS_SHAPING
#if HAS_ZV_SHAPING
static void set_shaping_damping_ratio(const AxisEnum axis, const_float_t zeta);
static float get_shaping_damping_ratio(const AxisEnum axis);
static void set_shaping_frequency(const AxisEnum axis, const_float_t freq);
Expand Down
2 changes: 1 addition & 1 deletion ini/features.ini
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ HAS_DUPLICATION_MODE = src_filter=+<src/gcode/control/M605.cpp
LIN_ADVANCE = src_filter=+<src/gcode/feature/advance>
PHOTO_GCODE = src_filter=+<src/gcode/feature/camera>
CONTROLLER_FAN_EDITABLE = src_filter=+<src/gcode/feature/controllerfan>
HAS_SHAPING = src_filter=+<src/gcode/feature/input_shaping>
HAS_ZV_SHAPING = src_filter=+<src/gcode/feature/input_shaping>
GCODE_MACROS = src_filter=+<src/gcode/feature/macro>
GRADIENT_MIX = src_filter=+<src/gcode/feature/mixing/M166.cpp>
HAS_SAVED_POSITIONS = src_filter=+<src/gcode/feature/pause/G60.cpp> +<src/gcode/feature/pause/G61.cpp>
Expand Down

0 comments on commit a2390e5

Please sign in to comment.