diff --git a/src/hoverserial.ino b/src/hoverserial.ino index f60b2b8..49a4672 100644 --- a/src/hoverserial.ino +++ b/src/hoverserial.ino @@ -38,7 +38,9 @@ #define HOVER_SERIAL_BAUD 115200 // [-] Baud rate for HoverSerial (used to communicate with the hoverboard) #define SERIAL_BAUD 115200 // [-] Baud rate for built-in Serial (used for the Serial Monitor) -#define START_FRAME 0xAAAA // [-] Start frme definition for reliable serial communication +// #define START_FRAME 0xAAAA // [-] Start frme definition for reliable serial communication +#define START_FRAME 0xABCD // [-] Start frme definition for reliable serial communication + #define TIME_SEND 25 // [ms] Sending time interval #define SPEED_MAX_TEST 300 // [-] Maximum speed for testing //#define DEBUG_RX // [-] Debug received data. Prints all bytes to serial (comment-out to disable) @@ -101,6 +103,10 @@ Nunchuk nchuk; // ########################## SETUP ########################## void setup() { + Serial.begin(SERIAL_BAUD); + if (Serial) { + Serial.println(VERSION_TAG); + } nchuk.begin(); while (!nchuk.connect()) { @@ -134,10 +140,6 @@ void setup() Serial1.begin(HOVER_SERIAL_BAUD); // RX, TX from arduino to TX RX on hoverboard board. ! be carreful 3v3 pinMode(LED_BUILTIN, OUTPUT); - Serial.begin(SERIAL_BAUD); - if (Serial) { - Serial.println(VERSION_TAG); - } } // ########################## SEND ########################## @@ -264,7 +266,8 @@ int old_cursorX, old_cursorY; old_cursorY = display.getCursorY(); display.fillRect(old_cursorX, old_cursorY, (6 * 5), 8, SSD1306_BLACK); // erase previous display display.setCursor(old_cursorX, old_cursorY); - display.print(cmd1); + // display.print(cmd1); + display.print(cmd2); /* display.setCursor(0, 50); display.setTextSize(1); // Draw 1X-scale text @@ -368,7 +371,7 @@ void loop(void) unsigned long timeNow = millis(); // Check for new received data -// Receive(); + Receive(); if (iTimeSend > timeNow) return;