Compare commits

...

2 Commits

2 changed files with 25 additions and 5 deletions

View File

@ -126,9 +126,21 @@ static void udp_server_task(void *pvParameters) {
(uint8_t *)&(rx_buffer[3]), len - 3); (uint8_t *)&(rx_buffer[3]), len - 3);
break; break;
default: case 3: // computer brightness changed
if (rx_buffer[1] == 1) {
display1_brightness.value = rx_buffer[2];
} else if (rx_buffer[1] == 2) {
display2_brightness.value = rx_buffer[2];
}
break;
ESP_LOGI(UDP_SERVER_TAG, "%s", rx_buffer); case 4: // computer volume changed
computer_volume.value = rx_buffer[1];
break;
default:
ESP_LOG_BUFFER_HEXDUMP(UDP_SERVER_TAG, rx_buffer, len,
ESP_LOG_INFO);
break; break;
} }
ESP_LOGD(UDP_SERVER_TAG, "Received %d bytes from %s:", len, addr_str); ESP_LOGD(UDP_SERVER_TAG, "Received %d bytes from %s:", len, addr_str);

View File

@ -84,6 +84,7 @@ static lv_obj_t *desktop_label;
static lv_anim_t desktop_animate; static lv_anim_t desktop_animate;
value_setting_panel_t *value_setting_panel = NULL; value_setting_panel_t *value_setting_panel = NULL;
static bool panel_locked = false;
static lv_obj_t *scr; static lv_obj_t *scr;
@ -237,9 +238,10 @@ static void gui_close_value_setting_panel() {
} }
static void gui_check_value_setting_panel_task(void *pvParameters) { static void gui_check_value_setting_panel_task(void *pvParameters) {
vTaskDelay(5000 / portTICK_PERIOD_MS); vTaskDelay(GUI_PANEL_TIMEOUT_US / 1000 / portTICK_PERIOD_MS);
for (;;) { for (;;) {
if (esp_timer_get_time() - value_setting_panel->last_updated_at > if (!panel_locked &&
esp_timer_get_time() - value_setting_panel->last_updated_at >
GUI_PANEL_TIMEOUT_US) { GUI_PANEL_TIMEOUT_US) {
gui_close_value_setting_panel(); gui_close_value_setting_panel();
vTaskDelete(NULL); vTaskDelete(NULL);
@ -296,26 +298,32 @@ static void gui_create_value_setting_panel() {
} }
static void gui_change_strip_level(int32_t target_value) { static void gui_change_strip_level(int32_t target_value) {
panel_locked = true;
gui_create_value_setting_panel(); gui_create_value_setting_panel();
lv_label_set_text(value_setting_panel->label, "Strip Level"); lv_label_set_text(value_setting_panel->label, "Strip Level");
lv_bar_set_range(value_setting_panel->bar, 0, 255); lv_bar_set_range(value_setting_panel->bar, 0, 255);
lv_bar_set_value(value_setting_panel->bar, target_value, LV_ANIM_ON); lv_bar_set_value(value_setting_panel->bar, target_value, LV_ANIM_ON);
panel_locked = false;
} }
static void gui_change_display_brightness(int8_t display_index, static void gui_change_display_brightness(int8_t display_index,
int32_t target_value) { int32_t target_value) {
panel_locked = true;
gui_create_value_setting_panel(); gui_create_value_setting_panel();
lv_label_set_text_fmt(value_setting_panel->label, "Display#%d Brightness", lv_label_set_text_fmt(value_setting_panel->label, "Display#%d Brightness",
display_index); display_index);
lv_bar_set_range(value_setting_panel->bar, 0, 100); lv_bar_set_range(value_setting_panel->bar, 0, 100);
lv_bar_set_value(value_setting_panel->bar, target_value, LV_ANIM_ON); lv_bar_set_value(value_setting_panel->bar, target_value, LV_ANIM_ON);
panel_locked = false;
} }
static void gui_change_volume_level(int32_t target_value) { static void gui_change_volume_level(int32_t target_value) {
panel_locked = true;
gui_create_value_setting_panel(); gui_create_value_setting_panel();
lv_label_set_text(value_setting_panel->label, "Volume Level"); lv_label_set_text(value_setting_panel->label, "Volume Level");
lv_bar_set_range(value_setting_panel->bar, 0, 100); lv_bar_set_range(value_setting_panel->bar, 0, 100);
lv_bar_set_value(value_setting_panel->bar, target_value, LV_ANIM_ON); lv_bar_set_value(value_setting_panel->bar, target_value, LV_ANIM_ON);
panel_locked = false;
} }
void gui_status_bar_create(lv_obj_t *scr) { void gui_status_bar_create(lv_obj_t *scr) {