This commit is contained in:
rusefi 2017-11-26 22:30:37 -05:00
parent 7cdea8932e
commit 56b6e33eab
8 changed files with 61 additions and 6 deletions

View File

@ -21,6 +21,7 @@
#include "advance_map.h"
#include "efilib2.h"
#include "settings.h"
#include "aux_valves.h"
#if EFI_PROD_CODE || defined(__DOXYGEN__)
#include "injector_central.h"
@ -180,6 +181,7 @@ EngineState::EngineState() {
baroCorrection = timingAdvance = 0;
sparkDwell = mapAveragingDuration = 0;
totalLoggedBytes = injectionOffset = 0;
auxValveStart = auxValveEnd = 0;
}
void EngineState::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
@ -199,6 +201,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
} else {
timeSinceCranking = nowNt - crankingTime;
}
updateAuxValves(PASS_ENGINE_PARAMETER_SIGNATURE);
int rpm = GET_RPM();
sparkDwell = getSparkDwell(rpm PASS_ENGINE_PARAMETER_SUFFIX);
@ -356,7 +359,7 @@ void Engine::watchdog() {
}
isSpinning = false;
ignitionEvents.isReady = false;
#if EFI_PROD_CODE || EFI_SIMULATOR
#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__)
scheduleMsg(&logger, "engine has STOPPED");
scheduleMsg(&logger, "templog engine has STOPPED [%x][%x] [%x][%x] %d",
(int)(nowNt >> 32), (int)nowNt,

View File

@ -147,6 +147,8 @@ public:
float engineNoiseHipLevel;
float auxValveStart;
float auxValveEnd;
ThermistorMath iatCurve;
ThermistorMath cltCurve;

View File

@ -272,6 +272,7 @@ void initInjectorCentral(Logging *sharedLogger) {
enginePins.startInjectionPins();
enginePins.startIgnitionPins();
enginePins.startAuxValves();
printInjectorsStatus();
addConsoleActionII("injector", setInjectorEnabled);

View File

@ -33,6 +33,8 @@ static const char *sparkNames[IGNITION_PIN_COUNT] = { "c1", "c2", "c3", "c4", "c
static const char *injectorNames[INJECTION_PIN_COUNT] = { "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8",
"j9", "iA", "iB", "iC"};
static const char *auxValveNames[INJECTION_PIN_COUNT] = { "a1", "a2"};
EnginePins::EnginePins() {
dizzyOutput.name = DIZZY_NAME;
tachOut.name = TACH_NAME;
@ -44,6 +46,9 @@ EnginePins::EnginePins() {
enginePins.injectors[i].injectorIndex = i;
enginePins.injectors[i].name = injectorNames[i];
}
for (int i = 0; i < AUX_DIGITAL_VALVE_COUNT;i++) {
enginePins.auxValve[i].name = auxValveNames[i];
}
}
/**
@ -75,6 +80,9 @@ bool EnginePins::stopPins() {
for (int i = 0; i < INJECTION_PIN_COUNT; i++) {
result |= injectors[i].stop();
}
for (int i = 0; i < AUX_DIGITAL_VALVE_COUNT; i++) {
result |= auxValve[i].stop();
}
return result;
}
@ -143,6 +151,15 @@ void EnginePins::stopInjectionPins(void) {
#endif /* EFI_PROD_CODE */
}
void EnginePins::startAuxValves(void) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
for (int i = 0; i < AUX_DIGITAL_VALVE_COUNT; i++) {
NamedOutputPin *output = &enginePins.auxValve[i];
output->initPin(output->name, engineConfiguration->auxValves[i]);
}
#endif /* EFI_PROD_CODE */
}
void EnginePins::startIgnitionPins(void) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {

View File

@ -105,6 +105,7 @@ public:
void unregisterPins();
void startInjectionPins();
void startIgnitionPins();
void startAuxValves();
void stopInjectionPins();
void stopIgnitionPins();
OutputPin mainRelay;
@ -112,7 +113,6 @@ public:
OutputPin acRelay;
OutputPin fuelPumpRelay;
OutputPin o2heater;
// OutputPin alternatorField;
/**
* brain board RED LED by default
*/
@ -127,7 +127,10 @@ public:
* this one is usually on the gauge cluster, not on the ECU
*/
OutputPin checkEnginePin;
NamedOutputPin tachOut;
NamedOutputPin dizzyOutput;
OutputPin etbOutput1;
OutputPin etbOutput2;
OutputPin fsioOutputs[FSIO_COMMAND_COUNT];
@ -138,7 +141,7 @@ public:
InjectorOutputPin injectors[INJECTION_PIN_COUNT];
IgnitionOutputPin coils[IGNITION_PIN_COUNT];
NamedOutputPin dizzyOutput;
NamedOutputPin auxValve[AUX_DIGITAL_VALVE_COUNT];
};
/**

View File

@ -6,8 +6,36 @@
*/
#include "aux_valves.h"
#include "allsensors.h"
#include "trigger_central.h"
void initAuxValves(Logging *sharedLogger) {
EXTERN_ENGINE
;
static void auxValveTriggerCallback(trigger_event_e ckpSignalType,
uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
}
void initAuxValves(Logging *sharedLogger) {
#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__)
if (engineConfiguration->auxValves[0] == GPIO_UNASSIGNED) {
return;
}
addTriggerEventListener(auxValveTriggerCallback, "tach", engine);
#endif /* EFI_PROD_CODE */
}
void updateAuxValves(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (engineConfiguration->auxValves[0] == GPIO_UNASSIGNED) {
return;
}
float x = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
engine->engineState.auxValveStart = interpolate2d("aux", x, engineConfiguration->fsioCurve1Bins,
engineConfiguration->fsioCurve1, FSIO_CURVE_16);
engine->engineState.auxValveEnd = interpolate2d("aux", x, engineConfiguration->fsioCurve2Bins,
engineConfiguration->fsioCurve2, FSIO_CURVE_16);
}

View File

@ -11,5 +11,6 @@
#include "engine.h"
void initAuxValves(Logging *sharedLogger);
void updateAuxValves(DECLARE_ENGINE_PARAMETER_SIGNATURE);
#endif /* CONTROLLERS_TRIGGER_AUX_VALVES_H_ */

View File

@ -262,9 +262,9 @@ static void initializeIgnitionActions(IgnitionEventList *list DECLARE_ENGINE_PAR
for (int cylinderIndex = 0; cylinderIndex < CONFIG(specs.cylindersCount); cylinderIndex++) {
list->elements[cylinderIndex].cylinderIndex = cylinderIndex;
#if EFI_UNIT_TEST
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
list->elements[cylinderIndex].engine = engine;
#endif
#endif /* EFI_UNIT_TEST */
prepareIgnitionSchedule(&list->elements[cylinderIndex] PASS_ENGINE_PARAMETER_SUFFIX);
}
list->isReady = true;