mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-23 12:04:19 +00:00
🎨 calibration_stage => stage
This commit is contained in:
parent
d68ad9e0b1
commit
accfab85a2
@ -501,26 +501,26 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT,
|
||||
|
||||
void MarlinUI::touch_calibration_screen() {
|
||||
uint16_t x, y;
|
||||
calibrationState calibration_stage = touch_calibration.get_calibration_state();
|
||||
calibrationState stage = touch_calibration.get_calibration_state();
|
||||
|
||||
if (calibration_stage == CALIBRATION_NONE) {
|
||||
if (stage == CALIBRATION_NONE) {
|
||||
// start and clear screen
|
||||
defer_status_screen(true);
|
||||
calibration_stage = touch_calibration.calibration_start();
|
||||
stage = touch_calibration.calibration_start();
|
||||
tftio.set_window(0, 0, (TFT_WIDTH) - 1, (TFT_HEIGHT) - 1);
|
||||
tftio.WriteMultiple(TFT_MARLINBG_COLOR, uint32_t(TFT_WIDTH) * (TFT_HEIGHT));
|
||||
}
|
||||
else {
|
||||
// clear last cross
|
||||
x = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
|
||||
y = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
|
||||
x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
|
||||
y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
|
||||
drawCross(x, y, TFT_MARLINBG_COLOR);
|
||||
}
|
||||
|
||||
FSTR_P str = nullptr;
|
||||
if (calibration_stage < CALIBRATION_SUCCESS) {
|
||||
if (stage < CALIBRATION_SUCCESS) {
|
||||
// handle current state
|
||||
switch (calibration_stage) {
|
||||
switch (stage) {
|
||||
case CALIBRATION_TOP_LEFT: str = GET_TEXT_F(MSG_TOP_LEFT); break;
|
||||
case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT_F(MSG_BOTTOM_LEFT); break;
|
||||
case CALIBRATION_TOP_RIGHT: str = GET_TEXT_F(MSG_TOP_RIGHT); break;
|
||||
@ -528,13 +528,13 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT,
|
||||
default: break;
|
||||
}
|
||||
|
||||
x = touch_calibration.calibration_points[calibration_stage].x;
|
||||
y = touch_calibration.calibration_points[calibration_stage].y;
|
||||
x = touch_calibration.calibration_points[stage].x;
|
||||
y = touch_calibration.calibration_points[stage].y;
|
||||
drawCross(x, y, TFT_MARLINUI_COLOR);
|
||||
}
|
||||
else {
|
||||
// end calibration
|
||||
str = calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT_F(MSG_CALIBRATION_COMPLETED) : GET_TEXT_F(MSG_CALIBRATION_FAILED);
|
||||
str = stage == CALIBRATION_SUCCESS ? GET_TEXT_F(MSG_CALIBRATION_COMPLETED) : GET_TEXT_F(MSG_CALIBRATION_FAILED);
|
||||
defer_status_screen(false);
|
||||
touch_calibration.calibration_end();
|
||||
TERN_(HAS_TOUCH_BUTTONS, redrawTouchButtons = true);
|
||||
@ -548,7 +548,7 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT,
|
||||
} while (u8g.nextPage());
|
||||
drawing_screen = false;
|
||||
safe_delay(250);
|
||||
if (calibration_stage == CALIBRATION_SUCCESS) {
|
||||
if (stage == CALIBRATION_SUCCESS) {
|
||||
safe_delay(500);
|
||||
ui.goto_previous_screen();
|
||||
}
|
||||
|
@ -55,22 +55,22 @@ static void drawCross(uint16_t x, uint16_t y, uint16_t color) {
|
||||
void lv_update_touch_calibration_screen() {
|
||||
uint16_t x, y;
|
||||
|
||||
calibrationState calibration_stage = touch_calibration.get_calibration_state();
|
||||
if (calibration_stage == CALIBRATION_NONE) {
|
||||
calibrationState stage = touch_calibration.get_calibration_state();
|
||||
if (stage == CALIBRATION_NONE) {
|
||||
// start and clear screen
|
||||
calibration_stage = touch_calibration.calibration_start();
|
||||
stage = touch_calibration.calibration_start();
|
||||
}
|
||||
else {
|
||||
// clear last cross
|
||||
x = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
|
||||
y = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
|
||||
x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
|
||||
y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
|
||||
drawCross(x, y, LV_COLOR_BACKGROUND.full);
|
||||
}
|
||||
|
||||
const char *str = nullptr;
|
||||
if (calibration_stage < CALIBRATION_SUCCESS) {
|
||||
if (stage < CALIBRATION_SUCCESS) {
|
||||
// handle current state
|
||||
switch (calibration_stage) {
|
||||
switch (stage) {
|
||||
case CALIBRATION_TOP_LEFT: str = GET_TEXT(MSG_TOP_LEFT); break;
|
||||
case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT(MSG_BOTTOM_LEFT); break;
|
||||
case CALIBRATION_TOP_RIGHT: str = GET_TEXT(MSG_TOP_RIGHT); break;
|
||||
@ -78,13 +78,13 @@ void lv_update_touch_calibration_screen() {
|
||||
default: break;
|
||||
}
|
||||
|
||||
x = touch_calibration.calibration_points[calibration_stage].x;
|
||||
y = touch_calibration.calibration_points[calibration_stage].y;
|
||||
x = touch_calibration.calibration_points[stage].x;
|
||||
y = touch_calibration.calibration_points[stage].y;
|
||||
drawCross(x, y, LV_COLOR_WHITE.full);
|
||||
}
|
||||
else {
|
||||
// end calibration
|
||||
str = calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED);
|
||||
str = stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED);
|
||||
touch_calibration.calibration_end();
|
||||
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_TC_RETURN);
|
||||
}
|
||||
|
@ -225,24 +225,24 @@ void MarlinUI::clear_lcd() {
|
||||
void MarlinUI::touch_calibration_screen() {
|
||||
uint16_t x, y;
|
||||
|
||||
calibrationState calibration_stage = touch_calibration.get_calibration_state();
|
||||
calibrationState stage = touch_calibration.get_calibration_state();
|
||||
|
||||
if (calibration_stage == CALIBRATION_NONE) {
|
||||
if (stage == CALIBRATION_NONE) {
|
||||
defer_status_screen(true);
|
||||
clear_lcd();
|
||||
calibration_stage = touch_calibration.calibration_start();
|
||||
stage = touch_calibration.calibration_start();
|
||||
}
|
||||
else {
|
||||
x = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
|
||||
y = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
|
||||
x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
|
||||
y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
|
||||
tft.canvas(x - 15, y - 15, 31, 31);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
}
|
||||
|
||||
touch.clear();
|
||||
|
||||
if (calibration_stage < CALIBRATION_SUCCESS) {
|
||||
switch (calibration_stage) {
|
||||
if (stage < CALIBRATION_SUCCESS) {
|
||||
switch (stage) {
|
||||
case CALIBRATION_TOP_LEFT: tft_string.set(GET_TEXT(MSG_TOP_LEFT)); break;
|
||||
case CALIBRATION_BOTTOM_LEFT: tft_string.set(GET_TEXT(MSG_BOTTOM_LEFT)); break;
|
||||
case CALIBRATION_TOP_RIGHT: tft_string.set(GET_TEXT(MSG_TOP_RIGHT)); break;
|
||||
@ -250,8 +250,8 @@ void MarlinUI::clear_lcd() {
|
||||
default: break;
|
||||
}
|
||||
|
||||
x = touch_calibration.calibration_points[calibration_stage].x;
|
||||
y = touch_calibration.calibration_points[calibration_stage].y;
|
||||
x = touch_calibration.calibration_points[stage].x;
|
||||
y = touch_calibration.calibration_points[stage].y;
|
||||
|
||||
tft.canvas(x - 15, y - 15, 31, 31);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
@ -261,7 +261,7 @@ void MarlinUI::clear_lcd() {
|
||||
touch.add_control(CALIBRATE, 0, 0, TFT_WIDTH, TFT_HEIGHT, uint32_t(x) << 16 | uint32_t(y));
|
||||
}
|
||||
else {
|
||||
tft_string.set(calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED));
|
||||
tft_string.set(stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED));
|
||||
defer_status_screen(false);
|
||||
touch_calibration.calibration_end();
|
||||
touch.add_control(BACK, 0, 0, TFT_WIDTH, TFT_HEIGHT);
|
||||
|
Loading…
Reference in New Issue
Block a user