Skip to content

Commit 17b43d6

Browse files
committed
🎨 calibration_stage => stage
1 parent 724ba4b commit 17b43d6

File tree

3 files changed

+31
-31
lines changed

3 files changed

+31
-31
lines changed

Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -501,40 +501,40 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT,
501501

502502
void MarlinUI::touch_calibration_screen() {
503503
uint16_t x, y;
504-
calibrationState calibration_stage = touch_calibration.get_calibration_state();
504+
calibrationState stage = touch_calibration.get_calibration_state();
505505

506-
if (calibration_stage == CALIBRATION_NONE) {
506+
if (stage == CALIBRATION_NONE) {
507507
// start and clear screen
508508
defer_status_screen(true);
509-
calibration_stage = touch_calibration.calibration_start();
509+
stage = touch_calibration.calibration_start();
510510
tftio.set_window(0, 0, (TFT_WIDTH) - 1, (TFT_HEIGHT) - 1);
511511
tftio.WriteMultiple(TFT_MARLINBG_COLOR, uint32_t(TFT_WIDTH) * (TFT_HEIGHT));
512512
}
513513
else {
514514
// clear last cross
515-
x = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
516-
y = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
515+
x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
516+
y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
517517
drawCross(x, y, TFT_MARLINBG_COLOR);
518518
}
519519

520520
FSTR_P str = nullptr;
521-
if (calibration_stage < CALIBRATION_SUCCESS) {
521+
if (stage < CALIBRATION_SUCCESS) {
522522
// handle current state
523-
switch (calibration_stage) {
523+
switch (stage) {
524524
case CALIBRATION_TOP_LEFT: str = GET_TEXT_F(MSG_TOP_LEFT); break;
525525
case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT_F(MSG_BOTTOM_LEFT); break;
526526
case CALIBRATION_TOP_RIGHT: str = GET_TEXT_F(MSG_TOP_RIGHT); break;
527527
case CALIBRATION_BOTTOM_RIGHT: str = GET_TEXT_F(MSG_BOTTOM_RIGHT); break;
528528
default: break;
529529
}
530530

531-
x = touch_calibration.calibration_points[calibration_stage].x;
532-
y = touch_calibration.calibration_points[calibration_stage].y;
531+
x = touch_calibration.calibration_points[stage].x;
532+
y = touch_calibration.calibration_points[stage].y;
533533
drawCross(x, y, TFT_MARLINUI_COLOR);
534534
}
535535
else {
536536
// end calibration
537-
str = calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT_F(MSG_CALIBRATION_COMPLETED) : GET_TEXT_F(MSG_CALIBRATION_FAILED);
537+
str = stage == CALIBRATION_SUCCESS ? GET_TEXT_F(MSG_CALIBRATION_COMPLETED) : GET_TEXT_F(MSG_CALIBRATION_FAILED);
538538
defer_status_screen(false);
539539
touch_calibration.calibration_end();
540540
TERN_(HAS_TOUCH_BUTTONS, redrawTouchButtons = true);
@@ -548,7 +548,7 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT,
548548
} while (u8g.nextPage());
549549
drawing_screen = false;
550550
safe_delay(250);
551-
if (calibration_stage == CALIBRATION_SUCCESS) {
551+
if (stage == CALIBRATION_SUCCESS) {
552552
safe_delay(500);
553553
ui.goto_previous_screen();
554554
}

Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -55,36 +55,36 @@ static void drawCross(uint16_t x, uint16_t y, uint16_t color) {
5555
void lv_update_touch_calibration_screen() {
5656
uint16_t x, y;
5757

58-
calibrationState calibration_stage = touch_calibration.get_calibration_state();
59-
if (calibration_stage == CALIBRATION_NONE) {
58+
calibrationState stage = touch_calibration.get_calibration_state();
59+
if (stage == CALIBRATION_NONE) {
6060
// start and clear screen
61-
calibration_stage = touch_calibration.calibration_start();
61+
stage = touch_calibration.calibration_start();
6262
}
6363
else {
6464
// clear last cross
65-
x = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
66-
y = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
65+
x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
66+
y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
6767
drawCross(x, y, LV_COLOR_BACKGROUND.full);
6868
}
6969

7070
const char *str = nullptr;
71-
if (calibration_stage < CALIBRATION_SUCCESS) {
71+
if (stage < CALIBRATION_SUCCESS) {
7272
// handle current state
73-
switch (calibration_stage) {
73+
switch (stage) {
7474
case CALIBRATION_TOP_LEFT: str = GET_TEXT(MSG_TOP_LEFT); break;
7575
case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT(MSG_BOTTOM_LEFT); break;
7676
case CALIBRATION_TOP_RIGHT: str = GET_TEXT(MSG_TOP_RIGHT); break;
7777
case CALIBRATION_BOTTOM_RIGHT: str = GET_TEXT(MSG_BOTTOM_RIGHT); break;
7878
default: break;
7979
}
8080

81-
x = touch_calibration.calibration_points[calibration_stage].x;
82-
y = touch_calibration.calibration_points[calibration_stage].y;
81+
x = touch_calibration.calibration_points[stage].x;
82+
y = touch_calibration.calibration_points[stage].y;
8383
drawCross(x, y, LV_COLOR_WHITE.full);
8484
}
8585
else {
8686
// end calibration
87-
str = calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED);
87+
str = stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED);
8888
touch_calibration.calibration_end();
8989
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);
9090
}

Marlin/src/lcd/tft/ui_common.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -228,33 +228,33 @@ void MarlinUI::clear_lcd() {
228228
void MarlinUI::touch_calibration_screen() {
229229
uint16_t x, y;
230230

231-
calibrationState calibration_stage = touch_calibration.get_calibration_state();
231+
calibrationState stage = touch_calibration.get_calibration_state();
232232

233-
if (calibration_stage == CALIBRATION_NONE) {
233+
if (stage == CALIBRATION_NONE) {
234234
defer_status_screen(true);
235235
clear_lcd();
236-
calibration_stage = touch_calibration.calibration_start();
236+
stage = touch_calibration.calibration_start();
237237
}
238238
else {
239-
x = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
240-
y = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
239+
x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
240+
y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
241241
tft.canvas(x - 15, y - 15, 31, 31);
242242
tft.set_background(COLOR_BACKGROUND);
243243
}
244244

245245
touch.clear();
246246

247-
if (calibration_stage < CALIBRATION_SUCCESS) {
248-
switch (calibration_stage) {
247+
if (stage < CALIBRATION_SUCCESS) {
248+
switch (stage) {
249249
case CALIBRATION_TOP_LEFT: tft_string.set(GET_TEXT(MSG_TOP_LEFT)); break;
250250
case CALIBRATION_BOTTOM_LEFT: tft_string.set(GET_TEXT(MSG_BOTTOM_LEFT)); break;
251251
case CALIBRATION_TOP_RIGHT: tft_string.set(GET_TEXT(MSG_TOP_RIGHT)); break;
252252
case CALIBRATION_BOTTOM_RIGHT: tft_string.set(GET_TEXT(MSG_BOTTOM_RIGHT)); break;
253253
default: break;
254254
}
255255

256-
x = touch_calibration.calibration_points[calibration_stage].x;
257-
y = touch_calibration.calibration_points[calibration_stage].y;
256+
x = touch_calibration.calibration_points[stage].x;
257+
y = touch_calibration.calibration_points[stage].y;
258258

259259
tft.canvas(x - 15, y - 15, 31, 31);
260260
tft.set_background(COLOR_BACKGROUND);
@@ -264,7 +264,7 @@ void MarlinUI::clear_lcd() {
264264
touch.add_control(CALIBRATE, 0, 0, TFT_WIDTH, TFT_HEIGHT, uint32_t(x) << 16 | uint32_t(y));
265265
}
266266
else {
267-
tft_string.set(calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED));
267+
tft_string.set(stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED));
268268
defer_status_screen(false);
269269
touch_calibration.calibration_end();
270270
touch.add_control(BACK, 0, 0, TFT_WIDTH, TFT_HEIGHT);

0 commit comments

Comments
 (0)