mirror of
https://github.com/suchmememanyskill/CYD-Klipper.git
synced 2026-03-21 05:33:24 +00:00
Add color fix for dual-usb 2432S028R
This commit is contained in:
@@ -64,6 +64,7 @@ typedef struct _GLOBAL_CONFIG {
|
|||||||
bool auto_ota_update : 1;
|
bool auto_ota_update : 1;
|
||||||
bool multi_printer_mode : 1;
|
bool multi_printer_mode : 1;
|
||||||
bool on_during_print : 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
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,15 @@ void screen_setup()
|
|||||||
|
|
||||||
tft.init();
|
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);
|
ledcSetup(0, 5000, 12);
|
||||||
ledcAttachPin(21, 0);
|
ledcAttachPin(21, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,14 @@ static void wake_timeout_dropdown(lv_event_t * e){
|
|||||||
write_global_config();
|
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){
|
static void rotate_screen_switch(lv_event_t* e){
|
||||||
auto state = lv_obj_get_state(lv_event_get_target(e));
|
auto state = lv_obj_get_state(lv_event_get_target(e));
|
||||||
bool checked = (state & LV_STATE_CHECKED == LV_STATE_CHECKED);
|
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);
|
lv_create_custom_menu_dropdown("Wake Timeout", panel, wake_timeout_dropdown, wake_timeout_options, wake_timeout_settings_index);
|
||||||
#endif
|
#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("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("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);
|
lv_create_custom_menu_switch("Auto Update", panel, auto_ota_update_switch, global_config.auto_ota_update);
|
||||||
|
|||||||
Reference in New Issue
Block a user