- LEGACY/remote/teensy/: old remote sketch from https://mangavalk.com/Hexapod/remote.git @ 492dece (reference only). - remote/Config.h: sticks on A0-A5, Nextion on Serial1 (0/1), as in the old sketch; MPU6050 moved to Wire2 (25/24) since A4/A5 are Wire's pins. - NextionUI: controls on a vscope-global "control" page added to the old HMI; keeps the old t1 status texts; the old page-1 b2 button (and serial 'U') enter Nextion upload passthrough, following the PC's baud. - Docs: NEXTION.md, remote README wiring, CLAUDE.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.5 KiB
C++
34 lines
1.5 KiB
C++
#include "SerialConsole.h"
|
|
#include <Arduino.h>
|
|
|
|
bool SerialConsole::poll(UiEvent& ui, Local& local) {
|
|
ui = UiEvent{};
|
|
local = Local::None;
|
|
while (Serial.available()) {
|
|
char c = Serial.read();
|
|
switch (c) {
|
|
case 'a': ui.cmd = UiCmd::ToggleArm; return true;
|
|
case 'k': ui.cmd = UiCmd::Disarm; return true;
|
|
case 's': ui.cmd = UiCmd::ToggleStand; return true;
|
|
case 'g': ui.cmd = UiCmd::ToggleGait; return true;
|
|
case 'm': ui.cmd = UiCmd::ToggleWalkMode; return true;
|
|
case 't': ui.cmd = UiCmd::ToggleRStickXlate; return true;
|
|
case 'r': ui.cmd = UiCmd::ToggleRemoteGyro; return true;
|
|
case 'b': ui.cmd = UiCmd::ToggleRobotGyro; return true;
|
|
case '+': case '=': ui.cmd = UiCmd::SpeedUp; return true;
|
|
case '-': case '_': ui.cmd = UiCmd::SpeedDown; return true;
|
|
case ']': ui.cmd = UiCmd::HeightUp; return true;
|
|
case '[': ui.cmd = UiCmd::HeightDown; return true;
|
|
case 'z': ui.cmd = UiCmd::ZeroGyro; return true;
|
|
case 'c': ui.cmd = UiCmd::CalStartSave; return true;
|
|
case 'x': ui.cmd = UiCmd::CalCancel; return true;
|
|
case 'U': ui.cmd = UiCmd::NextionUpload; return true;
|
|
case 'p': local = Local::PrintStatus; return true;
|
|
case 'd': local = Local::ToggleDump; return true;
|
|
case 'R': local = Local::ResetCal; return true;
|
|
default: break; // ignore line endings and unknown keys
|
|
}
|
|
}
|
|
return false;
|
|
}
|