auto-sync
This commit is contained in:
parent
7b86f1553d
commit
e83e1c4c55
|
@ -198,6 +198,18 @@ static void handleGpio(Engine *engine, int index) {
|
|||
|
||||
}
|
||||
|
||||
static void setPinState(io_pin_e ioPin, LEElement *element, Engine *engine) {
|
||||
if (element == NULL) {
|
||||
warning(OBD_PCM_Processor_Fault, "invalid expression for %s", getIo_pin_e(ioPin));
|
||||
} else {
|
||||
int value = calc.getValue2(element, engine);
|
||||
if (value != getOutputPinValue(ioPin)) {
|
||||
scheduleMsg(&logger, "setting %s %s", getIo_pin_e(ioPin), boolToString(value));
|
||||
setOutputPinValue(ioPin, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void onEvenyGeneralMilliseconds(Engine *engine) {
|
||||
/**
|
||||
* We need to push current value into the 64 bit counter often enough so that we do not miss an overflow
|
||||
|
@ -218,20 +230,13 @@ static void onEvenyGeneralMilliseconds(Engine *engine) {
|
|||
|
||||
#if EFI_FUEL_PUMP
|
||||
if (boardConfiguration->fuelPumpPin != GPIO_NONE && engineConfiguration->isFuelPumpEnabled) {
|
||||
if (fuelPumpLogic == NULL) {
|
||||
warning(OBD_PCM_Processor_Fault, "invalid expression for %s", getIo_pin_e(FUEL_PUMP_RELAY));
|
||||
} else {
|
||||
int value = calc.getValue2(fuelPumpLogic, engine);
|
||||
if (value != getOutputPinValue(FUEL_PUMP_RELAY)) {
|
||||
scheduleMsg(&logger, "setting %s %s", getIo_pin_e(FUEL_PUMP_RELAY), boolToString(value));
|
||||
setOutputPinValue(FUEL_PUMP_RELAY, value);
|
||||
}
|
||||
}
|
||||
setPinState(FUEL_PUMP_RELAY, fuelPumpLogic, engine);
|
||||
}
|
||||
#endif
|
||||
|
||||
updateErrorCodes();
|
||||
|
||||
// todo: migrate this to flex logic
|
||||
fanRelayControl();
|
||||
|
||||
cylinderCleanupControl(engine);
|
||||
|
@ -371,7 +376,7 @@ void initEngineContoller(Engine *engine) {
|
|||
|
||||
chThdCreateStatic(csThreadStack, sizeof(csThreadStack), LOWPRIO, (tfunc_t) csThread, NULL);
|
||||
|
||||
initInjectorCentral();
|
||||
initInjectorCentral(engine);
|
||||
initPwmTester();
|
||||
initIgnitionCentral();
|
||||
initMalfunctionCentral();
|
||||
|
|
|
@ -133,6 +133,18 @@ static void fuelbench2(const char *delayStr, const char *indexStr, const char *
|
|||
pinbench(delayStr, onTimeStr, offTimeStr, countStr, p, b);
|
||||
}
|
||||
|
||||
static void fanbench(Engine *engine) {
|
||||
brainPin = boardConfiguration->fanPin;
|
||||
pinX = FAN_RELAY;
|
||||
|
||||
delayMs = 1000;
|
||||
onTime = 5000;
|
||||
offTime = 0;
|
||||
count = 1;
|
||||
|
||||
needToRunBench = true;
|
||||
}
|
||||
|
||||
static void fuelpumpbench(int delayParam, int onTimeParam) {
|
||||
brainPin = boardConfiguration->fuelPumpPin;
|
||||
pinX = FUEL_PUMP_RELAY;
|
||||
|
@ -164,7 +176,7 @@ static void sparkbench(const char * onTimeStr, const char *offTimeStr, const cha
|
|||
static THD_WORKING_AREA(benchThreadStack, UTILITY_THREAD_STACK_SIZE);
|
||||
|
||||
static msg_t benchThread(int param) {
|
||||
(void)param;
|
||||
(void) param;
|
||||
chRegSetThreadName("BenchThread");
|
||||
|
||||
while (TRUE) {
|
||||
|
@ -179,13 +191,13 @@ static msg_t benchThread(int param) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void initInjectorCentral(void) {
|
||||
void initInjectorCentral(Engine *engine) {
|
||||
initLogging(&logger, "InjectorCentral");
|
||||
chThdCreateStatic(benchThreadStack, sizeof(benchThreadStack), NORMALPRIO, (tfunc_t) benchThread, NULL);
|
||||
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
is_injector_enabled[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// todo: should we move this code closer to the injection logic?
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
|
@ -198,11 +210,12 @@ void initInjectorCentral(void) {
|
|||
printStatus();
|
||||
addConsoleActionII("injector", setInjectorEnabled);
|
||||
|
||||
addConsoleActionII("fuelpumpbench", &fuelpumpbench);
|
||||
addConsoleActionII("fuelpumpbench", fuelpumpbench);
|
||||
addConsoleActionP("fanbench", (VoidPtr) fanbench, engine);
|
||||
|
||||
addConsoleActionSSS("fuelbench", &fuelbench);
|
||||
addConsoleActionSSS("sparkbench", &sparkbench);
|
||||
addConsoleActionSSS("fuelbench", fuelbench);
|
||||
addConsoleActionSSS("sparkbench", sparkbench);
|
||||
|
||||
addConsoleActionSSSSS("fuelbench2", &fuelbench2);
|
||||
addConsoleActionSSSSS("sparkbench2", &sparkbench2);
|
||||
addConsoleActionSSSSS("fuelbench2", fuelbench2);
|
||||
addConsoleActionSSSSS("sparkbench2", sparkbench2);
|
||||
}
|
||||
|
|
|
@ -7,24 +7,15 @@
|
|||
* @author Andrey Belomutskiy, (c) 2012-2014
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INJECTOR_CENTRAL_H_
|
||||
#define INJECTOR_CENTRAL_H_
|
||||
|
||||
#include "signal_executor.h"
|
||||
#include "engine.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void initInjectorCentral(void);
|
||||
void initInjectorCentral(Engine *engine);
|
||||
bool_t isRunningBenchTest(void);
|
||||
int isInjectorEnabled(int cylinderId);
|
||||
void assertCylinderId(int cylinderId, const char *msg);
|
||||
bool_t isRunningBenchTest(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* INJECTOR_CENTRAL_H_ */
|
||||
|
|
Loading…
Reference in New Issue