Skip to content

Commit 9a2a797

Browse files
committed
gui: code clean up
1 parent fe703ec commit 9a2a797

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

main/src/user/gui.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ static void gui_task(void *pvParameter)
4646

4747
while (1) {
4848
if (gui_mode) {
49-
if (xEventGroupGetBits(user_event_group) & GUI_RELOAD_BIT) {
50-
xEventGroupClearBits(user_event_group, GUI_RELOAD_BIT);
51-
continue;
52-
}
53-
5449
xLastWakeTime = xTaskGetTickCount();
5550

5651
gdispGSetBacklight(gui_gdisp, 255);
@@ -68,6 +63,10 @@ static void gui_task(void *pvParameter)
6863

6964
vTaskDelayUntil(&xLastWakeTime, 16 / portTICK_RATE_MS);
7065
} else {
66+
if (xEventGroupGetBits(user_event_group) & GUI_RELOAD_BIT) {
67+
xEventGroupClearBits(user_event_group, GUI_RELOAD_BIT);
68+
}
69+
7170
gdispGSetBacklight(gui_gdisp, 0);
7271

7372
xEventGroupWaitBits(
@@ -85,11 +84,7 @@ void gui_set_mode(bool val)
8584
{
8685
gui_mode = val;
8786

88-
if (gui_mode) {
89-
xEventGroupSetBits(user_event_group, GUI_RELOAD_BIT);
90-
} else {
91-
xEventGroupClearBits(user_event_group, GUI_RELOAD_BIT);
92-
}
87+
xEventGroupSetBits(user_event_group, GUI_RELOAD_BIT);
9388

9489
ESP_LOGI(TAG, "mode: %u", gui_mode);
9590
}
@@ -101,7 +96,5 @@ bool gui_get_mode(void)
10196

10297
void gui_init(void)
10398
{
104-
xEventGroupSetBits(user_event_group, GUI_RELOAD_BIT);
105-
10699
xTaskCreatePinnedToCore(gui_task, "guiT", 1920, NULL, 7, NULL, 0);
107100
}

0 commit comments

Comments
 (0)