mirror of
https://github.com/suchmememanyskill/CYD-Klipper.git
synced 2026-03-21 05:33:24 +00:00
Lower CPU speed if screen is off
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#ifndef _SCREEN_DRIVER_INIT
|
||||
#define _SCREEN_DRIVER_INIT
|
||||
|
||||
#define CPU_FREQ_HIGH 240
|
||||
#define CPU_FREQ_LOW 80
|
||||
|
||||
#include <XPT2046_Touchscreen.h>
|
||||
#include <TFT_eSPI.h>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ void setup() {
|
||||
Serial.println("Screen init done");
|
||||
|
||||
wifi_init();
|
||||
ip_setup();
|
||||
ip_init();
|
||||
data_setup();
|
||||
|
||||
nav_style_setup();
|
||||
|
||||
@@ -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()){
|
||||
|
||||
@@ -1 +1 @@
|
||||
void ip_setup();
|
||||
void ip_init();
|
||||
Reference in New Issue
Block a user