mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2026-01-08 07:37:43 -07:00
🎨 AxisEnum style
This commit is contained in:
parent
baa20d9ea2
commit
20e99497dd
9 changed files with 24 additions and 24 deletions
|
|
@ -143,7 +143,7 @@ void safe_delay(millis_t ms) {
|
|||
SERIAL_ECHOPGM("ABL Adjustment");
|
||||
LOOP_NUM_AXES(a) {
|
||||
SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&SP_AXIS_STR[a]));
|
||||
serial_offset(planner.get_axis_position_mm(AxisEnum(a)) - current_position[a]);
|
||||
serial_offset(planner.get_axis_position_mm((AxisEnum)a) - current_position[a]);
|
||||
}
|
||||
#else
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ int16_t Babystep::accum;
|
|||
void Babystep::step_axis(const AxisEnum axis) {
|
||||
const int16_t curTodo = steps[BS_AXIS_IND(axis)]; // get rid of volatile for performance
|
||||
if (curTodo) {
|
||||
stepper.do_babystep((AxisEnum)axis, curTodo > 0);
|
||||
stepper.do_babystep(axis, curTodo > 0);
|
||||
if (curTodo > 0) steps[BS_AXIS_IND(axis)]--; else steps[BS_AXIS_IND(axis)]++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void StepperDAC::print_values() {
|
|||
LOOP_LOGICAL_AXES(a) {
|
||||
SERIAL_CHAR(' ', IAXIS_CHAR(a), ':');
|
||||
SERIAL_ECHO(dac_perc(a));
|
||||
SERIAL_ECHOPGM_P(PSTR(" ("), dac_amps(AxisEnum(a)), PSTR(")"));
|
||||
SERIAL_ECHOPGM_P(PSTR(" ("), dac_amps((AxisEnum)a), PSTR(")"));
|
||||
}
|
||||
#if HAS_EXTRUDERS
|
||||
SERIAL_ECHOLNPGM_P(SP_E_LBL, dac_perc(E_AXIS), PSTR(" ("), dac_amps(E_AXIS), PSTR(")"));
|
||||
|
|
|
|||
|
|
@ -801,7 +801,7 @@ void I2CPositionEncodersMgr::M860() {
|
|||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen_test(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
const uint8_t idx = idx_from_axis((AxisEnum)i);
|
||||
if ((int8_t)idx >= 0) report_position(idx, hasU, hasO);
|
||||
}
|
||||
}
|
||||
|
|
@ -828,7 +828,7 @@ void I2CPositionEncodersMgr::M861() {
|
|||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
const uint8_t idx = idx_from_axis((AxisEnum)i);
|
||||
if ((int8_t)idx >= 0) report_status(idx);
|
||||
}
|
||||
}
|
||||
|
|
@ -856,7 +856,7 @@ void I2CPositionEncodersMgr::M862() {
|
|||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
const uint8_t idx = idx_from_axis((AxisEnum)i);
|
||||
if ((int8_t)idx >= 0) test_axis(idx);
|
||||
}
|
||||
}
|
||||
|
|
@ -887,7 +887,7 @@ void I2CPositionEncodersMgr::M863() {
|
|||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
const uint8_t idx = idx_from_axis((AxisEnum)i);
|
||||
if ((int8_t)idx >= 0) calibrate_steps_mm(idx, iterations);
|
||||
}
|
||||
}
|
||||
|
|
@ -963,7 +963,7 @@ void I2CPositionEncodersMgr::M865() {
|
|||
if (!I2CPE_addr) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
const uint8_t idx = idx_from_axis((AxisEnum)i);
|
||||
if ((int8_t)idx >= 0) report_module_firmware(encoders[idx].get_address());
|
||||
}
|
||||
}
|
||||
|
|
@ -994,12 +994,12 @@ void I2CPositionEncodersMgr::M866() {
|
|||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
const uint8_t idx = idx_from_axis((AxisEnum)i);
|
||||
if ((int8_t)idx >= 0) {
|
||||
if (hasR)
|
||||
reset_error_count(idx, AxisEnum(i));
|
||||
reset_error_count(idx, (AxisEnum)i);
|
||||
else
|
||||
report_error_count(idx, AxisEnum(i));
|
||||
report_error_count(idx, (AxisEnum)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1032,10 +1032,10 @@ void I2CPositionEncodersMgr::M867() {
|
|||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
const uint8_t idx = idx_from_axis((AxisEnum)i);
|
||||
if ((int8_t)idx >= 0) {
|
||||
const bool ena = onoff == -1 ? !encoders[I2CPE_idx].get_ec_enabled() : !!onoff;
|
||||
enable_ec(idx, ena, AxisEnum(i));
|
||||
enable_ec(idx, ena, (AxisEnum)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1068,7 +1068,7 @@ void I2CPositionEncodersMgr::M868() {
|
|||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
const uint8_t idx = idx_from_axis((AxisEnum)i);
|
||||
if ((int8_t)idx >= 0) {
|
||||
if (newThreshold != -9999)
|
||||
set_ec_threshold(idx, newThreshold, encoders[idx].get_axis());
|
||||
|
|
@ -1102,7 +1102,7 @@ void I2CPositionEncodersMgr::M869() {
|
|||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
const uint8_t idx = idx_from_axis((AxisEnum)i);
|
||||
if ((int8_t)idx >= 0) report_error(idx);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ void GcodeSuite::M425() {
|
|||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
SERIAL_ECHOPGM(" Average measured backlash (mm):");
|
||||
if (backlash.has_any_measurement()) {
|
||||
LOOP_NUM_AXES(a) if (axis_can_calibrate(a) && backlash.has_measurement(AxisEnum(a))) {
|
||||
LOOP_NUM_AXES(a) if (axis_can_calibrate(a) && backlash.has_measurement((AxisEnum)a)) {
|
||||
SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&SP_AXIS_STR[a]), backlash.get_measurement((AxisEnum)a));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ void do_enable(const stepper_flags_t to_enable) {
|
|||
// Enable all flagged axes
|
||||
LOOP_NUM_AXES(a) {
|
||||
if (TEST(shall_enable, a)) {
|
||||
stepper.enable_axis(AxisEnum(a)); // Mark and enable the requested axis
|
||||
stepper.enable_axis((AxisEnum)a); // Mark and enable the requested axis
|
||||
DEBUG_ECHOLNPGM("Enabled ", AXIS_CHAR(a), " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... Enabled: ", hex_word(stepper.axis_enabled.bits));
|
||||
also_enabled |= enable_overlap[a];
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ void try_to_disable(const stepper_flags_t to_disable) {
|
|||
LOOP_NUM_AXES(a)
|
||||
if (TEST(to_disable.bits, a)) {
|
||||
DEBUG_ECHOPGM("Try to disable ", AXIS_CHAR(a), " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... ");
|
||||
if (stepper.disable_axis(AxisEnum(a))) { // Mark the requested axis and request to disable
|
||||
if (stepper.disable_axis((AxisEnum)a)) { // Mark the requested axis and request to disable
|
||||
DEBUG_ECHOPGM("OK");
|
||||
still_enabled &= ~(_BV(a) | enable_overlap[a]); // If actually disabled, clear one or more tracked bits
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ void GcodeSuite::get_destination_from_command() {
|
|||
if (skip_move)
|
||||
destination[i] = current_position[i];
|
||||
else
|
||||
destination[i] = axis_is_relative(AxisEnum(i)) ? current_position[i] + v : LOGICAL_TO_NATIVE(v, i);
|
||||
destination[i] = axis_is_relative((AxisEnum)i) ? current_position[i] + v : LOGICAL_TO_NATIVE(v, i);
|
||||
}
|
||||
else
|
||||
destination[i] = current_position[i];
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ namespace ExtUI {
|
|||
void onSteppersDisabled() {}
|
||||
void onSteppersEnabled() {}
|
||||
void onAxisDisabled(const axis_t axis) {
|
||||
set_axis_untrusted(AxisEnum(axis)); // MRISCOC workaround: https://github.com/MarlinFirmware/Marlin/issues/23095
|
||||
set_axis_untrusted((AxisEnum)axis); // MRISCOC workaround: https://github.com/MarlinFirmware/Marlin/issues/23095
|
||||
}
|
||||
void onAxisEnabled(const axis_t) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -654,19 +654,19 @@ namespace ExtUI {
|
|||
|
||||
#if HAS_SHAPING
|
||||
float getShapingZeta(const axis_t axis) {
|
||||
return stepper.get_shaping_damping_ratio(AxisEnum(axis));
|
||||
return stepper.get_shaping_damping_ratio((AxisEnum)axis);
|
||||
}
|
||||
void setShapingZeta(const float zeta, const axis_t axis) {
|
||||
if (!WITHIN(zeta, 0, 1)) return;
|
||||
stepper.set_shaping_damping_ratio(AxisEnum(axis), zeta);
|
||||
stepper.set_shaping_damping_ratio((AxisEnum)axis, zeta);
|
||||
}
|
||||
float getShapingFrequency(const axis_t axis) {
|
||||
return stepper.get_shaping_frequency(AxisEnum(axis));
|
||||
return stepper.get_shaping_frequency((AxisEnum)axis);
|
||||
}
|
||||
void setShapingFrequency(const float freq, const axis_t axis) {
|
||||
constexpr float min_freq = float(uint32_t(STEPPER_TIMER_RATE) / 2) / shaping_time_t(-2);
|
||||
if (freq == 0.0f || freq > min_freq)
|
||||
stepper.set_shaping_frequency(AxisEnum(axis), freq);
|
||||
stepper.set_shaping_frequency((AxisEnum)axis, freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue