From e4289a172b7054d51e7d2161082e7675cf96793c Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 5 Jan 2025 15:21:34 +0100 Subject: [PATCH] WUPSConfigItemButtonCombo: Fix displaying the conlict warning --- include/wups/config/WUPSConfigItemButtonCombo.h | 1 + libraries/libwups/WUPSConfigItemButtonCombo.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/wups/config/WUPSConfigItemButtonCombo.h b/include/wups/config/WUPSConfigItemButtonCombo.h index f36efac..cda182b 100644 --- a/include/wups/config/WUPSConfigItemButtonCombo.h +++ b/include/wups/config/WUPSConfigItemButtonCombo.h @@ -13,6 +13,7 @@ typedef enum ConfigItemButtonCombo_State { WUPS_CONFIG_ITEM_BUTTON_COMBO_STATE_PREPARE_FOR_HOLD, WUPS_CONFIG_ITEM_BUTTON_COMBO_STATE_WAIT_FOR_HOLD, WUPS_CONFIG_ITEM_BUTTON_COMBO_STATE_INVALID_HANDLE, + WUPS_CONFIG_ITEM_BUTTON_COMBO_STATE_CONFLICT_WAIT, } ConfigItemButtonCombo_State; typedef struct ConfigItemButtonCombo { diff --git a/libraries/libwups/WUPSConfigItemButtonCombo.cpp b/libraries/libwups/WUPSConfigItemButtonCombo.cpp index ae5336a..a32e15e 100644 --- a/libraries/libwups/WUPSConfigItemButtonCombo.cpp +++ b/libraries/libwups/WUPSConfigItemButtonCombo.cpp @@ -159,13 +159,17 @@ namespace { if (const auto res = checkForHold(item); res == WUPS_BUTTON_COMBO_ERROR_SUCCESS || res == WUPS_BUTTON_COMBO_ERROR_ABORTED) { item->itemState = WUPS_CONFIG_ITEM_BUTTON_COMBO_STATE_NONE; } else { - item->itemState = WUPS_CONFIG_ITEM_BUTTON_COMBO_STATE_PREPARE_FOR_HOLD; + item->itemState = WUPS_CONFIG_ITEM_BUTTON_COMBO_STATE_CONFLICT_WAIT; snprintf(out_buf, out_size, "ERROR: Conflict detected. Try again"); - OSSleepTicks(OSMillisecondsToTicks(2000)); return 0; } break; } + case WUPS_CONFIG_ITEM_BUTTON_COMBO_STATE_CONFLICT_WAIT: + OSSleepTicks(OSMillisecondsToTicks(2000)); + snprintf(out_buf, out_size, "ERROR: Conflict detected. Try again"); + item->itemState = WUPS_CONFIG_ITEM_BUTTON_COMBO_STATE_PREPARE_FOR_HOLD; + return 0; case WUPS_CONFIG_ITEM_BUTTON_COMBO_STATE_NONE: break; }