code cleanup

This commit is contained in:
Luca Borsari 2021-07-13 14:35:06 +02:00
parent a6215ac161
commit 7d20f555dd
3 changed files with 8 additions and 9 deletions

View file

@ -1,9 +1,8 @@
Revisions history
-----------------
* 2020-12-09: Ver 0.9.6 - Luca
...............................
* 2020-12-17: Ver 0.9.6- Luca // Gitlab Commit = 0.9.6a
.......................................................
- Removed dependency from "AsyncSerialLib"
- new class SerialCommand()
- Remove delay() (blocking) in Countdown phase

View file

@ -62,8 +62,7 @@ int SerialCommand::checkSerial() {
void SerialCommand::sendCommand(char* str) {
// get command length
int dlen=0;
// for(; dlen<_bufLen; dlen++ ) { // limit transmitted command length to received command buffer
for(; dlen<80; dlen++ ) { // limit transmitted command length to received command buffer
for(; dlen<80; dlen++ ) { // "dlen<80" to avoid infinite loop on malformed str without EOC
if(*(str+dlen) == _eoc ){
dlen++; // send EOC
break;

View file

@ -15,7 +15,6 @@
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
First public version by:
Angel Maldonado (https://gitlab.com/angeljmc)
Gerardo Barbarov (gbarbarov AT singulardevices DOT com)
@ -23,7 +22,6 @@
Basen on original idea and 2 players code by:
Gerardo Barbarov for Arduino day Seville 2019
https://github.com/gbarbarov/led-race
Public Repository for this code:
https://gitlab.com/open-led-race/olr-arduino
@ -49,7 +47,8 @@ char const version[] = "0.9.6";
#define PIN_LED 2 // R 500 ohms to DI pin for WS2812 and WS2813, for WS2813 BI pin of first LED to GND , CAP 1000 uF to VCC 5v/GND,power supplie 5V 2A
#define PIN_AUDIO 3 // through CAP 2uf to speaker 8 ohms
#define REC_COMMAND_BUFLEN 32
#define REC_COMMAND_BUFLEN 32 // received command buffer size
#define TX_COMMAND_BUFLEN 80 // send command buffer size
#define EOL '\n' // End of Command char used in Protocol
#define COLOR1 track.Color(255,0,0)
@ -135,7 +134,7 @@ static track_t tck;
static int const eeadrInfo = 0;
char txbuff[64];
@ -174,6 +173,8 @@ void draw_winner( track_t* tck, uint32_t color);
char cmd[REC_COMMAND_BUFLEN]; // Stores command received by ReadSerialComand()
SerialCommand serialCommand = SerialCommand(cmd, REC_COMMAND_BUFLEN, EOL, &Serial); // get complete command from serial
char txbuff[TX_COMMAND_BUFLEN];
Adafruit_NeoPixel track;