diff --git a/CYD-Klipper/src/core/screen_driver.cpp b/CYD-Klipper/src/core/screen_driver.cpp index 8b6adb7..ce6bfa8 100644 --- a/CYD-Klipper/src/core/screen_driver.cpp +++ b/CYD-Klipper/src/core/screen_driver.cpp @@ -100,12 +100,20 @@ void screen_timer_wake() lv_timer_reset(screenSleepTimer); isScreenInSleep = false; set_screen_brightness(); + + // Reset cpu freq + setCpuFrequencyMhz(CPU_FREQ_HIGH); + Serial.printf("CPU Speed: %d MHz\n", ESP.getCpuFreqMHz()); } void screen_timer_sleep(lv_timer_t *timer) { screen_setBrightness(0); isScreenInSleep = true; + + // Screen is off, no need to make the cpu run fast, the user won't notice ;) + setCpuFrequencyMhz(CPU_FREQ_LOW); + Serial.printf("CPU Speed: %d MHz\n", ESP.getCpuFreqMHz()); } void screen_timer_setup() diff --git a/CYD-Klipper/src/core/screen_driver.h b/CYD-Klipper/src/core/screen_driver.h index 6b68fcd..90f808e 100644 --- a/CYD-Klipper/src/core/screen_driver.h +++ b/CYD-Klipper/src/core/screen_driver.h @@ -4,6 +4,9 @@ #ifndef _SCREEN_DRIVER_INIT #define _SCREEN_DRIVER_INIT +#define CPU_FREQ_HIGH 240 +#define CPU_FREQ_LOW 80 + #include #include diff --git a/CYD-Klipper/src/main.cpp b/CYD-Klipper/src/main.cpp index 89851ff..1e03eb6 100644 --- a/CYD-Klipper/src/main.cpp +++ b/CYD-Klipper/src/main.cpp @@ -25,7 +25,7 @@ void setup() { Serial.println("Screen init done"); wifi_init(); - ip_setup(); + ip_init(); data_setup(); nav_style_setup(); diff --git a/CYD-Klipper/src/ui/ip_setup.cpp b/CYD-Klipper/src/ui/ip_setup.cpp index 2acb3db..f57c259 100644 --- a/CYD-Klipper/src/ui/ip_setup.cpp +++ b/CYD-Klipper/src/ui/ip_setup.cpp @@ -95,7 +95,7 @@ void ip_setup_inner(){ lv_keyboard_set_textarea(keyboard, ipEntry); } -void ip_setup(){ +void ip_init(){ connect_ok = false; if (global_config.ipConfigured && retry_ip_verify()){ diff --git a/CYD-Klipper/src/ui/ip_setup.h b/CYD-Klipper/src/ui/ip_setup.h index 25ce25a..aa41ec1 100644 --- a/CYD-Klipper/src/ui/ip_setup.h +++ b/CYD-Klipper/src/ui/ip_setup.h @@ -1 +1 @@ -void ip_setup(); \ No newline at end of file +void ip_init(); \ No newline at end of file