diff --git a/Marlin/src/core/utility.h b/Marlin/src/core/utility.h index c3324443bab9..d387222db92b 100644 --- a/Marlin/src/core/utility.h +++ b/Marlin/src/core/utility.h @@ -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) diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index 52a9020830b7..902bad5747e6 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -299,7 +299,7 @@ class FilamentSensorBase { #else UNUSED(extruder); #endif - return !!runout_states; // Any extruder ran out + return !!runout_states; // Any extruder ran out } public: @@ -320,28 +320,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 *********************************/ diff --git a/Marlin/src/gcode/feature/digipot/M907-M910.cpp b/Marlin/src/gcode/feature/digipot/M907-M910.cpp index ab1c3167058d..03266c3addcc 100644 --- a/Marlin/src/gcode/feature/digipot/M907-M910.cpp +++ b/Marlin/src/gcode/feature/digipot/M907-M910.cpp @@ -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? #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? #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 } diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 589cd2bc486c..964940b57610 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -76,8 +76,8 @@ * * M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled) * M1 -> M0 - * M3 - Turn ON Laser | Spindle (clockwise), set Power | Speed. (Requires SPINDLE_FEATURE or LASER_FEATURE) - * M4 - Turn ON Laser | Spindle (counter-clockwise), set Power | Speed. (Requires SPINDLE_FEATURE or LASER_FEATURE) + * M3 - Turn ON Laser | Spindle (clockwise), set Power | Speed. (Requires SPINDLE_FEATURE or LASER_FEATURE) + * M4 - Turn ON Laser | Spindle (counter-clockwise), set Power | Speed. (Requires SPINDLE_FEATURE or LASER_FEATURE) * M5 - Turn OFF Laser | Spindle. (Requires SPINDLE_FEATURE or LASER_FEATURE) * M7 - Turn mist coolant ON. (Requires COOLANT_CONTROL) * M8 - Turn flood coolant ON. (Requires COOLANT_CONTROL) @@ -163,10 +163,11 @@ * M123 - Report fan tachometers. (Requires En_FAN_TACHO_PIN) Optionally set auto-report interval. (Requires AUTO_REPORT_FANS) * M125 - Save current position and move to filament change position. (Requires PARK_HEAD_ON_PAUSE) * - * M126 - Solenoid Air Valve Open. (Requires BARICUDA) - * M127 - Solenoid Air Valve Closed. (Requires BARICUDA) - * M128 - EtoP Open. (Requires BARICUDA) - * M129 - EtoP Closed. (Requires BARICUDA) + *** BARICUDA *** + * M126 - Solenoid Air Valve Open. + * M127 - Solenoid Air Valve Closed. + * M128 - EtoP Open. + * M129 - EtoP Closed. * * M140 - Set bed target temp. S * M141 - Set heated chamber target temp. S (Requires a chamber heater) diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 64c64020ed99..8386f3e0b7db 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -214,14 +214,6 @@ class MarlinUI { static void clear_lcd() {} #endif - static void reinit_lcd() { TERN_(REINIT_NOISY_LCD, init_lcd()); } - - #if HAS_WIRED_LCD - static bool detected(); - #else - static bool detected() { return true; } - #endif - #if HAS_MULTI_LANGUAGE static uint8_t language; static void set_language(const uint8_t lang); @@ -499,8 +491,8 @@ class MarlinUI { * @param cstr A C-string to set as the status. */ static void set_status_no_expire_P(PGM_P const pstr) { set_status_P(pstr, true); } - static void set_status_no_expire(const char * const cstr) { set_status(cstr, true); } - static void set_status_no_expire(FSTR_P const fstr) { set_status(fstr, true); } + static void set_status_no_expire(const char * const cstr) { set_status(cstr, true); } + static void set_status_no_expire(FSTR_P const fstr) { set_status(fstr, true); } /** * @brief Set a status with a format string and parameters. @@ -640,6 +632,9 @@ class MarlinUI { #endif + static bool detected() IF_DISABLED(HAS_WIRED_LCD, { return true; }); + static void reinit_lcd() { TERN_(REINIT_NOISY_LCD, init_lcd()); } + #if !HAS_WIRED_LCD static void quick_feedback(const bool=true) {} #endif diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 6d3bfaed0dc5..051ca2366194 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -141,17 +141,22 @@ inline int8_t pgm_read_any(const int8_t *p) { return TERN(__IMXRT1062__, *p, pgm static const XYZval NAME##_P DEFS_PROGMEM = NUM_AXIS_ARRAY(X_##OPT, Y_##OPT, Z_##OPT, I_##OPT, J_##OPT, K_##OPT, U_##OPT, V_##OPT, W_##OPT); \ return pgm_read_any(&NAME##_P[axis]); \ } -XYZ_DEFS(float, base_min_pos, MIN_POS); -XYZ_DEFS(float, base_max_pos, MAX_POS); -XYZ_DEFS(float, base_home_pos, HOME_POS); -XYZ_DEFS(float, max_length, MAX_LENGTH); +XYZ_DEFS(float, base_min_pos, MIN_POS); +XYZ_DEFS(float, base_max_pos, MAX_POS); +XYZ_DEFS(float, base_home_pos, HOME_POS); +XYZ_DEFS(float, max_length, MAX_LENGTH); XYZ_DEFS(int8_t, home_dir, HOME_DIR); // Flags for rotational axes constexpr AxisFlags rotational{0 LOGICAL_AXIS_GANG( | 0, | 0, | 0, | 0, - | (ENABLED(AXIS4_ROTATES)<= DXC_DUPLICATION_MODE; } diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 630557180ba2..d6c9f93d7795 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1185,10 +1185,14 @@ void Planner::recalculate(const_float_t safe_exit_speed_sqr) { #define FAN_SET(F) do{ kickstart_fan(fan_speed, ms, F); _FAN_SET(F); }while(0) const millis_t ms = millis(); - TERN_(HAS_FAN0, FAN_SET(0)); TERN_(HAS_FAN1, FAN_SET(1)); - TERN_(HAS_FAN2, FAN_SET(2)); TERN_(HAS_FAN3, FAN_SET(3)); - TERN_(HAS_FAN4, FAN_SET(4)); TERN_(HAS_FAN5, FAN_SET(5)); - TERN_(HAS_FAN6, FAN_SET(6)); TERN_(HAS_FAN7, FAN_SET(7)); + TERN_(HAS_FAN0, FAN_SET(0)); + TERN_(HAS_FAN1, FAN_SET(1)); + TERN_(HAS_FAN2, FAN_SET(2)); + TERN_(HAS_FAN3, FAN_SET(3)); + TERN_(HAS_FAN4, FAN_SET(4)); + TERN_(HAS_FAN5, FAN_SET(5)); + TERN_(HAS_FAN6, FAN_SET(6)); + TERN_(HAS_FAN7, FAN_SET(7)); } #if FAN_KICKSTART_TIME @@ -1903,8 +1907,12 @@ bool Planner::_populate_block( #endif SECONDARY_AXIS_CODE( - dm.i = (dist.i > 0), dm.j = (dist.j > 0), dm.k = (dist.k > 0), - dm.u = (dist.u > 0), dm.v = (dist.v > 0), dm.w = (dist.w > 0) + dm.i = (dist.i > 0), + dm.j = (dist.j > 0), + dm.k = (dist.k > 0), + dm.u = (dist.u > 0), + dm.v = (dist.v > 0), + dm.w = (dist.w > 0) ); #if HAS_EXTRUDERS @@ -1969,7 +1977,8 @@ bool Planner::_populate_block( #else // default non-h-bot planning ABS(dist.a), ABS(dist.b), ABS(dist.c) #endif - , ABS(dist.i), ABS(dist.j), ABS(dist.k), ABS(dist.u), ABS(dist.v), ABS(dist.w) + , ABS(dist.i), ABS(dist.j), ABS(dist.k) + , ABS(dist.u), ABS(dist.v), ABS(dist.w) )); /** @@ -2021,8 +2030,12 @@ bool Planner::_populate_block( #endif SECONDARY_AXIS_CODE( - dist_mm.i = dist.i * mm_per_step[I_AXIS], dist_mm.j = dist.j * mm_per_step[J_AXIS], dist_mm.k = dist.k * mm_per_step[K_AXIS], - dist_mm.u = dist.u * mm_per_step[U_AXIS], dist_mm.v = dist.v * mm_per_step[V_AXIS], dist_mm.w = dist.w * mm_per_step[W_AXIS] + dist_mm.i = dist.i * mm_per_step[I_AXIS], + dist_mm.j = dist.j * mm_per_step[J_AXIS], + dist_mm.k = dist.k * mm_per_step[K_AXIS], + dist_mm.u = dist.u * mm_per_step[U_AXIS], + dist_mm.v = dist.v * mm_per_step[V_AXIS], + dist_mm.w = dist.w * mm_per_step[W_AXIS] ); TERN_(HAS_EXTRUDERS, dist_mm.e = esteps_float * mm_per_step[E_AXIS_N(extruder)]); @@ -2034,9 +2047,15 @@ bool Planner::_populate_block( #endif if (true NUM_AXIS_GANG( - && block->steps.a < MIN_STEPS_PER_SEGMENT, && block->steps.b < MIN_STEPS_PER_SEGMENT, && block->steps.c < MIN_STEPS_PER_SEGMENT, - && block->steps.i < MIN_STEPS_PER_SEGMENT, && block->steps.j < MIN_STEPS_PER_SEGMENT, && block->steps.k < MIN_STEPS_PER_SEGMENT, - && block->steps.u < MIN_STEPS_PER_SEGMENT, && block->steps.v < MIN_STEPS_PER_SEGMENT, && block->steps.w < MIN_STEPS_PER_SEGMENT + && block->steps.a < MIN_STEPS_PER_SEGMENT, + && block->steps.b < MIN_STEPS_PER_SEGMENT, + && block->steps.c < MIN_STEPS_PER_SEGMENT, + && block->steps.i < MIN_STEPS_PER_SEGMENT, + && block->steps.j < MIN_STEPS_PER_SEGMENT, + && block->steps.k < MIN_STEPS_PER_SEGMENT, + && block->steps.u < MIN_STEPS_PER_SEGMENT, + && block->steps.v < MIN_STEPS_PER_SEGMENT, + && block->steps.w < MIN_STEPS_PER_SEGMENT ) ) { block->millimeters = TERN0(HAS_EXTRUDERS, ABS(dist_mm.e)); @@ -2079,10 +2098,17 @@ bool Planner::_populate_block( block->step_event_count = ( #if NUM_AXES - _MAX(LOGICAL_AXIS_LIST(esteps, - block->steps.a, block->steps.b, block->steps.c, - block->steps.i, block->steps.j, block->steps.k, - block->steps.u, block->steps.v, block->steps.w + _MAX(LOGICAL_AXIS_LIST( + esteps, + block->steps.a, + block->steps.b, + block->steps.c, + block->steps.i, + block->steps.j, + block->steps.k, + block->steps.u, + block->steps.v, + block->steps.w )) #elif HAS_EXTRUDERS esteps @@ -2149,9 +2175,12 @@ bool Planner::_populate_block( #endif #if ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) SECONDARY_AXIS_CODE( - if (block->steps.i) stepper.enable_axis(I_AXIS), if (block->steps.j) stepper.enable_axis(J_AXIS), - if (block->steps.k) stepper.enable_axis(K_AXIS), if (block->steps.u) stepper.enable_axis(U_AXIS), - if (block->steps.v) stepper.enable_axis(V_AXIS), if (block->steps.w) stepper.enable_axis(W_AXIS) + if (block->steps.i) stepper.enable_axis(I_AXIS), + if (block->steps.j) stepper.enable_axis(J_AXIS), + if (block->steps.k) stepper.enable_axis(K_AXIS), + if (block->steps.u) stepper.enable_axis(U_AXIS), + if (block->steps.v) stepper.enable_axis(V_AXIS), + if (block->steps.w) stepper.enable_axis(W_AXIS) ); #endif @@ -2173,12 +2202,12 @@ bool Planner::_populate_block( #define _IS_DUPE(N) TERN0(HAS_DUPLICATION_MODE, (extruder_duplication_enabled && TERN1(MULTI_NOZZLE_DUPLICATION, TEST(duplication_e_mask, N)))) #define ENABLE_ONE_E(N) do{ \ - if (N == E_STEPPER_INDEX(extruder) || _IS_DUPE(N)) { /* N is 'extruder', or N is duplicating */ \ - stepper.ENABLE_EXTRUDER(N); /* Enable the relevant E stepper... */ \ - extruder_last_move[N] = (BLOCK_BUFFER_SIZE) * 2; /* ...and reset its counter */ \ + if (N == E_STEPPER_INDEX(extruder) || _IS_DUPE(N)) { /* N is 'extruder', or N is duplicating */ \ + stepper.ENABLE_EXTRUDER(N); /* Enable the relevant E stepper... */ \ + extruder_last_move[N] = (BLOCK_BUFFER_SIZE) * 2; /* ...and reset its counter */ \ } \ - else if (!extruder_last_move[N]) /* Counter expired since last E stepper enable */ \ - stepper.DISABLE_EXTRUDER(N); /* Disable the E stepper */ \ + else if (!extruder_last_move[N]) /* Counter expired since last E stepper enable */ \ + stepper.DISABLE_EXTRUDER(N); /* Disable the E stepper */ \ }while(0); #else @@ -2358,8 +2387,8 @@ bool Planner::_populate_block( #if ENABLED(LIN_ADVANCE) bool use_advance_lead = false; #endif - if (!ANY_AXIS_MOVES(block)) { // Is this a retract / recover move? - accel = CEIL(settings.retract_acceleration * steps_per_mm); // Convert to: acceleration steps/sec^2 + if (!ANY_AXIS_MOVES(block)) { // Is this a retract / recover move? + accel = CEIL(settings.retract_acceleration * steps_per_mm); // Convert to: acceleration steps/sec^2 } else { #define LIMIT_ACCEL_LONG(AXIS,INDX) do{ \ @@ -2421,17 +2450,29 @@ bool Planner::_populate_block( if (block->step_event_count <= acceleration_long_cutoff) { LOGICAL_AXIS_CODE( LIMIT_ACCEL_LONG(E_AXIS, E_INDEX_N(extruder)), - LIMIT_ACCEL_LONG(A_AXIS, 0), LIMIT_ACCEL_LONG(B_AXIS, 0), LIMIT_ACCEL_LONG(C_AXIS, 0), - LIMIT_ACCEL_LONG(I_AXIS, 0), LIMIT_ACCEL_LONG(J_AXIS, 0), LIMIT_ACCEL_LONG(K_AXIS, 0), - LIMIT_ACCEL_LONG(U_AXIS, 0), LIMIT_ACCEL_LONG(V_AXIS, 0), LIMIT_ACCEL_LONG(W_AXIS, 0) + LIMIT_ACCEL_LONG(A_AXIS, 0), + LIMIT_ACCEL_LONG(B_AXIS, 0), + LIMIT_ACCEL_LONG(C_AXIS, 0), + LIMIT_ACCEL_LONG(I_AXIS, 0), + LIMIT_ACCEL_LONG(J_AXIS, 0), + LIMIT_ACCEL_LONG(K_AXIS, 0), + LIMIT_ACCEL_LONG(U_AXIS, 0), + LIMIT_ACCEL_LONG(V_AXIS, 0), + LIMIT_ACCEL_LONG(W_AXIS, 0) ); } else { LOGICAL_AXIS_CODE( LIMIT_ACCEL_FLOAT(E_AXIS, E_INDEX_N(extruder)), - LIMIT_ACCEL_FLOAT(A_AXIS, 0), LIMIT_ACCEL_FLOAT(B_AXIS, 0), LIMIT_ACCEL_FLOAT(C_AXIS, 0), - LIMIT_ACCEL_FLOAT(I_AXIS, 0), LIMIT_ACCEL_FLOAT(J_AXIS, 0), LIMIT_ACCEL_FLOAT(K_AXIS, 0), - LIMIT_ACCEL_FLOAT(U_AXIS, 0), LIMIT_ACCEL_FLOAT(V_AXIS, 0), LIMIT_ACCEL_FLOAT(W_AXIS, 0) + LIMIT_ACCEL_FLOAT(A_AXIS, 0), + LIMIT_ACCEL_FLOAT(B_AXIS, 0), + LIMIT_ACCEL_FLOAT(C_AXIS, 0), + LIMIT_ACCEL_FLOAT(I_AXIS, 0), + LIMIT_ACCEL_FLOAT(J_AXIS, 0), + LIMIT_ACCEL_FLOAT(K_AXIS, 0), + LIMIT_ACCEL_FLOAT(U_AXIS, 0), + LIMIT_ACCEL_FLOAT(V_AXIS, 0), + LIMIT_ACCEL_FLOAT(W_AXIS, 0) ); } } @@ -2513,10 +2554,17 @@ bool Planner::_populate_block( #if HAS_DIST_MM_ARG cart_dist_mm #else - LOGICAL_AXIS_ARRAY(dist_mm.e, - dist_mm.x, dist_mm.y, dist_mm.z, - dist_mm.i, dist_mm.j, dist_mm.k, - dist_mm.u, dist_mm.v, dist_mm.w) + LOGICAL_AXIS_ARRAY( + dist_mm.e, + dist_mm.x, + dist_mm.y, + dist_mm.z, + dist_mm.i, + dist_mm.j, + dist_mm.k, + dist_mm.u, + dist_mm.v, + dist_mm.w) #endif ; @@ -2756,7 +2804,7 @@ bool Planner::_populate_block( previous_speed = current_speed; previous_nominal_speed = block->nominal_speed; - position = target; // Update the position + position = target; // Update the position #if ENABLED(POWER_LOSS_RECOVERY) block->sdpos = recovery.command_sdpos(); @@ -2766,7 +2814,7 @@ bool Planner::_populate_block( TERN_(HAS_POSITION_FLOAT, position_float = target_float); TERN_(GRADIENT_MIX, mixer.gradient_control(target_float.z)); - return true; // Movement was accepted + return true; // Movement was accepted } // _populate_block() @@ -2956,6 +3004,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*/ @@ -2969,15 +3019,27 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s #if HAS_JUNCTION_DEVIATION const xyze_pos_t cart_dist_mm = LOGICAL_AXIS_ARRAY( cart.e - position_cart.e, - cart.x - position_cart.x, cart.y - position_cart.y, cart.z - position_cart.z, - cart.i - position_cart.i, cart.j - position_cart.j, cart.k - position_cart.k, - cart.u - position_cart.u, cart.v - position_cart.v, cart.w - position_cart.w + cart.x - position_cart.x, + cart.y - position_cart.y, + cart.z - position_cart.z, + cart.i - position_cart.i, + cart.j - position_cart.j, + cart.k - position_cart.k, + cart.u - position_cart.u, + cart.v - position_cart.v, + cart.w - position_cart.w ); #else const xyz_pos_t cart_dist_mm = NUM_AXIS_ARRAY( - cart.x - position_cart.x, cart.y - position_cart.y, cart.z - position_cart.z, - cart.i - position_cart.i, cart.j - position_cart.j, cart.k - position_cart.k, - cart.u - position_cart.u, cart.v - position_cart.v, cart.w - position_cart.w + cart.x - position_cart.x, + cart.y - position_cart.y, + cart.z - position_cart.z, + cart.i - position_cart.i, + cart.j - position_cart.j, + cart.k - position_cart.k, + cart.u - position_cart.u, + cart.v - position_cart.v, + cart.w - position_cart.w ); #endif @@ -3296,9 +3358,15 @@ void Planner::set_max_feedrate(const AxisEnum axis, float inMaxFeedrateMMS) { #else LOGICAL_AXIS_ARRAY( (DEFAULT_EJERK) * 2, - (DEFAULT_XJERK) * 2, (DEFAULT_YJERK) * 2, (DEFAULT_ZJERK) * 2, - (DEFAULT_IJERK) * 2, (DEFAULT_JJERK) * 2, (DEFAULT_KJERK) * 2, - (DEFAULT_UJERK) * 2, (DEFAULT_VJERK) * 2, (DEFAULT_WJERK) * 2 + (DEFAULT_XJERK) * 2, + (DEFAULT_YJERK) * 2, + (DEFAULT_ZJERK) * 2, + (DEFAULT_IJERK) * 2, + (DEFAULT_JJERK) * 2, + (DEFAULT_KJERK) * 2, + (DEFAULT_UJERK) * 2, + (DEFAULT_VJERK) * 2, + (DEFAULT_WJERK) * 2 ) #endif ; diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 64381350cc1c..fd1f0b2cfa41 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -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 diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index b1573f2be9e9..c9e1ea4b30a9 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -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) diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 306b2151b51f..2838217381cc 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -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 diff --git a/Marlin/src/module/stepper/indirection.h b/Marlin/src/module/stepper/indirection.h index 4c83cbd6a66b..c1fcb37ad9b5 100644 --- a/Marlin/src/module/stepper/indirection.h +++ b/Marlin/src/module/stepper/indirection.h @@ -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); } diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 96295d7db586..c10fb5ded1d5 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -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