Fix up smartdisplay driver, update readme, update install page

This commit is contained in:
suchmememanyskill
2024-02-08 23:35:31 +01:00
parent 725d76d9c5
commit 2d6c2e8d10
19 changed files with 59 additions and 13 deletions

View File

@@ -112,4 +112,5 @@ build_flags =
# -DCYD_SCREEN_FONT=&lv_font_montserrat_16
# -DCYD_SCREEN_FONT_SMALL=&lv_font_montserrat_12
# -DCYD_SCREEN_SIDEBAR_SIZE_PX=50
# -DCYD_SCREEN_DRIVER_ESP32_SMARTDISPLAY=1
# -DCYD_SCREEN_DRIVER_ESP32_SMARTDISPLAY=1
# -DCYD_SCREEN_DISABLE_TIMEOUT=1

View File

@@ -24,6 +24,7 @@ void set_screen_brightness()
void screen_timer_wake()
{
#ifndef CYD_SCREEN_DISABLE_TIMEOUT
lv_timer_reset(screenSleepTimer);
if (!isScreenInSleep){
@@ -36,16 +37,19 @@ void screen_timer_wake()
// Reset cpu freq
setCpuFrequencyMhz(CPU_FREQ_HIGH);
Serial.printf("CPU Speed: %d MHz\n", ESP.getCpuFreqMHz());
#endif
}
void screen_timer_sleep(lv_timer_t *timer)
{
#ifndef CYD_SCREEN_DISABLE_TIMEOUT
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());
#endif
}
void screen_timer_setup()

View File

@@ -167,6 +167,7 @@ void settings_panel_init(lv_obj_t* panel){
create_settings_widget("Brightness", dropdown, panel);
#ifndef CYD_SCREEN_DISABLE_TIMEOUT
dropdown = lv_dropdown_create(panel);
lv_dropdown_set_options(dropdown, wake_timeout_options);
lv_obj_add_style(dropdown, get_default_label_style(), 0);
@@ -180,6 +181,7 @@ void settings_panel_init(lv_obj_t* panel){
}
create_settings_widget("Wake Timeout", dropdown, panel);
#endif
toggle = lv_switch_create(panel);
lv_obj_set_width(toggle, CYD_SCREEN_MIN_BUTTON_WIDTH_PX * 2);
@@ -190,6 +192,7 @@ void settings_panel_init(lv_obj_t* panel){
create_settings_widget("Rotate Screen", toggle, panel);
#ifndef CYD_SCREEN_DISABLE_TIMEOUT
toggle = lv_switch_create(panel);
lv_obj_set_width(toggle, CYD_SCREEN_MIN_BUTTON_WIDTH_PX * 2);
lv_obj_add_event_cb(toggle, on_during_print_switch, LV_EVENT_VALUE_CHANGED, NULL);
@@ -198,4 +201,5 @@ void settings_panel_init(lv_obj_t* panel){
lv_obj_add_state(toggle, LV_STATE_CHECKED);
create_settings_widget("Screen On During Print", toggle, panel);
#endif
}