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

@@ -126,7 +126,7 @@ void GcodeSuite::M48() {
if (probing_good) {
randomSeed(millis());
for (uint8_t n = 0; n < n_samples; n++) {
LOOP_L_N(n, n_samples) {
#if HAS_SPI_LCD
// Display M48 progress in the status bar
ui.status_printf_P(0, PSTR(S_FMT ": %d/%d"), GET_TEXT(MSG_M48_POINT), int(n + 1), int(n_samples));
@@ -149,7 +149,7 @@ void GcodeSuite::M48() {
SERIAL_ECHOLNPGM("CW");
}
for (uint8_t l = 0; l < n_legs - 1; l++) {
LOOP_L_N(l, n_legs - 1) {
float delta_angle;
if (schizoid_flag) {
@@ -204,7 +204,7 @@ void GcodeSuite::M48() {
* Get the current mean for the data points we have so far
*/
float sum = 0.0;
for (uint8_t j = 0; j <= n; j++) sum += sample_set[j];
LOOP_LE_N(j, n) sum += sample_set[j];
mean = sum / (n + 1);
NOMORE(min, sample_set[n]);
@@ -215,7 +215,7 @@ void GcodeSuite::M48() {
* data points we have so far
*/
sum = 0.0;
for (uint8_t j = 0; j <= n; j++)
LOOP_LE_N(j, n)
sum += sq(sample_set[j] - mean);
sigma = SQRT(sum / (n + 1));