mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-01-31 14:12:52 +00:00
🎨 Adjust TFT code/comments
This commit is contained in:
parent
18ccc40443
commit
1fbeac7b52
8 changed files with 93 additions and 107 deletions
|
@ -96,12 +96,12 @@ void Canvas::addText(uint16_t x, uint16_t y, uint16_t color, uint16_t *string, u
|
|||
}
|
||||
|
||||
void Canvas::addImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) {
|
||||
uint16_t *data = (uint16_t *)Images[image].data;
|
||||
uint16_t *data = (uint16_t *)images[image].data;
|
||||
if (!data) return;
|
||||
|
||||
uint16_t image_width = Images[image].width,
|
||||
image_height = Images[image].height;
|
||||
colorMode_t color_mode = Images[image].colorMode;
|
||||
uint16_t image_width = images[image].width,
|
||||
image_height = images[image].height;
|
||||
colorMode_t color_mode = images[image].colorMode;
|
||||
|
||||
if (color_mode != HIGHCOLOR)
|
||||
return addImage(x, y, image_width, image_height, color_mode, (uint8_t *)data, colors);
|
||||
|
|
|
@ -75,7 +75,7 @@ const tImage Leveling_32x32x4 = { (void *)leveling_32x32x4, 32, 32, GREYSC
|
|||
|
||||
const tImage Slider8x16x4 = { (void *)slider_8x16x4, 8, 16, GREYSCALE4 };
|
||||
|
||||
const tImage Images[imgCount] = {
|
||||
const tImage images[imgCount] = {
|
||||
TERN(SHOW_BOOTSCREEN, TERN(BOOT_MARLIN_LOGO_SMALL, MarlinLogo195x59x16, MARLIN_LOGO_FULL_SIZE), NoLogo),
|
||||
HotEnd_64x64x4,
|
||||
Bed_64x64x4,
|
||||
|
|
|
@ -175,4 +175,4 @@ extern const tImage Leveling_32x32x4;
|
|||
|
||||
extern const tImage Slider8x16x4;
|
||||
|
||||
extern const tImage Images[imgCount];
|
||||
extern const tImage images[imgCount];
|
||||
|
|
|
@ -289,7 +289,7 @@ void TFT_Queue::add_image(int16_t x, int16_t y, MarlinImage image, uint16_t *col
|
|||
task_parameters->count++;
|
||||
parameters->nextParameter = end_of_queue;
|
||||
|
||||
colorMode_t color_mode = Images[image].colorMode;
|
||||
colorMode_t color_mode = images[image].colorMode;
|
||||
|
||||
if (color_mode == HIGHCOLOR) return;
|
||||
|
||||
|
@ -325,7 +325,7 @@ uint16_t gradient(uint16_t colorA, uint16_t colorB, uint16_t factor) {
|
|||
|
||||
void TFT_Queue::add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main, uint16_t color_background, uint16_t color_shadow) {
|
||||
uint16_t colors[16];
|
||||
colorMode_t color_mode = Images[image].colorMode;
|
||||
colorMode_t color_mode = images[image].colorMode;
|
||||
uint16_t i;
|
||||
|
||||
switch (color_mode) {
|
||||
|
|
|
@ -324,12 +324,10 @@ bool MarlinUI::touch_pressed() {
|
|||
}
|
||||
|
||||
void add_control(uint16_t x, uint16_t y, TouchControlType control_type, intptr_t data, MarlinImage image, bool is_enabled, uint16_t color_enabled, uint16_t color_disabled) {
|
||||
uint16_t width = Images[image].width;
|
||||
uint16_t height = Images[image].height;
|
||||
const uint16_t width = images[image].width, height = images[image].height;
|
||||
tft.canvas(x, y, width, height);
|
||||
tft.add_image(0, 0, image, is_enabled ? color_enabled : color_disabled);
|
||||
if (is_enabled)
|
||||
touch.add_control(control_type, x, y, width, height, data);
|
||||
if (is_enabled) touch.add_control(control_type, x, y, width, height, data);
|
||||
}
|
||||
|
||||
#endif // TOUCH_SCREEN
|
||||
|
|
|
@ -225,11 +225,10 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
TERN_(TOUCH_SCREEN, touch.clear());
|
||||
|
||||
// heaters and fan
|
||||
uint16_t i, x, y = TFT_STATUS_TOP_Y;
|
||||
|
||||
for (i = 0 ; i < ITEMS_COUNT; i++) {
|
||||
x = (TFT_WIDTH / ITEMS_COUNT - 80) / 2 + (TFT_WIDTH * i / ITEMS_COUNT);
|
||||
// Statuses of heaters and fans
|
||||
uint16_t y = TFT_STATUS_TOP_Y;
|
||||
for (uint16_t i = 0 ; i < ITEMS_COUNT; i++) {
|
||||
const uint16_t x = (TFT_WIDTH / ITEMS_COUNT - 80) / 2 + (TFT_WIDTH * i / ITEMS_COUNT);
|
||||
switch (i) {
|
||||
#if HAS_EXTRUDERS
|
||||
case ITEM_E0: draw_heater_status(x, y, H_E0); break;
|
||||
|
@ -257,7 +256,7 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
y += 200;
|
||||
|
||||
// coordinates
|
||||
// Coordinates
|
||||
tft.canvas(4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft.add_rectangle(0, 0, TFT_WIDTH - 8, FONT_LINE_HEIGHT, COLOR_AXIS_HOMED);
|
||||
|
@ -315,7 +314,7 @@ void MarlinUI::draw_status_screen() {
|
|||
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
|
||||
|
||||
y += 100;
|
||||
// feed rate
|
||||
// Feed rate
|
||||
tft.canvas(274, y, 128, 32);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
uint16_t color = feedrate_percentage == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
||||
|
@ -349,7 +348,7 @@ void MarlinUI::draw_status_screen() {
|
|||
#endif
|
||||
|
||||
y += 100;
|
||||
// print duration
|
||||
// Print duration
|
||||
char buffer[14];
|
||||
duration_t elapsed = print_job_timer.duration();
|
||||
elapsed.toDigital(buffer);
|
||||
|
@ -360,7 +359,7 @@ void MarlinUI::draw_status_screen() {
|
|||
tft.add_text(tft_string.center(128), 0, COLOR_PRINT_TIME, tft_string);
|
||||
|
||||
y += 50;
|
||||
// progress bar
|
||||
// Progress bar
|
||||
const uint8_t progress = ui.get_progress_percent();
|
||||
tft.canvas(4, y, TFT_WIDTH - 8, 9);
|
||||
tft.set_background(COLOR_PROGRESS_BG);
|
||||
|
@ -369,7 +368,7 @@ void MarlinUI::draw_status_screen() {
|
|||
tft.add_bar(1, 1, ((TFT_WIDTH - 10) * progress) / 100, 7, COLOR_PROGRESS_BAR);
|
||||
|
||||
y += 50;
|
||||
// status message
|
||||
// Status message
|
||||
tft.canvas(0, y, TFT_WIDTH, FONT_LINE_HEIGHT);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft_string.set(status_message);
|
||||
|
@ -736,29 +735,28 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||
probe.offset.z = new_offs;
|
||||
else
|
||||
TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
|
||||
drawMessage(F("")); // clear the error
|
||||
drawMessage(F("")); // Clear the error
|
||||
drawAxisValue(axis);
|
||||
}
|
||||
else
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
|
||||
#else
|
||||
// only change probe.offset.z
|
||||
// Only change probe.offset.z
|
||||
probe.offset.z += diff;
|
||||
if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) {
|
||||
current_position[axis] = Z_PROBE_OFFSET_RANGE_MIN;
|
||||
if (direction < 0 && current_position.z < Z_PROBE_OFFSET_RANGE_MIN) {
|
||||
current_position.z = Z_PROBE_OFFSET_RANGE_MIN;
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
}
|
||||
else if (direction > 0 && current_position[axis] > Z_PROBE_OFFSET_RANGE_MAX) {
|
||||
current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX;
|
||||
else if (direction > 0 && current_position.z > Z_PROBE_OFFSET_RANGE_MAX) {
|
||||
current_position.z = Z_PROBE_OFFSET_RANGE_MAX;
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
}
|
||||
else
|
||||
drawMessage(F("")); // clear the error
|
||||
drawMessage(F("")); // Clear the error
|
||||
|
||||
drawAxisValue(axis);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#endif // HAS_BED_PROBE
|
||||
|
@ -854,9 +852,9 @@ static void disable_steppers() {
|
|||
queue.inject(F("M84"));
|
||||
}
|
||||
|
||||
static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {
|
||||
const uint16_t width = Images[imgBtn52Rounded].width,
|
||||
height = Images[imgBtn52Rounded].height;
|
||||
static void drawBtn(const int x, const int y, const char *label, intptr_t data, const MarlinImage img, uint16_t bgColor, const bool enabled=true) {
|
||||
const uint16_t width = images[imgBtn52Rounded].width,
|
||||
height = images[imgBtn52Rounded].height;
|
||||
|
||||
if (!enabled) bgColor = COLOR_CONTROL_DISABLED;
|
||||
|
||||
|
@ -870,9 +868,8 @@ static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage
|
|||
tft_string.trim();
|
||||
tft.add_text(tft_string.center(width), height / 2 - tft_string.font_height() / 2, bgColor, tft_string);
|
||||
}
|
||||
else {
|
||||
else
|
||||
tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
|
||||
}
|
||||
|
||||
TERN_(TOUCH_SCREEN, if (enabled) touch.add_control(BUTTON, x, y, width, height, data));
|
||||
}
|
||||
|
@ -914,7 +911,7 @@ void MarlinUI::move_axis_screen() {
|
|||
|
||||
x += spacing;
|
||||
#if HAS_Z_AXIS
|
||||
drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
||||
drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); // Only enabled when not busy or have baby step
|
||||
#endif
|
||||
|
||||
// ROW 2 -> "Ex" X- HOME X+ "Z"
|
||||
|
@ -935,11 +932,11 @@ void MarlinUI::move_axis_screen() {
|
|||
x += BTN_WIDTH + spacing; //imgHome is 64x64
|
||||
|
||||
#if ALL(HAS_X_AXIS, TOUCH_SCREEN)
|
||||
add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy);
|
||||
add_control(TFT_WIDTH / 2 - images[imgHome].width / 2, y - (images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy);
|
||||
#endif
|
||||
|
||||
x += BTN_WIDTH + spacing;
|
||||
uint16_t xplus_x = x;
|
||||
const uint16_t xplus_x = x;
|
||||
|
||||
TERN_(HAS_X_AXIS, drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy));
|
||||
|
||||
|
@ -965,16 +962,20 @@ void MarlinUI::move_axis_screen() {
|
|||
TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS));
|
||||
#endif
|
||||
|
||||
// Cur X
|
||||
#if HAS_X_AXIS
|
||||
motionAxisState.xValuePos.set(BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4, y - 10);
|
||||
drawAxisValue(X_AXIS);
|
||||
#endif
|
||||
|
||||
x += BTN_WIDTH + spacing;
|
||||
|
||||
// Cur Y
|
||||
TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy));
|
||||
|
||||
x += BTN_WIDTH + spacing;
|
||||
|
||||
// Cur Z
|
||||
#if HAS_Z_AXIS
|
||||
drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); // Only enabled when not busy or have babystep
|
||||
motionAxisState.zValuePos.set(x, y + BTN_HEIGHT + 2);
|
||||
|
@ -990,10 +991,10 @@ void MarlinUI::move_axis_screen() {
|
|||
TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, x, y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size));
|
||||
}
|
||||
|
||||
// aligned with x+
|
||||
// Aligned with x+
|
||||
drawBtn(xplus_x, TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
|
||||
|
||||
TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
|
||||
}
|
||||
|
||||
#endif // HAS_UI_480x320
|
||||
#endif // HAS_UI_1024x600
|
||||
|
|
|
@ -227,11 +227,10 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
TERN_(TOUCH_SCREEN, touch.clear());
|
||||
|
||||
// heaters and fan
|
||||
uint16_t i, x, y = TFT_STATUS_TOP_Y;
|
||||
|
||||
for (i = 0 ; i < ITEMS_COUNT; i++) {
|
||||
x = (TFT_WIDTH / ITEMS_COUNT - 64) / 2 + (TFT_WIDTH * i / ITEMS_COUNT);
|
||||
// Statuses of heaters and fans
|
||||
const uint16_t y = TFT_STATUS_TOP_Y;
|
||||
for (uint16_t i = 0 ; i < ITEMS_COUNT; i++) {
|
||||
const uint16_t x = (TFT_WIDTH / ITEMS_COUNT - 64) / 2 + (TFT_WIDTH * i / ITEMS_COUNT);
|
||||
switch (i) {
|
||||
#if HAS_EXTRUDERS
|
||||
case ITEM_E0: draw_heater_status(x, y, H_E0); break;
|
||||
|
@ -257,27 +256,16 @@ void MarlinUI::draw_status_screen() {
|
|||
}
|
||||
}
|
||||
|
||||
// coordinates
|
||||
tft.canvas(4, 103,
|
||||
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
||||
232, FONT_LINE_HEIGHT * 2
|
||||
#else
|
||||
312, FONT_LINE_HEIGHT
|
||||
#endif
|
||||
);
|
||||
// 2nd horizontal group - current coordinates (height = 24, top margin = 3)
|
||||
uint16_t width = TERN(TFT_COLOR_UI_PORTRAIT, 232, 312),
|
||||
height = FONT_LINE_HEIGHT * TERN(TFT_COLOR_UI_PORTRAIT, 2, 1);
|
||||
tft.canvas(4, 103, width, height);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft.add_rectangle(0, 0,
|
||||
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
||||
232, FONT_LINE_HEIGHT * 2
|
||||
#else
|
||||
312, FONT_LINE_HEIGHT
|
||||
#endif
|
||||
, COLOR_AXIS_HOMED
|
||||
);
|
||||
tft.add_rectangle(0, 0, width, height, COLOR_AXIS_HOMED);
|
||||
|
||||
if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) {
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
tft.add_text( 10, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, "E");
|
||||
tft.add_text(10, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, "E");
|
||||
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
||||
tft_string.set(ftostr4sign(e_move_accumulator / escale));
|
||||
tft_string.add(escale == 10 ? 'c' : 'm');
|
||||
|
@ -347,7 +335,7 @@ void MarlinUI::draw_status_screen() {
|
|||
#endif
|
||||
));
|
||||
|
||||
// feed rate
|
||||
// Feed rate
|
||||
tft.canvas(
|
||||
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
||||
30, 172, 80
|
||||
|
@ -397,7 +385,7 @@ void MarlinUI::draw_status_screen() {
|
|||
));
|
||||
#endif // HAS_EXTRUDERS
|
||||
|
||||
// print duration
|
||||
// Print duration
|
||||
char buffer[14];
|
||||
duration_t elapsed = print_job_timer.duration();
|
||||
elapsed.toDigital(buffer);
|
||||
|
@ -414,7 +402,7 @@ void MarlinUI::draw_status_screen() {
|
|||
tft_string.set(buffer);
|
||||
tft.add_text(tft_string.center(128), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_PRINT_TIME, tft_string);
|
||||
|
||||
// progress bar
|
||||
// Progress bar
|
||||
const uint8_t progress = ui.get_progress_percent();
|
||||
tft.canvas(
|
||||
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
||||
|
@ -436,7 +424,7 @@ void MarlinUI::draw_status_screen() {
|
|||
if (progress)
|
||||
tft.add_bar(1, 1, ((TFT_WIDTH - 10) * progress) / 100, 7, COLOR_PROGRESS_BAR);
|
||||
|
||||
// status message
|
||||
// Status message
|
||||
tft.canvas(
|
||||
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
||||
0, 296, 240
|
||||
|
@ -828,29 +816,28 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||
probe.offset.z = new_offs;
|
||||
else
|
||||
TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
|
||||
drawMessage(NUL_STR); // clear the error
|
||||
drawMessage(NUL_STR); // Clear the error
|
||||
drawAxisValue(axis);
|
||||
}
|
||||
else
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
|
||||
#else
|
||||
// only change probe.offset.z
|
||||
// Only change probe.offset.z
|
||||
probe.offset.z += diff;
|
||||
if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) {
|
||||
current_position[axis] = Z_PROBE_OFFSET_RANGE_MIN;
|
||||
if (direction < 0 && current_position.z < Z_PROBE_OFFSET_RANGE_MIN) {
|
||||
current_position.z = Z_PROBE_OFFSET_RANGE_MIN;
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
}
|
||||
else if (direction > 0 && current_position[axis] > Z_PROBE_OFFSET_RANGE_MAX) {
|
||||
current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX;
|
||||
else if (direction > 0 && current_position.z > Z_PROBE_OFFSET_RANGE_MAX) {
|
||||
current_position.z = Z_PROBE_OFFSET_RANGE_MAX;
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
}
|
||||
else
|
||||
drawMessage(NUL_STR); // clear the error
|
||||
drawMessage(NUL_STR); // Clear the error
|
||||
|
||||
drawAxisValue(axis);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#endif // HAS_BED_PROBE
|
||||
|
@ -947,9 +934,9 @@ static void disable_steppers() {
|
|||
queue.inject(F("M84"));
|
||||
}
|
||||
|
||||
static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {
|
||||
const uint16_t width = Images[imgBtn39Rounded].width,
|
||||
height = Images[imgBtn39Rounded].height;
|
||||
static void drawBtn(const int x, const int y, const char *label, intptr_t data, const MarlinImage img, uint16_t bgColor, const bool enabled=true) {
|
||||
const uint16_t width = images[imgBtn39Rounded].width,
|
||||
height = images[imgBtn39Rounded].height;
|
||||
|
||||
if (!enabled) bgColor = COLOR_CONTROL_DISABLED;
|
||||
|
||||
|
@ -1003,7 +990,7 @@ void MarlinUI::move_axis_screen() {
|
|||
uint16_t zplus_x = x;
|
||||
|
||||
#if HAS_Z_AXIS
|
||||
drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
||||
drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); // Only enabled when not busy or have baby step
|
||||
#endif
|
||||
|
||||
// ROW 2 -> "Ex" CurY "Z"
|
||||
|
@ -1032,7 +1019,7 @@ void MarlinUI::move_axis_screen() {
|
|||
|
||||
#if HAS_X_AXIS
|
||||
drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
||||
TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy));
|
||||
TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - images[imgHome].width / 2, y - (images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy));
|
||||
drawBtn(zplus_x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy);
|
||||
#endif
|
||||
|
||||
|
@ -1080,7 +1067,7 @@ void MarlinUI::move_axis_screen() {
|
|||
TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size));
|
||||
}
|
||||
|
||||
// aligned with x+
|
||||
// Aligned with x+
|
||||
drawBtn(yplus_x, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
|
||||
|
||||
#else // !TFT_COLOR_UI_PORTRAIT
|
||||
|
@ -1127,11 +1114,11 @@ void MarlinUI::move_axis_screen() {
|
|||
x += BTN_WIDTH + spacing; //imgHome is 64x64
|
||||
|
||||
#if ALL(HAS_X_AXIS, TOUCH_SCREEN)
|
||||
add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy);
|
||||
add_control(TFT_WIDTH / 2 - images[imgHome].width / 2, y - (images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy);
|
||||
#endif
|
||||
|
||||
x += BTN_WIDTH + spacing;
|
||||
uint16_t xplus_x = x;
|
||||
const uint16_t xplus_x = x;
|
||||
|
||||
TERN_(HAS_X_AXIS, drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy));
|
||||
|
||||
|
@ -1157,6 +1144,7 @@ void MarlinUI::move_axis_screen() {
|
|||
TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS));
|
||||
#endif
|
||||
|
||||
// Cur X
|
||||
#if HAS_X_AXIS
|
||||
motionAxisState.xValuePos.set(BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4, y - 10);
|
||||
drawAxisValue(X_AXIS);
|
||||
|
@ -1164,15 +1152,14 @@ void MarlinUI::move_axis_screen() {
|
|||
|
||||
x += BTN_WIDTH + spacing;
|
||||
|
||||
// Cur Y
|
||||
TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy));
|
||||
|
||||
x += BTN_WIDTH + spacing;
|
||||
|
||||
// Cur Z
|
||||
#if HAS_Z_AXIS
|
||||
drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
||||
#endif
|
||||
|
||||
#if HAS_Z_AXIS
|
||||
motionAxisState.zValuePos.set(x, y + BTN_HEIGHT + 2);
|
||||
drawAxisValue(Z_AXIS);
|
||||
#endif
|
||||
|
@ -1186,7 +1173,7 @@ void MarlinUI::move_axis_screen() {
|
|||
TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size));
|
||||
}
|
||||
|
||||
// aligned with x+
|
||||
// Aligned with x+
|
||||
drawBtn(xplus_x, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
|
||||
|
||||
#endif // !TFT_COLOR_UI_PORTRAIT
|
||||
|
|
|
@ -264,7 +264,7 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) {
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
tft.add_text( 16, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, "E");
|
||||
tft.add_text(16, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, "E");
|
||||
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
||||
tft_string.set(ftostr4sign(e_move_accumulator / escale));
|
||||
tft_string.add(escale == 10 ? 'c' : 'm');
|
||||
|
@ -745,29 +745,28 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||
probe.offset.z = new_offs;
|
||||
else
|
||||
TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
|
||||
drawMessage(NUL_STR); // clear the error
|
||||
drawMessage(NUL_STR); // Clear the error
|
||||
drawAxisValue(axis);
|
||||
}
|
||||
else
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
|
||||
#else
|
||||
// only change probe.offset.z
|
||||
// Only change probe.offset.z
|
||||
probe.offset.z += diff;
|
||||
if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) {
|
||||
current_position[axis] = Z_PROBE_OFFSET_RANGE_MIN;
|
||||
if (direction < 0 && current_position.z < Z_PROBE_OFFSET_RANGE_MIN) {
|
||||
current_position.z = Z_PROBE_OFFSET_RANGE_MIN;
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
}
|
||||
else if (direction > 0 && current_position[axis] > Z_PROBE_OFFSET_RANGE_MAX) {
|
||||
current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX;
|
||||
else if (direction > 0 && current_position.z > Z_PROBE_OFFSET_RANGE_MAX) {
|
||||
current_position.z = Z_PROBE_OFFSET_RANGE_MAX;
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
}
|
||||
else
|
||||
drawMessage(NUL_STR); // clear the error
|
||||
drawMessage(NUL_STR); // Clear the error
|
||||
|
||||
drawAxisValue(axis);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#endif // HAS_BED_PROBE
|
||||
|
@ -863,9 +862,9 @@ static void disable_steppers() {
|
|||
queue.inject(F("M84"));
|
||||
}
|
||||
|
||||
static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {
|
||||
const uint16_t width = Images[imgBtn52Rounded].width,
|
||||
height = Images[imgBtn52Rounded].height;
|
||||
static void drawBtn(const int x, const int y, const char *label, intptr_t data, const MarlinImage img, uint16_t bgColor, const bool enabled=true) {
|
||||
const uint16_t width = images[imgBtn52Rounded].width,
|
||||
height = images[imgBtn52Rounded].height;
|
||||
|
||||
if (!enabled) bgColor = COLOR_CONTROL_DISABLED;
|
||||
|
||||
|
@ -953,7 +952,7 @@ void MarlinUI::move_axis_screen() {
|
|||
|
||||
#if HAS_X_AXIS
|
||||
drawBtn(TFT_WIDTH / 6 - BTN_WIDTH / 2, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
||||
TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy));
|
||||
TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - images[imgHome].width / 2, y - (images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy));
|
||||
drawBtn(TFT_WIDTH * 5 / 6 - BTN_WIDTH / 2, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy);
|
||||
#endif
|
||||
|
||||
|
@ -1018,7 +1017,7 @@ void MarlinUI::move_axis_screen() {
|
|||
drawBtn(TFT_WIDTH / 2, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
|
||||
|
||||
// Button "Back"
|
||||
TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH * 5 / 6 - Images[imgBack].width / 2, y + 12, BACK, imgBack));
|
||||
TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH * 5 / 6 - images[imgBack].width / 2, y + 12, BACK, imgBack));
|
||||
|
||||
#else // !TFT_COLOR_UI_PORTRAIT
|
||||
|
||||
|
@ -1042,7 +1041,7 @@ void MarlinUI::move_axis_screen() {
|
|||
|
||||
x += spacing;
|
||||
#if HAS_Z_AXIS
|
||||
drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
||||
drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); // Only enabled when not busy or have baby step
|
||||
#endif
|
||||
|
||||
// ROW 2 -> "Ex" X- HOME X+ "Z"
|
||||
|
@ -1063,11 +1062,11 @@ void MarlinUI::move_axis_screen() {
|
|||
x += BTN_WIDTH + spacing; //imgHome is 64x64
|
||||
|
||||
#if ALL(HAS_X_AXIS, TOUCH_SCREEN)
|
||||
add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy);
|
||||
add_control(TFT_WIDTH / 2 - images[imgHome].width / 2, y - (images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy);
|
||||
#endif
|
||||
|
||||
x += BTN_WIDTH + spacing;
|
||||
uint16_t xplus_x = x;
|
||||
const uint16_t xplus_x = x;
|
||||
|
||||
TERN_(HAS_X_AXIS, drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy));
|
||||
|
||||
|
@ -1092,21 +1091,22 @@ void MarlinUI::move_axis_screen() {
|
|||
drawAxisValue(E_AXIS);
|
||||
#endif
|
||||
|
||||
// Cur X
|
||||
#if HAS_X_AXIS
|
||||
motionAxisState.xValuePos.set(BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4, y - 10);
|
||||
TERN_(HAS_X_AXIS, drawAxisValue(X_AXIS));
|
||||
#endif
|
||||
|
||||
x += BTN_WIDTH + spacing;
|
||||
|
||||
// Cur Y
|
||||
TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy));
|
||||
|
||||
x += BTN_WIDTH + spacing;
|
||||
#if HAS_Z_AXIS
|
||||
drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
||||
#endif
|
||||
|
||||
// Cur Z
|
||||
#if HAS_Z_AXIS
|
||||
drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
||||
motionAxisState.zValuePos.set(x, y + BTN_HEIGHT + 2);
|
||||
drawAxisValue(Z_AXIS);
|
||||
#endif
|
||||
|
@ -1120,7 +1120,7 @@ void MarlinUI::move_axis_screen() {
|
|||
TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size));
|
||||
}
|
||||
|
||||
// aligned with x+
|
||||
// Aligned with x+
|
||||
drawBtn(xplus_x, TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
|
||||
|
||||
TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
|
||||
|
|
Loading…
Reference in a new issue