This commit is contained in:
Andrew 2024-11-24 18:55:42 -06:00 committed by GitHub
commit bf4d1fa7df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 63 additions and 57 deletions

View File

@ -86,11 +86,15 @@ constexpr uint8_t ui8_to_percent(const uint8_t i) { return (int(i) * 100 + 127)
const xyze_char_t axis_codes LOGICAL_AXIS_ARRAY('E', 'X', 'Y', 'Z', AXIS4_NAME, AXIS5_NAME, AXIS6_NAME, AXIS7_NAME, AXIS8_NAME, AXIS9_NAME);
#if NUM_AXES <= XYZ && !HAS_EXTRUDERS
#define AXIS_CHAR(A) ((char)('X' + A))
#define IAXIS_CHAR AXIS_CHAR
#if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC)
#define IAXIS_CHAR AXIS_CHAR
#endif
#else
const xyze_char_t iaxis_codes LOGICAL_AXIS_ARRAY('E', 'X', 'Y', 'Z', 'I', 'J', 'K', 'U', 'V', 'W');
#if ANY(HAS_MOTOR_CURRENT_SPI, HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC)
const xyze_char_t iaxis_codes LOGICAL_AXIS_ARRAY('E', 'X', 'Y', 'Z', 'I', 'J', 'K', 'U', 'V', 'W');
#define IAXIS_CHAR(A) iaxis_codes[A]
#endif
#define AXIS_CHAR(A) axis_codes[A]
#define IAXIS_CHAR(A) iaxis_codes[A]
#endif
#if ENABLED(MARLIN_DEV_MODE)

View File

@ -297,7 +297,7 @@ class FilamentSensorBase {
#else
UNUSED(extruder);
#endif
return !!runout_states; // Any extruder ran out
return !!runout_states; // Any extruder ran out
}
public:
@ -318,28 +318,28 @@ class FilamentSensorBase {
}
};
#endif // HAS_FILAMENT_SWITCH
#endif // HAS_FILAMENT_SWITCH
/**
* This is a simple endstop switch in the path of the filament.
* It can detect filament runout, but not stripouts or jams.
*/
class FilamentSensor : public FilamentSensorBase {
private:
TERN_(HAS_FILAMENT_MOTION, static FilamentSensorEncoder encoder_sensor);
TERN_(HAS_FILAMENT_SWITCH, static FilamentSensorSwitch switch_sensor);
/**
* This is a simple endstop switch in the path of the filament.
* It can detect filament runout, but not stripouts or jams.
*/
class FilamentSensor : public FilamentSensorBase {
private:
TERN_(HAS_FILAMENT_MOTION, static FilamentSensorEncoder encoder_sensor);
TERN_(HAS_FILAMENT_SWITCH, static FilamentSensorSwitch switch_sensor);
public:
static void block_completed(const block_t * const b) {
TERN_(HAS_FILAMENT_MOTION, encoder_sensor.block_completed(b));
TERN_(HAS_FILAMENT_SWITCH, switch_sensor.block_completed(b));
}
public:
static void block_completed(const block_t * const b) {
TERN_(HAS_FILAMENT_MOTION, encoder_sensor.block_completed(b));
TERN_(HAS_FILAMENT_SWITCH, switch_sensor.block_completed(b));
}
static void run() {
TERN_(HAS_FILAMENT_MOTION, encoder_sensor.run());
TERN_(HAS_FILAMENT_SWITCH, switch_sensor.run());
}
};
static void run() {
TERN_(HAS_FILAMENT_MOTION, encoder_sensor.run());
TERN_(HAS_FILAMENT_SWITCH, switch_sensor.run());
}
};
/********************************* RESPONSE TYPE *********************************/

View File

@ -52,7 +52,7 @@ void GcodeSuite::M907() {
return M907_report();
if (parser.seenval('S')) for (uint8_t i = 0; i < MOTOR_CURRENT_COUNT; ++i) stepper.set_digipot_current(i, parser.value_int());
LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper.set_digipot_current(i, parser.value_int()); // X Y Z (I J K U V W) E (map to drivers according to DIGIPOT_CHANNELS. Default with NUM_AXES 3: map X Y Z E to X Y Z E0)
LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper.set_digipot_current(i, parser.value_int()); // X Y Z (I J K U V W) E (map to drivers according to DIGIPOT_CHANNELS. Default with NUM_AXES 3: map X Y Z E to X Y Z E0)
// Additional extruders use B,C.
// TODO: Change these parameters because 'E' is used and D should be reserved for debugging. B<index>?
#if E_STEPPERS >= 2
@ -105,7 +105,7 @@ void GcodeSuite::M907() {
#if HAS_MOTOR_CURRENT_I2C
// this one uses actual amps in floating point
if (parser.seenval('S')) for (uint8_t q = 0; q < DIGIPOT_I2C_NUM_CHANNELS; ++q) digipot_i2c.set_current(q, parser.value_float());
LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) digipot_i2c.set_current(i, parser.value_float()); // X Y Z (I J K U V W) E (map to drivers according to pots adresses. Default with NUM_AXES 3 X Y Z E: map to X Y Z E0)
LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) digipot_i2c.set_current(i, parser.value_float()); // X Y Z (I J K U V W) E (map to drivers according to pots adresses. Default with NUM_AXES 3 X Y Z E: map to X Y Z E0)
// Additional extruders use B,C,D.
// TODO: Change these parameters because 'E' is used and because 'D' should be reserved for debugging. B<index>?
#if E_STEPPERS >= 2
@ -119,7 +119,7 @@ void GcodeSuite::M907() {
const float dac_percent = parser.value_float();
LOOP_LOGICAL_AXES(i) stepper_dac.set_current_percent(i, dac_percent);
}
LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper_dac.set_current_percent(i, parser.value_float()); // X Y Z (I J K U V W) E (map to drivers according to DAC_STEPPER_ORDER. Default with NUM_AXES 3: X Y Z E map to X Y Z E0)
LOOP_LOGICAL_AXES(i) if (parser.seenval(IAXIS_CHAR(i))) stepper_dac.set_current_percent(i, parser.value_float()); // X Y Z (I J K U V W) E (map to drivers according to DAC_STEPPER_ORDER. Default with NUM_AXES 3: X Y Z E map to X Y Z E0)
#endif
}

View File

@ -2956,6 +2956,8 @@ bool Planner::buffer_segment(const abce_pos_t &abce
* @param fr_mm_s (Target) speed of the move (mm/s)
* @param extruder Optional target extruder (otherwise active_extruder)
* @param hints Optional parameters to aid planner calculations
*
* @return false if no segment was queued due to cleaning, cold extrusion, full queue, etc.
*/
bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s
, const uint8_t extruder/*=active_extruder*/

View File

@ -898,7 +898,7 @@ class Planner {
* @param extruder Optional target extruder (otherwise active_extruder)
* @param hints Optional parameters to aid planner calculations
*
* @return false if no segment was queued due to cleaning, cold extrusion, full queue, etc...
* @return false if no segment was queued due to cleaning, cold extrusion, full queue, etc.
*/
static bool buffer_segment(const abce_pos_t &abce
OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm)
@ -919,7 +919,7 @@ class Planner {
* @param extruder Optional target extruder (otherwise active_extruder)
* @param hints Optional parameters to aid planner calculations
*
* @return false if no segment was queued due to cleaning, cold extrusion, full queue, etc...
* @return false if no segment was queued due to cleaning, cold extrusion, full queue, etc.
*/
static bool buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s
, const uint8_t extruder=active_extruder

View File

@ -242,15 +242,15 @@ uint32_t Stepper::advance_divisor = 0,
#endif
#if ENABLED(S_CURVE_ACCELERATION)
int32_t __attribute__((used)) Stepper::bezier_A __asm__("bezier_A"); // A coefficient in Bézier speed curve with alias for assembler
int32_t __attribute__((used)) Stepper::bezier_B __asm__("bezier_B"); // B coefficient in Bézier speed curve with alias for assembler
int32_t __attribute__((used)) Stepper::bezier_C __asm__("bezier_C"); // C coefficient in Bézier speed curve with alias for assembler
uint32_t __attribute__((used)) Stepper::bezier_F __asm__("bezier_F"); // F coefficient in Bézier speed curve with alias for assembler
int32_t __attribute__((used)) Stepper::bezier_A __asm__("bezier_A"); // A coefficient in Bézier speed curve with alias for assembler
int32_t __attribute__((used)) Stepper::bezier_B __asm__("bezier_B"); // B coefficient in Bézier speed curve with alias for assembler
int32_t __attribute__((used)) Stepper::bezier_C __asm__("bezier_C"); // C coefficient in Bézier speed curve with alias for assembler
uint32_t __attribute__((used)) Stepper::bezier_F __asm__("bezier_F"); // F coefficient in Bézier speed curve with alias for assembler
uint32_t __attribute__((used)) Stepper::bezier_AV __asm__("bezier_AV"); // AV coefficient in Bézier speed curve with alias for assembler
#ifdef __AVR__
bool __attribute__((used)) Stepper::A_negative __asm__("A_negative"); // If A coefficient was negative
#endif
bool Stepper::bezier_2nd_half; // =false If Bézier curve has been initialized or not
bool Stepper::bezier_2nd_half; // = false if Bézier curve has been initialized or not
#endif
#if ENABLED(LIN_ADVANCE)

View File

@ -374,7 +374,7 @@ class Stepper {
;
#endif
static uint32_t acceleration_time, deceleration_time; // time measured in Stepper Timer ticks
static uint32_t acceleration_time, deceleration_time; // Time measured in Stepper Timer ticks
#if MULTISTEPPING_LIMIT == 1
static constexpr uint8_t steps_per_isr = 1; // Count of steps to perform per Stepper ISR call
@ -408,10 +408,10 @@ class Stepper {
#endif
#if ENABLED(S_CURVE_ACCELERATION)
static int32_t bezier_A, // A coefficient in Bézier speed curve
bezier_B, // B coefficient in Bézier speed curve
bezier_C; // C coefficient in Bézier speed curve
static uint32_t bezier_F, // F coefficient in Bézier speed curve
static int32_t bezier_A, // A coefficient in Bézier speed curve
bezier_B, // B coefficient in Bézier speed curve
bezier_C; // C coefficient in Bézier speed curve
static uint32_t bezier_F, // F coefficient in Bézier speed curve
bezier_AV; // AV coefficient in Bézier speed curve
#ifdef __AVR__
static bool A_negative; // If A coefficient was negative
@ -458,7 +458,7 @@ class Stepper {
static hal_timer_t ticks_nominal;
#if DISABLED(S_CURVE_ACCELERATION)
static uint32_t acc_step_rate; // needed for deceleration start point
static uint32_t acc_step_rate; // Needed for deceleration start point
#endif
// Exact steps at which an endstop was triggered
@ -567,7 +567,7 @@ class Stepper {
// The direction of a single motor. A true result indicates forward or positive motion.
FORCE_INLINE static bool motor_direction(const AxisEnum axis) { return last_direction_bits[axis]; }
// The last movement direction was not null on the specified axis. Note that motor direction is not necessarily the same.
// The last movement direction was not null on the specified axis. NOTE: Motor direction is not necessarily the same.
FORCE_INLINE static bool axis_is_moving(const AxisEnum axis) { return axis_did_move[axis]; }
// Handle a triggered endstop
@ -620,7 +620,7 @@ class Stepper {
#endif
#if ENABLED(BABYSTEPPING)
static void do_babystep(const AxisEnum axis, const bool direction); // perform a short step with a single stepper motor, outside of any convention
static void do_babystep(const AxisEnum axis, const bool direction); // Perform a short step with a single stepper motor, outside of any convention
#endif
#if HAS_MOTOR_CURRENT_PWM

View File

@ -997,6 +997,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define DISABLE_AXIS_Y() NOOP
#endif
#ifdef Z_IDLE_HEIGHT
#define Z_RESET() do{ current_position.z = Z_IDLE_HEIGHT; sync_plan_position(); }while(0)
#else
#define Z_RESET()
#endif
#if HAS_Z_AXIS
#define ENABLE_AXIS_Z() if (SHOULD_ENABLE(z)) { ENABLE_STEPPER_Z(); ENABLE_STEPPER_Z2(); ENABLE_STEPPER_Z3(); ENABLE_STEPPER_Z4(); AFTER_CHANGE(z, true); }
#define DISABLE_AXIS_Z() if (SHOULD_DISABLE(z)) { DISABLE_STEPPER_Z(); DISABLE_STEPPER_Z2(); DISABLE_STEPPER_Z3(); DISABLE_STEPPER_Z4(); AFTER_CHANGE(z, false); set_axis_untrusted(Z_AXIS); Z_RESET(); TERN_(BD_SENSOR, bdl.config_state = BDS_IDLE); }
@ -1005,12 +1011,6 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define DISABLE_AXIS_Z() NOOP
#endif
#ifdef Z_IDLE_HEIGHT
#define Z_RESET() do{ current_position.z = Z_IDLE_HEIGHT; sync_plan_position(); }while(0)
#else
#define Z_RESET()
#endif
#if HAS_I_AXIS
#define ENABLE_AXIS_I() if (SHOULD_ENABLE(i)) { ENABLE_STEPPER_I(); AFTER_CHANGE(i, true); }
#define DISABLE_AXIS_I() if (SHOULD_DISABLE(i)) { DISABLE_STEPPER_I(); AFTER_CHANGE(i, false); set_axis_untrusted(I_AXIS); }

View File

@ -903,7 +903,7 @@ volatile bool Temperature::raw_temps_ready = false;
}
}
#endif
} // every 2 seconds
} // Every 2 seconds
// Timeout after PID_AUTOTUNE_MAX_CYCLE_MINS minutes since the last undershoot/overshoot cycle
#ifndef PID_AUTOTUNE_MAX_CYCLE_MINS
@ -4426,14 +4426,14 @@ void Temperature::isr() {
/**
* Print a single heater state in the form:
* Extruder: " T0:nnn.nn /nnn.nn"
* With ADC: " T0:nnn.nn /nnn.nn (nnn.nn)"
* Bed: " B:nnn.nn /nnn.nn"
* Chamber: " C:nnn.nn /nnn.nn"
* Cooler: " L:nnn.nn /nnn.nn"
* Probe: " P:nnn.nn"
* Cooler: " L:nnn.nn /nnn.nn"
* Board: " M:nnn.nn"
* SoC: " S:nnn.nn"
* Redundant: " R:nnn.nn /nnn.nn"
* With ADC: " T0:nnn.nn /nnn.nn (nnn.nn)"
*/
static void print_heater_state(const heater_id_t e, const_celsius_float_t c, const_celsius_float_t t
OPTARG(SHOW_TEMP_ADC_VALUES, const float r)
@ -4451,12 +4451,12 @@ void Temperature::isr() {
#if HAS_TEMP_CHAMBER
case H_CHAMBER: k = 'C'; break;
#endif
#if HAS_TEMP_COOLER
case H_COOLER: k = 'L'; break;
#endif
#if HAS_TEMP_PROBE
case H_PROBE: k = 'P'; show_t = false; break;
#endif
#if HAS_TEMP_COOLER
case H_COOLER: k = 'L'; break;
#endif
#if HAS_TEMP_BOARD
case H_BOARD: k = 'M'; show_t = false; break;
#endif
@ -4488,11 +4488,11 @@ void Temperature::isr() {
* See print_heater_state for heater output strings.
* Power output strings are in the format:
* Extruder: " @:nnn"
* Hotends: " @0:nnn @1:nnn ..."
* Bed: " B@:nnn"
* Peltier: " P@:H/C"
* Chamber: " C@:nnn"
* Cooler: " L@:nnn"
* Hotends: " @0:nnn @1:nnn ..."
*/
void Temperature::print_heater_states(const int8_t target_extruder
OPTARG(HAS_TEMP_REDUNDANT, const bool include_r/*=false*/)
@ -4506,12 +4506,12 @@ void Temperature::isr() {
#if HAS_TEMP_CHAMBER
print_heater_state(H_CHAMBER, degChamber(), TERN0(HAS_HEATED_CHAMBER, degTargetChamber()) OPTARG(SHOW_TEMP_ADC_VALUES, rawChamberTemp()));
#endif
#if HAS_TEMP_COOLER
print_heater_state(H_COOLER, degCooler(), TERN0(HAS_COOLER, degTargetCooler()) OPTARG(SHOW_TEMP_ADC_VALUES, rawCoolerTemp()));
#endif
#if HAS_TEMP_PROBE
print_heater_state(H_PROBE, degProbe(), 0 OPTARG(SHOW_TEMP_ADC_VALUES, rawProbeTemp()));
#endif
#if HAS_TEMP_COOLER
print_heater_state(H_COOLER, degCooler(), TERN0(HAS_COOLER, degTargetCooler()) OPTARG(SHOW_TEMP_ADC_VALUES, rawCoolerTemp()));
#endif
#if HAS_TEMP_BOARD
print_heater_state(H_BOARD, degBoard(), 0 OPTARG(SHOW_TEMP_ADC_VALUES, rawBoardTemp()));
#endif