diff --git a/ECU/Application/Inc/Lights.h b/ECU/Application/Inc/Lights.h index 37e3b6626..08fa9658c 100644 --- a/ECU/Application/Inc/Lights.h +++ b/ECU/Application/Inc/Lights.h @@ -12,6 +12,8 @@ * * @return void */ +void BrakeLightControl(ECU_StateData *stateLump); +void dashLights(ECU_StateData *stateLump); void lightControl(ECU_StateData *stateData); #endif diff --git a/ECU/Application/Src/Lights.c b/ECU/Application/Src/Lights.c index 3e0e7c31d..ddd9eb07c 100644 --- a/ECU/Application/Src/Lights.c +++ b/ECU/Application/Src/Lights.c @@ -13,7 +13,13 @@ void BrakeLightControl(ECU_StateData *stateLump) { + static uint32_t brake_light_start_millis; + if (PressingBrake(stateLump)) { + brake_light_start_millis = MillisecondsSinceBoot(); + } + + if (MillisecondsSinceBoot() - brake_light_start_millis < 100) { LL_GPIO_SetOutputPin(BRAKE_LIGHT_GPIO_Port, BRAKE_LIGHT_Pin); } else { LL_GPIO_ResetOutputPin(BRAKE_LIGHT_GPIO_Port, BRAKE_LIGHT_Pin); diff --git a/ECU/Application/Src/StateTicks.c b/ECU/Application/Src/StateTicks.c index 18d3cf616..9201d4f8e 100644 --- a/ECU/Application/Src/StateTicks.c +++ b/ECU/Application/Src/StateTicks.c @@ -245,6 +245,9 @@ void ECU_Drive_Active(ECU_StateData *stateData) } if (APPS_BSE_Violation(stateData)) { + // FIXME Strongly illegal! We are not allowed to do this at all! EV.9.7.3 + buzzer_start_millis = millis_since_boot + MAX_BUZZER_TIME_MS - 100; + // FIXME Strongly illegal! We are not allowed to do this at all! EV.9.7.3 stateData->apps_bse_violation = true; } else if (CalcAccPedalTravel(stateData) < (stateData->apps_deadzone + 0.05f)) { stateData->apps_bse_violation = false; diff --git a/ECU/Core/Src/main.c b/ECU/Core/Src/main.c index 9ad6a31bb..3e1f442ea 100644 --- a/ECU/Core/Src/main.c +++ b/ECU/Core/Src/main.c @@ -485,6 +485,8 @@ int main(void) LOGOMATIC("Boot completed at %lu ms\n", MillisecondsSinceBoot()); while (MillisecondsSinceBoot() < 5000) { // Notes per Andrey and Ryan + BrakeLightControl(&stateLump); + dashLights(&stateLump); LL_mDelay(1); ADC_UpdateAnalogValues_EMA(ADC_buffers, NUM_SIGNALS, adc_alpha, ADC_outputs); write_adc_values_to_state_data();