Fix warnings

This commit is contained in:
2023-03-20 15:21:45 +01:00
parent 73e878097e
commit aba6604e57
5 changed files with 7 additions and 12 deletions

View File

@ -39,7 +39,6 @@ void ui_thread_entry(ULONG _) {
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
// This gets called when an edge on one of the encoder pins is detected.
static uint32_t last_change[NUM_ENCS * 2] = {0};
static GPIO_PinState last_state[NUM_ENCS * 2] = {GPIO_PIN_RESET};
if (GPIO_Pin == ENC2B_Pin) {
@ -48,8 +47,6 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
// ENC2A, we can just ignore it now.
}
uint32_t now = HAL_GetTick();
uint16_t pin_a, pin_b;
int idx_a, idx_b;
ButtonMessage msg;
@ -79,14 +76,10 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
// Second rising edge, direction depends on which pin changed last
if (a_changed && b_changed) {
// This shouldn't happen. Ignore this event.
last_change[idx_a] = now;
last_change[idx_b] = now;
return;
} else if (a_changed) {
last_change[idx_a] = now;
msg.kind = UMK_ENC_CCW;
} else if (b_changed) {
last_change[idx_b] = now;
msg.kind = UMK_ENC_CW;
} else {
// This shouldn't happen. Ignore this event.