|
@ -241,6 +241,9 @@ void MarlinUI::draw_status_screen() { |
|
|
#ifdef ITEM_CHAMBER |
|
|
#ifdef ITEM_CHAMBER |
|
|
case ITEM_CHAMBER: draw_heater_status(x, y, H_CHAMBER); break; |
|
|
case ITEM_CHAMBER: draw_heater_status(x, y, H_CHAMBER); break; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
#ifdef ITEM_COOLER |
|
|
|
|
|
case ITEM_COOLER: draw_heater_status(x, y, H_COOLER); break; |
|
|
|
|
|
#endif |
|
|
#ifdef ITEM_FAN |
|
|
#ifdef ITEM_FAN |
|
|
case ITEM_FAN: draw_fan_status(x, y, blink); break; |
|
|
case ITEM_FAN: draw_fan_status(x, y, blink); break; |
|
|
#endif |
|
|
#endif |
|
@ -278,6 +281,7 @@ void MarlinUI::draw_status_screen() { |
|
|
offset -= tft_string.width(); |
|
|
offset -= tft_string.width(); |
|
|
} |
|
|
} |
|
|
tft.add_text(301 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); |
|
|
tft.add_text(301 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); |
|
|
|
|
|
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103, 312, 24)); |
|
|
|
|
|
|
|
|
// feed rate
|
|
|
// feed rate
|
|
|
tft.canvas(70, 136, 80, 32); |
|
|
tft.canvas(70, 136, 80, 32); |
|
@ -354,16 +358,16 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const val |
|
|
menu_line(line - 1); |
|
|
menu_line(line - 1); |
|
|
|
|
|
|
|
|
tft_string.set(X_LBL); |
|
|
tft_string.set(X_LBL); |
|
|
tft.add_text(52, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); |
|
|
tft.add_text(TFT_WIDTH / 2 - 120, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); |
|
|
tft_string.set(ftostr52(LOGICAL_X_POSITION(current_position.x))); |
|
|
tft_string.set(ftostr52(LOGICAL_X_POSITION(current_position.x))); |
|
|
tft_string.trim(); |
|
|
tft_string.trim(); |
|
|
tft.add_text(144 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); |
|
|
tft.add_text(TFT_WIDTH / 2 - 16 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); |
|
|
|
|
|
|
|
|
tft_string.set(Y_LBL); |
|
|
tft_string.set(Y_LBL); |
|
|
tft.add_text(176, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); |
|
|
tft.add_text(TFT_WIDTH / 2 + 16, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); |
|
|
tft_string.set(ftostr52(LOGICAL_X_POSITION(current_position.y))); |
|
|
tft_string.set(ftostr52(LOGICAL_X_POSITION(current_position.y))); |
|
|
tft_string.trim(); |
|
|
tft_string.trim(); |
|
|
tft.add_text(268 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); |
|
|
tft.add_text(TFT_WIDTH / 2 + 120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
@ -393,9 +397,9 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const val |
|
|
|
|
|
|
|
|
void TFT::draw_edit_screen_buttons() { |
|
|
void TFT::draw_edit_screen_buttons() { |
|
|
#if ENABLED(TOUCH_SCREEN) |
|
|
#if ENABLED(TOUCH_SCREEN) |
|
|
add_control(32, 176, DECREASE, imgDecrease); |
|
|
add_control(32, TFT_HEIGHT - 64, DECREASE, imgDecrease); |
|
|
add_control(224, 176, INCREASE, imgIncrease); |
|
|
add_control(224, TFT_HEIGHT - 64, INCREASE, imgIncrease); |
|
|
add_control(128, 176, CLICK, imgConfirm); |
|
|
add_control(128, TFT_HEIGHT - 64, CLICK, imgConfirm); |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -424,8 +428,8 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const |
|
|
tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); |
|
|
tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); |
|
|
} |
|
|
} |
|
|
#if ENABLED(TOUCH_SCREEN) |
|
|
#if ENABLED(TOUCH_SCREEN) |
|
|
add_control(48, 176, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL); |
|
|
add_control(48, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL); |
|
|
add_control(208, 176, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM)); |
|
|
add_control(208, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM)); |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -435,7 +439,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const |
|
|
#if ENABLED(TOUCH_SCREEN) |
|
|
#if ENABLED(TOUCH_SCREEN) |
|
|
touch.clear(); |
|
|
touch.clear(); |
|
|
draw_menu_navigation = false; |
|
|
draw_menu_navigation = false; |
|
|
touch.add_control(RESUME_CONTINUE , 0, 0, 320, 240); |
|
|
touch.add_control(RESUME_CONTINUE , 0, 0, TFT_WIDTH, TFT_HEIGHT); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
menu_line(row); |
|
|
menu_line(row); |
|
@ -477,7 +481,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const |
|
|
const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) }, |
|
|
const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) }, |
|
|
lpos = pos.asLogical(); |
|
|
lpos = pos.asLogical(); |
|
|
|
|
|
|
|
|
tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - 32) / 2 - 32, 96, 32); |
|
|
tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 - MENU_ITEM_HEIGHT, 96, MENU_ITEM_HEIGHT); |
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
tft_string.set(X_LBL); |
|
|
tft_string.set(X_LBL); |
|
|
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); |
|
|
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); |
|
@ -485,7 +489,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const |
|
|
tft_string.trim(); |
|
|
tft_string.trim(); |
|
|
tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); |
|
|
tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); |
|
|
|
|
|
|
|
|
tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - 32) / 2, 96, 32); |
|
|
tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2, 96, MENU_ITEM_HEIGHT); |
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
tft_string.set(Y_LBL); |
|
|
tft_string.set(Y_LBL); |
|
|
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); |
|
|
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); |
|
@ -493,7 +497,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const |
|
|
tft_string.trim(); |
|
|
tft_string.trim(); |
|
|
tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); |
|
|
tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); |
|
|
|
|
|
|
|
|
tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - 32) / 2 + 32, 96, 32); |
|
|
tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 + MENU_ITEM_HEIGHT, 96, MENU_ITEM_HEIGHT); |
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
tft_string.set(Z_LBL); |
|
|
tft_string.set(Z_LBL); |
|
|
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); |
|
|
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); |
|
@ -502,13 +506,13 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const |
|
|
tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); |
|
|
tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); |
|
|
|
|
|
|
|
|
constexpr uint8_t w = (TFT_WIDTH) / 10; |
|
|
constexpr uint8_t w = (TFT_WIDTH) / 10; |
|
|
tft.canvas(GRID_OFFSET_X + (GRID_WIDTH - w) / 2, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET - 1, w, 32); |
|
|
tft.canvas(GRID_OFFSET_X + (GRID_WIDTH - w) / 2, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET - 1, w, MENU_ITEM_HEIGHT); |
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
tft_string.set(ui8tostr3rj(x_plot)); |
|
|
tft_string.set(ui8tostr3rj(x_plot)); |
|
|
tft_string.trim(); |
|
|
tft_string.trim(); |
|
|
tft.add_text(tft_string.center(w), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); |
|
|
tft.add_text(tft_string.center(w), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string); |
|
|
|
|
|
|
|
|
tft.canvas(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET, GRID_OFFSET_Y + (GRID_HEIGHT - 27) / 2, w, 32); |
|
|
tft.canvas(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET, GRID_OFFSET_Y + (GRID_HEIGHT - 27) / 2, w, MENU_ITEM_HEIGHT); |
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
tft_string.set(ui8tostr3rj(y_plot)); |
|
|
tft_string.set(ui8tostr3rj(y_plot)); |
|
|
tft_string.trim(); |
|
|
tft_string.trim(); |
|
@ -527,7 +531,376 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const |
|
|
} |
|
|
} |
|
|
#endif // AUTO_BED_LEVELING_UBL
|
|
|
#endif // AUTO_BED_LEVELING_UBL
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(BABYSTEP_ZPROBE_OFFSET) |
|
|
|
|
|
#include "../../feature/babystep.h" |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if HAS_BED_PROBE |
|
|
|
|
|
#include "../../module/probe.h" |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#define Z_SELECTION_Z 1 |
|
|
|
|
|
#define Z_SELECTION_Z_PROBE -1 |
|
|
|
|
|
|
|
|
|
|
|
struct MotionAxisState { |
|
|
|
|
|
xy_int_t xValuePos, yValuePos, zValuePos, eValuePos, stepValuePos, zTypePos, eNamePos; |
|
|
|
|
|
float currentStepSize = 10.0; |
|
|
|
|
|
int z_selection = Z_SELECTION_Z; |
|
|
|
|
|
uint8_t e_selection = 0; |
|
|
|
|
|
bool blocked = false; |
|
|
|
|
|
char message[32]; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
MotionAxisState motionAxisState; |
|
|
|
|
|
|
|
|
|
|
|
#define E_BTN_COLOR COLOR_YELLOW |
|
|
|
|
|
#define X_BTN_COLOR COLOR_CORAL_RED |
|
|
|
|
|
#define Y_BTN_COLOR COLOR_VIVID_GREEN |
|
|
|
|
|
#define Z_BTN_COLOR COLOR_LIGHT_BLUE |
|
|
|
|
|
|
|
|
|
|
|
#define BTN_WIDTH 48 |
|
|
|
|
|
#define BTN_HEIGHT 39 |
|
|
|
|
|
#define X_MARGIN 15 |
|
|
|
|
|
#define Y_MARGIN 11 |
|
|
|
|
|
|
|
|
|
|
|
static void quick_feedback() { |
|
|
|
|
|
#if HAS_CHIRP |
|
|
|
|
|
ui.chirp(); // Buzz and wait. Is the delay needed for buttons to settle?
|
|
|
|
|
|
#if BOTH(HAS_LCD_MENU, USE_BEEPER) |
|
|
|
|
|
for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); } |
|
|
|
|
|
#elif HAS_LCD_MENU |
|
|
|
|
|
delay(10); |
|
|
|
|
|
#endif |
|
|
|
|
|
#endif |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#define CUR_STEP_VALUE_WIDTH 38 |
|
|
|
|
|
static void drawCurStepValue() { |
|
|
|
|
|
tft_string.set((uint8_t *)ftostr52sp(motionAxisState.currentStepSize)); |
|
|
|
|
|
tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, 20); |
|
|
|
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
|
|
|
tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string); |
|
|
|
|
|
tft.queue.sync(); |
|
|
|
|
|
tft_string.set("mm"); |
|
|
|
|
|
tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y + 20, CUR_STEP_VALUE_WIDTH, 20); |
|
|
|
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
|
|
|
tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void drawCurZSelection() { |
|
|
|
|
|
tft_string.set("Z"); |
|
|
|
|
|
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 20); |
|
|
|
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
|
|
|
tft.add_text(0, 0, Z_BTN_COLOR, tft_string); |
|
|
|
|
|
tft.queue.sync(); |
|
|
|
|
|
tft_string.set("Offset"); |
|
|
|
|
|
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 20); |
|
|
|
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
|
|
|
if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { |
|
|
|
|
|
tft.add_text(0, 0, Z_BTN_COLOR, tft_string); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void drawCurESelection() { |
|
|
|
|
|
tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT); |
|
|
|
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
|
|
|
tft_string.set("E"); |
|
|
|
|
|
tft.add_text(0, 0, E_BTN_COLOR , tft_string); |
|
|
|
|
|
tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void drawMessage(const char *msg) { |
|
|
|
|
|
tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 29, (TFT_WIDTH / 2) - (BTN_WIDTH / 2) - X_MARGIN, 20); |
|
|
|
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
|
|
|
tft.add_text(0, 0, COLOR_YELLOW, msg); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void drawAxisValue(const AxisEnum axis) { |
|
|
|
|
|
const float value = ( |
|
|
|
|
|
TERN_(HAS_BED_PROBE, axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ? probe.offset.z :) |
|
|
|
|
|
ui.manual_move.axis_value(axis) |
|
|
|
|
|
); |
|
|
|
|
|
xy_int_t pos; |
|
|
|
|
|
uint16_t color; |
|
|
|
|
|
switch (axis) { |
|
|
|
|
|
case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break; |
|
|
|
|
|
case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break; |
|
|
|
|
|
case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break; |
|
|
|
|
|
case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break; |
|
|
|
|
|
default: return; |
|
|
|
|
|
} |
|
|
|
|
|
tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, 20); |
|
|
|
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
|
|
|
tft_string.set(ftostr52sp(value)); |
|
|
|
|
|
tft.add_text(0, 0, color, tft_string); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void moveAxis(const AxisEnum axis, const int8_t direction) { |
|
|
|
|
|
quick_feedback(); |
|
|
|
|
|
|
|
|
|
|
|
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { |
|
|
|
|
|
drawMessage("Too cold"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const float diff = motionAxisState.currentStepSize * direction; |
|
|
|
|
|
|
|
|
|
|
|
if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { |
|
|
|
|
|
#if ENABLED(BABYSTEP_ZPROBE_OFFSET) |
|
|
|
|
|
const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z; |
|
|
|
|
|
const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0; |
|
|
|
|
|
const float bsDiff = planner.steps_to_mm[Z_AXIS] * babystep_increment, |
|
|
|
|
|
new_probe_offset = probe.offset.z + bsDiff, |
|
|
|
|
|
new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET |
|
|
|
|
|
, do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff |
|
|
|
|
|
, new_probe_offset |
|
|
|
|
|
); |
|
|
|
|
|
if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { |
|
|
|
|
|
babystep.add_steps(Z_AXIS, babystep_increment); |
|
|
|
|
|
if (do_probe) |
|
|
|
|
|
probe.offset.z = new_offs; |
|
|
|
|
|
else |
|
|
|
|
|
TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP); |
|
|
|
|
|
drawMessage(""); // clear the error
|
|
|
|
|
|
drawAxisValue(axis); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); |
|
|
|
|
|
} |
|
|
|
|
|
#elif HAS_BED_PROBE |
|
|
|
|
|
// 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; |
|
|
|
|
|
drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); |
|
|
|
|
|
} |
|
|
|
|
|
else if (direction > 0 && current_position[axis] > Z_PROBE_OFFSET_RANGE_MAX) { |
|
|
|
|
|
current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX; |
|
|
|
|
|
drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS)); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
drawMessage(""); // clear the error
|
|
|
|
|
|
} |
|
|
|
|
|
drawAxisValue(axis); |
|
|
|
|
|
#endif |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!ui.manual_move.processing) { |
|
|
|
|
|
// Get motion limit from software endstops, if any
|
|
|
|
|
|
float min, max; |
|
|
|
|
|
soft_endstop.get_manual_axis_limits(axis, min, max); |
|
|
|
|
|
|
|
|
|
|
|
// Delta limits XY based on the current offset from center
|
|
|
|
|
|
// This assumes the center is 0,0
|
|
|
|
|
|
#if ENABLED(DELTA) |
|
|
|
|
|
if (axis != Z_AXIS && axis != E_AXIS) { |
|
|
|
|
|
max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
|
|
|
|
|
|
min = -max; |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// Get the new position
|
|
|
|
|
|
const bool limited = ui.manual_move.apply_diff(axis, diff, min, max); |
|
|
|
|
|
#if IS_KINEMATIC |
|
|
|
|
|
UNUSED(limited); |
|
|
|
|
|
#else |
|
|
|
|
|
PGM_P const msg = limited ? GET_TEXT(MSG_LCD_SOFT_ENDSTOPS) : NUL_STR; |
|
|
|
|
|
drawMessage(msg); |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
ui.manual_move.soon(axis |
|
|
|
|
|
#if MULTI_MANUAL |
|
|
|
|
|
, motionAxisState.e_selection |
|
|
|
|
|
#endif |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
drawAxisValue(axis); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void e_plus() { moveAxis(E_AXIS, 1); } |
|
|
|
|
|
static void e_minus() { moveAxis(E_AXIS, -1); } |
|
|
|
|
|
static void x_minus() { moveAxis(X_AXIS, -1); } |
|
|
|
|
|
static void x_plus() { moveAxis(X_AXIS, 1); } |
|
|
|
|
|
static void y_plus() { moveAxis(Y_AXIS, 1); } |
|
|
|
|
|
static void y_minus() { moveAxis(Y_AXIS, -1); } |
|
|
|
|
|
static void z_plus() { moveAxis(Z_AXIS, 1); } |
|
|
|
|
|
static void z_minus() { moveAxis(Z_AXIS, -1); } |
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(TOUCH_SCREEN) |
|
|
|
|
|
static void e_select() { |
|
|
|
|
|
motionAxisState.e_selection++; |
|
|
|
|
|
if (motionAxisState.e_selection >= EXTRUDERS) { |
|
|
|
|
|
motionAxisState.e_selection = 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
quick_feedback(); |
|
|
|
|
|
drawCurESelection(); |
|
|
|
|
|
drawAxisValue(E_AXIS); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void do_home() { |
|
|
|
|
|
quick_feedback(); |
|
|
|
|
|
drawMessage(GET_TEXT(MSG_LEVEL_BED_HOMING)); |
|
|
|
|
|
queue.inject_P(G28_STR); |
|
|
|
|
|
// Disable touch until home is done
|
|
|
|
|
|
TERN_(HAS_TFT_XPT2046, touch.disable()); |
|
|
|
|
|
drawAxisValue(E_AXIS); |
|
|
|
|
|
drawAxisValue(X_AXIS); |
|
|
|
|
|
drawAxisValue(Y_AXIS); |
|
|
|
|
|
drawAxisValue(Z_AXIS); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void step_size() { |
|
|
|
|
|
motionAxisState.currentStepSize = motionAxisState.currentStepSize / 10.0; |
|
|
|
|
|
if (motionAxisState.currentStepSize < 0.0015) motionAxisState.currentStepSize = 10.0; |
|
|
|
|
|
quick_feedback(); |
|
|
|
|
|
drawCurStepValue(); |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if HAS_BED_PROBE |
|
|
|
|
|
static void z_select() { |
|
|
|
|
|
motionAxisState.z_selection *= -1; |
|
|
|
|
|
quick_feedback(); |
|
|
|
|
|
drawCurZSelection(); |
|
|
|
|
|
drawAxisValue(Z_AXIS); |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
static void disable_steppers() { |
|
|
|
|
|
quick_feedback(); |
|
|
|
|
|
queue.inject_P(PSTR("M84")); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) { |
|
|
|
|
|
uint16_t width = Images[imgBtn39Rounded].width; |
|
|
|
|
|
uint16_t height = Images[imgBtn39Rounded].height; |
|
|
|
|
|
|
|
|
|
|
|
if (!enabled) bgColor = COLOR_CONTROL_DISABLED; |
|
|
|
|
|
|
|
|
|
|
|
tft.canvas(x, y, width, height); |
|
|
|
|
|
tft.set_background(COLOR_BACKGROUND); |
|
|
|
|
|
tft.add_image(0, 0, imgBtn39Rounded, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY); |
|
|
|
|
|
|
|
|
|
|
|
// TODO: Make an add_text() taking a font arg
|
|
|
|
|
|
if (label) { |
|
|
|
|
|
tft_string.set(label); |
|
|
|
|
|
tft_string.trim(); |
|
|
|
|
|
tft.add_text(tft_string.center(width), height / 2 - tft_string.font_height() / 2, bgColor, tft_string); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TERN_(HAS_TFT_XPT2046, if (enabled) touch.add_control(BUTTON, x, y, width, height, data)); |
|
|
|
|
|
} |
|
|
void MarlinUI::move_axis_screen() { |
|
|
void MarlinUI::move_axis_screen() { |
|
|
|
|
|
// Reset
|
|
|
|
|
|
defer_status_screen(true); |
|
|
|
|
|
motionAxisState.blocked = false; |
|
|
|
|
|
TERN_(HAS_TFT_XPT2046, touch.enable()); |
|
|
|
|
|
|
|
|
|
|
|
ui.clear_lcd(); |
|
|
|
|
|
|
|
|
|
|
|
TERN_(TOUCH_SCREEN, touch.clear()); |
|
|
|
|
|
|
|
|
|
|
|
const bool busy = printingIsActive(); |
|
|
|
|
|
|
|
|
|
|
|
// Babysteps during printing? Select babystep for Z probe offset
|
|
|
|
|
|
if (busy && ENABLED(BABYSTEP_ZPROBE_OFFSET)) |
|
|
|
|
|
motionAxisState.z_selection = Z_SELECTION_Z_PROBE; |
|
|
|
|
|
|
|
|
|
|
|
// ROW 1 -> E- Y- CurY Z+
|
|
|
|
|
|
int x = X_MARGIN, y = Y_MARGIN, spacing = 0; |
|
|
|
|
|
|
|
|
|
|
|
drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy); |
|
|
|
|
|
|
|
|
|
|
|
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; |
|
|
|
|
|
x += BTN_WIDTH + spacing; |
|
|
|
|
|
uint16_t yplus_x = x; |
|
|
|
|
|
drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy); |
|
|
|
|
|
|
|
|
|
|
|
// Cur Y
|
|
|
|
|
|
x += BTN_WIDTH; |
|
|
|
|
|
motionAxisState.yValuePos.x = x + 2; |
|
|
|
|
|
motionAxisState.yValuePos.y = y; |
|
|
|
|
|
drawAxisValue(Y_AXIS); |
|
|
|
|
|
|
|
|
|
|
|
x += spacing; |
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
// ROW 2 -> "Ex" X- HOME X+ "Z"
|
|
|
|
|
|
y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3; |
|
|
|
|
|
x = X_MARGIN; |
|
|
|
|
|
spacing = (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; |
|
|
|
|
|
|
|
|
|
|
|
motionAxisState.eNamePos.x = x; |
|
|
|
|
|
motionAxisState.eNamePos.y = y; |
|
|
|
|
|
drawCurESelection(); |
|
|
|
|
|
TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); |
|
|
|
|
|
|
|
|
|
|
|
x += BTN_WIDTH + spacing; |
|
|
|
|
|
drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); |
|
|
|
|
|
|
|
|
|
|
|
x += BTN_WIDTH + spacing; //imgHome is 64x64
|
|
|
|
|
|
TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); |
|
|
|
|
|
|
|
|
|
|
|
x += BTN_WIDTH + spacing; |
|
|
|
|
|
uint16_t xplus_x = x; |
|
|
|
|
|
drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy); |
|
|
|
|
|
|
|
|
|
|
|
x += BTN_WIDTH + spacing; |
|
|
|
|
|
motionAxisState.zTypePos.x = x; |
|
|
|
|
|
motionAxisState.zTypePos.y = y; |
|
|
|
|
|
drawCurZSelection(); |
|
|
|
|
|
#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) |
|
|
|
|
|
if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// ROW 3 -> E- CurX Y- Z-
|
|
|
|
|
|
y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3; |
|
|
|
|
|
x = X_MARGIN; |
|
|
|
|
|
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; |
|
|
|
|
|
|
|
|
|
|
|
drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); |
|
|
|
|
|
|
|
|
|
|
|
// Cur E
|
|
|
|
|
|
motionAxisState.eValuePos.x = x; |
|
|
|
|
|
motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2; |
|
|
|
|
|
drawAxisValue(E_AXIS); |
|
|
|
|
|
|
|
|
|
|
|
// Cur X
|
|
|
|
|
|
motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos
|
|
|
|
|
|
motionAxisState.xValuePos.y = y - 10; |
|
|
|
|
|
drawAxisValue(X_AXIS); |
|
|
|
|
|
|
|
|
|
|
|
x += BTN_WIDTH + spacing; |
|
|
|
|
|
drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy); |
|
|
|
|
|
|
|
|
|
|
|
x += BTN_WIDTH + spacing; |
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
// Cur Z
|
|
|
|
|
|
motionAxisState.zValuePos.x = x; |
|
|
|
|
|
motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2; |
|
|
|
|
|
drawAxisValue(Z_AXIS); |
|
|
|
|
|
|
|
|
|
|
|
// ROW 4 -> step_size disable steppers back
|
|
|
|
|
|
y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; //
|
|
|
|
|
|
x = xplus_x - CUR_STEP_VALUE_WIDTH - 10; |
|
|
|
|
|
motionAxisState.stepValuePos.x = yplus_x + BTN_WIDTH - CUR_STEP_VALUE_WIDTH; |
|
|
|
|
|
motionAxisState.stepValuePos.y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; |
|
|
|
|
|
if (!busy) { |
|
|
|
|
|
drawCurStepValue(); |
|
|
|
|
|
TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// aligned with x+
|
|
|
|
|
|
drawBtn(xplus_x, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy); |
|
|
|
|
|
|
|
|
|
|
|
TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // HAS_UI_320x240
|
|
|
#endif // HAS_UI_320x240
|
|
|