From b42ffe8e0be41e5aa99bbe656921883b6ba8c92d Mon Sep 17 00:00:00 2001 From: BuGu <62454025+Z2Z-GuGu@users.noreply.github.com> Date: Tue, 15 Apr 2025 11:29:22 +0800 Subject: [PATCH] Add Function: Automatically wake up the screen OLED will automatically wake up in the following scenarios: 1. Plug and unplug the network cable 2. Plug and unplug USB 3. WiFi connection status has changed 4. Plug and unplug HDMI 5. HDMI input resolution changes 6. The transmission format has changed 7. Change in transmission quality --- .../kvm_system/main/lib/oled_ui/oled_ui.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/support/sg2002/kvm_system/main/lib/oled_ui/oled_ui.cpp b/support/sg2002/kvm_system/main/lib/oled_ui/oled_ui.cpp index 115bcf7..20b6a1e 100644 --- a/support/sg2002/kvm_system/main/lib/oled_ui/oled_ui.cpp +++ b/support/sg2002/kvm_system/main/lib/oled_ui/oled_ui.cpp @@ -182,6 +182,22 @@ uint8_t ip_changed(ip_addr_t ip_type) return ret; } +uint8_t kvm_state_is_changed() +{ + if( (kvm_sys_state.eth_state != kvm_oled_state.eth_state) || + (kvm_sys_state.wifi_state != kvm_oled_state.wifi_state) || + (kvm_sys_state.usb_state != kvm_oled_state.usb_state) || + (kvm_sys_state.hdmi_state != kvm_oled_state.hdmi_state) || + /* (kvm_sys_state.now_fps != kvm_oled_state.now_fps) || */ + (kvm_sys_state.hdmi_width != kvm_oled_state.hdmi_width) || + (kvm_sys_state.hdmi_height != kvm_oled_state.hdmi_height) || + (kvm_sys_state.type != kvm_oled_state.type) || + (kvm_sys_state.qlty != kvm_oled_state.qlty) ) + return 1; + else + return 0; +} + void kvm_eth_state_disp(ip_addr_t _ip_type, uint8_t first_disp) { static ip_addr_t _ip_type_old = NULL_IP; @@ -337,6 +353,11 @@ void kvm_main_ui_disp(uint8_t first_disp, uint8_t subpage_changed) ip_addr_t now_ip_type; // if(kvm_oled_state.sub_page == 0) // if(kvm_oled_state.oled_sleep_state == 1){ + + // Any operation will update the OLED sleep time + if (kvm_state_is_changed()) + oled_auto_sleep_time_update(); + if(kvm_oled_state.sub_page == 1){ // main page (oled sleep) kvm_oled_clear(first_disp || subpage_changed);