fix: Status LEDs solid=OK blink=error (#22) #26

Merged
seb merged 2 commits from sl-firmware/status-leds into main 2026-02-28 18:45:24 -05:00
Collaborator

Summary

New LED behavior (active-low: RESET=ON, SET=OFF):

State LED1 (PC15) LED2 (PC14)
Disarmed, IMU OK Solid ON OFF
Armed Solid ON Solid ON
Tilt fault Blink 1Hz Blink 1Hz
IMU error Blink 1Hz Solid ON

Rule: solid = good, slow blink (~1Hz) = needs attention.

Removed: fast 5Hz error blink (confusing), baro flash-every-5s pattern.

status_update() signature changed: baro_okarmed + tilt_fault so LED state reflects arm and fault directly.

Closes #22.

## Summary New LED behavior (active-low: RESET=ON, SET=OFF): | State | LED1 (PC15) | LED2 (PC14) | |---|---|---| | Disarmed, IMU OK | Solid ON | OFF | | Armed | Solid ON | Solid ON | | Tilt fault | Blink 1Hz | Blink 1Hz | | IMU error | Blink 1Hz | Solid ON | **Rule: solid = good, slow blink (~1Hz) = needs attention.** Removed: fast 5Hz error blink (confusing), baro flash-every-5s pattern. `status_update()` signature changed: `baro_ok` → `armed + tilt_fault` so LED state reflects arm and fault directly. Closes #22.
sl-firmware added 2 commits 2026-02-28 17:45:24 -05:00
On boot, before the main loop, sample 1000 gyro readings (~1s) while
board is held still. Compute per-axis mean offset (sensor-frame raw LSBs)
and subtract from all subsequent readings in mpu6000_read().

- mpu6000_calibrate(): LED1+LED2 solid ON during 1s sample window,
  resets filter state to zero once bias is known
- mpu6000_is_calibrated(): gate; main loop blocks arming and USB
  streaming until calibration completes
- Bias subtracted in sensor frame before CW270 axis transform + scale,
  so all three axes (pitch/roll/yaw rate) benefit
- config.h: GYRO_CAL_SAMPLES=1000
- No flash storage — recalibrate fresh each boot (bias varies with temp)

Closes #21 (3.5°/s yaw drift), #23 (gyro bias calibration on boot).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
New LED behavior (active-low, PC15=LED1, PC14=LED2):
  Disarmed, IMU OK : LED1 solid ON  + LED2 off
  Armed            : LED1 solid ON  + LED2 solid ON
  Tilt fault       : LED1 blink 1Hz + LED2 blink 1Hz
  IMU error        : LED1 blink 1Hz + LED2 solid ON

Rule: solid = good, slow blink (~1Hz) = needs attention.
Removed the confusing fast-blink-at-5Hz-for-error and the
baro-flash-every-5s patterns.

status_update() signature changed: baro_ok → armed + tilt_fault
so the LED pattern can reflect arm state directly.

Closes #22.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
seb approved these changes 2026-02-28 18:45:18 -05:00
seb left a comment
Owner

Flash-tested all 3 together. Gyro cal eliminates yaw drift, LEDs solid, I2C probe clean.

Flash-tested all 3 together. Gyro cal eliminates yaw drift, LEDs solid, I2C probe clean.
seb merged commit e1b82941ea into main 2026-02-28 18:45:24 -05:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: seb/saltylab-firmware#26
No description provided.