main relay bench test uses a timer

This commit is contained in:
Matthew Kennedy 2024-04-25 16:22:16 -07:00
parent 632c493c4f
commit e6442f06f0
3 changed files with 4 additions and 7 deletions

View File

@ -406,10 +406,7 @@ todo: move to shutdown_controller.cpp
}
bool Engine::isInMainRelayBench() {
if (mainRelayBenchStartNt == 0) {
return false;
}
return (getTimeNowNt() - mainRelayBenchStartNt) < NT_PER_SECOND;
return mainRelayBenchTimer.hasElapsedSec(1);
}
bool Engine::isInShutdownMode() const {

View File

@ -303,7 +303,7 @@ public:
SensorsState sensors;
efitick_t mainRelayBenchStartNt;
Timer mainRelayBenchTimer;
void preCalculate();

View File

@ -245,9 +245,9 @@ void acRelayBench(void) {
pinbench(1000.0, 100.0, 1, enginePins.acRelay);
}
static void mainRelayBench(void) {
static void mainRelayBench() {
// main relay is usually "ON" via FSIO thus bench testing that one is pretty unusual
engine->mainRelayBenchStartNt = getTimeNowNt();
engine->mainRelayBenchTimer.reset();
}
static void hpfpValveBench(void) {