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

@@ -564,7 +564,7 @@ void MarlinUI::draw_status_screen() {
if (PAGE_UNDER(6 + 1 + 12 + 1 + 6 + 1)) {
// Extruders
#if DO_DRAW_HOTENDS
for (uint8_t e = 0; e < MAX_HOTEND_DRAW; ++e)
LOOP_L_N(e, MAX_HOTEND_DRAW)
_draw_hotend_status((heater_ind_t)e, blink);
#endif

View File

@@ -209,7 +209,7 @@ void ST7920_Lite_Status_Screen::clear_ddram() {
/* This fills the entire graphics buffer with zeros */
void ST7920_Lite_Status_Screen::clear_gdram() {
for (uint8_t y = 0; y < BUFFER_HEIGHT; y++) {
LOOP_L_N(y, BUFFER_HEIGHT) {
set_gdram_address(0, y);
begin_data();
for (uint8_t i = (BUFFER_WIDTH) / 16; i--;) write_word(0);
@@ -407,7 +407,7 @@ void ST7920_Lite_Status_Screen::draw_degree_symbol(uint8_t x, uint8_t y, const b
const uint8_t x_word = x >> 1,
y_top = degree_symbol_y_top,
y_bot = y_top + COUNT(degree_symbol);
for (uint8_t i = y_top; i < y_bot; i++) {
LOOP_S_L_N(i, y_top, y_bot) {
uint8_t byte = pgm_read_byte(p_bytes++);
set_gdram_address(x_word, i + y * 16);
begin_data();
@@ -467,10 +467,10 @@ void ST7920_Lite_Status_Screen::draw_progress_bar(const uint8_t value) {
const uint8_t char_pcnt = 100 / width; // How many percent does each 16-bit word represent?
// Draw the progress bar as a bitmap in CGRAM
for (uint8_t y = top; y <= bottom; y++) {
LOOP_S_LE_N(y, top, bottom) {
set_gdram_address(left, y);
begin_data();
for (uint8_t x = 0; x < width; x++) {
LOOP_L_N(x, width) {
uint16_t gfx_word = 0x0000;
if ((x + 1) * char_pcnt <= value)
gfx_word = 0xFFFF; // Draw completely filled bytes

View File

@@ -87,11 +87,11 @@ void clear_graphics_DRAM(u8g_t *u8g, u8g_dev_t *dev) {
u8g_SetAddress(u8g, dev, 0); // cmd mode
u8g_WriteByte(u8g, dev, 0x08); //display off, cursor+blink off
u8g_WriteByte(u8g, dev, 0x3E); //extended mode + GDRAM active
for (uint8_t y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM
LOOP_L_N(y, (LCD_PIXEL_HEIGHT) / 2) { //clear GDRAM
u8g_WriteByte(u8g, dev, 0x80 | y); //set y
u8g_WriteByte(u8g, dev, 0x80); //set x = 0
u8g_SetAddress(u8g, dev, 1); /* data mode */
for (uint8_t i = 0; i < 2 * (LCD_PIXEL_WIDTH) / 8; i++) //2x width clears both segments
LOOP_L_N(i, 2 * (LCD_PIXEL_WIDTH) / 8) //2x width clears both segments
u8g_WriteByte(u8g, dev, 0);
u8g_SetAddress(u8g, dev, 0); /* cmd mode */
}

View File

@@ -670,7 +670,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
case U8G_DEV_MSG_PAGE_NEXT:
if (++page > (HEIGHT / PAGE_HEIGHT)) return 1;
for (uint8_t y = 0; y < PAGE_HEIGHT; y++) {
LOOP_L_N(y, PAGE_HEIGHT) {
uint32_t k = 0;
#ifdef LCD_USE_DMA_FSMC
buffer = (y & 1) ? bufferB : bufferA;