|
|
|
|
@ -145,7 +145,9 @@ void Send(int16_t uSteer, int16_t uSpeed)
|
|
|
|
|
|
|
|
|
|
// ########################## RECEIVE ##########################
|
|
|
|
|
void Receive()
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
int old_cursorX, old_cursorY;
|
|
|
|
|
// Check for new data availability in the Serial buffer
|
|
|
|
|
if (Serial1.available()) {
|
|
|
|
|
incomingByte = Serial1.read(); // Read the incoming byte
|
|
|
|
|
@ -205,6 +207,16 @@ void Receive()
|
|
|
|
|
Serial.print(" 8: ");
|
|
|
|
|
Serial.println(Feedback.boardTemp);
|
|
|
|
|
}
|
|
|
|
|
display.setCursor(0, 30);
|
|
|
|
|
display.setTextSize(1); // Draw 1X-scale text
|
|
|
|
|
display.setTextColor(SSD1306_WHITE);
|
|
|
|
|
display.print("V : ");
|
|
|
|
|
old_cursorX = display.getCursorX();
|
|
|
|
|
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(Feedback.batVoltage);
|
|
|
|
|
display.display();
|
|
|
|
|
} else {
|
|
|
|
|
if (Serial)
|
|
|
|
|
Serial.println("Non-valid data skipped");
|
|
|
|
|
@ -224,8 +236,8 @@ int old_cursorX, old_cursorY;
|
|
|
|
|
nchuk.reconnect();
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
cmd1 = map(nchuk.joyX(),0,256,-300,300); // x - axis. Nunchuck joystick readings range 30 - 230
|
|
|
|
|
cmd2 = map(nchuk.joyY(),0,256, 300, -300); // y - axis
|
|
|
|
|
cmd1 = map(nchuk.joyX(),0,256,150,-150); // x - axis. Nunchuck joystick readings range 30 - 230
|
|
|
|
|
cmd2 = map(nchuk.joyY(),0,256,-150,150); // y - axis
|
|
|
|
|
}
|
|
|
|
|
display.setCursor(0, 40);
|
|
|
|
|
display.setTextSize(1); // Draw 1X-scale text
|
|
|
|
|
|