Apply loop shorthand macros (#17159)
This commit is contained in:
@ -583,7 +583,7 @@ void MarlinSettings::postprocess() {
|
||||
|
||||
#if HAS_HOTEND_OFFSET
|
||||
// Skip hotend 0 which must be 0
|
||||
for (uint8_t e = 1; e < HOTENDS; e++)
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
EEPROM_WRITE(hotend_offset[e]);
|
||||
#endif
|
||||
}
|
||||
@ -1420,7 +1420,7 @@ void MarlinSettings::postprocess() {
|
||||
{
|
||||
#if HAS_HOTEND_OFFSET
|
||||
// Skip hotend 0 which must be 0
|
||||
for (uint8_t e = 1; e < HOTENDS; e++)
|
||||
LOOP_S_L_N(e, 1, HOTENDS)
|
||||
EEPROM_READ(hotend_offset[e]);
|
||||
#endif
|
||||
}
|
||||
@ -2915,7 +2915,7 @@ void MarlinSettings::reset() {
|
||||
#if HAS_HOTEND_OFFSET
|
||||
CONFIG_ECHO_HEADING("Hotend offsets:");
|
||||
CONFIG_ECHO_START();
|
||||
for (uint8_t e = 1; e < HOTENDS; e++) {
|
||||
LOOP_S_L_N(e, 1, HOTENDS) {
|
||||
SERIAL_ECHOPAIR_P(
|
||||
PSTR(" M218 T"), (int)e,
|
||||
SP_X_STR, LINEAR_UNIT(hotend_offset[e].x),
|
||||
|
@ -481,7 +481,7 @@ void _O2 Endstops::report_states() {
|
||||
print_es_state(READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_INVERTING, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
|
||||
#else
|
||||
#define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break;
|
||||
for (uint8_t i = 1; i <= NUM_RUNOUT_SENSORS; i++) {
|
||||
LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) {
|
||||
pin_t pin;
|
||||
switch (i) {
|
||||
default: continue;
|
||||
|
@ -1408,7 +1408,7 @@ void Planner::check_axes_activity() {
|
||||
* The multiplier converts a given E value into a length.
|
||||
*/
|
||||
void Planner::calculate_volumetric_multipliers() {
|
||||
for (uint8_t i = 0; i < COUNT(filament_size); i++) {
|
||||
LOOP_L_N(i, COUNT(filament_size)) {
|
||||
volumetric_multiplier[i] = calculate_volumetric_multiplier(filament_size[i]);
|
||||
refresh_e_factor(i);
|
||||
}
|
||||
@ -1991,7 +1991,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
|
||||
#if ENABLED(DISABLE_INACTIVE_EXTRUDER) // Enable only the selected extruder
|
||||
|
||||
for (uint8_t i = 0; i < EXTRUDERS; i++)
|
||||
LOOP_L_N(i, EXTRUDERS)
|
||||
if (g_uc_extruder_last_move[i] > 0) g_uc_extruder_last_move[i]--;
|
||||
|
||||
#if HAS_DUPLICATION_MODE
|
||||
|
@ -403,7 +403,7 @@ class Planner {
|
||||
FORCE_INLINE static void set_filament_size(const uint8_t e, const float &v) {
|
||||
filament_size[e] = v;
|
||||
// make sure all extruders have some sane value for the filament size
|
||||
for (uint8_t i = 0; i < COUNT(filament_size); i++)
|
||||
LOOP_L_N(i, COUNT(filament_size))
|
||||
if (!filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
||||
}
|
||||
|
||||
@ -807,7 +807,7 @@ class Planner {
|
||||
FORCE_INLINE static void recalculate_max_e_jerk() {
|
||||
#define GET_MAX_E_JERK(N) SQRT(SQRT(0.5) * junction_deviation_mm * (N) * RECIPROCAL(1.0 - SQRT(0.5)))
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
for (uint8_t i = 0; i < EXTRUDERS; i++)
|
||||
LOOP_L_N(i, EXTRUDERS)
|
||||
max_e_jerk[i] = GET_MAX_E_JERK(settings.max_acceleration_mm_per_s2[E_AXIS_N(i)]);
|
||||
#else
|
||||
max_e_jerk = GET_MAX_E_JERK(settings.max_acceleration_mm_per_s2[E_AXIS]);
|
||||
|
@ -624,7 +624,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
|
||||
|
||||
#if EXTRA_PROBING
|
||||
// Insert Z measurement into probes[]. Keep it sorted ascending.
|
||||
for (uint8_t i = 0; i <= p; i++) { // Iterate the saved Zs to insert the new Z
|
||||
LOOP_LE_N(i, p) { // Iterate the saved Zs to insert the new Z
|
||||
if (i == p || probes[i] > z) { // Last index or new Z is smaller than this Z
|
||||
for (int8_t m = p; --m >= i;) probes[m + 1] = probes[m]; // Shift items down after the insertion point
|
||||
probes[i] = z; // Insert the new Z measurement
|
||||
@ -662,7 +662,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
|
||||
max_avg_idx--; else min_avg_idx++;
|
||||
|
||||
// Return the average value of all remaining probes.
|
||||
for (uint8_t i = min_avg_idx; i <= max_avg_idx; i++)
|
||||
LOOP_S_LE_N(i, min_avg_idx, max_avg_idx)
|
||||
probes_z_sum += probes[i];
|
||||
|
||||
#endif
|
||||
|
@ -2116,7 +2116,7 @@ void Stepper::init() {
|
||||
#if MB(ALLIGATOR)
|
||||
const float motor_current[] = MOTOR_CURRENT;
|
||||
unsigned int digipot_motor = 0;
|
||||
for (uint8_t i = 0; i < 3 + EXTRUDERS; i++) {
|
||||
LOOP_L_N(i, 3 + EXTRUDERS) {
|
||||
digipot_motor = 255 * (motor_current[i] / 2.5);
|
||||
dac084s085::setValue(i, digipot_motor);
|
||||
}
|
||||
@ -2756,7 +2756,7 @@ void Stepper::report_positions() {
|
||||
SPI.begin();
|
||||
SET_OUTPUT(DIGIPOTSS_PIN);
|
||||
|
||||
for (uint8_t i = 0; i < COUNT(digipot_motor_current); i++) {
|
||||
LOOP_L_N(i, COUNT(digipot_motor_current)) {
|
||||
//digitalPotWrite(digipot_ch[i], digipot_motor_current[i]);
|
||||
digipot_current(i, digipot_motor_current[i]);
|
||||
}
|
||||
|
@ -708,7 +708,7 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) {
|
||||
}while(0)
|
||||
|
||||
uint8_t fanDone = 0;
|
||||
for (uint8_t f = 0; f < COUNT(fanBit); f++) {
|
||||
LOOP_L_N(f, COUNT(fanBit)) {
|
||||
const uint8_t realFan = pgm_read_byte(&fanBit[f]);
|
||||
if (TEST(fanDone, realFan)) continue;
|
||||
const bool fan_on = TEST(fanState, realFan);
|
||||
@ -2422,7 +2422,7 @@ void Temperature::readings_ready() {
|
||||
#endif // HOTENDS > 1
|
||||
};
|
||||
|
||||
for (uint8_t e = 0; e < COUNT(temp_dir); e++) {
|
||||
LOOP_L_N(e, COUNT(temp_dir)) {
|
||||
const int8_t tdir = temp_dir[e];
|
||||
if (tdir) {
|
||||
const int16_t rawtemp = temp_hotend[e].raw * tdir; // normal direction, +rawtemp, else -rawtemp
|
||||
|
@ -251,7 +251,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
#elif ENABLED(PARKING_EXTRUDER)
|
||||
|
||||
void pe_solenoid_init() {
|
||||
for (uint8_t n = 0; n <= 1; ++n)
|
||||
LOOP_LE_N(n, 1)
|
||||
#if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
|
||||
pe_activate_solenoid(n);
|
||||
#else
|
||||
|
Reference in New Issue
Block a user