Compare commits

..

3 Commits

4
.gitignore vendored

@ -3,3 +3,7 @@
.vscode/ .vscode/
hoverserial.code-workspace hoverserial.code-workspace
.piolibdeps/ .piolibdeps/
hoverserial.ino
build_opt.h
.gcc-flags.json
.clang_complete

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

@ -148,7 +148,9 @@ void Send(int16_t uSteer, int16_t uSpeed)
// ########################## RECEIVE ########################## // ########################## RECEIVE ##########################
void Receive() void Receive()
{ {
int old_cursorX, old_cursorY;
// Check for new data availability in the Serial buffer // Check for new data availability in the Serial buffer
if (Serial1.available()) { if (Serial1.available()) {
incomingByte = Serial1.read(); // Read the incoming byte incomingByte = Serial1.read(); // Read the incoming byte
@ -208,6 +210,16 @@ void Receive()
Serial.print(" 8: "); Serial.print(" 8: ");
Serial.println(Feedback.boardTemp); 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 { } else {
if (Serial) if (Serial)
Serial.println("Non-valid data skipped"); Serial.println("Non-valid data skipped");
@ -228,12 +240,12 @@ int old_cursorX, old_cursorY;
} else { } 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("X : "); Serial.println(nchuk.joyX());
Serial.print("Y : "); Serial.println(nchuk.joyY()); 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); display.setCursor(0, 40);

Loading…
Cancel
Save