unit tests progress
This commit is contained in:
parent
221ef7d9bb
commit
154092bbf5
|
@ -306,18 +306,11 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
class IdleController : public PeriodicTimerController {
|
int IdleController::getPeriodMs() {
|
||||||
public:
|
|
||||||
Engine *engine = NULL;
|
|
||||||
engine_configuration_s *engineConfiguration = NULL;
|
|
||||||
persistent_config_s *config = NULL;
|
|
||||||
board_configuration_s *boardConfiguration = NULL;
|
|
||||||
|
|
||||||
int getPeriodMs() override {
|
|
||||||
return GET_PERIOD_LIMITED(&engineConfiguration->idleRpmPid);
|
return GET_PERIOD_LIMITED(&engineConfiguration->idleRpmPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeriodicTask() override {
|
void IdleController::PeriodicTask() {
|
||||||
/*
|
/*
|
||||||
* Here we have idle logic thread - actual stepper movement is implemented in a separate
|
* Here we have idle logic thread - actual stepper movement is implemented in a separate
|
||||||
* working thread,
|
* working thread,
|
||||||
|
@ -452,9 +445,9 @@ public:
|
||||||
applyIACposition(engine->engineState.idle.currentIdlePosition);
|
applyIACposition(engine->engineState.idle.currentIdlePosition);
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
static IdleController idleControllerInstance;
|
|
||||||
|
IdleController idleControllerInstance;
|
||||||
|
|
||||||
static void applyPidSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
static void applyPidSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
idlePid.updateFactors(engineConfiguration->idleRpmPid.pFactor, engineConfiguration->idleRpmPid.iFactor, engineConfiguration->idleRpmPid.dFactor);
|
idlePid.updateFactors(engineConfiguration->idleRpmPid.pFactor, engineConfiguration->idleRpmPid.iFactor, engineConfiguration->idleRpmPid.dFactor);
|
||||||
|
|
|
@ -10,6 +10,18 @@
|
||||||
#define IDLE_THREAD_H_
|
#define IDLE_THREAD_H_
|
||||||
|
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
#include "periodic_task.h"
|
||||||
|
|
||||||
|
class IdleController : public PeriodicTimerController {
|
||||||
|
public:
|
||||||
|
Engine *engine = NULL;
|
||||||
|
engine_configuration_s *engineConfiguration = NULL;
|
||||||
|
persistent_config_s *config = NULL;
|
||||||
|
board_configuration_s *boardConfiguration = NULL;
|
||||||
|
|
||||||
|
int getPeriodMs() override;
|
||||||
|
void PeriodicTask() override;
|
||||||
|
};
|
||||||
|
|
||||||
percent_t getIdlePosition(void);
|
percent_t getIdlePosition(void);
|
||||||
void setIdleValvePosition(int positionPercent);
|
void setIdleValvePosition(int positionPercent);
|
||||||
|
|
|
@ -108,6 +108,10 @@ TransmissionState::TransmissionState() {
|
||||||
|
|
||||||
EngineState::EngineState() {
|
EngineState::EngineState() {
|
||||||
timeSinceLastTChargeK = getTimeNowNt();
|
timeSinceLastTChargeK = getTimeNowNt();
|
||||||
|
|
||||||
|
#if ! EFI_PROD_CODE
|
||||||
|
memset(mockPinStates, 0, sizeof(mockPinStates));
|
||||||
|
#endif /* EFI_PROD_CODE */
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineState::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void EngineState::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
#include "pid.h"
|
#include "pid.h"
|
||||||
#include "engine_state_generated.h"
|
#include "engine_state_generated.h"
|
||||||
|
|
||||||
|
#define BRAIN_PIN_COUNT (1 << sizeof(brain_pin_e))
|
||||||
|
|
||||||
|
|
||||||
class EngineState : public engine_state2_s {
|
class EngineState : public engine_state2_s {
|
||||||
public:
|
public:
|
||||||
EngineState();
|
EngineState();
|
||||||
|
@ -21,6 +24,10 @@ public:
|
||||||
void updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
void updateTChargeK(int rpm, float tps DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void updateTChargeK(int rpm, float tps DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
#if ! EFI_PROD_CODE
|
||||||
|
bool mockPinStates[BRAIN_PIN_COUNT];
|
||||||
|
#endif
|
||||||
|
|
||||||
FuelConsumptionState fuelConsumption;
|
FuelConsumptionState fuelConsumption;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,6 +109,9 @@ public:
|
||||||
#if EFI_ENABLE_MOCK_ADC
|
#if EFI_ENABLE_MOCK_ADC
|
||||||
MockAdcState mockAdcState;
|
MockAdcState mockAdcState;
|
||||||
#endif /* EFI_ENABLE_MOCK_ADC */
|
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
#include "tps.h"
|
#include "tps.h"
|
||||||
#include "pid.h"
|
#include "pid.h"
|
||||||
#include "fsio_impl.h"
|
#include "fsio_impl.h"
|
||||||
|
#include "idle_thread.h"
|
||||||
|
|
||||||
|
extern IdleController idleControllerInstance;
|
||||||
|
|
||||||
#define Q(x) #x
|
#define Q(x) #x
|
||||||
#define QUOTE(x) Q(x)
|
#define QUOTE(x) Q(x)
|
||||||
|
|
Loading…
Reference in New Issue