start touch calibration on lvgl if no calibration is stored on settings
This commit is contained in:
parent
95c629a20e
commit
a9e41e5e81
4 changed files with 15 additions and 5 deletions
|
|
@ -147,15 +147,15 @@ SPIClass::SPIClass(uint32_t spi_num) {
|
|||
_currentSetting->state = SPI_STATE_IDLE;
|
||||
}
|
||||
|
||||
SPIClass::SPIClass(int8_t mosi, int8_t miso, int8_t sclk, int8_t ssel) {
|
||||
SPIClass::SPIClass(int8_t mosi, int8_t miso, int8_t sclk, int8_t ssel) : SPIClass(1) {
|
||||
#if BOARD_NR_SPI >= 1
|
||||
if (mosi == BOARD_SPI1_MOSI_PIN) SPIClass(1);
|
||||
if (mosi == BOARD_SPI1_MOSI_PIN) setModule(1);
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 2
|
||||
if (mosi == BOARD_SPI2_MOSI_PIN) SPIClass(2);
|
||||
if (mosi == BOARD_SPI2_MOSI_PIN) setModule(2);
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 3
|
||||
if (mosi == BOARD_SPI3_MOSI_PIN) SPIClass(3);
|
||||
if (mosi == BOARD_SPI3_MOSI_PIN) setModule(3);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
|||
}
|
||||
|
||||
void lv_draw_touch_calibration_screen(void) {
|
||||
disp_state_stack._disp_index = 0;
|
||||
ZERO(disp_state_stack._disp_state);
|
||||
scr = lv_screen_create(TOUCH_CALIBRATION_UI, "");
|
||||
|
||||
status_label = lv_label_create(scr, "");
|
||||
|
|
|
|||
|
|
@ -216,7 +216,14 @@ void tft_lvgl_init() {
|
|||
}
|
||||
#endif
|
||||
|
||||
if (ready) lv_draw_ready_print();
|
||||
if (ready) {
|
||||
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
||||
if (touch_calibration.need_calibration()) lv_draw_touch_calibration_screen();
|
||||
else lv_draw_ready_print();
|
||||
#else
|
||||
lv_draw_ready_print();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (mks_test_flag == 0x1E)
|
||||
mks_gpio_test();
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ public:
|
|||
|
||||
static touch_calibration_t calibration;
|
||||
static void calibration_reset() { calibration = {TOUCH_CALIBRATION_X, TOUCH_CALIBRATION_Y, TOUCH_OFFSET_X, TOUCH_OFFSET_Y, TOUCH_ORIENTATION}; }
|
||||
static bool need_calibration() { return !calibration.offset_x && !calibration.offset_y && !calibration.x && !calibration.y; }
|
||||
|
||||
static calibrationState calibration_start() {
|
||||
calibration = {0, 0, 0, 0, TOUCH_ORIENTATION_NONE};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue