Compare commits
2 Commits
3bdd8d70c3
...
c9b3edcc11
Author | SHA1 | Date | |
---|---|---|---|
c9b3edcc11 | |||
7c9c016aef |
@ -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);
|
||||||
|
14
main/gui.c
14
main/gui.c
@ -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,10 +238,11 @@ 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 &&
|
||||||
GUI_PANEL_TIMEOUT_US) {
|
esp_timer_get_time() - value_setting_panel->last_updated_at >
|
||||||
|
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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user