DC/DC: Simplify startup_inhibit function and increase time

This commit is contained in:
Martin Jäger
2021-05-17 14:58:56 +02:00
parent 2a59a010ff
commit 70cd1e0c8d
2 changed files with 6 additions and 9 deletions
+4 -9
View File
@@ -208,20 +208,15 @@ bool Dcdc::check_hs_mosfet_short()
bool Dcdc::startup_inhibit(bool reset)
{
// wait at least 100 ms for voltages to settle
static const int num_wait_calls =
(CONFIG_CONTROL_FREQUENCY / 10 >= 1) ? (CONFIG_CONTROL_FREQUENCY / 10) : 1;
static int startup_delay_counter = 0;
static uint32_t inhibit_start;
if (reset) {
startup_delay_counter = 0;
inhibit_start = uptime();
return true;
}
else {
startup_delay_counter++;
return (uptime() < inhibit_start + DCDC_STARTUP_INHIBIT_TIME);
}
return (startup_delay_counter < num_wait_calls);
}
__weak void Dcdc::control()
+2
View File
@@ -20,6 +20,8 @@
#include "power_port.h"
#define DCDC_STARTUP_INHIBIT_TIME 3 // seconds
/**
* DC/DC operation mode
*