mirror of
https://github.com/suchmememanyskill/CYD-Klipper.git
synced 2026-03-21 05:33:24 +00:00
Driver configuration improvements
This commit is contained in:
@@ -85,7 +85,6 @@ void screen_setup()
|
|||||||
|
|
||||||
tft.setRotation(global_config.rotateScreen ? 3 : 1);
|
tft.setRotation(global_config.rotateScreen ? 3 : 1);
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
set_screen_brightness();
|
|
||||||
set_invert_display();
|
set_invert_display();
|
||||||
|
|
||||||
touchscreen_spi.begin(XPT2046_CLK, XPT2046_MISO, XPT2046_MOSI, XPT2046_CS);
|
touchscreen_spi.begin(XPT2046_CLK, XPT2046_MISO, XPT2046_MOSI, XPT2046_CS);
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ void screen_setup()
|
|||||||
ledcAttachPin(TFT_BL, 0);
|
ledcAttachPin(TFT_BL, 0);
|
||||||
tft.setRotation(global_config.rotateScreen ? 3 : 1);
|
tft.setRotation(global_config.rotateScreen ? 3 : 1);
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
set_screen_brightness();
|
|
||||||
set_invert_display();
|
set_invert_display();
|
||||||
LED_init();
|
LED_init();
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ void screen_setBrightness(byte brightness)
|
|||||||
smartdisplay_lcd_set_backlight(brightness / 255.0f);
|
smartdisplay_lcd_set_backlight(brightness / 255.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_invert_display(){
|
void set_invert_display()
|
||||||
|
{
|
||||||
lv_obj_invalidate(lv_scr_act());
|
lv_obj_invalidate(lv_scr_act());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,12 +34,21 @@ void lv_screen_intercept(_lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_col
|
|||||||
original_screen_driver(disp_drv, area, color_p);
|
original_screen_driver(disp_drv, area, color_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CYD_SCREEN_VERTICAL
|
|
||||||
#define ROTATION_INVERTED LV_DISP_ROT_180
|
#ifndef ROTATION_INVERTED
|
||||||
#define ROTATION_NORMAL LV_DISP_ROT_NONE
|
#ifdef CYD_SCREEN_VERTICAL
|
||||||
#else
|
#define ROTATION_INVERTED LV_DISP_ROT_180
|
||||||
#define ROTATION_INVERTED LV_DISP_ROT_270
|
#else
|
||||||
#define ROTATION_NORMAL LV_DISP_ROT_90
|
#define ROTATION_INVERTED LV_DISP_ROT_270
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ROTATION_NORMAL
|
||||||
|
#ifdef CYD_SCREEN_VERTICAL
|
||||||
|
#define ROTATION_NORMAL LV_DISP_ROT_NONE
|
||||||
|
#else
|
||||||
|
#define ROTATION_NORMAL LV_DISP_ROT_90
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void screen_setup()
|
void screen_setup()
|
||||||
|
|||||||
@@ -25,13 +25,14 @@ void lv_touch_intercept_calibration(lv_indev_drv_t *indev_driver, lv_indev_data_
|
|||||||
original_touch_driver(indev_driver, data);
|
original_touch_driver(indev_driver, data);
|
||||||
|
|
||||||
if (data->state == LV_INDEV_STATE_PR){
|
if (data->state == LV_INDEV_STATE_PR){
|
||||||
point[0] = data->point.x;
|
lv_coord_t local_point[] = {data->point.x, data->point.y};
|
||||||
point[1] = data->point.y;
|
|
||||||
|
|
||||||
while (data->state == LV_INDEV_STATE_PR){
|
while (data->state == LV_INDEV_STATE_PR){
|
||||||
original_touch_driver(indev_driver, data);
|
original_touch_driver(indev_driver, data);
|
||||||
delay(20);
|
delay(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
point[0] = local_point[0];
|
||||||
|
point[1] = local_point[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
data->state = LV_INDEV_STATE_REL;
|
data->state = LV_INDEV_STATE_REL;
|
||||||
@@ -102,6 +103,8 @@ void lv_do_calibration(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delay(300);
|
||||||
|
|
||||||
lv_coord_t x1 = point[0];
|
lv_coord_t x1 = point[0];
|
||||||
lv_coord_t y1 = point[1];
|
lv_coord_t y1 = point[1];
|
||||||
point[0] = 0;
|
point[0] = 0;
|
||||||
@@ -267,6 +270,7 @@ void lv_setup()
|
|||||||
|
|
||||||
screen_timer_setup();
|
screen_timer_setup();
|
||||||
screen_timer_start();
|
screen_timer_start();
|
||||||
|
set_screen_brightness();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_screen_asleep()
|
bool is_screen_asleep()
|
||||||
|
|||||||
Reference in New Issue
Block a user