shithub: m8c

Download patch

ref: ffbdb212f0a58ea4a73f149cfc5d29357342905e
parent: 1d51460cd917febf948a6d675a313927aac2796b
author: Jonne Kokkonen <jonne.kokkonen@ambientia.fi>
date: Tue Aug 29 06:20:24 EDT 2023

fix background color detect in big font mode, reset display again after audio init

--- a/main.c
+++ b/main.c
@@ -87,11 +87,13 @@
   do {
     // try to init serial port
     int port_inited = init_serial(1);
-    // if port init was successful, try to reset display
-    if (port_inited == 1 && enable_and_reset_display() == 1) {
+    // if port init was successful, try to enable and reset display
+    if (port_inited == 1 && enable_and_reset_display(0) == 1) {
       // if audio routing is enabled, try to initialize audio devices
       if (conf.audio_enabled == 1) {
         audio_init(conf.audio_buffer_size, conf.audio_device_name);
+        // if audio is enabled, reset the display for second time to avoid glitches
+        reset_display();
       }
       run = RUN;
     } else {
@@ -141,7 +143,6 @@
             }
 
             int result = enable_and_reset_display();
-            SDL_Delay(100);
             // Device was found; enable display and proceed to the main loop
             if (result == 1) {
               run = RUN;
--- a/render.c
+++ b/render.c
@@ -146,8 +146,9 @@
   render_rect.w = command->size.width;
 
   // Background color changed
-  if (render_rect.x == 0 && render_rect.y == 0 && render_rect.w == 320 &&
+  if (render_rect.x == 0 && render_rect.y <= 0 && render_rect.w == 320 &&
       render_rect.h >= 240) {
+    SDL_LogDebug(SDL_LOG_CATEGORY_SYSTEM, "BG color change: %d %d %d",command->color.r,command->color.g,command->color.b);
     background_color.r = command->color.r;
     background_color.g = command->color.g;
     background_color.b = command->color.b;
--- a/serial.c
+++ b/serial.c
@@ -197,8 +197,8 @@
     return 0;
   }
 
-  SDL_Delay(10);
   result = reset_display();
+
   return result;
 }
 
--