diff --git a/firmware/main.c b/firmware/main.c index 16e7830..e56d013 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -8,7 +8,7 @@ void spi_proc() { - static uint8_t spi_cs_last = 0; + static uint8_t new_data = 0; static uint8_t x = 0; static uint8_t y = DISPLAY_HEIGHT / 8 - 1; uint8_t spi_cs; @@ -21,21 +21,22 @@ void spi_proc() if (y == 0) { y = DISPLAY_HEIGHT / 8 - 1; x++; - if (x == DISPLAY_WIDTH) + if (x == DISPLAY_WIDTH) { x = 0; + new_data = 1; // Only update the display if a full frame was received + } } else { y--; } } } else { - if (spi_cs_last) { + if (new_data) { lcd_display(); + new_data = 0; } x = 0; y = DISPLAY_HEIGHT / 8 - 1; } - - spi_cs_last = spi_cs; } int main()