From bcbde909f87e51535b095b96bee927117142f3bf Mon Sep 17 00:00:00 2001 From: Alex Duchesne Date: Sat, 3 Aug 2024 19:45:31 -0400 Subject: [PATCH] rg_system: exitCalled and ledValue should be local I know I've changed back and forth over the years but it makes no sense to have them accessible to the outside (via rg_system_get_app). --- components/retro-go/rg_system.c | 13 +++++++------ components/retro-go/rg_system.h | 4 ---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/components/retro-go/rg_system.c b/components/retro-go/rg_system.c index 502153f16..d3ec10cb7 100644 --- a/components/retro-go/rg_system.c +++ b/components/retro-go/rg_system.c @@ -74,6 +74,8 @@ static struct static RTC_NOINIT_ATTR panic_trace_t panicTrace; static RTC_NOINIT_ATTR time_t rtcValue; static bool panicTraceCleared = false; +static bool exitCalled = false; +static int ledValue = 0; static rg_stats_t statistics; static rg_app_t app; static rg_task_t tasks[8]; @@ -179,7 +181,7 @@ static void system_monitor_task(void *arg) rg_task_delay(2000); - while (!app.exitCalled) + while (!exitCalled) { nextLoopTime = rg_system_timer() + 1000000; rtcValue = time(NULL); @@ -684,7 +686,7 @@ void rg_system_event(int event, void *arg) static void shutdown_cleanup(void) { - app.exitCalled = true; + exitCalled = true; rg_display_clear(C_BLACK); // Let the user know that something is happening rg_gui_draw_hourglass(); // ... rg_system_event(RG_EVENT_SHUTDOWN, NULL); // Allow apps to save their state if they want @@ -886,15 +888,14 @@ bool rg_system_save_trace(const char *filename, bool panic_trace) void rg_system_set_led(int value) { #if defined(ESP_PLATFORM) && defined(RG_GPIO_LED) - if (app.ledValue != value) - gpio_set_level(RG_GPIO_LED, value); + gpio_set_level(RG_GPIO_LED, value); #endif - app.ledValue = value; + ledValue = value; } int rg_system_get_led(void) { - return app.ledValue; + return ledValue; } void rg_system_set_log_level(rg_log_level_t level) diff --git a/components/retro-go/rg_system.h b/components/retro-go/rg_system.h index b7747b81a..6cf861974 100644 --- a/components/retro-go/rg_system.h +++ b/components/retro-go/rg_system.h @@ -182,10 +182,6 @@ typedef struct const rg_gui_option_t *options; rg_handlers_t handlers; bool initialized; - - // Volatile values - int exitCalled; - int ledValue; } rg_app_t; typedef struct