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

@@ -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