refactoring: wider usage of new periodic task
This commit is contained in:
parent
7288f8aab9
commit
4ef2a72930
|
@ -15,7 +15,7 @@
|
|||
#include "voltage.h"
|
||||
#include "pid.h"
|
||||
#include "local_version_holder.h"
|
||||
#include "periodic_thread_controller.h"
|
||||
#include "periodic_task.h"
|
||||
|
||||
#include "pwm_generator.h"
|
||||
#include "pin_repository.h"
|
||||
|
@ -47,14 +47,12 @@ static void pidReset(void) {
|
|||
altPid.reset();
|
||||
}
|
||||
|
||||
class AlternatorController : public PeriodicController<UTILITY_THREAD_STACK_SIZE> {
|
||||
public:
|
||||
AlternatorController() : PeriodicController("AlternatorController") { }
|
||||
private:
|
||||
void PeriodicTask(efitime_t nowNt) override {
|
||||
UNUSED(nowNt);
|
||||
setPeriod(GET_PERIOD_LIMITED(&engineConfiguration->alternatorControl));
|
||||
class AlternatorController : public PeriodicTimerController {
|
||||
int getPeriodMs() override {
|
||||
return GET_PERIOD_LIMITED(&engineConfiguration->alternatorControl);
|
||||
}
|
||||
|
||||
void PeriodicTask() override {
|
||||
#if ! EFI_UNIT_TEST
|
||||
if (shouldResetPid) {
|
||||
pidReset();
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
#include "pwm_generator_logic.h"
|
||||
#include "pid.h"
|
||||
#include "engine_controller.h"
|
||||
#include "periodic_thread_controller.h"
|
||||
#include "periodic_task.h"
|
||||
#include "pin_repository.h"
|
||||
#include "pwm_generator.h"
|
||||
#include "dc_motor.h"
|
||||
|
@ -169,17 +169,15 @@ static percent_t currentEtbDuty;
|
|||
#define ETB_DUTY_LIMIT 0.9
|
||||
#define PERCENT_TO_DUTY(X) (maxF(minF((X / 100.0), ETB_DUTY_LIMIT - 0.01), 0.01 - ETB_DUTY_LIMIT))
|
||||
|
||||
class EtbController : public PeriodicController<UTILITY_THREAD_STACK_SIZE> {
|
||||
public:
|
||||
EtbController() : PeriodicController("ETB") { }
|
||||
private:
|
||||
class EtbController : public PeriodicTimerController {
|
||||
|
||||
float feedForward = 0;
|
||||
|
||||
void PeriodicTask(efitime_t nowNt) override {
|
||||
UNUSED(nowNt);
|
||||
setPeriod(GET_PERIOD_LIMITED(&engineConfiguration->etb));
|
||||
|
||||
int getPeriodMs() override {
|
||||
return GET_PERIOD_LIMITED(&engineConfiguration->etb);
|
||||
}
|
||||
|
||||
void PeriodicTask() override {
|
||||
// set debug_mode 17
|
||||
if (engineConfiguration->debugMode == DBG_ELECTRONIC_THROTTLE_PID) {
|
||||
#if EFI_TUNER_STUDIO
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "idle_thread.h"
|
||||
#include "pin_repository.h"
|
||||
#include "engine.h"
|
||||
#include "periodic_thread_controller.h"
|
||||
#include "periodic_task.h"
|
||||
#include "stepper.h"
|
||||
#include "allsensors.h"
|
||||
|
||||
|
@ -249,14 +249,12 @@ static percent_t automaticIdleController() {
|
|||
return newValue;
|
||||
}
|
||||
|
||||
class IdleController : public PeriodicController<UTILITY_THREAD_STACK_SIZE> {
|
||||
public:
|
||||
IdleController() : PeriodicController("IdleValve") { }
|
||||
private:
|
||||
void PeriodicTask(efitime_t nowNt) override {
|
||||
UNUSED(nowNt);
|
||||
setPeriod(GET_PERIOD_LIMITED(&engineConfiguration->idleRpmPid));
|
||||
class IdleController : public PeriodicTimerController {
|
||||
int getPeriodMs() override {
|
||||
return GET_PERIOD_LIMITED(&engineConfiguration->idleRpmPid);
|
||||
}
|
||||
|
||||
void PeriodicTask() override {
|
||||
/*
|
||||
* Here we have idle logic thread - actual stepper movement is implemented in a separate
|
||||
* working thread,
|
||||
|
|
|
@ -337,8 +337,8 @@ static void doPeriodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
}
|
||||
|
||||
void initPeriodicEvents(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
slowController.start();
|
||||
fastController.start();
|
||||
slowController.Start();
|
||||
fastController.Start();
|
||||
}
|
||||
|
||||
char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer) {
|
||||
|
@ -793,7 +793,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 7400
|
||||
#define RAM_UNUSED_SIZE 11000
|
||||
#endif
|
||||
#ifndef CCM_UNUSED_SIZE
|
||||
#define CCM_UNUSED_SIZE 4600
|
||||
|
@ -814,6 +814,6 @@ int getRusEfiVersion(void) {
|
|||
if (initBootloader() != 0)
|
||||
return 123;
|
||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||
return 20190706;
|
||||
return 20190709;
|
||||
}
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
virtual void PeriodicTask() = 0;
|
||||
|
||||
void start() {
|
||||
void Start() {
|
||||
runAndScheduleNext(this);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue