sl-firmware d41a9dfe10 feat(safety): remote e-stop over 4G MQTT (Issue #63)
STM32 firmware:
- safety.h/c: EstopSource enum, safety_remote_estop/clear/get/active()
  CDC 'E'=ESTOP_REMOTE, 'F'=ESTOP_CELLULAR_TIMEOUT, 'Z'=clear latch
- usbd_cdc_if: cdc_estop_request/cdc_estop_clear_request volatile flags
- status: status_update() +remote_estop param; both LEDs fast-blink 200ms
- main.c: immediate motor cutoff highest-priority; arming gated by
  !safety_remote_estop_active(); motor estop auto-clear gated; telemetry
  'es' field 0-4; status_update() updated to 5 args

Safety: IMMEDIATE motor cutoff, latched until explicit Z + DISARMED,
cannot re-arm via MQTT alone (requires RC arm hold). IWDG-safe.

Jetson bridge:
- remote_estop_node.py: paho-mqtt + pyserial, cellular watchdog 5s
- estop_params.yaml, remote_estop.launch.py
- setup.py / package.xml: register node + paho-mqtt dep
- docker-compose.yml: remote-estop service
- test_remote_estop.py: kill/clear/watchdog/latency unit tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 04:55:54 -05:00

21 lines
712 B
C

#ifndef STATUS_H
#define STATUS_H
#include <stdint.h>
void status_init(void);
void status_boot_beep(void);
/*
* status_update() — call every main loop iteration.
* Controls LED1 (PC15) and LED2 (PC14), both active-low.
*
* Solid ON = good (normal operation)
* Slow blink (~1 Hz) = needs attention (error or fault)
*
* LED1 solid + LED2 off → disarmed, IMU OK
* LED1 solid + LED2 solid → armed
* Both slow blink → tilt fault
* Both fast blink (200ms) -- remote e-stop active (highest priority)
* LED1 slow blink + LED2 solid → IMU error (solid LED2 = always-on indicator)
*/
void status_update(uint32_t tick, int imu_ok, int armed, int tilt_fault, int remote_estop);
#endif