Merge branch 'master' of mygit.jblb.net:jerome/hoverserial into stm32

stm32
JbLb 6 years ago
commit f92b02fee9

@ -20,8 +20,8 @@ framework = arduino
platform = atmelavr
lib_deps =
Nintendo Extension Ctrl
upload_port = /dev/ttyACM*
monitor_port = /dev/ttyACM*
upload_port = /dev/ttyACM*
monitor_speed = 115200
[env:usbasp]

@ -151,7 +151,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
@ -211,6 +213,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");
@ -230,13 +242,13 @@ int old_cursorX, old_cursorY;
nchuk.reconnect();
} else {
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
Serial.print("X : "); Serial.println(nchuk.joyX());
Serial.print("Y : "); Serial.println(nchuk.joyY());
cmd1 = map(nchuk.joyX(),0,256,300,-300); // x - axis. Nunchuck joystick readings range 300 - -300
cmd2 = map(nchuk.joyY(),0,256,-300, 300); // y - axis
}
/*
display.setCursor(0, 40);

Loading…
Cancel
Save