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

+13 -13
View File
@@ -9,15 +9,15 @@ static constexpr uint8_t REG_PWR_MGMT_1 = 0x6B;
static constexpr uint8_t REG_ACCEL_XOUT_H = 0x3B;
static bool writeReg(uint8_t reg, uint8_t val) {
Wire.beginTransmission(IMU_ADDR);
Wire.write(reg);
Wire.write(val);
return Wire.endTransmission() == 0;
IMU_WIRE.beginTransmission(IMU_ADDR);
IMU_WIRE.write(reg);
IMU_WIRE.write(val);
return IMU_WIRE.endTransmission() == 0;
}
bool RemoteIMU::begin() {
Wire.begin();
Wire.setClock(400000);
IMU_WIRE.begin();
IMU_WIRE.setClock(400000);
ok_ = writeReg(REG_PWR_MGMT_1, 0x00); // wake out of sleep
if (!ok_) return false;
writeReg(REG_CONFIG, 0x03); // 44 Hz DLPF: a handheld remote doesn't need more bandwidth
@@ -49,16 +49,16 @@ bool RemoteIMU::begin() {
}
bool RemoteIMU::readRaw(float a[3], float g[3]) {
Wire.beginTransmission(IMU_ADDR);
Wire.write(REG_ACCEL_XOUT_H);
if (Wire.endTransmission(false) != 0) return false;
Wire.requestFrom((int)IMU_ADDR, 14);
if (Wire.available() < 14) return false;
IMU_WIRE.beginTransmission(IMU_ADDR);
IMU_WIRE.write(REG_ACCEL_XOUT_H);
if (IMU_WIRE.endTransmission(false) != 0) return false;
IMU_WIRE.requestFrom((int)IMU_ADDR, 14);
if (IMU_WIRE.available() < 14) return false;
int16_t raw[7]; // ax ay az temp gx gy gz, big-endian
for (int k = 0; k < 7; k++) {
uint8_t hi = Wire.read(); // two statements: the order of calls inside one expression is unspecified
uint8_t lo = Wire.read();
uint8_t hi = IMU_WIRE.read(); // two statements: the order of calls inside one expression is unspecified
uint8_t lo = IMU_WIRE.read();
raw[k] = (int16_t)((hi << 8) | lo);
}