diff --git a/src/hoverserial.ino b/src/hoverserial.ino index 9c88501..b11684b 100644 --- a/src/hoverserial.ino +++ b/src/hoverserial.ino @@ -95,14 +95,21 @@ void setup() // Clear the buffer display.clearDisplay(); display.display(); - display.setCursor(0, 0); display.setTextSize(1); // Draw 1X-scale text display.setTextColor(SSD1306_WHITE); + display. + setCursor(int + ((display.width() - + (strlen("Hoverboard Serial") * 6)) / 2), 0); display.println("Hoverboard Serial"); - display.println("v1.0"); + display.setCursor(52, 8); + display.println("v0.2"); +/* display.print("Nunchuk "); nchuk.connect()? display.print("") : display.print("not "); display.println("connected"); +*/ + display.display(); Serial1.begin(HOVER_SERIAL_BAUD); // RX, TX from arduino to TX RX on hoverboard board. ! be carreful 3v3 @@ -159,11 +166,11 @@ void Receive() if (idx == sizeof(SerialFeedback)) { uint16_t checksum; checksum = - (uint16_t) (NewFeedback.start ^ NewFeedback.cmd1 ^ NewFeedback. - cmd2 ^ NewFeedback.speedR ^ NewFeedback. - speedL ^ NewFeedback.speedR_meas ^ NewFeedback. - speedL_meas ^ NewFeedback.batVoltage ^ NewFeedback. - boardTemp); + (uint16_t) (NewFeedback.start ^ NewFeedback. + cmd1 ^ NewFeedback.cmd2 ^ NewFeedback. + speedR ^ NewFeedback.speedL ^ NewFeedback. + speedR_meas ^ NewFeedback.speedL_meas ^ + NewFeedback.batVoltage ^ NewFeedback.boardTemp); // Check validity of the new data if (NewFeedback.start == START_FRAME @@ -259,8 +266,8 @@ void loop(void) display.print("Speed : "); old_cursorX = display.getCursorX(); old_cursorY = display.getCursorY(); - display.fillRect(old_cursorX,old_cursorY,(6*4),8,SSD1306_BLACK); // erase previous display - display.setCursor(old_cursorX,old_cursorY); + display.fillRect(old_cursorX, old_cursorY, (6 * 4), 8, SSD1306_BLACK); // erase previous display + display.setCursor(old_cursorX, old_cursorY); display.print(iTest); display.display(); // Calculate test command signal