2026 remote: tabbed Nextion UI, robot telemetry, servo centre calibration
Protocol v4: CmdPacket grows to 26 bytes (cal_cmd, cal_servo, cal_value); new 30-byte Telemetry rides back on the nRF24 ack payload (robot state, IMU, battery, 18 joint angles, packets/s, servo-cal echo). Each end drops wrong-length packets, so version mismatches still fail closed. Robot (owner-approved): SERVO_CAL state while disarmed, per-servo centre trims (+-200 us) in EEPROM, telemetry, battery reading; the IMU estimate now always runs (leveling still gated by ROBOT GYRO). Remote: generated HMI (scripts/make_remote_hmi.py) with pages splash, drive, status, servos, cal, setup, upload; page-aware NextionUI that only writes the showing page and only what changed; servo calibration and UPDATE DISPLAY on the touchscreen and serial console; battery module. The display is on Serial2 (pins 7/8), found on the real remote; the old sketch's Serial1 was never connected to it. Sim: RF24 shim supports ack payloads, API version 8 (hxsim_get_ack_payload); sim_smoke checks telemetry and every CAL command. Unity CmdPacket mirror updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
481610c9fd
commit
0b836af8de
40 files changed
+1463
-281
No files matched your search
@@ -109,24 +109,37 @@ constexpr uint32_t WALK_LINGER_MS = 250;
|
||||
// (post-deadzone, -1000..1000 scale), so the robot never arms mid-command.
|
||||
constexpr int16_t ARM_CENTER_TOLERANCE = 50;
|
||||
|
||||
// ---- Nextion touchscreen on Serial1 (RX1 = pin 0, TX1 = pin 1), as in the old remote ----
|
||||
#define NEXTION_SERIAL Serial1
|
||||
// BENCH: the old sketch used the ITEAD library, whose nexInit() talks at 9600
|
||||
// unless it was modified. This firmware expects 115200: add `bauds=115200`
|
||||
// to the HMI's Program.s (see remote/NEXTION.md) or set 9600 here.
|
||||
// ---- Nextion touchscreen on Serial2 (RX2 = pin 7, TX2 = pin 8) ----
|
||||
// Found on the real remote (2026-11-17): the display answers on Serial2 at 115200. The old
|
||||
// sketch's Serial1.begin() was a red herring; its ITEAD Nextion library used Serial2.
|
||||
#define NEXTION_SERIAL Serial2
|
||||
// The HMI (remote/remote.HMI) sets this with `bauds=115200` in Program.s.
|
||||
constexpr uint32_t NEXTION_BAUD = 115200;
|
||||
// Controls live on this page (remote/NEXTION.md). Its components must have
|
||||
// vscope = global, so the firmware can update them whichever page is showing.
|
||||
#define NEXTION_CONTROL_PAGE "control"
|
||||
// The old HMI's link-status texts, also vscope = global. Its pages are
|
||||
// 0 splashsceen (sic), 1 main, 2 servocal, 3 page0, 4 uploadscreen,
|
||||
// 5 joysticks; the texts are t1 on page 1 (main) and page 3 (page0).
|
||||
constexpr const char* NEXTION_STATUS_TEXTS[] = { "main.t1", "page0.t1" };
|
||||
// The old HMI's "upload" button: page 1, component id 5 (b2), sends the
|
||||
// standard touch event. It puts the remote into Nextion upload passthrough.
|
||||
constexpr uint8_t NEXTION_UPLOAD_BUTTON_PAGE = 1;
|
||||
constexpr uint8_t NEXTION_UPLOAD_BUTTON_ID = 5;
|
||||
#define NEXTION_UPLOAD_PAGE "uploadscreen"
|
||||
#define NEXTION_UPLOAD_PAGE "upload"
|
||||
// The firmware only writes the page that is showing (each page reports itself
|
||||
// with a 'P' frame), and only what changed since the last write.
|
||||
constexpr uint32_t NEXTION_RENDER_MS = 50; // repaint rate of the showing page
|
||||
constexpr uint32_t NEXTION_SERVOS_RENDER_MS = 100; // SERVOS page: 36 values, so a bit slower
|
||||
constexpr uint32_t NEXTION_FULL_REFRESH_MS = 2000; // re-push everything periodically (self-heals after a display reset)
|
||||
constexpr uint32_t NEXTION_LINK_REFRESH_MS = 250; // link-quality text update rate
|
||||
// A render is skipped while less than this is free in the TX buffer, so the
|
||||
// TX loop never blocks on the display.
|
||||
constexpr int NEXTION_TX_MIN_FREE = 400;
|
||||
constexpr uint32_t STATUS_MESSAGE_MS = 2500; // how long transient status messages stay up
|
||||
constexpr uint32_t UPLOAD_CONFIRM_MS = 3000; // UPDATE DISPLAY: second tap within this
|
||||
|
||||
// ---- Robot telemetry (ack payloads) ----
|
||||
constexpr uint32_t TELEMETRY_STALE_MS = 500; // older than this -> the display shows "no data"
|
||||
|
||||
// ---- Servo centre calibration (CAL page) ----
|
||||
constexpr int16_t SERVO_TRIM_STEP_SMALL_US = 1;
|
||||
constexpr int16_t SERVO_TRIM_STEP_BIG_US = 10;
|
||||
// SAVE / REVERT go out for this long (the robot acts once; repeats are harmless).
|
||||
constexpr uint32_t SERVO_CAL_OP_MS = 300;
|
||||
|
||||
// ---- Battery voltage (STATUS page) ----
|
||||
// BENCH: not built yet. Planned: the 18650's + through a 100k/100k divider
|
||||
// into A6 (pin 20) with 100 nF to GND (see README.md "Planned"). Then set
|
||||
// the pin to A6. 255 = not fitted: the display shows "--".
|
||||
constexpr uint8_t BATTERY_SENSE_PIN = 255;
|
||||
constexpr float BATTERY_DIVIDER = 2.0f; // battery V / pin V
|
||||
constexpr float BATTERY_ADC_REF_V = 3.3f;
|
||||
Reference in new issue
Block a user