shithub: m8c

Download patch

ref: 2c4fe83c40da40a982beaffc84564e172f1e9177
parent: 9e14ab7b90cad8d4d7a6a277db435dae14be84a5
author: Jonne Kokkonen <jonne.kokkonen@gmail.com>
date: Thu Apr 29 18:38:10 EDT 2021

update readme, change main thread delay logic

--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # m8c
 
-m8c is a Linux client for Dirtywave M8 tracker's headless mode. It is intended for use with lower end systems like RPi zero.
+m8c is a Linux client for Dirtywave M8 tracker's headless mode. It is intended for use with lower end systems like RPi zero. The application should be cross-platform ready and can be built in Mac OS and Windows (with MSYS2/MINGW64).
 
 Please note that routing the headless M8 USB audio isn't in the scope of this program -- if this is needed, it can be achieved with tools like jackd, alsa\_in and alsa\_out for example. Check out the guide in file AUDIOGUIDE.md for some instructions on routing the audio.
 
@@ -19,7 +19,7 @@
 ### Install required packages
 
 ```
-sudo apt update && sudo apt install -y git gcc make libsdl2-dev libsdl2-ttf-dev
+sudo apt update && sudo apt install -y git gcc make libsdl2-dev libsdl2-ttf-dev libserialport-dev
 ```
 
 ### Download source code
--- a/main.c
+++ b/main.c
@@ -4,9 +4,7 @@
 #include <libserialport.h>
 #include <signal.h>
 
-
 #include "serial.h"
-
 #include "command.h"
 #include "input.h"
 #include "render.h"
@@ -63,9 +61,8 @@
   // main loop
   while (run) {
 
-    //read serial port
-    size_t bytes_read =
-        sp_nonblocking_read(port, serial_buf, serial_read_size);
+    // read serial port
+    size_t bytes_read = sp_nonblocking_read(port, serial_buf, serial_read_size);
     if (bytes_read < 0) {
       fprintf(stderr, "Error %zu reading serial. \n", bytes_read);
       run = 0;
@@ -79,9 +76,11 @@
           fprintf(stderr, "SLIP error %d\n", n);
         }
       }
+    } else {
+      SDL_Delay(1);
     }
 
-    //get current inputs
+    // get current inputs
     input_msg_s input = get_input_msg();
 
     switch (input.type) {
@@ -111,9 +110,6 @@
     }
 
     render_screen();
-
-    SDL_Delay(1);
-    
   }
 
   // exit, clean up
--