refactoring
This commit is contained in:
parent
8e8b5256c8
commit
111b017442
|
@ -22,7 +22,11 @@
|
|||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
void plainPinTurnOn(AuxActor *current) {
|
||||
static void plainPinTurnOff(NamedOutputPin *output) {
|
||||
output->setLow();
|
||||
}
|
||||
|
||||
void auxPlainPinTurnOn(AuxActor *current) {
|
||||
NamedOutputPin *output = &enginePins.auxValve[current->valveIndex];
|
||||
output->setHigh();
|
||||
|
||||
|
@ -35,7 +39,7 @@ void plainPinTurnOn(AuxActor *current) {
|
|||
TRIGGER_EVENT_UNDEFINED,
|
||||
getTimeNowNt(),
|
||||
current->extra + engine->engineState.auxValveStart,
|
||||
{ plainPinTurnOn, current }
|
||||
{ auxPlainPinTurnOn, current }
|
||||
PASS_ENGINE_PARAMETER_SUFFIX
|
||||
);
|
||||
|
||||
|
@ -52,10 +56,6 @@ void plainPinTurnOn(AuxActor *current) {
|
|||
);
|
||||
}
|
||||
|
||||
void plainPinTurnOff(NamedOutputPin *output) {
|
||||
output->setLow();
|
||||
}
|
||||
|
||||
void initAuxValves(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
UNUSED(sharedLogger);
|
||||
if (engineConfiguration->auxValves[0] == GPIO_UNASSIGNED) {
|
||||
|
@ -83,7 +83,7 @@ void initAuxValves(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
TRIGGER_EVENT_UNDEFINED,
|
||||
getTimeNowNt(),
|
||||
actor->extra + engine->engineState.auxValveStart,
|
||||
{ plainPinTurnOn, actor }
|
||||
{ auxPlainPinTurnOn, actor }
|
||||
PASS_ENGINE_PARAMETER_SUFFIX
|
||||
);
|
||||
}
|
||||
|
|
|
@ -11,5 +11,4 @@
|
|||
|
||||
void initAuxValves(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void recalculateAuxValveTiming(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void plainPinTurnOn(AuxActor *current);
|
||||
void plainPinTurnOff(NamedOutputPin *output);
|
||||
void auxPlainPinTurnOn(AuxActor *current);
|
||||
|
|
|
@ -22,8 +22,8 @@ TEST(misc, testAuxValves) {
|
|||
eth.fireTriggerEvents2(2 /* count */ , 600 /* ms */);
|
||||
ASSERT_EQ( 100, GET_RPM()) << "spinning-RPM#1";
|
||||
|
||||
eth.assertTriggerEvent("a0", 0, &engine->auxValves[0][0].open, (void*)&plainPinTurnOn, 7, 86);
|
||||
eth.assertTriggerEvent("a1", 1, &engine->auxValves[0][1].open, (void*)&plainPinTurnOn, 3, 86);
|
||||
eth.assertTriggerEvent("a2", 2, &engine->auxValves[1][0].open, (void*)&plainPinTurnOn, 1, 86);
|
||||
eth.assertTriggerEvent("a0", 0, &engine->auxValves[0][0].open, (void*)&auxPlainPinTurnOn, 7, 86);
|
||||
eth.assertTriggerEvent("a1", 1, &engine->auxValves[0][1].open, (void*)&auxPlainPinTurnOn, 3, 86);
|
||||
eth.assertTriggerEvent("a2", 2, &engine->auxValves[1][0].open, (void*)&auxPlainPinTurnOn, 1, 86);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue