diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 20bf5fbeb..613743e74 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -10916,12 +10916,12 @@ inline void gcode_M502() { Max7219_Clear(); if (parser.seen('F')) - for(uint8_t x = 0; x < MAX7219_X_LEDS; x++) + for (uint8_t x = 0; x < MAX7219_X_LEDS; x++) Max7219_Set_Column(x, 0xffffffff); if (parser.seenval('R')) { const uint32_t r = parser.value_int(); - Max7219_Set_Row(r, parser.ulongval('V')); + Max7219_Set_Row(r, parser.byteval('V')); return; } else if (parser.seenval('C')) { @@ -10939,7 +10939,7 @@ inline void gcode_M502() { } if (parser.seen('P')) { - for(uint8_t x = 0; x < (8*MAX7219_NUMBER_UNITS); x++) { + for (uint8_t x = 0; x < (8 * MAX7219_NUMBER_UNITS); x++) { SERIAL_ECHOPAIR("LEDs[", x); SERIAL_ECHOPAIR("]=", LEDs[x]); SERIAL_ECHO("\n"); diff --git a/Marlin/Max7219_Debug_LEDs.cpp b/Marlin/Max7219_Debug_LEDs.cpp index ff71903f2..79a59361f 100644 --- a/Marlin/Max7219_Debug_LEDs.cpp +++ b/Marlin/Max7219_Debug_LEDs.cpp @@ -48,7 +48,7 @@ #include "Marlin.h" #include "delay.h" -uint8_t LEDs[8*MAX7219_NUMBER_UNITS] = { 0 }; +uint8_t LEDs[8 * MAX7219_NUMBER_UNITS] = { 0 }; // Delay for 0.1875µs (16MHz AVR) or 0.15µs (20MHz AVR) #define SIG_DELAY() DELAY_NS(188) @@ -191,7 +191,7 @@ inline void _Max7219_Set_Digit_Segments(const uint8_t digit, const uint8_t val) void Max7219_Set_Row(const uint8_t row, const uint32_t val) { if (row >= MAX7219_Y_LEDS) return Max7219_Error(PSTR("Max7219_Set_Row"), row); uint32_t mask = 0x0000001; - for(uint8_t x = 0; x < MAX7219_X_LEDS; x++) { + for (uint8_t x = 0; x < MAX7219_X_LEDS; x++) { if (val & mask) SET_PIXEL_7219(MAX7219_X_LEDS-1-x, row); else @@ -199,7 +199,7 @@ void Max7219_Set_Row(const uint8_t row, const uint32_t val) { mask <<= 1; } #if _ROT == 90 || _ROT == 270 - for(uint8_t x = 0; x < 8; x++) + for (uint8_t x = 0; x < 8; x++) SEND_7219(x); // force all columns out to the Max7219 chips and strobe them #else SEND_7219(row); // force the single column out to the Max7219 chips and strobe them @@ -225,7 +225,7 @@ void Max7219_Clear_Row(const uint8_t row) { void Max7219_Set_Column(const uint8_t col, const uint32_t val) { if (col >= MAX7219_X_LEDS) return Max7219_Error(PSTR("Max7219_Set_Column"), col); uint32_t mask = 0x0000001; - for(uint8_t y = 0; y < MAX7219_Y_LEDS; y++) { + for (uint8_t y = 0; y < MAX7219_Y_LEDS; y++) { if (val & mask) SET_PIXEL_7219(col, MAX7219_Y_LEDS-1-y); else @@ -235,7 +235,7 @@ void Max7219_Set_Column(const uint8_t col, const uint32_t val) { #if _ROT == 90 || _ROT == 270 SEND_7219(col); // force the column out to the Max7219 chips and strobe them #else - for(uint8_t yy = 0; yy < 8; yy++) + for (uint8_t yy = 0; yy < 8; yy++) SEND_7219(yy); // force all columns out to the Max7219 chips and strobe them #endif return; @@ -244,13 +244,13 @@ void Max7219_Set_Column(const uint8_t col, const uint32_t val) { void Max7219_Clear_Column(const uint8_t col) { if (col >= MAX7219_X_LEDS) return Max7219_Error(PSTR("Max7219_Clear_Column"), col); - for(uint8_t yy = 0; yy < MAX7219_Y_LEDS; yy++) + for (uint8_t yy = 0; yy < MAX7219_Y_LEDS; yy++) CLEAR_PIXEL_7219(col, yy); #if _ROT == 90 || _ROT == 270 SEND_7219(col); // force the column out to the Max7219 chips and strobe them #else - for(uint8_t y = 0; y < 8; y++) + for (uint8_t y = 0; y < 8; y++) SEND_7219(y); // force all columns out to the Max7219 chips and strobe them #endif return; @@ -322,22 +322,22 @@ void Max7219_Set_Columns_32bits(const uint8_t x, uint32_t val) { void Max7219_register_setup() { // Initialize the Max7219 - for(int i=0; i < MAX7219_NUMBER_UNITS; i++) + for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++) Max7219(max7219_reg_scanLimit, 0x07); Max7219_pulse_load(); // tell the chips to load the clocked out data - for(int i=0; i < MAX7219_NUMBER_UNITS; i++) + for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++) Max7219(max7219_reg_decodeMode, 0x00); // using an led matrix (not digits) Max7219_pulse_load(); // tell the chips to load the clocked out data - for(int i=0; i < MAX7219_NUMBER_UNITS; i++) + for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++) Max7219(max7219_reg_shutdown, 0x01); // not in shutdown mode Max7219_pulse_load(); // tell the chips to load the clocked out data - for(int i=0; i < MAX7219_NUMBER_UNITS; i++) + for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++) Max7219(max7219_reg_displayTest, 0x00); // no display test Max7219_pulse_load(); // tell the chips to load the clocked out data - for(int i=0; i < MAX7219_NUMBER_UNITS; i++) + for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++) Max7219(max7219_reg_intensity, 0x01 & 0x0F); // the first 0x0F is the value you can set // range: 0x00 to 0x0F Max7219_pulse_load(); // tell the chips to load the clocked out data diff --git a/Marlin/Max7219_Debug_LEDs.h b/Marlin/Max7219_Debug_LEDs.h index ba8cf05d9..dc0609d7d 100644 --- a/Marlin/Max7219_Debug_LEDs.h +++ b/Marlin/Max7219_Debug_LEDs.h @@ -110,7 +110,7 @@ void Max7219_idle_tasks(); #define SET_PIXEL_7219(x, y) LEDs[y + (x >> 3) * 8] |= _BV(7 - (x & 0x07)) #define CLEAR_PIXEL_7219(x, y) LEDs[y + (x >> 3) * 8] &= (_BV(7 - (x & 0x07)) ^ 0xff) #define BIT_7219(x, y) TEST(LEDs[y + (x >> 3) * 8], 7 - (x & 0x07)) - #define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0); + #define SEND_7219(R) do{ for (int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); }while(0) #elif _ROT == 90 #define MAX7219_UPDATE_AXIS x // Fast line update axis for this orientation of the matrix display #define MAX7219_X_LEDS 8 @@ -119,7 +119,7 @@ void Max7219_idle_tasks(); #define SET_PIXEL_7219(x, y) LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)] |= _BV((y & 0x7)) #define CLEAR_PIXEL_7219(x, y) LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)] &= (_BV((y & 0x7)) ^ 0xff) #define BIT_7219(x, y) TEST(LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)], (y & 0x7)) - #define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0); + #define SEND_7219(R) do{ for (int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); }while(0) #elif _ROT == 180 #define MAX7219_UPDATE_AXIS y // Fast line update axis for this orientation of the matrix display #define MAX7219_X_LEDS (8 * MAX7219_NUMBER_UNITS) @@ -128,7 +128,7 @@ void Max7219_idle_tasks(); #define SET_PIXEL_7219(x, y) LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8] |= _BV((x & 0x07)) #define CLEAR_PIXEL_7219(x, y) LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8] &= (_BV((x & 0x07)) ^ 0xff) #define BIT_7219(x, y) TEST(LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8], ((x & 0x07))) - #define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0); + #define SEND_7219(R) do{ for (int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); }while(0) #elif _ROT == 270 #define MAX7219_UPDATE_AXIS x // Fast line update axis for this orientation of the matrix display #define MAX7219_X_LEDS 8 @@ -137,11 +137,11 @@ void Max7219_idle_tasks(); #define SET_PIXEL_7219(x, y) LEDs[x + (y >> 3) * 8] |= _BV(7 - (y & 0x7)) #define CLEAR_PIXEL_7219(x, y) LEDs[x + (y >> 3) * 8] &= (_BV(7 - (y & 0x7)) ^ 0xff) #define BIT_7219(x, y) TEST(LEDs[x + ( y >> 3) * 8], 7 - (y & 0x7)) - #define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0); + #define SEND_7219(R) do{ for (int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); }while(0) #else #error "MAX7219_ROTATE must be a multiple of +/- 90°." #endif -extern uint8_t LEDs[8*MAX7219_NUMBER_UNITS]; +extern uint8_t LEDs[8 * MAX7219_NUMBER_UNITS]; #endif // __MAX7219_DEBUG_LEDS_H__ diff --git a/Marlin/Sd2Card.cpp b/Marlin/Sd2Card.cpp index ab3fc2f37..118b83cd9 100644 --- a/Marlin/Sd2Card.cpp +++ b/Marlin/Sd2Card.cpp @@ -399,7 +399,7 @@ bool Sd2Card::readBlock(uint32_t blockNumber, uint8_t* dst) { #if ENABLED(SD_CHECK_AND_RETRY) uint8_t retryCnt = 3; - for(;;) { + for (;;) { if (cardCommand(CMD17, blockNumber)) error(SD_CARD_ERROR_CMD17); else if (readData(dst, 512)) diff --git a/Marlin/status_screen_lite_ST7920.h b/Marlin/status_screen_lite_ST7920.h index 144591da7..17cb44a66 100644 --- a/Marlin/status_screen_lite_ST7920.h +++ b/Marlin/status_screen_lite_ST7920.h @@ -395,7 +395,7 @@ void ST7920_Lite_Status_Screen::draw_degree_symbol(uint8_t x, uint8_t y, bool dr const uint8_t x_word = x >> 1; const uint8_t y_top = degree_symbol_y_top; const uint8_t y_bot = y_top + sizeof(degree_symbol)/sizeof(degree_symbol[0]); - for(uint8_t i = y_top; i < y_bot; i++) { + for (uint8_t i = y_top; i < y_bot; i++) { uint8_t byte = pgm_read_byte_near(p_bytes++); set_gdram_address(x_word,i+y*16); begin_data();