extracting prime_injection
This commit is contained in:
parent
7eb453bc54
commit
2d9dbbd6b8
|
@ -43,6 +43,7 @@
|
||||||
#include "fan_control.h"
|
#include "fan_control.h"
|
||||||
#include "sensor_checker.h"
|
#include "sensor_checker.h"
|
||||||
#include "fuel_schedule.h"
|
#include "fuel_schedule.h"
|
||||||
|
#include "prime_injection.h"
|
||||||
|
|
||||||
#ifndef EFI_UNIT_TEST
|
#ifndef EFI_UNIT_TEST
|
||||||
#error EFI_UNIT_TEST must be defined!
|
#error EFI_UNIT_TEST must be defined!
|
||||||
|
@ -113,34 +114,6 @@ protected:
|
||||||
trigger_config_s getType() const override;
|
trigger_config_s getType() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PrimeController : public EngineModule {
|
|
||||||
public:
|
|
||||||
void onIgnitionStateChanged(bool ignitionOn) override;
|
|
||||||
|
|
||||||
floatms_t getPrimeDuration() const;
|
|
||||||
|
|
||||||
void onPrimeStart();
|
|
||||||
void onPrimeEnd();
|
|
||||||
|
|
||||||
bool isPriming() const {
|
|
||||||
return m_isPriming;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
scheduling_s m_start;
|
|
||||||
scheduling_s m_end;
|
|
||||||
|
|
||||||
bool m_isPriming = false;
|
|
||||||
|
|
||||||
static void onPrimeStartAdapter(PrimeController* instance) {
|
|
||||||
instance->onPrimeStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void onPrimeEndAdapter(PrimeController* instance) {
|
|
||||||
instance->onPrimeEnd();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class Engine final : public TriggerStateListener {
|
class Engine final : public TriggerStateListener {
|
||||||
public:
|
public:
|
||||||
Engine();
|
Engine();
|
||||||
|
|
|
@ -42,6 +42,7 @@ CONTROLLERS_SRC_CPP = \
|
||||||
$(CONTROLLERS_DIR)/engine_cycle/spark_logic.cpp \
|
$(CONTROLLERS_DIR)/engine_cycle/spark_logic.cpp \
|
||||||
$(CONTROLLERS_DIR)/engine_cycle/knock_controller.cpp \
|
$(CONTROLLERS_DIR)/engine_cycle/knock_controller.cpp \
|
||||||
$(CONTROLLERS_DIR)/engine_cycle/main_trigger_callback.cpp \
|
$(CONTROLLERS_DIR)/engine_cycle/main_trigger_callback.cpp \
|
||||||
|
$(CONTROLLERS_DIR)/engine_cycle/prime_injection.cpp \
|
||||||
$(CONTROLLERS_DIR)/engine_cycle/aux_valves.cpp \
|
$(CONTROLLERS_DIR)/engine_cycle/aux_valves.cpp \
|
||||||
$(CONTROLLERS_DIR)/engine_cycle/fuel_schedule.cpp \
|
$(CONTROLLERS_DIR)/engine_cycle/fuel_schedule.cpp \
|
||||||
$(CONTROLLERS_DIR)/flash_main.cpp \
|
$(CONTROLLERS_DIR)/flash_main.cpp \
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "engine_configuration.h"
|
||||||
|
|
||||||
class EngineModule {
|
class EngineModule {
|
||||||
public:
|
public:
|
||||||
// Called when 'Burn' is invoked
|
// Called when 'Burn' is invoked
|
||||||
|
|
|
@ -59,7 +59,7 @@ void startSimultaneousInjection(void*) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void endSimultaneousInjectionOnlyTogglePins() {
|
void endSimultaneousInjectionOnlyTogglePins() {
|
||||||
efitick_t nowNt = getTimeNowNt();
|
efitick_t nowNt = getTimeNowNt();
|
||||||
for (size_t i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
for (size_t i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||||
enginePins.injectors[i].close(nowNt);
|
enginePins.injectors[i].close(nowNt);
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp, angle_t currentPhase, angle_t nextPhase);
|
void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp, angle_t currentPhase, angle_t nextPhase);
|
||||||
|
|
||||||
void startSimultaneousInjection(void* = nullptr);
|
|
||||||
void endSimultaneousInjection(InjectionEvent *event);
|
void endSimultaneousInjection(InjectionEvent *event);
|
||||||
void turnInjectionPinHigh(InjectionEvent *event);
|
void turnInjectionPinHigh(InjectionEvent *event);
|
||||||
void turnInjectionPinLow(InjectionEvent *event);
|
void turnInjectionPinLow(InjectionEvent *event);
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
/*
|
||||||
|
* @file prime_injection.cpp
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "prime_injection.h"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* @file prime_injection.h
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "engine_module.h"
|
||||||
|
#include "rusefi_types.h"
|
||||||
|
#include "scheduler.h"
|
||||||
|
|
||||||
|
class PrimeController : public EngineModule {
|
||||||
|
public:
|
||||||
|
void onIgnitionStateChanged(bool ignitionOn) override;
|
||||||
|
|
||||||
|
floatms_t getPrimeDuration() const;
|
||||||
|
|
||||||
|
void onPrimeStart();
|
||||||
|
void onPrimeEnd();
|
||||||
|
|
||||||
|
bool isPriming() const {
|
||||||
|
return m_isPriming;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
scheduling_s m_start;
|
||||||
|
scheduling_s m_end;
|
||||||
|
|
||||||
|
bool m_isPriming = false;
|
||||||
|
|
||||||
|
static void onPrimeStartAdapter(PrimeController* instance) {
|
||||||
|
instance->onPrimeStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void onPrimeEndAdapter(PrimeController* instance) {
|
||||||
|
instance->onPrimeEnd();
|
||||||
|
}
|
||||||
|
};
|
|
@ -115,6 +115,9 @@ public:
|
||||||
const char *shortName = nullptr;
|
const char *shortName = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void startSimultaneousInjection(void* = nullptr);
|
||||||
|
void endSimultaneousInjectionOnlyTogglePins();
|
||||||
|
|
||||||
class InjectorOutputPin final : public NamedOutputPin {
|
class InjectorOutputPin final : public NamedOutputPin {
|
||||||
public:
|
public:
|
||||||
InjectorOutputPin();
|
InjectorOutputPin();
|
||||||
|
|
Loading…
Reference in New Issue