diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index fc9759b40a..6d15935815 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -299,6 +299,9 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_ boardConfiguration->acRelayPin = GPIO_UNASSIGNED; boardConfiguration->acRelayPinMode = OM_DEFAULT; + boardConfiguration->alternatorControlPin = GPIO_UNASSIGNED; + boardConfiguration->alternatorControlPinMode = OM_DEFAULT; + engineConfiguration->acSwitchAdc = EFI_ADC_NONE; #if EFI_PROD_CODE diff --git a/firmware/controllers/core/le_functions.h b/firmware/controllers/core/le_functions.h index 6b6d5101a6..84b12d1c99 100644 --- a/firmware/controllers/core/le_functions.h +++ b/firmware/controllers/core/le_functions.h @@ -20,6 +20,8 @@ #define AC_RELAY_LOGIC "ac_on_switch" +#define ALTERNATOR_LOGIC "vbatt 14.5 <" + /** * In human language that's * (fan and (coolant > fan_off_setting)) OR (coolant > fan_on_setting) diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 820c5e036e..f15987b8e2 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -64,6 +64,7 @@ static LEElementPool lePool(mainPool, LE_ELEMENT_POOL_SIZE); static LEElement * acRelayLogic; static LEElement * fuelPumpLogic; static LEElement * radiatorFanLogic; +static LEElement * alternatorLogic; extern OutputPin outputs[IO_PIN_COUNT]; extern pin_output_mode_e *pinDefaultState[IO_PIN_COUNT]; @@ -251,6 +252,10 @@ static void onEvenyGeneralMilliseconds(Engine *engine) { setPinState(AC_RELAY, acRelayLogic, engine); } + if (boardConfiguration->alternatorControlPin != GPIO_UNASSIGNED) { + setPinState(ALTERNATOR_SWITCH, alternatorLogic, engine); + } + updateErrorCodes(); // todo: migrate this to flex logic @@ -419,6 +424,8 @@ void initEngineContoller(Engine *engine) { acRelayLogic = lePool.parseExpression(AC_RELAY_LOGIC); + alternatorLogic = lePool.parseExpression(ALTERNATOR_LOGIC); + addConsoleAction("analoginfo", printAnalogInfo); for (int i = 0; i < LE_COMMAND_COUNT; i++) { diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 4bbb3602a0..e3c0d49ad6 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -265,5 +265,5 @@ int getRusEfiVersion(void) { return 1; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE == 0) return 1; // this is here to make the compiler happy about the unused array - return 20141129; + return 20141130; }