diff --git a/firmware/config/engines/dodge_neon.cpp b/firmware/config/engines/dodge_neon.cpp index b57b13fe60..78d810aeab 100644 --- a/firmware/config/engines/dodge_neon.cpp +++ b/firmware/config/engines/dodge_neon.cpp @@ -465,7 +465,7 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { #if EFI_FSIO || defined(__DOXYGEN__) // /** -// * set_fsio_setting 0 0.55 +// * set_fsio_setting 1 0.55 // */ // boardConfiguration->fsio_setting[0] = 0.55; // setFsioExt(0, GPIOE_5, "0 fsio_setting", 400 PASS_ENGINE_PARAMETER); diff --git a/firmware/config/engines/ford_festiva.cpp b/firmware/config/engines/ford_festiva.cpp index ffb5a89a65..89c0beae2d 100644 --- a/firmware/config/engines/ford_festiva.cpp +++ b/firmware/config/engines/ford_festiva.cpp @@ -227,19 +227,19 @@ void setFordEscortGt(DECLARE_ENGINE_PARAMETER_F) { // VICS solenoid /** * to test - * set_fsio_setting 0 5000 + * set_fsio_setting 1 5000 */ boardConfiguration->fsio_setting[0] = 5000; // set_rpn_expression 1 "rpm 0 fsio_setting >" - setFsioExt(0, GPIOE_3, "rpm 0 fsio_setting >", 150 PASS_ENGINE_PARAMETER); + setFsioExt(0, GPIOE_3, "rpm 1 fsio_setting >", 150 PASS_ENGINE_PARAMETER); // warning light /** * to test - * set_fsio_setting 1 1800 - * set_fsio_setting 2 95 - * set_fsio_setting 3 14 + * set_fsio_setting 2 1800 + * set_fsio_setting 3 95 + * set_fsio_setting 4 14 * * set_rpn_expression 1 "rpm 0 fsio_setting > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |" * eval "rpm 0 fsio_setting > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |" @@ -248,7 +248,7 @@ void setFordEscortGt(DECLARE_ENGINE_PARAMETER_F) { boardConfiguration->fsio_setting[2] = 90; // CLT threshold boardConfiguration->fsio_setting[3] = 13.5; // voltage threshold - setFsio(1, GPIOC_13, "rpm 1 fsio_setting > coolant 2 fsio_setting > | vbatt 3 fsio_setting < |" PASS_ENGINE_PARAMETER); + setFsio(1, GPIOC_13, "rpm 2 fsio_setting > coolant 3 fsio_setting > | vbatt 4 fsio_setting < |" PASS_ENGINE_PARAMETER); config->ignitionRpmBins[0] = 800; diff --git a/firmware/config/engines/lada_kalina.cpp b/firmware/config/engines/lada_kalina.cpp index b6514ae631..a1a84762e8 100644 --- a/firmware/config/engines/lada_kalina.cpp +++ b/firmware/config/engines/lada_kalina.cpp @@ -52,10 +52,10 @@ void setLadaKalina(DECLARE_ENGINE_PARAMETER_F) { // starter relay solenoid /** * to test - * set_fsio_setting 0 5000 + * set_fsio_setting 1 5000 */ engineConfiguration->bc.fsio_setting[0] = 500; // set_rpn_expression 1 "rpm 0 fsio_setting <" - setFsioExt(0, GPIOE_3, "rpm 0 fsio_setting <", 0 PASS_ENGINE_PARAMETER); + setFsioExt(0, GPIOE_3, "rpm 1 fsio_setting <", 0 PASS_ENGINE_PARAMETER); } diff --git a/firmware/config/engines/mazda_miata_1_6.cpp b/firmware/config/engines/mazda_miata_1_6.cpp index 5e54e310b4..30b4cdc4f9 100644 --- a/firmware/config/engines/mazda_miata_1_6.cpp +++ b/firmware/config/engines/mazda_miata_1_6.cpp @@ -167,28 +167,29 @@ void setMiataNA_1_6_Configuration(DECLARE_ENGINE_PARAMETER_F) { // warning light /** * to test - * set_fsio_setting 0 1800 - * set_fsio_setting 1 95 - * set_fsio_setting 3 14 + * set_fsio_setting 1 1800 + * set_fsio_setting 2 95 + * set_fsio_setting 4 14 * * set_rpn_expression 1 "rpm 0 fsio_setting > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |" - * rpn_eval "rpm 0 fsio_setting > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |" + * rpn_eval "rpm 1 fsio_setting > coolant 2 fsio_setting > | vbatt 4 fsio_setting < |" */ boardConfiguration->fsio_setting[0] = 6400; // RPM threshold - boardConfiguration->fsio_setting[1] = 100; // CLT threshold - boardConfiguration->fsio_setting[2] = 13.0; // voltage threshold + boardConfiguration->fsio_setting[1] = 100; // CLT threshold, fsio_setting #2 + boardConfiguration->fsio_setting[2] = 13.0; // voltage threshold, fsio_setting #3 - // set_fsio_setting 3 3000 - boardConfiguration->fsio_setting[3] = 3000; // oil pressure RPM - // set_fsio_setting 4 0.52 - boardConfiguration->fsio_setting[4] = 0.52; // oil pressure threshold + // set_fsio_setting 4 3000 + boardConfiguration->fsio_setting[3] = 3000; // oil pressure RPM, fsio_setting #4 + // set_fsio_setting 5 0.52 + boardConfiguration->fsio_setting[4] = 0.52; // oil pressure threshold, fsio_setting #5 // * set_rpn_expression 1 "rpm 3 fsio_setting >" - // rpn_eval "rpm 3 fsio_setting >" + // rpn_eval "rpm 1 fsio_setting >" // rpn_eval "fsio_input" - // set_rpn_expression 0 "rpm 3 fsio_setting > fsio_input 4 fsio_setting < & rpm 0 fsio_setting | > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |" + // set_fsio_expression 0 "((rpm > fsio_setting(4) & (fsio_input < fsio_setting(5)) | rpm > fsio_setting(1) | (coolant > fsio_setting(2) > | (vbatt < fsio_setting(3)" + // todo: convert setFsio(0, GPIOC_13, "rpm 3 fsio_setting > fsio_input 4 fsio_setting < & rpm 0 fsio_setting | > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |" PASS_ENGINE_PARAMETER); boardConfiguration->ignitionPins[0] = GPIOE_14; // Frankenso high side - pin 1G diff --git a/firmware/config/engines/mazda_miata_nb.cpp b/firmware/config/engines/mazda_miata_nb.cpp index d7a45bfbd3..00af898a10 100644 --- a/firmware/config/engines/mazda_miata_nb.cpp +++ b/firmware/config/engines/mazda_miata_nb.cpp @@ -83,7 +83,7 @@ void setMazdaMiataNb1EngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { // VICS solenoid /** * to test - * set_fsio_setting 0 5000 + * set_fsio_setting 1 5000 */ boardConfiguration->fsio_setting[0] = 5000; // (self and (rpm > 4800)) OR (rpm > 5000) diff --git a/firmware/config/engines/mazda_miata_vvt.cpp b/firmware/config/engines/mazda_miata_vvt.cpp index 4bd236bf5d..b3073390af 100644 --- a/firmware/config/engines/mazda_miata_vvt.cpp +++ b/firmware/config/engines/mazda_miata_vvt.cpp @@ -129,7 +129,7 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { engineConfiguration->auxPidFrequency[0] = 300; engineConfiguration->auxPidPins[0] = GPIOE_3; // VVT solenoid control // /** - // * set_fsio_setting 0 0.55 + // * set_fsio_setting 1 0.55 // */ boardConfiguration->fsio_setting[0] = 0.0; // setFsioExt(0, GPIOE_3, "0 fsio_setting", 400 PASS_ENGINE_PARAMETER); diff --git a/firmware/controllers/core/fsio_core.cpp b/firmware/controllers/core/fsio_core.cpp index ca082cc8f7..bcdab9288e 100644 --- a/firmware/controllers/core/fsio_core.cpp +++ b/firmware/controllers/core/fsio_core.cpp @@ -255,8 +255,8 @@ bool LECalculator::processElement(Engine *engine, LEElement *element) { } break; case LE_METHOD_FSIO_SETTING: { - float i = pop(LE_METHOD_FSIO_SETTING); - int index = (int) i; + float humanIndex = pop(LE_METHOD_FSIO_SETTING); + int index = (int) humanIndex - 1; if (index >= 0 && index < LE_COMMAND_COUNT) { push(element->action, engine->engineConfiguration->bc.fsio_setting[index]); } else { diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index ce7a982ba2..9a909a21a6 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -325,7 +325,11 @@ static void setFsioFrequency(int index, int frequency) { return; } boardConfiguration->fsioFrequency[index] = frequency; - scheduleMsg(logger, "Setting FSIO frequency %d on #%d", frequency, index + 1); + if (frequency == 0) { + scheduleMsg(logger, "FSIO output #%d@%s set to on/off mode", index + 1, hwPortname(boardConfiguration->fsioPins[index])); + } else { + scheduleMsg(logger, "Setting FSIO frequency %dHz on #%d@%s", frequency, index + 1, hwPortname(boardConfiguration->fsioPins[index])); + } } void runFsio(void) { @@ -426,16 +430,16 @@ static void showFsioInfo(void) { } /** - * set_fsio_setting 0 0.11 + * set_fsio_setting 1 0.11 */ static void setFsioSetting(float indexF, float value) { #if EFI_PROD_CODE || EFI_SIMULATOR - int index = (int)indexF; - if (index < 0 || index >= LE_COMMAND_COUNT) { - scheduleMsg(logger, "invalid FSIO index: %d", index); + int humanIndex = (int)indexF; + if (humanIndex < 1 || humanIndex > LE_COMMAND_COUNT) { + scheduleMsg(logger, "invalid FSIO index: %d", humanIndex); return; } - engineConfiguration->bc.fsio_setting[index] = value; + engineConfiguration->bc.fsio_setting[humanIndex] = value; showFsioInfo(); #endif }