Skip to content

Commit

Permalink
let's move away from PeriodicTimerController
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Aug 13, 2024
1 parent 00ac30a commit b6ccc9b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions firmware/hw_layer/microsecond_timer/microsecond_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#if EFI_PROD_CODE

#include "periodic_task.h"
#include "periodic_thread_controller.h"

// Just in case we have a mechanism to validate that hardware timer is clocked right and all the
// conversions between wall clock and hardware frequencies are done right
Expand Down Expand Up @@ -107,17 +107,16 @@ void portMicrosecondTimerCallback() {
}
}

class MicrosecondTimerWatchdogController : public PeriodicTimerController {
void PeriodicTask() override {
efitick_t nowNt = getTimeNowNt();
struct MicrosecondTimerWatchdogController : public PeriodicController<256> {
MicrosecondTimerWatchdogController()
: PeriodicController("MstWatchdog", NORMALPRIO, 2)
{
}

void PeriodicTask(efitick_t nowNt) override {
// 2 seconds of inactivity would not look right
efiAssertVoid(ObdCode::CUSTOM_TIMER_WATCHDOG, nowNt < lastSetTimerTimeNt + 2 * CORE_CLOCK, "Watchdog: no events for 2 seconds!");
}

int getPeriodMs() override {
return 500;
}
};

static MicrosecondTimerWatchdogController watchdogControllerInstance;
Expand Down

0 comments on commit b6ccc9b

Please sign in to comment.