diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 0a75b2dbef..bead5c7e78 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -827,6 +827,8 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->clutchUpState = engine->clutchUpState; tsOutputChannels->clutchDownState = engine->clutchDownState; + tsOutputChannels->brakePedalState = engine->brakePedalState; + tsOutputChannels->tCharge = getTCharge(rpm, tps, coolant, intake PASS_ENGINE_PARAMETER); float timing = engine->engineState.timingAdvance; tsOutputChannels->ignitionAdvance = timing > 360 ? timing - 720 : timing; diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index c3eeda8b85..6f6e05a46f 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -134,7 +134,7 @@ void Engine::reset() { timeOfLastKnockEvent = 0; fuelMs = 0; - clutchDownState = clutchUpState = false; + clutchDownState = clutchUpState = brakePedalState = false; memset(&m, 0, sizeof(m)); } diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index b161a4bbc5..dd902b96db 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -329,6 +329,7 @@ public: bool clutchUpState; bool clutchDownState; + bool brakePedalState; bool isRunningPwmTest; diff --git a/firmware/controllers/idle_thread.cpp b/firmware/controllers/idle_thread.cpp index 1cb926aac1..1ad755ee1d 100644 --- a/firmware/controllers/idle_thread.cpp +++ b/firmware/controllers/idle_thread.cpp @@ -210,12 +210,14 @@ static msg_t ivThread(int param) { // this value is not used yet if (boardConfiguration->clutchDownPin != GPIO_UNASSIGNED) { - engine->clutchDownState = palReadPad(getHwPort(boardConfiguration->clutchDownPin), - getHwPin(boardConfiguration->clutchDownPin)); + engine->clutchDownState = efiReadPin(boardConfiguration->clutchDownPin); } if (boardConfiguration->clutchUpPin != GPIO_UNASSIGNED) { - engine->clutchUpState = palReadPad(getHwPort(boardConfiguration->clutchUpPin), - getHwPin(boardConfiguration->clutchUpPin)); + engine->clutchUpState = efiReadPin(boardConfiguration->clutchUpPin); + } + + if (engineConfiguration->brakePedalPin != GPIO_UNASSIGNED) { + engine->brakePedalState = efiReadPin(engineConfiguration->brakePedalPin); } finishIdleTestIfNeeded(); @@ -320,13 +322,20 @@ void startIdleThread(Logging*sharedLogger) { // this is idle switch INPUT - sometimes there is a switch on the throttle pedal // this switch is not used yet - if (boardConfiguration->clutchDownPin != GPIO_UNASSIGNED) + if (boardConfiguration->clutchDownPin != GPIO_UNASSIGNED) { mySetPadMode2("clutch down switch", boardConfiguration->clutchDownPin, getInputMode(boardConfiguration->clutchDownPinMode)); + } - if (boardConfiguration->clutchUpPin != GPIO_UNASSIGNED) + if (boardConfiguration->clutchUpPin != GPIO_UNASSIGNED) { mySetPadMode2("clutch up switch", boardConfiguration->clutchUpPin, getInputMode(boardConfiguration->clutchUpPinMode)); + } + + if (engineConfiguration->brakePedalPin != GPIO_UNASSIGNED) { + mySetPadMode2("brake pedal switch", engineConfiguration->brakePedalPin, + getInputMode(engineConfiguration->brakePedalPinMode)); + } addConsoleAction("idleinfo", showIdleInfo); diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index 3304131bcc..0e74a4f3b0 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -45,7 +45,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon May 15 04:47:12 EDT 2017 +; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon May 15 05:04:09 EDT 2017 pageSize = 16376 page = 1 @@ -1743,6 +1743,7 @@ cmd_call_from_pit = "w\x00\x20\x34\x56" field = "Vehicle Speed Input pin", vehicleSpeedSensorInputPin field = "clutchDownPin", clutchDownPin field = "clutchUpPin", clutchUpPin + field = "brakePedalPin", brakePedalPin dialog = allPins2 field = "Tachometer output Pin", tachOutputPin @@ -2403,4 +2404,5 @@ cmd_call_from_pit = "w\x00\x20\x34\x56" field = "Use Fuel Cut", step1fuelCutEnable field = "clutchDownPin", clutchDownPin field = "clutchUpPin", clutchUpPin + field = "brakePedalPin", brakePedalPin diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 17a4eac1fa..bc12bb054a 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -1003,6 +1003,7 @@ cmd_call_from_pit = "w\x00\x20\x34\x56" field = "Vehicle Speed Input pin", vehicleSpeedSensorInputPin field = "clutchDownPin", clutchDownPin field = "clutchUpPin", clutchUpPin + field = "brakePedalPin", brakePedalPin dialog = allPins2 field = "Tachometer output Pin", tachOutputPin @@ -1663,4 +1664,5 @@ cmd_call_from_pit = "w\x00\x20\x34\x56" field = "Use Fuel Cut", step1fuelCutEnable field = "clutchDownPin", clutchDownPin field = "clutchUpPin", clutchUpPin + field = "brakePedalPin", brakePedalPin