Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various cosmetic changes #27503

Open
wants to merge 11 commits into
base: bugfix-2.1.x
Choose a base branch
from
10 changes: 7 additions & 3 deletions Marlin/src/core/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
40 changes: 20 additions & 20 deletions Marlin/src/feature/runout.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 *********************************/

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/gcode/feature/digipot/M907-M910.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
}

Expand Down
13 changes: 7 additions & 6 deletions Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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<temp>
* M141 - Set heated chamber target temp. S<temp> (Requires a chamber heater)
Expand Down
15 changes: 5 additions & 10 deletions Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
25 changes: 14 additions & 11 deletions Marlin/src/module/motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,22 @@ inline int8_t pgm_read_any(const int8_t *p) { return TERN(__IMXRT1062__, *p, pgm
static const XYZval<T> 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)<<I_AXIS), | (ENABLED(AXIS5_ROTATES)<<J_AXIS), | (ENABLED(AXIS6_ROTATES)<<K_AXIS),
| (ENABLED(AXIS7_ROTATES)<<U_AXIS), | (ENABLED(AXIS8_ROTATES)<<V_AXIS), | (ENABLED(AXIS9_ROTATES)<<W_AXIS))
| (ENABLED(AXIS4_ROTATES)<<I_AXIS),
| (ENABLED(AXIS5_ROTATES)<<J_AXIS),
| (ENABLED(AXIS6_ROTATES)<<K_AXIS),
| (ENABLED(AXIS7_ROTATES)<<U_AXIS),
| (ENABLED(AXIS8_ROTATES)<<V_AXIS),
| (ENABLED(AXIS9_ROTATES)<<W_AXIS)
)
};

inline float home_bump_mm(const AxisEnum axis) {
Expand Down Expand Up @@ -242,9 +247,7 @@ inline float home_bump_mm(const AxisEnum axis) {
extern soft_endstops_t soft_endstop;
void apply_motion_limits(xyz_pos_t &target);
void update_software_endstops(const AxisEnum axis
#if HAS_HOTEND_OFFSET
, const uint8_t old_tool_index=0, const uint8_t new_tool_index=0
#endif
OPTARG(HAS_HOTEND_OFFSET, const uint8_t old_tool_index=0, const uint8_t new_tool_index=0)
);
#define SET_SOFT_ENDSTOP_LOOSE(loose) (soft_endstop._loose = loose)

Expand Down Expand Up @@ -605,10 +608,10 @@ void home_if_needed(const bool keeplev=false);
extern float inactive_extruder_x, // Used in mode 0 & 1
duplicate_extruder_x_offset; // Used in mode 2 & 3
extern xyz_pos_t raised_parked_position; // Used in mode 1
extern bool active_extruder_parked; // Used in mode 1, 2 & 3
extern millis_t delayed_move_time; // Used in mode 1
extern celsius_t duplicate_extruder_temp_offset; // Used in mode 2 & 3
extern bool idex_mirrored_mode; // Used in mode 3
extern bool active_extruder_parked, // Used in mode 1, 2 & 3
idex_mirrored_mode; // Used in mode 3

FORCE_INLINE bool idex_is_duplicating() { return dual_x_carriage_mode >= DXC_DUPLICATION_MODE; }

Expand Down
Loading