more code into unit tests
This commit is contained in:
parent
ad7e36c228
commit
b8ce0daf85
|
@ -37,7 +37,7 @@ static void turnOff(NamedOutputPin *output) {
|
|||
static void auxValveTriggerCallback(trigger_event_e ckpSignalType,
|
||||
uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
UNUSED(ckpSignalType);
|
||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||
|
||||
if (index != SCHEDULING_TRIGGER_INDEX) {
|
||||
return;
|
||||
}
|
||||
|
@ -46,8 +46,7 @@ static void auxValveTriggerCallback(trigger_event_e ckpSignalType,
|
|||
return;
|
||||
}
|
||||
|
||||
for (int valveIndex = 0; valveIndex < AUX_DIGITAL_VALVE_COUNT;
|
||||
valveIndex++) {
|
||||
for (int valveIndex = 0; valveIndex < AUX_DIGITAL_VALVE_COUNT; valveIndex++) {
|
||||
|
||||
NamedOutputPin *output = &enginePins.auxValve[valveIndex];
|
||||
|
||||
|
@ -66,27 +65,22 @@ static void auxValveTriggerCallback(trigger_event_e ckpSignalType,
|
|||
fixAngle(onTime, "onTime", CUSTOM_ERR_6556);
|
||||
scheduleByAngle(rpm, &turnOnEvent[valveIndex][phaseIndex],
|
||||
onTime,
|
||||
(schfunc_t) &turnOn, output);
|
||||
(schfunc_t) &turnOn, output PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
angle_t offTime = extra + engine->engineState.auxValveEnd;
|
||||
fixAngle(offTime, "offTime", CUSTOM_ERR_6557);
|
||||
scheduleByAngle(rpm, &turnOffEvent[valveIndex][phaseIndex],
|
||||
offTime,
|
||||
(schfunc_t) &turnOff, output);
|
||||
|
||||
(schfunc_t) &turnOff, output PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
||||
}
|
||||
|
||||
void initAuxValves(Logging *sharedLogger) {
|
||||
void initAuxValves(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
UNUSED(sharedLogger);
|
||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||
if (engineConfiguration->auxValves[0] == GPIO_UNASSIGNED) {
|
||||
return;
|
||||
}
|
||||
addTriggerEventListener(auxValveTriggerCallback, "tach", engine);
|
||||
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
||||
}
|
||||
|
||||
void updateAuxValves(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "engine.h"
|
||||
|
||||
void initAuxValves(Logging *sharedLogger);
|
||||
void initAuxValves(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void updateAuxValves(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
#endif /* CONTROLLERS_TRIGGER_AUX_VALVES_H_ */
|
||||
|
|
|
@ -631,7 +631,7 @@ void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX
|
|||
efiAssertVoid(CUSTOM_ERR_6631, engine!=NULL, "null engine");
|
||||
initSparkLogic(logger);
|
||||
|
||||
initAuxValves(logger);
|
||||
initAuxValves(logger PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
addConsoleAction("performanceinfo", showTriggerHistogram);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "globalaccess.h"
|
||||
#include "os_access.h"
|
||||
#include "engine.h"
|
||||
#include "rpm_calculator.h"
|
||||
|
@ -291,12 +291,12 @@ static scheduling_s tdcScheduler[2];
|
|||
|
||||
static char rpmBuffer[_MAX_FILLER];
|
||||
|
||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||
/**
|
||||
* This callback has nothing to do with actual engine control, it just sends a Top Dead Center mark to the rusEfi console
|
||||
* digital sniffer.
|
||||
*/
|
||||
static void onTdcCallback(void) {
|
||||
static void onTdcCallback(Engine *engine) {
|
||||
EXPAND_Engine;
|
||||
itoa10(rpmBuffer, GET_RPM());
|
||||
#if EFI_ENGINE_SNIFFER
|
||||
waveChart.startDataCollection();
|
||||
|
@ -317,11 +317,11 @@ static void tdcMarkCallback(trigger_event_e ckpSignalType,
|
|||
// todo: use tooth event-based scheduling, not just time-based scheduling
|
||||
if (isValidRpm(rpm)) {
|
||||
scheduleByAngle(rpm, &tdcScheduler[revIndex2], tdcPosition(),
|
||||
(schfunc_t) onTdcCallback, NULL);
|
||||
(schfunc_t) onTdcCallback, engine PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @return Current crankshaft angle, 0 to 720 for four-stroke
|
||||
|
@ -344,10 +344,8 @@ void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
if (hasFirmwareError()) {
|
||||
return;
|
||||
}
|
||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||
|
||||
addTriggerEventListener(tdcMarkCallback, "chart TDC mark", engine);
|
||||
#endif
|
||||
|
||||
addTriggerEventListener(rpmShaftPositionCallback, "rpm reporter", engine);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue