AP_BattMonitor: fixed a segv with BATT_MONITOR=14

this causes a hang on boot on some boards
This commit is contained in:
Andrew Tridgell 2021-12-28 19:08:34 +11:00 committed by Peter Barker
parent 3ff9b76b08
commit fa2ae44926
1 changed files with 3 additions and 1 deletions

View File

@ -22,12 +22,14 @@ AP_BattMonitor_SMBus_SUI::AP_BattMonitor_SMBus_SUI(AP_BattMonitor &mon,
cell_count(_cell_count)
{
_pec_supported = false;
_dev->set_retries(2);
}
void AP_BattMonitor_SMBus_SUI::init(void)
{
AP_BattMonitor_SMBus::init();
if (_dev) {
_dev->set_retries(2);
}
if (_dev && timer_handle) {
// run twice as fast for two phases
_dev->adjust_periodic_callback(timer_handle, 50000);