Apply loop shorthand macros (#17159)
This commit is contained in:
@ -71,7 +71,7 @@ void GcodeSuite::M305() {
|
||||
SERIAL_ECHO_MSG("!Invalid Steinhart-Hart C coeff. (-0.01 < C < +0.01)");
|
||||
} // If not setting then report parameters
|
||||
else if (t_index < 0) { // ...all user thermistors
|
||||
for (uint8_t i = 0; i < USER_THERMISTORS; i++)
|
||||
LOOP_L_N(i, USER_THERMISTORS)
|
||||
thermalManager.log_user_thermistor(i);
|
||||
}
|
||||
else // ...one user thermistor
|
||||
|
@ -57,7 +57,7 @@ inline void toggle_pins() {
|
||||
end = PARSED_PIN_INDEX('L', NUM_DIGITAL_PINS - 1),
|
||||
wait = parser.intval('W', 500);
|
||||
|
||||
for (uint8_t i = start; i <= end; i++) {
|
||||
LOOP_S_LE_N(i, start, end) {
|
||||
pin_t pin = GET_PIN_MAP_PIN_M43(i);
|
||||
if (!VALID_PIN(pin)) continue;
|
||||
if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) {
|
||||
@ -313,7 +313,7 @@ void GcodeSuite::M43() {
|
||||
NOLESS(first_pin, 2); // Don't hijack the UART pins
|
||||
#endif
|
||||
uint8_t pin_state[last_pin - first_pin + 1];
|
||||
for (uint8_t i = first_pin; i <= last_pin; i++) {
|
||||
LOOP_S_LE_N(i, first_pin, last_pin) {
|
||||
pin_t pin = GET_PIN_MAP_PIN_M43(i);
|
||||
if (!VALID_PIN(pin)) continue;
|
||||
if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue;
|
||||
@ -339,7 +339,7 @@ void GcodeSuite::M43() {
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
for (uint8_t i = first_pin; i <= last_pin; i++) {
|
||||
LOOP_S_LE_N(i, first_pin, last_pin) {
|
||||
pin_t pin = GET_PIN_MAP_PIN_M43(i);
|
||||
if (!VALID_PIN(pin)) continue;
|
||||
if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue;
|
||||
@ -365,7 +365,7 @@ void GcodeSuite::M43() {
|
||||
}
|
||||
else {
|
||||
// Report current state of selected pin(s)
|
||||
for (uint8_t i = first_pin; i <= last_pin; i++) {
|
||||
LOOP_S_LE_N(i, first_pin, last_pin) {
|
||||
pin_t pin = GET_PIN_MAP_PIN_M43(i);
|
||||
if (VALID_PIN(pin)) report_pin_state_extended(pin, ignore_protection, true);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@
|
||||
// b3 b2 b1 b0 ~b0 ... lo bits, NOT last bit
|
||||
//
|
||||
void M672_send(uint8_t b) { // bit rate requirement: 1KHz +/- 30%
|
||||
for (uint8_t bits = 0; bits < 14; bits++) {
|
||||
LOOP_L_N(bits, 14) {
|
||||
switch (bits) {
|
||||
default: { OUT_WRITE(SMART_EFFECTOR_MOD_PIN, !!(b & 0x80)); b <<= 1; break; } // send bit, shift next into place
|
||||
case 7:
|
||||
|
@ -34,7 +34,7 @@ void report_M92(const bool echo=true, const int8_t e=-1) {
|
||||
SERIAL_EOL();
|
||||
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
for (uint8_t i = 0; i < E_STEPPERS; i++) {
|
||||
LOOP_L_N(i, E_STEPPERS) {
|
||||
if (e >= 0 && i != e) continue;
|
||||
if (echo) SERIAL_ECHO_START(); else SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOLNPAIR_P(PSTR(" M92 T"), (int)i,
|
||||
|
Reference in New Issue
Block a user