diff --git a/configurator/src/include/config.h b/configurator/src/include/config.h index ab696e2..90629ea 100644 --- a/configurator/src/include/config.h +++ b/configurator/src/include/config.h @@ -9,7 +9,7 @@ #include "screen.h" #include "commands.h" -#define MAX_ENTRIES 21 +#define MAX_ENTRIES 22 #define MAX_KEY_LENGTH 20 #define MAX_STRING_VALUE_LENGTH 64 diff --git a/configurator/src/include/helper.h b/configurator/src/include/helper.h index 0f31cab..f6ea5c2 100644 --- a/configurator/src/include/helper.h +++ b/configurator/src/include/helper.h @@ -82,7 +82,7 @@ static __uint32_t random_number = 0x0; #define NETWORKLOAD_WAIT_TIME 40 #define ROMS_JSON_WAIT_TIME 5 #define ROMSLOAD_WAIT_TIME 40 -#define FLOPPYDB_WAIT_TIME 5 +#define FLOPPYDB_WAIT_TIME 10 #define FLOPPYLOAD_WAIT_TIME 40 #define FLOPPYLIST_WAIT_TIME 10 #define CONFIG_WAIT_TIME 10 @@ -103,6 +103,7 @@ static __uint32_t random_number = 0x0; #define KEY_ESC 0x1001B #define PARAM_DOWNLOAD_TIMEOUT_SEC "DOWNLOAD_TIMEOUT_SEC" +#define PARAM_MENU_REFRESH_SEC "MENU_REFRESH_SEC" #define PRINT_APP_HEADER(version) \ do \ diff --git a/configurator/src/main.c b/configurator/src/main.c index c0868f0..d111427 100644 --- a/configurator/src/main.c +++ b/configurator/src/main.c @@ -38,8 +38,9 @@ #define MENU_ALIGN_Y 4 #define PROMT_ALIGN_X 7 #define PROMT_ALIGN_Y 20 -#define MENU_CALLBACK_INTERVAL 6 // Every 6 seconds poll for the connection status -#define ALLOWED_KEYS "123456DWCRE" // Only these keys are allowed +#define MENU_CALLBACK_INTERVAL 6 // Default poll for the connection status in seconds +#define MENU_CALLBACK_INTERVAL_MIN 2 // Minimum value for the menu callback interval in seconds +#define ALLOWED_KEYS "123456DWCRE" // Only these keys are allowed typedef struct { @@ -81,7 +82,7 @@ static void blink_if_new_version_available(__uint16_t blink_toogle) } } -static __int8_t get_number_active_wait(CallbackFunction networkCallback, CallbackFunction storageCallback) +static __int8_t get_number_active_wait(CallbackFunction networkCallback, CallbackFunction storageCallback, __uint8_t refresh_interval_sec) { __uint16_t callback_interval = 0; __uint16_t first_time = TRUE; @@ -117,7 +118,7 @@ static __int8_t get_number_active_wait(CallbackFunction networkCallback, Callbac { networkCallback(TRUE); } - callback_interval = MENU_CALLBACK_INTERVAL * 50; + callback_interval = refresh_interval_sec * 50; if (first_time) { first_time = FALSE; @@ -158,12 +159,20 @@ static __int8_t get_number_active_wait(CallbackFunction networkCallback, Callbac static __int8_t menu() { + ConfigEntry *menu_refresh_sec = get_config_entry(PARAM_MENU_REFRESH_SEC); + __uint8_t menu_callback_interval = menu_refresh_sec != NULL ? atoi(menu_refresh_sec->value) : MENU_CALLBACK_INTERVAL; + // If the value is less than the minimum, set the minimum value + if (menu_callback_interval < MENU_CALLBACK_INTERVAL_MIN) + { + menu_callback_interval = MENU_CALLBACK_INTERVAL_MIN; + } + PRINT_APP_HEADER(VERSION); locate(PROMT_ALIGN_X, PROMT_ALIGN_Y); char *prompt; asprintf(&prompt, "Choose the feature (1 to %d), or press 0 to exit: ", LAST_OPTION); - __int8_t feature = get_number_active_wait((CallbackFunction)get_connection_status, (CallbackFunction)get_storage_status); + __int8_t feature = get_number_active_wait((CallbackFunction)get_connection_status, (CallbackFunction)get_storage_status, menu_callback_interval); if (feature <= 0) feature = -1;