Apply loop shorthand macros (#17159)

This commit is contained in:
Scott Lahteine
2020-03-13 23:18:16 -05:00
committed by GitHub
parent a96be32fae
commit 118bd2f8b2
93 changed files with 465 additions and 505 deletions

View File

@ -508,7 +508,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in
// Work on the drivers
//
for (uint8_t k = 0; k < driver_count; k++) {
LOOP_L_N(k, driver_count) {
uint8_t not_found = true;
for (j = 1; j <= L64XX::chain[0]; j++) {
PGM_P const str = (PGM_P)pgm_read_ptr(&index_to_axis[L64XX::chain[j]]);

View File

@ -54,7 +54,7 @@ Nozzle nozzle;
#endif
// Start the stroke pattern
for (uint8_t i = 0; i < (strokes >> 1); i++) {
LOOP_L_N(i, strokes >> 1) {
do_blocking_move_to_xy(end);
do_blocking_move_to_xy(start);
}
@ -91,7 +91,7 @@ Nozzle nozzle;
const bool horiz = ABS(diff.x) >= ABS(diff.y); // Do a horizontal wipe?
const float P = (horiz ? diff.x : diff.y) / zigs; // Period of each zig / zag
const xyz_pos_t *side;
for (uint8_t j = 0; j < strokes; j++) {
LOOP_L_N(j, strokes) {
for (int8_t i = 0; i < zigs; i++) {
side = (i & 1) ? &end : &start;
if (horiz)
@ -134,8 +134,8 @@ Nozzle nozzle;
do_blocking_move_to(start);
#endif
for (uint8_t s = 0; s < strokes; s++)
for (uint8_t i = 0; i < NOZZLE_CLEAN_CIRCLE_FN; i++)
LOOP_L_N(s, strokes)
LOOP_L_N(i, NOZZLE_CLEAN_CIRCLE_FN)
do_blocking_move_to_xy(
middle.x + sin((RADIANS(360) / NOZZLE_CLEAN_CIRCLE_FN) * i) * radius,
middle.y + cos((RADIANS(360) / NOZZLE_CLEAN_CIRCLE_FN) * i) * radius

View File

@ -96,8 +96,8 @@ void apply_rotation_xyz(const matrix_3x3 &matrix, float &_x, float &_y, float &_
// Reset to identity. No rotate or translate.
void matrix_3x3::set_to_identity() {
for (uint8_t i = 0; i < 3; i++)
for (uint8_t j = 0; j < 3; j++)
LOOP_L_N(i, 3)
LOOP_L_N(j, 3)
vectors[i][j] = float(i == j);
}
@ -134,8 +134,8 @@ matrix_3x3 matrix_3x3::create_look_at(const vector_3 &target) {
// Get a transposed copy of the matrix
matrix_3x3 matrix_3x3::transpose(const matrix_3x3 &original) {
matrix_3x3 new_matrix;
for (uint8_t i = 0; i < 3; i++)
for (uint8_t j = 0; j < 3; j++)
LOOP_L_N(i, 3)
LOOP_L_N(j, 3)
new_matrix.vectors[i][j] = original.vectors[j][i];
return new_matrix;
}
@ -145,8 +145,8 @@ void matrix_3x3::debug(PGM_P const title) {
serialprintPGM(title);
SERIAL_EOL();
}
for (uint8_t i = 0; i < 3; i++) {
for (uint8_t j = 0; j < 3; j++) {
LOOP_L_N(i, 3) {
LOOP_L_N(j, 3) {
if (vectors[i][j] >= 0.0) SERIAL_CHAR('+');
SERIAL_ECHO_F(vectors[i][j], 6);
SERIAL_CHAR(' ');