Skip to content

Commit

Permalink
rg_system: exitCalled and ledValue should be local
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
ducalex committed Aug 3, 2024
1 parent 0c68997 commit bcbde90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
13 changes: 7 additions & 6 deletions components/retro-go/rg_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions components/retro-go/rg_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bcbde90

Please sign in to comment.