Engineering, firmware
Specified, not written.
No line of second generation firmware exists yet. What exists is this specification, from the record, precise enough that the code it describes has no decisions left to make.
The reflex loop
Five steps, every tick.
From docs/05. The loop runs on the RP2350 with no operating system; a stuck actuator write can never delay a sensor read because the two buses are separate; brownout and watchdog reset land in a safe state with all motors off.
- Read both laser grids on the sensor I2C bus and the radar on its UART.
- Fuse a per column nearest distance map and detect drop offs.
- Apply the three laws to produce twenty amplitude and rhythm commands.
- Write the commands through the actuator I2C bus to the DRV2605L drivers.
- Service the hardware watchdog every tick.
The one way link
The Reflex only transmits.
From docs/05 and docs/06. The Reflex has no data dependency on the Spine or the phone: its TX pin feeds the Spine's RX, and no wire runs back. Nothing upstream can block a warning.
Once per control tick, the Reflex emits one 20 byte T.E.K.-Link 0.1 frame, the team's own format, not a standard. The Spine logs it and forwards it to the phone over Bluetooth; the tens of milliseconds that link costs never touch the warning path.
T.e.k.-link 0.1
Twenty bytes, little endian, once per tick.
| Offset | Bytes | Field | Meaning |
|---|---|---|---|
| 0 | 1 | SYNC | frame start marker |
| 1 | 1 | VER | protocol version, 0x01 |
| 2 | 1 | SEQ | rolling counter |
| 3 | 1 | FLAGS | drop off, mover present, fault bits |
| 4 | 8 | COLS | eight belt column nearest distances |
| 12 | 1 | HEAD | collar nearest distance |
| 13 | 2 | GND | ground and drop off state |
| 15 | 2 | MOVER | nearest mover range and bearing |
| 17 | 1 | AMPL | global amplitude summary |
| 18 | 1 | STATE | reflex state machine code |
| 19 | 1 | CRC8 | over bytes 0 to 18 |