mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
fix(battery_simulator): constrain param to min of 1
to avoid division by zero. This reverts commit 6380c4fdee38f9f0c04cb9b5e69c8675595b9967.
This commit is contained in:
parent
6380c4fdee
commit
ab7e7b59bb
@ -85,7 +85,8 @@ void BatterySimulator::Run()
|
||||
|
||||
const hrt_abstime now_us = hrt_absolute_time();
|
||||
|
||||
const float discharge_interval_us = _param_sim_bat_drain.get() * 1000 * 1000;
|
||||
// Limit to +1.0 s to guard against division by 0
|
||||
const float discharge_interval_us = math::max(_param_sim_bat_drain.get(), 1.0f) * 1000 * 1000;
|
||||
|
||||
if (_armed) {
|
||||
if (_last_integration_us != 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user