Remote: match the old remote's hardware; old remote code in LEGACY

- 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>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-01 15:29:21 +02:00
1 parent 935526eab5
commit a961fa721b
18 files changed
+760 -76

No files matched your search

+38 -8
View File
@@ -14,7 +14,8 @@ remote/ Teensy 4.1 firmware (PlatformIO env remote)
shared/HexapodProtocol/ wire protocol, used by robot, remote and sim
sim/ robot firmware -> hexapod_sim.dll (CMake + g++), headless smoke test
Hexapod_Simulation_Unity/ Unity 6000.6 project that loads the DLL (Assets/HexapodSim/)
LEGACY/ owner's older material for reference (remote/remote.HMI = old Nextion UI, 6 pages)
LEGACY/ owner's older material for reference (remote/remote.HMI = old Nextion UI, 6 pages;
remote/teensy/ = old remote sketch from https://mangavalk.com/Hexapod/remote.git @ 492dece)
scripts/ PlatformIO helper
```
@@ -113,7 +114,7 @@ link-loss disarm) → PacketBuilder → `radio.write` → Nextion render.
| `RemoteState` | authoritative operator state and interlocks: arm needs centered sticks, disarm clears stand, stand needs armed, calibrate needs disarmed, link-loss auto-disarm. Smooths speed scale and fades remote tilt in/out |
| `PacketBuilder` | the inverse of InputMapper: stick frame → body frame per the contract, per-submode right-stick mapping, `FLAG_WALK` with 250 ms linger (twist ignored in mode B), tilt deadzone/scale × fade, zeros motion when disarmed |
| `RadioLink` | nRF24 TX, short retries (1, 3), ack-based link status and 32-packet quality % |
| `NextionUI` | library-free Nextion driver. HMI sends `'#' len cmd [val]` frames via `printh`. Remote pushes state by component name with diffing, a 2 s full refresh, and a redraw on the Nextion 0x88 "ready" frame |
| `NextionUI` | library-free Nextion driver on `Serial1`. HMI sends `'#' len cmd [val]` frames via `printh`. Remote pushes state by component name, as `control.<name>` (the owner adds a `control` page with vscope-global components to the old HMI), with diffing, a 2 s full refresh, and a redraw on the Nextion 0x88 "ready" frame. Also writes the old HMI's `t1` status texts (`NEXTION_STATUS_TEXTS`). The old page-1 `b2` sends a standard 0x65 touch frame, which triggers `runUploadPassthrough()`: USB ↔ display bridge for Nextion Editor, following `Serial.baud()`, never returns. Serial key `U` does the same |
| `SerialConsole` | USB keystrokes that mirror every UI command plus diagnostics |
| `SmoothedValue.h` | copy of the robot's (kept separate so robot/ stays untouched) |
| `NEXTION.md` | HMI build guide: component names, txt_maxl, touch event code |
@@ -284,17 +285,46 @@ Robot (`robot/README.md` has detail):
- `Limits::stancePolygonOk()` is computed but not acted on.
Remote (`remote/README.md` has detail):
- All pins in `remote/Config.h` (radio CE 9 / CSN 10, sticks A0–A3/A6/A7,
MPU6050 on 18/19, Nextion on Serial2 7/8).
- Pins in `remote/Config.h`, taken from the old remote sketch: radio CE 9 /
CSN 10, sticks A0–A5, Nextion on Serial1 (0/1). The MPU6050 is on
**Wire2 (25/24)**, since A4/A5 = Wire's SDA/SCL are stick pins; that's
the owner's choice and needs rewiring the MPU. Which stick axis is on
which pin is still unknown.
- `STICK_INVERT[]`, calibration defaults, deadzones, expo.
- `IMU_AXIS_FROM_CHIP` / `IMU_AXIS_SIGN` depend on how the MPU6050 is
mounted in the handset.
- The Nextion must have `bauds=115200` in Program.s, and the HMI must match
`NEXTION.md`. The owner's old 6-page HMI is in `LEGACY/remote/remote.HMI`;
its component names aren't readable outside Nextion Editor. Adapting
`NextionUI` to it needs the owner's component list, or the old remote
Teensy code, which the owner will add to `LEGACY/` when found. The
compiled `.tft` is gitignored.
its component names aren't readable outside Nextion Editor. The compiled
`.tft` is gitignored.
- What the old remote sketch (`LEGACY/remote/teensy/`, last ran on a
Teensy) tells us about the real hardware:
- **Nextion on `Serial1` (pins 0/1)**, driven by the ITEAD Nextion
library, whose `nexInit()` runs at 9600. `remote/Config.h` now uses
Serial1 and expects 115200 via `bauds=` in the HMI.
- The old HMI is a *servo monitor*, not the control UI in `NEXTION.md`:
- page 1: `t1` "connected"/"not connected", and `b2` = enter
upload mode;
- page 3: sliders `h0`–`h17` showing the 18 servo positions, plus
`t1` status;
- page 4: `uploadscreen`.
None of the arm/stand/gait/mode/gyro/speed/height controls exist yet.
The owner chose to add a `control` page per `NEXTION.md`.
- `b2` → **Nextion upload passthrough**: shows `uploadscreen`, then
bridges USB ↔ Serial1 forever, so Nextion Editor can upload a `.tft`
through the remote's USB port. The new firmware keeps this.
- Sticks on **A0–A5**, contiguous (`analogInPin + i`). On the Teensy 4.1,
A4/A5 are pins 18/19 = Wire SDA/SCL, which the MPU6050 needs. The old
code had the MPU code disabled (`if (false)`). Owner's decision: keep
the sticks, move the MPU to Wire2.
- nRF24 on CE 9 / CSN 10, the same as `remote/Config.h`. It used
RF24Network on channel 90, which the new protocol doesn't.
- Stick calibration was a 10 s min/max sweep saved to EEPROM, output
0–255, with no center or deadzone.
- USB serial at 250000. It received 18 servo bytes + checksum + `0xFE`
from the old Unity `Serial.cs` (servo passthrough, forwarded over RF
to the robot) and printed `i_value,...` stick lines.
- The Unity remote stand-in's joystick axis assignment (which of axes 4/6
is forward) couldn't be recovered from the old code. Check it with the
panel's raw-axis readout.