having fun with async - reducing threads

This commit is contained in:
rusefi 2019-07-13 11:08:17 -04:00
parent 8b0929a9ac
commit 8a393dc819
2 changed files with 10 additions and 14 deletions

View File

@ -792,7 +792,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
// help to notice when RAM usage goes up - if a code change adds to RAM usage these variables would fail
// linking process which is the way to raise the alarm
#ifndef RAM_UNUSED_SIZE
#define RAM_UNUSED_SIZE 17500
#define RAM_UNUSED_SIZE 19000
#endif
#ifndef CCM_UNUSED_SIZE
#define CCM_UNUSED_SIZE 4600

View File

@ -21,7 +21,7 @@
#if EFI_PROD_CODE && HAL_USE_GPT
#include "periodic_thread_controller.h"
#include "periodic_task.h"
/**
* Maximum duration of complete timer callback, all pending events together
@ -110,17 +110,9 @@ static void hwTimerCallback(GPTDriver *gptp) {
}
}
class MicrosecondTimerWatchdogController : public PeriodicController<UTILITY_THREAD_STACK_SIZE>
{
public:
MicrosecondTimerWatchdogController()
: PeriodicController("timer watchdog", NORMALPRIO, 1.0f)
{
}
private:
void PeriodicTask(efitime_t nowNt) override
{
class MicrosecondTimerWatchdogController : public PeriodicTimerController {
void PeriodicTask() override {
efitime_t nowNt = getTimeNowNt();
if (nowNt >= lastSetTimerTimeNt + 2 * CORE_CLOCK) {
strcpy(buff, "no_event");
itoa10(&buff[8], lastSetTimerValue);
@ -132,6 +124,10 @@ private:
// 2 seconds of inactivity would not look right
efiAssertVoid(CUSTOM_ERR_6682, nowNt < lastSetTimerTimeNt + 2 * CORE_CLOCK, msg);
}
int getPeriodMs() override {
return 500;
}
};
static MicrosecondTimerWatchdogController watchdogControllerInstance;
@ -149,7 +145,7 @@ void initMicrosecondTimer(void) {
lastSetTimerTimeNt = getTimeNowNt();
#if EFI_EMULATE_POSITION_SENSORS
watchdogControllerInstance.Start();
#endif /* EFI_ENGINE_EMULATOR */
#endif /* EFI_EMULATE_POSITION_SENSORS */
}
#endif /* EFI_PROD_CODE */