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

@@ -0,0 +1,122 @@
#include "TransferDataStructure.h"
String getValue(String data, char separator, int index)
{
int found = 0;
int strIndex[] = { 0, -1 };
int maxIndex = data.length() - 1;
for (int i = 0; i <= maxIndex && found <= index; i++) {
if (data.charAt(i) == separator || i == maxIndex) {
found++;
strIndex[0] = strIndex[1] + 1;
strIndex[1] = (i == maxIndex) ? i + 1 : i;
}
}
return found > index ? data.substring(strIndex[0], strIndex[1]) : "";
}
dataStruct2 GetSerialData(dataStruct2 &dataIn, bool debug = false)
{
if (Serial.available() && Serial.peek() != -1)
{
// String data = Serial.readStringUntil('\r');
// while (Serial.read() >= 0);
// int maxIndex = data.length() - 1;
// int index = 0;
// int next_index;
// String data_word;
// String channel;
// String angle;
// do {
// next_index = data.indexOf(',', index);
//
// data_word = data.substring(index, next_index);
// channel = data_word.substring(0, data_word.indexOf('_'));
// angle = data_word.substring(data_word.indexOf('_') + 1);
//
// if (isDigit(angle[0])) // prevent error overwriting first entry.
// dataIn.servoPositions[channel.toInt()] = angle.toFloat();
//
// index = next_index + 1;
// } while ((next_index != -1) && (next_index < maxIndex));
/*String s = Serial.readStringUntil('s');
for (int i = 0; i < 18; i++)
{
Serial.setTimeout(10);
String c = Serial.readStringUntil('_');
String v = Serial.readStringUntil(',');
String cc = Serial.readStringUntil('=');
int channel = c.toInt();
int value = v.toInt();
int crc = cc.toInt();
if ((crc == (channel) * value) && value >= 0 && value <= 180)
dataIn.servoPositions[channel] = value;*/
//byte recv[18 + 1];
if (Serial.available() >= 18 + 1 + 2 + 30)
{
bool recc = false;
byte recv[256] = {0};
//Serial.readBytesUntil(0xffffff, recv, 255);
Serial.readBytesUntil(0xff, recv, 255);
for (int i = 0; i < 255 - 19; i++)
{
// if (recv[i + 1] == 0xff && recv[i + 2] == 0xff && recv[i + 3] == 0xff)
if (recv[i + 19] == 0xfe)
{
for (int j = 0; j < 18 + 1; j++)
{
recv[j] = recv[(i) + j];
}
recc = true;
break;
}
}
//s.getBytes(recv, s.length());
byte crc = 0x00;
for (int i = 0; i < 18; i++)
{
crc += recv[i];
}
if (crc == recv[18])
{
if (recc)
{
for (int i = 0; i < 18; i++)
{
dataIn.servoPositions[i] = recv[i];
}
}
}
//}
dataIn.remotePasstroughControl = true;
if (debug)
{
Serial.println("Enabled Servo Passtrough mode!");
Serial.println("Output line: ");
for (int i = 0; i < 18; i++)
{
Serial.print(i);
Serial.print(", ");
Serial.print(dataIn.servoPositions[i]);
Serial.println("");
}
Serial.println("");
}
}
}
return dataIn;
}