From beb6d33f855b133c3b4548fe6049ed5a32bb9898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Thu, 26 May 2022 10:39:03 +0200 Subject: [PATCH] app: add scrolling text animation --- application.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/application.c b/application.c index 1326ac5..d8fab32 100644 --- a/application.c +++ b/application.c @@ -879,11 +879,14 @@ void main(void) rgbmatrix_puts(1, 1, "DACHBODEN", FONT_KING10, false, true, false); rgbmatrix_puts(1, 12, "ZEIT", FONT_KING10, false, true, true); rgbmatrix_puts(1, 23, "MASCHINE", FONT_KING10, true, true, false); + sleep_ms(3000); // show the text for a tiny bit // start main loop bool action = false; // if an action has been performed don't go to sleep button_flag = false; // reset button flag led_on(); // switch LED to indicate booting completed + const char* scroll_text = "DACHBODEN ZEITMASCHINE"; + int16_t scroll_pos = 64; while (true) { // infinite loop iwdg_reset(); // kick the dog if (user_input_available) { // user input is available @@ -894,6 +897,13 @@ void main(void) } if (wakeup_flag) { // time to do periodic checks wakeup_flag = false; // clear flag + rgbmatrix_clear(); + rgbmatrix_puts(scroll_pos, 8, scroll_text, FONT_KING14, true, true, true); + if (scroll_pos < -1 * (int16_t)strlen(scroll_text) * (fonts[FONT_KING14].width + 1)) { + scroll_pos = 64; + } else { + scroll_pos -= 1; + } } if (second_flag) { // one second passed second_flag = false; // clear flag