Commit Graph
7 Commits
Author SHA1 Message Date
jessikitty b2016565f7 Restart hub scans that find nothing
A Legoino scan that never locates its hub ends quietly - isConnecting()
never goes true, so the old code left 'initialised' set and never touched
retryAt. That hub then sat on a dead scan until the board was power
cycled, which is why first connects needed several attempts.

Adds scanExpiresAt per hub and restarts the scan after 12s. Also
documents the startup order and the LED grounding in the header.
2026-09-15 23:08:38 +10:00
jessikitty 0c149272bd Smoother arms, and swap head tilt/turn ports
- ARM_STEP_DEG 8 -> 3 and a dedicated ARM_MIN_GAP_MS of 60, so the arm
  tracks the trigger instead of jumping between targets. Speed and spans
  left as they were.
- hub1 port B is the tilt motor, C is the turn motor - swapped from what
  the first build assumed.
- Zero the arm encoders once per boot rather than on every reconnect. The
  hub keeps its preset, and re-zeroing mid-session would redefine zero at
  whatever position the arms were in when the link dropped.
2026-09-11 12:34:56 +10:00
jessikitty 343544510f Position-controlled arms
Trigger position now sets arm ANGLE rather than power, via
setAbsoluteMotorPosition with BrakingStyle::HOLD. Encoders are zeroed on
hub1 connect, so both arms must be down at that moment.

Spans measured with tools/arm_calibrate: roughly +280 left, -275 right,
both comfortably under one motor revolution so the absolute encoder is
unambiguous. Set to +/-250 to keep backlash clear of the end stop.

L3/R3 are no longer bound - releasing the trigger is lowering.
Also documents the async-init trap in serviceHub.
2026-09-10 21:31:30 +10:00
jessikitty f5e7517cbd Evolved control scheme
- Correct hub1 port map: A is the left arm, C is the head tilt.
- Arms: L2/R2 raise proportionally, L3/R3 lower at reduced power.
- Head turn onto L1/R1, head tilt onto d-pad left/right, body lift onto
  d-pad up/down. All move while held.
- Square is now the panic stop; Cross toggles 50/100% track speed.
- Circle and Triangle toggle two GPIO LED circuits on pins 25 and 26.
- Latching controls are edge-detected; frames arrive at ~50Hz so a held
  button would otherwise toggle continuously.
2026-09-10 16:20:44 +10:00
jessikitty 39bc43a878 Working configuration - verified on hardware
- Swap HUB0/HUB1 addresses; they were the wrong way round.
- Add DIR_* constants for all seven motors, with DIR_RIGHT_TRACK at -1.
- Swap the right arm buttons: Cross raises, Triangle lowers.
- Move struct Frame into the types block - the Arduino prototype
  generator needs it declared above the first function definition.
- Pin core 2.0.17 in the header; 3.x will not build Legoino.
2026-09-10 11:39:37 +10:00
jessikitty 0b32384578 Rewrite receiver for all 7 Johnny 5 motors with tank drive
- Parse the extended frame (d-pad and analog triggers).
- Drive both hubs across all seven ports, one input per motor.
- Add a per-hub rate limit alongside the per-port one; hub1 has four
  motors and the per-port throttle alone floods it.
- DEBUG_MOTORS flag to log which port each command lands on.
2026-09-09 19:29:12 +10:00
jessikitty fe7960a00e Add Legoino receiver sketch for two Powered Up hubs 2026-08-27 19:32:36 +10:00