update step1 to use the gui semaphore
This commit is contained in:
+31
-13
@@ -118,9 +118,12 @@ static int generate_part_a(void) {
|
||||
|
||||
char* text_string = COLOR_NAMES[text_idx];
|
||||
|
||||
lv_label_set_text(text, text_string);
|
||||
lv_obj_center(text);
|
||||
lv_obj_add_style(text, color_styles[text_color], LV_STATE_DEFAULT);
|
||||
if (xSemaphoreTake(xGuiSemaphore, portMAX_DELAY) == pdTRUE) {
|
||||
lv_label_set_text(text, text_string);
|
||||
lv_obj_center(text);
|
||||
lv_obj_add_style(text, color_styles[text_color], LV_STATE_DEFAULT);
|
||||
xSemaphoreGive(xGuiSemaphore);
|
||||
}
|
||||
|
||||
generate_switch_leds();
|
||||
|
||||
@@ -139,9 +142,12 @@ static int generate_part_b(void) {
|
||||
|
||||
char* text_string = NUM_NAMES[text_number];
|
||||
|
||||
lv_label_set_text(text, text_string);
|
||||
lv_obj_center(text);
|
||||
lv_obj_add_style(text, color_styles[text_color], LV_STATE_DEFAULT);
|
||||
if (xSemaphoreTake(xGuiSemaphore, portMAX_DELAY) == pdTRUE) {
|
||||
lv_label_set_text(text, text_string);
|
||||
lv_obj_center(text);
|
||||
lv_obj_add_style(text, color_styles[text_color], LV_STATE_DEFAULT);
|
||||
xSemaphoreGive(xGuiSemaphore);
|
||||
}
|
||||
|
||||
generate_switch_leds();
|
||||
|
||||
@@ -158,10 +164,12 @@ static int generate_part_c(void) {
|
||||
int text_color = zero_to_three(my_gen);
|
||||
char* text_string = "switch";
|
||||
|
||||
lv_label_set_text(text, text_string);
|
||||
lv_obj_center(text);
|
||||
lv_obj_add_style(text, color_styles[text_color], LV_STATE_DEFAULT);
|
||||
|
||||
if (xSemaphoreTake(xGuiSemaphore, portMAX_DELAY) == pdTRUE) {
|
||||
lv_label_set_text(text, text_string);
|
||||
lv_obj_center(text);
|
||||
lv_obj_add_style(text, color_styles[text_color], LV_STATE_DEFAULT);
|
||||
xSemaphoreGive(xGuiSemaphore);
|
||||
}
|
||||
generate_switch_leds();
|
||||
|
||||
// the correct answer is the switch
|
||||
@@ -202,7 +210,11 @@ static void part_a(void) {
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
|
||||
lv_label_set_text(text, "");
|
||||
|
||||
if (xSemaphoreTake(xGuiSemaphore, portMAX_DELAY) == pdTRUE) {
|
||||
lv_label_set_text(text, "");
|
||||
xSemaphoreGive(xGuiSemaphore);
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(80));
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
}
|
||||
@@ -241,7 +253,10 @@ static void part_b(void) {
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
|
||||
lv_label_set_text(text, "");
|
||||
if (xSemaphoreTake(xGuiSemaphore, portMAX_DELAY) == pdTRUE) {
|
||||
lv_label_set_text(text, "");
|
||||
xSemaphoreGive(xGuiSemaphore);
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(80));
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
}
|
||||
@@ -287,7 +302,10 @@ static void part_c(void) {
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
|
||||
lv_label_set_text(text, "");
|
||||
if (xSemaphoreTake(xGuiSemaphore, portMAX_DELAY) == pdTRUE) {
|
||||
lv_label_set_text(text, "");
|
||||
xSemaphoreGive(xGuiSemaphore);
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(80));
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user