Skip to content

Commit accfab8

Browse files
committed
🎨 calibration_stage => stage
1 parent d68ad9e commit accfab8

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

Lines changed: 11 additions & 11 deletions
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

Lines changed: 10 additions & 10 deletions
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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,33 +225,33 @@ void MarlinUI::clear_lcd() {
225225
void MarlinUI::touch_calibration_screen() {
226226
uint16_t x, y;
227227

228-
calibrationState calibration_stage = touch_calibration.get_calibration_state();
228+
calibrationState stage = touch_calibration.get_calibration_state();
229229

230-
if (calibration_stage == CALIBRATION_NONE) {
230+
if (stage == CALIBRATION_NONE) {
231231
defer_status_screen(true);
232232
clear_lcd();
233-
calibration_stage = touch_calibration.calibration_start();
233+
stage = touch_calibration.calibration_start();
234234
}
235235
else {
236-
x = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
237-
y = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
236+
x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
237+
y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
238238
tft.canvas(x - 15, y - 15, 31, 31);
239239
tft.set_background(COLOR_BACKGROUND);
240240
}
241241

242242
touch.clear();
243243

244-
if (calibration_stage < CALIBRATION_SUCCESS) {
245-
switch (calibration_stage) {
244+
if (stage < CALIBRATION_SUCCESS) {
245+
switch (stage) {
246246
case CALIBRATION_TOP_LEFT: tft_string.set(GET_TEXT(MSG_TOP_LEFT)); break;
247247
case CALIBRATION_BOTTOM_LEFT: tft_string.set(GET_TEXT(MSG_BOTTOM_LEFT)); break;
248248
case CALIBRATION_TOP_RIGHT: tft_string.set(GET_TEXT(MSG_TOP_RIGHT)); break;
249249
case CALIBRATION_BOTTOM_RIGHT: tft_string.set(GET_TEXT(MSG_BOTTOM_RIGHT)); break;
250250
default: break;
251251
}
252252

253-
x = touch_calibration.calibration_points[calibration_stage].x;
254-
y = touch_calibration.calibration_points[calibration_stage].y;
253+
x = touch_calibration.calibration_points[stage].x;
254+
y = touch_calibration.calibration_points[stage].y;
255255

256256
tft.canvas(x - 15, y - 15, 31, 31);
257257
tft.set_background(COLOR_BACKGROUND);
@@ -261,7 +261,7 @@ void MarlinUI::clear_lcd() {
261261
touch.add_control(CALIBRATE, 0, 0, TFT_WIDTH, TFT_HEIGHT, uint32_t(x) << 16 | uint32_t(y));
262262
}
263263
else {
264-
tft_string.set(calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED));
264+
tft_string.set(stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED));
265265
defer_status_screen(false);
266266
touch_calibration.calibration_end();
267267
touch.add_control(BACK, 0, 0, TFT_WIDTH, TFT_HEIGHT);

0 commit comments

Comments
 (0)