feat: Battery voltage telemetry + LVC (Issue #613) #626
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "sl-firmware/issue-613-battery-voltage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements 3-stage low voltage cutoff (LVC) protection using the existing
battery_read_mv()ADC interface.include/lvc.h/src/lvc.c— LVC state machineLVC_WARNING(21.0 V):MELODY_LOW_BATTERYbuzzer, every 30 s; full powerLVC_CRITICAL(19.8 V): double-beep every 10 s; motor speed scaled to 50%LVC_CUTOFF(18.6 V):MELODY_ERRORone-shot; motors disabled; latched until rebootlvc_get_power_scale()returns 100/50/0 — applied to ESC speed commandinclude/jlink.h—JLINK_TLM_LVC(0x8B, 4 bytes):voltage_mv,percent(fuel gauge 0-100),protection_state(LvcState)src/jlink.c—jlink_send_lvc_tlm()frame encoder (10 bytes total)src/main.c— integrationlvc_init()at startuplvc_tick(now, battery_read_mv())each 1 kHz loop ticklvc_is_cutoff()→safety_arm_cancel + balance_disarm + motor_driver_estoplvc_get_power_scale()applied to ESC speed beforemotor_driver_update()JLINK_TLM_LVCtelemetry with percent fuel gaugeinclude/config.h—LVC_WARNING_MV,LVC_CRITICAL_MV,LVC_CUTOFF_MV,LVC_HYSTERESIS_MV,LVC_TLM_HZCloses #613
3e60d7552ato7785a16bff