truncate display_block area if too large
Dieser Commit ist enthalten in:
Ursprung
0dbd2a14d7
Commit
6a4b62579d
6
lcd.c
6
lcd.c
@ -465,9 +465,9 @@ uint8_t lcd_check_buffer(uint8_t x, uint8_t y) {
|
|||||||
return displayBuffer[(y / (DISPLAY_HEIGHT/8))][x] & (1 << (y % (DISPLAY_HEIGHT/8)));
|
return displayBuffer[(y / (DISPLAY_HEIGHT/8))][x] & (1 << (y % (DISPLAY_HEIGHT/8)));
|
||||||
}
|
}
|
||||||
void lcd_display_block(uint8_t x, uint8_t line, uint8_t width) {
|
void lcd_display_block(uint8_t x, uint8_t line, uint8_t width) {
|
||||||
if (line > (DISPLAY_HEIGHT/8-1)) return;
|
if (line > (DISPLAY_HEIGHT/8-1) || x > DISPLAY_WIDTH - 1){return;}
|
||||||
if (x + width > DISPLAY_WIDTH - 1) {
|
if (x + width > DISPLAY_WIDTH) { // no -1 here, x alone is width 1
|
||||||
width = DISPLAY_WIDTH - x - 1;
|
width = DISPLAY_WIDTH - x;
|
||||||
}
|
}
|
||||||
lcd_goto_xpix_y(x,line);
|
lcd_goto_xpix_y(x,line);
|
||||||
lcd_data(&displayBuffer[line][x], width);
|
lcd_data(&displayBuffer[line][x], width);
|
||||||
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren