mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-22 22:50:49 +08:00
* fix(battery): don't let a charging battery switch off the battery failsafes Since #28422 a DroneCAN battery that sets its charging flag reports WARNING_CHARGING, which is 7. The battery check keeps the highest warning across batteries and, while armed, only lets it rise, but the failsafe has no action for 7. So one charging report outranked a real emergency on another pack and stayed latched until disarm, and a vehicle that armed while still charging on a dock never got a low battery failsafe at all. The driver also replaced a real low, critical or emergency warning with charging, so a nearly empty pack on a charger still passed the arming check. The driver now reports charging only while the pack has no real warning, and the battery check treats charging as no warning when it picks the worst one. MAVLink still shows charging while the pack has no warning. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu> * test(commander): cover a charging battery in the battery check A charging pack doesn't outrank another pack's emergency, charging at arming doesn't latch over a later low or critical warning, and charging on its own is no warning. All three fail without the fix. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu> * docs(msg): say WARNING_CHARGING is a state, not a severity The DroneCAN driver only reports charging when no other warning applies, and the battery check and HIGH_LATENCY2 stream rely on that and on not ordering it against the real warnings. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com> * fix(mavlink): don't flag a charging battery as failed in HIGH_LATENCY2 WARNING_CHARGING is 7, so the greater-than-LOW test set HL_FAILURE_FLAG_BATTERY for every healthy pack on a charger. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com> --------- Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu> Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com> Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>