EFI_MAIN_RELAY_CONTROL draft

This commit is contained in:
Andrei 2017-06-13 01:14:39 +03:00
parent 88be4a0b5e
commit 23e20e4319
5 changed files with 29 additions and 1 deletions

View File

@ -124,6 +124,11 @@
#define EFI_IDLE_CONTROL TRUE
/**
* Control the main power relay based on measured ignition voltage (Vbatt)
*/
#define EFI_MAIN_RELAY_CONTROL FALSE
#define EFI_PWM TRUE
#define EFI_VEHICLE_SPEED TRUE

View File

@ -68,6 +68,10 @@ static LEElement * fuelPumpLogic;
static LEElement * radiatorFanLogic;
static LEElement * alternatorLogic;
#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__)
static LEElement * mainRelayLogic;
#endif /* EFI_MAIN_RELAY_CONTROL */
EXTERN_ENGINE
;
@ -345,11 +349,16 @@ void runFsio(void) {
}
#endif /* EFI_FUEL_PUMP */
#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__)
if (boardConfiguration->mainRelayPin != GPIO_UNASSIGNED)
setPinState("main_relay", &enginePins.mainRelay, mainRelayLogic);
#else /* EFI_MAIN_RELAY_CONTROL */
/**
* main relay is always on if ECU is on, that's a good enough initial implementation
*/
if (boardConfiguration->mainRelayPin != GPIO_UNASSIGNED)
enginePins.mainRelay.setValue(true);
#endif /* EFI_MAIN_RELAY_CONTROL */
enginePins.o2heater.setValue(engine->rpmCalculator.isRunning());
@ -498,6 +507,11 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
radiatorFanLogic = sysPool.parseExpression(FAN_CONTROL_LOGIC);
alternatorLogic = sysPool.parseExpression(ALTERNATOR_LOGIC);
#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__)
if (boardConfiguration->mainRelayPin != GPIO_UNASSIGNED)
mainRelayLogic = sysPool.parseExpression(MAIN_RELAY_LOGIC);
#endif /* EFI_MAIN_RELAY_CONTROL */
#if EFI_PROD_CODE || defined(__DOXYGEN__)
for (int i = 0; i < LE_COMMAND_COUNT; i++) {

View File

@ -1,6 +1,6 @@
// this https://en.wikipedia.org/wiki/Reverse_Polish_notation is generated automatically
// from controllers/system_fsio.txt
// on 2017-04-25_15_33_33
// on 2017-06-12_17_45_41
//
//
// in this file we define system FSIO expressions
@ -23,6 +23,11 @@
// Human-readable: ac_on_switch
#define AC_RELAY_LOGIC "ac_on_switch"
// Combined RPM, CLT and VBATT warning light
// Human-readable: (rpm > fsio_setting(2)) | ((coolant > fsio_setting(3)) | (vbatt < fsio_setting(4)))
#define COMBINED_WARNING_LIGHT "rpm 2 fsio_setting > coolant 3 fsio_setting > vbatt 4 fsio_setting < | |"
//needed by EFI_MAIN_RELAY_CONTROL
// Human-readable: (time_since_boot < 2) | (vbatt > 5)
#define MAIN_RELAY_LOGIC "time_since_boot 2 < vbatt 5 > |"

View File

@ -18,3 +18,6 @@ AC_RELAY_LOGIC=ac_on_switch
# Combined RPM, CLT and VBATT warning light
COMBINED_WARNING_LIGHT=(rpm > fsio_setting(2)) | ((coolant > fsio_setting(3)) | (vbatt < fsio_setting(4)))
#needed by EFI_MAIN_RELAY_CONTROL
MAIN_RELAY_LOGIC=(time_since_boot < 2) | (vbatt > 5)

View File

@ -54,6 +54,7 @@
#define EFI_ENGINE_CONTROL TRUE
#define EFI_IDLE_CONTROL FALSE
#define EFI_MAIN_RELAY_CONTROL FALSE
#define EFI_HIP_9011 FALSE
#define EFI_ELECTRONIC_THROTTLE_BODY FALSE
#define EFI_AUX_PID FALSE