Make all battery sensor drivers report their sample interval

To make use of the time abstraction in the leaky integrator.
This commit is contained in:
Matthias Grob
2020-04-01 21:36:39 +02:00
parent 4dc9ca69ab
commit 88c21337fa
14 changed files with 48 additions and 22 deletions

View File

@@ -350,7 +350,7 @@ void Simulator::handle_message_hil_sensor(const mavlink_message_t *msg)
static uint64_t last_integration_us = 0;
// battery simulation (limit update to 100Hz)
if (hrt_elapsed_time(&_last_battery_timestamp) >= 10_ms) {
if (hrt_elapsed_time(&_last_battery_timestamp) >= SimulatorBattery::SIMLATOR_BATTERY_SAMPLE_INTERVAL_US) {
const float discharge_interval_us = _param_sim_bat_drain.get() * 1000 * 1000;