shithub: m8c

Download patch

ref: 05a83039eeae5566e8b960e02fdfb40d8b39747b
parent: 65d1042e5bb864787b960a2ae8c0ea85de5902f4
author: Jonne Kokkonen <jonne.kokkonen@gmail.com>
date: Fri Dec 24 16:46:44 EST 2021

try to improve main loop a bit

--- a/main.c
+++ b/main.c
@@ -107,7 +107,7 @@
     }
 
     // read serial port
-    size_t bytes_read = sp_nonblocking_read(port, serial_buf, serial_read_size);
+    size_t bytes_read = sp_blocking_read(port, serial_buf, serial_read_size, 1);
     if (bytes_read < 0) {
       SDL_LogCritical(SDL_LOG_CATEGORY_ERROR, "Error %d reading serial. \n",
                       (int)bytes_read);
@@ -120,17 +120,13 @@
         int n = slip_read_byte(&slip, rx);
         if (n != SLIP_NO_ERROR) {
           if (n == SLIP_ERROR_INVALID_PACKET) {
-            // Reset display on invalid packets. On current firmwares this can cause a softlock in effect list so this is commented out for now.
-            //reset_display(port);
+            reset_display(port);
           } else {
             SDL_LogError(SDL_LOG_CATEGORY_ERROR, "SLIP error %d\n", n);
           }
         }
       }
-      usleep(10);
-    } else {
       render_screen();
-      usleep(100);
     }
   }
 
--