Add color fix for dual-usb 2432S028R

This commit is contained in:
suchmememanyskill
2024-03-28 18:25:32 +01:00
parent f110feee1e
commit 1238b7ee37
3 changed files with 21 additions and 0 deletions

View File

@@ -64,6 +64,7 @@ typedef struct _GLOBAL_CONFIG {
bool auto_ota_update : 1;
bool multi_printer_mode : 1;
bool on_during_print : 1;
bool display_mode : 1; // Driver specifc usage. Currently only used on ESP32-2432S028R to fix the screen on the usb-c model
};
};

View File

@@ -80,6 +80,15 @@ void screen_setup()
tft.init();
if (global_config.display_mode) {
// <3 https://github.com/witnessmenow/ESP32-Cheap-Yellow-Display/blob/main/cyd.md#the-display-doesnt-look-as-good
tft.writecommand(ILI9341_GAMMASET); //Gamma curve selected
tft.writedata(2);
delay(120);
tft.writecommand(ILI9341_GAMMASET); //Gamma curve selected
tft.writedata(1);
}
ledcSetup(0, 5000, 12);
ledcAttachPin(21, 0);

View File

@@ -88,6 +88,14 @@ static void wake_timeout_dropdown(lv_event_t * e){
write_global_config();
}
static void dualusb_screen_fix_switch(lv_event_t* e){
auto state = lv_obj_get_state(lv_event_get_target(e));
bool checked = (state & LV_STATE_CHECKED == LV_STATE_CHECKED);
global_config.display_mode = checked;
write_global_config();
ESP.restart();
}
static void rotate_screen_switch(lv_event_t* e){
auto state = lv_obj_get_state(lv_event_get_target(e));
bool checked = (state & LV_STATE_CHECKED == LV_STATE_CHECKED);
@@ -186,6 +194,9 @@ void settings_panel_init(lv_obj_t* panel){
lv_create_custom_menu_dropdown("Wake Timeout", panel, wake_timeout_dropdown, wake_timeout_options, wake_timeout_settings_index);
#endif
#ifdef CYD_SCREEN_DRIVER_ESP32_2432S028R
lv_create_custom_menu_switch("Dual USB Screen Color Fix", panel, dualusb_screen_fix_switch, global_config.display_mode);
#endif
lv_create_custom_menu_switch("Rotate Screen", panel, rotate_screen_switch, global_config.rotate_screen);
lv_create_custom_menu_switch("Multi Printer Mode", panel, multi_printer_switch, global_config.multi_printer_mode);
lv_create_custom_menu_switch("Auto Update", panel, auto_ota_update_switch, global_config.auto_ota_update);