Add most recent params for FT24

This commit is contained in:
2024-07-22 08:43:42 +02:00
parent 555a114ae5
commit a07d51f223
4 changed files with 95 additions and 97 deletions

View File

@ -12,6 +12,10 @@
#include "leds.h"
#define DRS_BUTTON_IDX (6)
#define DRS_PRESS_WAIT_CYCLES (10)
static drs_press_buf_cycles = 0;
void ui_thread_entry(ULONG _) {
GPIO_TypeDef *button_ports[NUM_BUTTONS] = {BTN1_GPIO_Port, BTN2_GPIO_Port,
BTN3_GPIO_Port, BTN4_GPIO_Port,
@ -46,12 +50,15 @@ void ui_thread_entry(ULONG _) {
tx_event_flags_set(&gui_update_events, GUI_UPDATE_NEXT_SCREEN, TX_OR);
}
if (button_states[6] == GPIO_PIN_SET) {
if (button_states[DRS_BUTTON_IDX] == GPIO_PIN_SET) {
// Set leftmost led to blue to indicate DRS activation
drs_press_buf_cycles = DRS_PRESS_WAIT_CYCLES;
led_set(0, 0, 0, 255);
} else {
// Turn it off if not active
} if (drs_press_buf_cycles < 0) {
// Assume no longer active, turn off
led_set(0, 0, 0, 0);
} else if (drs_press_buf_cycles >= 0) {
drs_press_buf_cycles--;
}
vehicle_broadcast_buttons(button_states);