Skip to content

Commit

Permalink
main: key_handler.cpp: Remove redundant checks
Browse files Browse the repository at this point in the history
In single tap event there is no need at all to check whether we are in single bud mode or if the event came from left or right earbud in TWS mode. The event is the same.

For quad tap we do nothing at all in TWS mode for now. So remove the checks for right or left earbud.
  • Loading branch information
Haxk20 authored Nov 4, 2023
1 parent 7facfe9 commit 48f3088
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions apps/main/key_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,7 @@ void send_prev_track(void) {
}
void app_key_single_tap(APP_KEY_STATUS *status, void *param) {
TRACE(2, "%s event %d", __func__, status->event);

if (!app_tws_ibrt_tws_link_connected()) {
// No other bud paired
TRACE(0, "Handling %s in single bud mode", __func__);
send_play_pause();
} else {
// Bud's are working as a pair
if (app_tws_is_left_side()) {
TRACE(0, "Handling %s as left bud", __func__);
// Lefty
send_play_pause();
} else {
TRACE(0, "Handling %s as right bud", __func__);
// Righty
send_play_pause();
}
}
send_play_pause();
}
void app_key_double_tap(APP_KEY_STATUS *status, void *param) {
TRACE(2, "%s event %d", __func__, status->event);
Expand Down Expand Up @@ -186,15 +170,6 @@ void app_key_quad_tap(APP_KEY_STATUS *status, void *param) {
// No other bud paired
TRACE(0, "Handling %s in single bud mode", __func__);
send_vol_down();
} else {
// Bud's are working as a pair
if (app_tws_is_left_side()) {
TRACE(0, "Handling %s as left bud", __func__);
// Lefty
} else {
TRACE(0, "Handling %s as right bud", __func__);
// Righty
}
}
}

Expand Down Expand Up @@ -268,4 +243,4 @@ void app_key_init_on_charging(void) {
for (i = 0; i < (sizeof(key_cfg) / sizeof(APP_KEY_HANDLE)); i++) {
app_key_handle_registration(&key_cfg[i]);
}
}
}

0 comments on commit 48f3088

Please sign in to comment.