🚸 TFT optional axes/extruder (#25624)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
06aed792c0
commit
d5fdbb89ea
@ -222,15 +222,19 @@ void Touch::touch(touch_control_t *control) {
|
|||||||
ui.clear_lcd();
|
ui.clear_lcd();
|
||||||
MenuItem_int3::action(GET_TEXT_F(MSG_SPEED), &feedrate_percentage, 10, 999);
|
MenuItem_int3::action(GET_TEXT_F(MSG_SPEED), &feedrate_percentage, 10, 999);
|
||||||
break;
|
break;
|
||||||
case FLOWRATE:
|
|
||||||
ui.clear_lcd();
|
#if HAS_EXTRUDERS
|
||||||
MenuItemBase::itemIndex = control->data;
|
case FLOWRATE:
|
||||||
#if EXTRUDERS == 1
|
ui.clear_lcd();
|
||||||
MenuItem_int3::action(GET_TEXT_F(MSG_FLOW), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
|
MenuItemBase::itemIndex = control->data;
|
||||||
#else
|
#if EXTRUDERS == 1
|
||||||
MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
|
MenuItem_int3::action(GET_TEXT_F(MSG_FLOW), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
|
||||||
#endif
|
#else
|
||||||
break;
|
MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case STOP:
|
case STOP:
|
||||||
ui.goto_screen([]{
|
ui.goto_screen([]{
|
||||||
MenuItem_confirm::select_screen(GET_TEXT_F(MSG_BUTTON_STOP),
|
MenuItem_confirm::select_screen(GET_TEXT_F(MSG_BUTTON_STOP),
|
||||||
|
@ -124,8 +124,12 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
|||||||
celsius_t currentTemperature, targetTemperature;
|
celsius_t currentTemperature, targetTemperature;
|
||||||
|
|
||||||
if (Heater >= 0) { // HotEnd
|
if (Heater >= 0) { // HotEnd
|
||||||
currentTemperature = thermalManager.wholeDegHotend(Heater);
|
#if HAS_EXTRUDERS
|
||||||
targetTemperature = thermalManager.degTargetHotend(Heater);
|
currentTemperature = thermalManager.wholeDegHotend(Heater);
|
||||||
|
targetTemperature = thermalManager.degTargetHotend(Heater);
|
||||||
|
#else
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else if (Heater == H_BED) {
|
else if (Heater == H_BED) {
|
||||||
@ -270,37 +274,45 @@ void MarlinUI::draw_status_screen() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tft.add_text(200, 3, COLOR_AXIS_HOMED , "X");
|
#if HAS_X_AXIS
|
||||||
const bool nhx = axis_should_home(X_AXIS);
|
tft.add_text(200, 3, COLOR_AXIS_HOMED , "X");
|
||||||
if (blink && nhx)
|
const bool nhx = axis_should_home(X_AXIS);
|
||||||
tft_string.set('?');
|
if (blink && nhx)
|
||||||
else
|
tft_string.set('?');
|
||||||
tft_string.set(ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
else
|
||||||
tft.add_text(300 - tft_string.width(), 3, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
tft_string.set(ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||||
|
tft.add_text(300 - tft_string.width(), 3, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
#endif
|
||||||
|
|
||||||
tft.add_text(500, 3, COLOR_AXIS_HOMED , "Y");
|
#if HAS_Y_AXIS
|
||||||
const bool nhy = axis_should_home(Y_AXIS);
|
tft.add_text(500, 3, COLOR_AXIS_HOMED , "Y");
|
||||||
if (blink && nhy)
|
const bool nhy = axis_should_home(Y_AXIS);
|
||||||
tft_string.set('?');
|
if (blink && nhy)
|
||||||
else
|
tft_string.set('?');
|
||||||
tft_string.set(ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
else
|
||||||
tft.add_text(600 - tft_string.width(), 3, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
tft_string.set(ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||||
|
tft.add_text(600 - tft_string.width(), 3, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
tft.add_text(800, 3, COLOR_AXIS_HOMED , "Z");
|
|
||||||
uint16_t offset = 32;
|
|
||||||
const bool nhz = axis_should_home(Z_AXIS);
|
|
||||||
if (blink && nhz)
|
|
||||||
tft_string.set('?');
|
|
||||||
else {
|
|
||||||
const float z = LOGICAL_Z_POSITION(current_position.z);
|
|
||||||
tft_string.set(ftostr52sp((int16_t)z));
|
|
||||||
tft_string.rtrim();
|
|
||||||
offset += tft_string.width();
|
|
||||||
|
|
||||||
tft_string.set(ftostr52sp(z));
|
#if HAS_Z_AXIS
|
||||||
offset -= tft_string.width();
|
tft.add_text(800, 3, COLOR_AXIS_HOMED , "Z");
|
||||||
}
|
uint16_t offset = 32;
|
||||||
tft.add_text(900 - tft_string.width() - offset, 3, nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
const bool nhz = axis_should_home(Z_AXIS);
|
||||||
|
if (blink && nhz)
|
||||||
|
tft_string.set('?');
|
||||||
|
else {
|
||||||
|
const float z = LOGICAL_Z_POSITION(current_position.z);
|
||||||
|
tft_string.set(ftostr52sp((int16_t)z));
|
||||||
|
tft_string.rtrim();
|
||||||
|
offset += tft_string.width();
|
||||||
|
|
||||||
|
tft_string.set(ftostr52sp(z));
|
||||||
|
offset -= tft_string.width();
|
||||||
|
}
|
||||||
|
tft.add_text(900 - tft_string.width() - offset, 3, nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
#endif // HAS_Z_AXIS
|
||||||
|
|
||||||
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
|
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
|
||||||
|
|
||||||
y += 100;
|
y += 100;
|
||||||
@ -314,15 +326,17 @@ void MarlinUI::draw_status_screen() {
|
|||||||
tft.add_text(36, 1, color , tft_string);
|
tft.add_text(36, 1, color , tft_string);
|
||||||
TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, 274, y, 128, 32));
|
TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, 274, y, 128, 32));
|
||||||
|
|
||||||
// flow rate
|
// Flow rate
|
||||||
tft.canvas(650, y, 128, 32);
|
#if HAS_EXTRUDERS
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
tft.canvas(650, y, 128, 32);
|
||||||
color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.add_image(0, 0, imgFlowRate, color);
|
color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
||||||
tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder]));
|
tft.add_image(0, 0, imgFlowRate, color);
|
||||||
tft_string.add('%');
|
tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder]));
|
||||||
tft.add_text(36, 1, color , tft_string);
|
tft_string.add('%');
|
||||||
TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, 650, y, 128, 32, active_extruder));
|
tft.add_text(36, 1, color , tft_string);
|
||||||
|
TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, 650, y, 128, 32, active_extruder));
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(TOUCH_SCREEN)
|
#if ENABLED(TOUCH_SCREEN)
|
||||||
add_control(900, y, menu_main, imgSettings);
|
add_control(900, y, menu_main, imgSettings);
|
||||||
@ -584,16 +598,26 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con
|
|||||||
#define Z_SELECTION_Z 1
|
#define Z_SELECTION_Z 1
|
||||||
#define Z_SELECTION_Z_PROBE -1
|
#define Z_SELECTION_Z_PROBE -1
|
||||||
|
|
||||||
struct MotionAxisState {
|
struct {
|
||||||
xy_int_t xValuePos, yValuePos, zValuePos, eValuePos, stepValuePos, zTypePos, eNamePos;
|
#if HAS_X_AXIS
|
||||||
|
xy_int_t xValuePos;
|
||||||
|
#endif
|
||||||
|
#if HAS_Y_AXIS
|
||||||
|
xy_int_t yValuePos;
|
||||||
|
#endif
|
||||||
|
#if HAS_Z_AXIS
|
||||||
|
xy_int_t zValuePos, zTypePos;
|
||||||
|
int z_selection = Z_SELECTION_Z;
|
||||||
|
#endif
|
||||||
|
#if HAS_EXTRUDERS
|
||||||
|
xy_int_t eValuePos, eNamePos;
|
||||||
|
uint8_t e_selection = 0;
|
||||||
|
#endif
|
||||||
|
xy_int_t stepValuePos;
|
||||||
float currentStepSize = 10.0;
|
float currentStepSize = 10.0;
|
||||||
int z_selection = Z_SELECTION_Z;
|
|
||||||
uint8_t e_selection = 0;
|
|
||||||
bool blocked = false;
|
bool blocked = false;
|
||||||
char message[32];
|
char message[32];
|
||||||
};
|
} motionAxisState;
|
||||||
|
|
||||||
MotionAxisState motionAxisState;
|
|
||||||
|
|
||||||
#define BTN_WIDTH 64
|
#define BTN_WIDTH 64
|
||||||
#define BTN_HEIGHT 52
|
#define BTN_HEIGHT 52
|
||||||
@ -620,27 +644,30 @@ static void drawCurStepValue() {
|
|||||||
tft.add_text(tft_string.center(CUR_STEP_VALUE_WIDTH), 0, COLOR_AXIS_HOMED, tft_string);
|
tft.add_text(tft_string.center(CUR_STEP_VALUE_WIDTH), 0, COLOR_AXIS_HOMED, tft_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawCurZSelection() {
|
#if HAS_Z_AXIS
|
||||||
tft_string.set('Z');
|
static void drawCurZSelection() {
|
||||||
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 34);
|
tft_string.set('Z');
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 34);
|
||||||
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.queue.sync();
|
|
||||||
tft_string.set(F("Offset"));
|
|
||||||
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 34);
|
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
|
||||||
if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
|
||||||
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
||||||
|
tft.queue.sync();
|
||||||
|
tft_string.set(F("Offset"));
|
||||||
|
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 34);
|
||||||
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
|
if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE)
|
||||||
|
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
static void drawCurESelection() {
|
#if HAS_EXTRUDERS
|
||||||
tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT);
|
static void drawCurESelection() {
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT);
|
||||||
tft_string.set('E');
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.add_text(0, 0, E_BTN_COLOR , tft_string);
|
tft_string.set('E');
|
||||||
tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
|
tft.add_text(0, 0, E_BTN_COLOR , tft_string);
|
||||||
}
|
tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void drawMessage(PGM_P const msg) {
|
static void drawMessage(PGM_P const msg) {
|
||||||
tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 34, TFT_HEIGHT / 2, 34);
|
tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 34, TFT_HEIGHT / 2, 34);
|
||||||
@ -658,10 +685,18 @@ static void drawAxisValue(const AxisEnum axis) {
|
|||||||
xy_int_t pos;
|
xy_int_t pos;
|
||||||
uint16_t color;
|
uint16_t color;
|
||||||
switch (axis) {
|
switch (axis) {
|
||||||
case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break;
|
#if HAS_X_AXIS
|
||||||
case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break;
|
case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break;
|
||||||
case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break;
|
#endif
|
||||||
case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break;
|
#if HAS_Y_AXIS
|
||||||
|
case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break;
|
||||||
|
#endif
|
||||||
|
#if HAS_Z_AXIS
|
||||||
|
case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break;
|
||||||
|
#endif
|
||||||
|
#if HAS_EXTRUDERS
|
||||||
|
case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break;
|
||||||
|
#endif
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, BTN_HEIGHT);
|
tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, BTN_HEIGHT);
|
||||||
@ -673,53 +708,57 @@ static void drawAxisValue(const AxisEnum axis) {
|
|||||||
static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
||||||
quick_feedback();
|
quick_feedback();
|
||||||
|
|
||||||
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
|
#if HAS_EXTRUDERS
|
||||||
drawMessage(F("Too cold"));
|
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
|
||||||
return;
|
drawMessage(F("Too cold"));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const float diff = motionAxisState.currentStepSize * direction;
|
const float diff = motionAxisState.currentStepSize * direction;
|
||||||
|
|
||||||
if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
#if HAS_Z_AXIS
|
||||||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
||||||
const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
|
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||||
const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
|
const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
|
||||||
const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment,
|
const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
|
||||||
new_probe_offset = probe.offset.z + bsDiff,
|
const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment,
|
||||||
new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
|
new_probe_offset = probe.offset.z + bsDiff,
|
||||||
, do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff
|
new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
|
||||||
, new_probe_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 (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
|
||||||
if (do_probe)
|
babystep.add_steps(Z_AXIS, babystep_increment);
|
||||||
probe.offset.z = new_offs;
|
if (do_probe)
|
||||||
|
probe.offset.z = new_offs;
|
||||||
|
else
|
||||||
|
TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
|
||||||
|
drawMessage(F("")); // clear the error
|
||||||
|
drawAxisValue(axis);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
|
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||||
drawMessage(F("")); // clear the error
|
|
||||||
|
#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_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;
|
||||||
|
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
drawMessage(F("")); // clear the error
|
||||||
|
|
||||||
drawAxisValue(axis);
|
drawAxisValue(axis);
|
||||||
}
|
#endif
|
||||||
else
|
return;
|
||||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
}
|
||||||
|
#endif // HAS_Z_AXIS
|
||||||
#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_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;
|
|
||||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
drawMessage(F("")); // clear the error
|
|
||||||
|
|
||||||
drawAxisValue(axis);
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ui.manual_move.processing) {
|
if (!ui.manual_move.processing) {
|
||||||
// Get motion limit from software endstops, if any
|
// Get motion limit from software endstops, if any
|
||||||
@ -729,7 +768,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||||||
// Delta limits XY based on the current offset from center
|
// Delta limits XY based on the current offset from center
|
||||||
// This assumes the center is 0,0
|
// This assumes the center is 0,0
|
||||||
#if ENABLED(DELTA)
|
#if ENABLED(DELTA)
|
||||||
if (axis != Z_AXIS && axis != E_AXIS) {
|
if (axis != Z_AXIS && TERN1(HAS_EXTRUDERS, axis != E_AXIS)) {
|
||||||
max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
|
max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
|
||||||
min = -max;
|
min = -max;
|
||||||
}
|
}
|
||||||
@ -750,35 +789,44 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||||||
drawAxisValue(axis);
|
drawAxisValue(axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void e_plus() { moveAxis(E_AXIS, 1); }
|
#if HAS_EXTRUDERS
|
||||||
static void e_minus() { moveAxis(E_AXIS, -1); }
|
static void e_plus() { moveAxis(E_AXIS, 1); }
|
||||||
static void x_minus() { moveAxis(X_AXIS, -1); }
|
static void e_minus() { moveAxis(E_AXIS, -1); }
|
||||||
static void x_plus() { moveAxis(X_AXIS, 1); }
|
#endif
|
||||||
static void y_plus() { moveAxis(Y_AXIS, 1); }
|
#if HAS_X_AXIS
|
||||||
static void y_minus() { moveAxis(Y_AXIS, -1); }
|
static void x_minus() { moveAxis(X_AXIS, -1); }
|
||||||
static void z_plus() { moveAxis(Z_AXIS, 1); }
|
static void x_plus() { moveAxis(X_AXIS, 1); }
|
||||||
static void z_minus() { moveAxis(Z_AXIS, -1); }
|
#endif
|
||||||
|
#if HAS_Y_AXIS
|
||||||
|
static void y_plus() { moveAxis(Y_AXIS, 1); }
|
||||||
|
static void y_minus() { moveAxis(Y_AXIS, -1); }
|
||||||
|
#endif
|
||||||
|
#if HAS_Z_AXIS
|
||||||
|
static void z_plus() { moveAxis(Z_AXIS, 1); }
|
||||||
|
static void z_minus() { moveAxis(Z_AXIS, -1); }
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(TOUCH_SCREEN)
|
#if ENABLED(TOUCH_SCREEN)
|
||||||
static void e_select() {
|
#if HAS_EXTRUDERS
|
||||||
if (++motionAxisState.e_selection >= EXTRUDERS)
|
static void e_select() {
|
||||||
motionAxisState.e_selection = 0;
|
if (++motionAxisState.e_selection >= EXTRUDERS)
|
||||||
|
motionAxisState.e_selection = 0;
|
||||||
quick_feedback();
|
quick_feedback();
|
||||||
drawCurESelection();
|
drawCurESelection();
|
||||||
drawAxisValue(E_AXIS);
|
drawAxisValue(E_AXIS);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void do_home() {
|
static void do_home() {
|
||||||
quick_feedback();
|
quick_feedback();
|
||||||
drawMessage(GET_TEXT_F(MSG_LEVEL_BED_HOMING));
|
drawMessage(GET_TEXT_F(MSG_LEVEL_BED_HOMING));
|
||||||
queue.inject_P(G28_STR);
|
queue.inject_P(G28_STR);
|
||||||
// Disable touch until home is done
|
// Disable touch until home is done
|
||||||
TERN_(TOUCH_SCREEN, touch.disable());
|
touch.disable();
|
||||||
drawAxisValue(E_AXIS);
|
TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS));
|
||||||
drawAxisValue(X_AXIS);
|
TERN_(HAS_X_AXIS, drawAxisValue(X_AXIS));
|
||||||
drawAxisValue(Y_AXIS);
|
TERN_(HAS_Y_AXIS, drawAxisValue(Y_AXIS));
|
||||||
drawAxisValue(Z_AXIS);
|
TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void step_size() {
|
static void step_size() {
|
||||||
@ -845,7 +893,7 @@ void MarlinUI::move_axis_screen() {
|
|||||||
// ROW 1 -> E- Y- CurY Z+
|
// ROW 1 -> E- Y- CurY Z+
|
||||||
int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
|
int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
|
||||||
|
|
||||||
drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy);
|
TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy));
|
||||||
|
|
||||||
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
@ -858,7 +906,9 @@ void MarlinUI::move_axis_screen() {
|
|||||||
drawAxisValue(Y_AXIS);
|
drawAxisValue(Y_AXIS);
|
||||||
|
|
||||||
x += spacing;
|
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
|
#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
|
||||||
|
#endif
|
||||||
|
|
||||||
// ROW 2 -> "Ex" X- HOME X+ "Z"
|
// ROW 2 -> "Ex" X- HOME X+ "Z"
|
||||||
y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
|
y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
|
||||||
@ -867,8 +917,10 @@ void MarlinUI::move_axis_screen() {
|
|||||||
|
|
||||||
motionAxisState.eNamePos.x = x;
|
motionAxisState.eNamePos.x = x;
|
||||||
motionAxisState.eNamePos.y = y;
|
motionAxisState.eNamePos.y = y;
|
||||||
drawCurESelection();
|
#if HAS_EXTRUDERS
|
||||||
TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
|
drawCurESelection();
|
||||||
|
TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
|
||||||
|
#endif
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
||||||
@ -883,7 +935,7 @@ void MarlinUI::move_axis_screen() {
|
|||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
motionAxisState.zTypePos.x = x;
|
motionAxisState.zTypePos.x = x;
|
||||||
motionAxisState.zTypePos.y = y;
|
motionAxisState.zTypePos.y = y;
|
||||||
drawCurZSelection();
|
TERN_(HAS_Z_AXIS, drawCurZSelection());
|
||||||
#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
||||||
if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
|
if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
|
||||||
#endif
|
#endif
|
||||||
@ -893,12 +945,12 @@ void MarlinUI::move_axis_screen() {
|
|||||||
x = X_MARGIN;
|
x = X_MARGIN;
|
||||||
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
||||||
|
|
||||||
drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy);
|
TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy));
|
||||||
|
|
||||||
// Cur E
|
// Cur E
|
||||||
motionAxisState.eValuePos.x = x;
|
motionAxisState.eValuePos.x = x;
|
||||||
motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
|
motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
|
||||||
drawAxisValue(E_AXIS);
|
TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS));
|
||||||
|
|
||||||
// Cur X
|
// Cur X
|
||||||
motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos
|
motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos
|
||||||
@ -909,12 +961,14 @@ void MarlinUI::move_axis_screen() {
|
|||||||
drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
|
drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing;
|
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
|
#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
|
// Cur Z
|
||||||
motionAxisState.zValuePos.x = x;
|
motionAxisState.zValuePos.x = x;
|
||||||
motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
|
motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
|
||||||
drawAxisValue(Z_AXIS);
|
TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS));
|
||||||
|
|
||||||
// ROW 4 -> step_size disable steppers back
|
// ROW 4 -> step_size disable steppers back
|
||||||
y = TFT_HEIGHT - Y_MARGIN - 32; //
|
y = TFT_HEIGHT - Y_MARGIN - 32; //
|
||||||
|
@ -126,8 +126,12 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
|||||||
celsius_t currentTemperature, targetTemperature;
|
celsius_t currentTemperature, targetTemperature;
|
||||||
|
|
||||||
if (Heater >= 0) { // HotEnd
|
if (Heater >= 0) { // HotEnd
|
||||||
currentTemperature = thermalManager.wholeDegHotend(Heater);
|
#if HAS_EXTRUDERS
|
||||||
targetTemperature = thermalManager.degTargetHotend(Heater);
|
currentTemperature = thermalManager.wholeDegHotend(Heater);
|
||||||
|
targetTemperature = thermalManager.degTargetHotend(Heater);
|
||||||
|
#else
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else if (Heater == H_BED) {
|
else if (Heater == H_BED) {
|
||||||
@ -283,52 +287,59 @@ void MarlinUI::draw_status_screen() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 32, 10), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "X");
|
#if HAS_X_AXIS
|
||||||
const bool nhx = axis_should_home(X_AXIS);
|
tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 32, 10), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "X");
|
||||||
tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
const bool nhx = axis_should_home(X_AXIS);
|
||||||
tft.add_text(
|
tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||||
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
tft.add_text(
|
||||||
32 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT),
|
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
||||||
#else
|
32 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT),
|
||||||
68 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT),
|
#else
|
||||||
#endif
|
68 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT),
|
||||||
nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string
|
#endif
|
||||||
);
|
nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string
|
||||||
|
);
|
||||||
tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 110, 127), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "Y");
|
|
||||||
const bool nhy = axis_should_home(Y_AXIS);
|
|
||||||
tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
|
||||||
tft.add_text(
|
|
||||||
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
||||||
110 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT),
|
|
||||||
#else
|
|
||||||
185 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT),
|
|
||||||
#endif
|
|
||||||
nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 192, 219), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "Z");
|
|
||||||
const bool nhz = axis_should_home(Z_AXIS);
|
|
||||||
uint16_t offset = 25;
|
|
||||||
if (blink && nhz)
|
|
||||||
tft_string.set('?');
|
|
||||||
else {
|
|
||||||
const float z = LOGICAL_Z_POSITION(current_position.z);
|
|
||||||
tft_string.set(ftostr52sp((int16_t)z));
|
|
||||||
tft_string.rtrim();
|
|
||||||
offset += tft_string.width();
|
|
||||||
|
|
||||||
tft_string.set(ftostr52sp(z));
|
|
||||||
offset -= tft_string.width();
|
|
||||||
}
|
|
||||||
tft.add_text(
|
|
||||||
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
|
||||||
192 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT),
|
|
||||||
#else
|
|
||||||
301 - tft_string.width() - offset, tft_string.vcenter(FONT_LINE_HEIGHT),
|
|
||||||
#endif
|
#endif
|
||||||
nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
|
||||||
|
#if HAS_Y_AXIS
|
||||||
|
tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 110, 127), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "Y");
|
||||||
|
const bool nhy = axis_should_home(Y_AXIS);
|
||||||
|
tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||||
|
tft.add_text(
|
||||||
|
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
||||||
|
110 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT),
|
||||||
|
#else
|
||||||
|
185 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT),
|
||||||
|
#endif
|
||||||
|
nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if HAS_Z_AXIS
|
||||||
|
tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 192, 219), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "Z");
|
||||||
|
const bool nhz = axis_should_home(Z_AXIS);
|
||||||
|
uint16_t offset = 25;
|
||||||
|
if (blink && nhz)
|
||||||
|
tft_string.set('?');
|
||||||
|
else {
|
||||||
|
const float z = LOGICAL_Z_POSITION(current_position.z);
|
||||||
|
tft_string.set(ftostr52sp((int16_t)z));
|
||||||
|
tft_string.rtrim();
|
||||||
|
offset += tft_string.width();
|
||||||
|
|
||||||
|
tft_string.set(ftostr52sp(z));
|
||||||
|
offset -= tft_string.width();
|
||||||
|
}
|
||||||
|
tft.add_text(
|
||||||
|
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
||||||
|
192 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT),
|
||||||
|
#else
|
||||||
|
301 - tft_string.width() - offset, tft_string.vcenter(FONT_LINE_HEIGHT),
|
||||||
|
#endif
|
||||||
|
nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
#endif
|
||||||
|
|
||||||
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103,
|
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103,
|
||||||
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
||||||
232, FONT_LINE_HEIGHT * 2
|
232, FONT_LINE_HEIGHT * 2
|
||||||
@ -361,29 +372,31 @@ void MarlinUI::draw_status_screen() {
|
|||||||
, 32
|
, 32
|
||||||
));
|
));
|
||||||
|
|
||||||
// flow rate
|
// Flow rate
|
||||||
tft.canvas(
|
#if HAS_EXTRUDERS
|
||||||
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
tft.canvas(
|
||||||
140, 172, 80
|
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
||||||
#else
|
140, 172, 80
|
||||||
170, 136, 84
|
#else
|
||||||
#endif
|
170, 136, 84
|
||||||
, 32
|
#endif
|
||||||
);
|
, 32
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
);
|
||||||
color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.add_image(0, 0, imgFlowRate, color);
|
color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
||||||
tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder]));
|
tft.add_image(0, 0, imgFlowRate, color);
|
||||||
tft_string.add('%');
|
tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder]));
|
||||||
tft.add_text(32, tft_string.vcenter(30), color , tft_string);
|
tft_string.add('%');
|
||||||
TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE,
|
tft.add_text(32, tft_string.vcenter(30), color , tft_string);
|
||||||
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE,
|
||||||
140, 172, 80
|
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
|
||||||
#else
|
140, 172, 80
|
||||||
170, 136, 84
|
#else
|
||||||
#endif
|
170, 136, 84
|
||||||
, 32, active_extruder
|
#endif
|
||||||
));
|
, 32, active_extruder
|
||||||
|
));
|
||||||
|
#endif // HAS_EXTRUDERS
|
||||||
|
|
||||||
// print duration
|
// print duration
|
||||||
char buffer[14];
|
char buffer[14];
|
||||||
@ -666,16 +679,26 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con
|
|||||||
#define Z_SELECTION_Z 1
|
#define Z_SELECTION_Z 1
|
||||||
#define Z_SELECTION_Z_PROBE -1
|
#define Z_SELECTION_Z_PROBE -1
|
||||||
|
|
||||||
struct MotionAxisState {
|
struct {
|
||||||
xy_int_t xValuePos, yValuePos, zValuePos, eValuePos, stepValuePos, zTypePos, eNamePos;
|
#if HAS_X_AXIS
|
||||||
|
xy_int_t xValuePos;
|
||||||
|
#endif
|
||||||
|
#if HAS_Y_AXIS
|
||||||
|
xy_int_t yValuePos;
|
||||||
|
#endif
|
||||||
|
#if HAS_Z_AXIS
|
||||||
|
xy_int_t zValuePos, zTypePos;
|
||||||
|
int z_selection = Z_SELECTION_Z;
|
||||||
|
#endif
|
||||||
|
#if HAS_EXTRUDERS
|
||||||
|
xy_int_t eValuePos, eNamePos;
|
||||||
|
uint8_t e_selection = 0;
|
||||||
|
#endif
|
||||||
|
xy_int_t stepValuePos;
|
||||||
float currentStepSize = 10.0;
|
float currentStepSize = 10.0;
|
||||||
int z_selection = Z_SELECTION_Z;
|
|
||||||
uint8_t e_selection = 0;
|
|
||||||
bool blocked = false;
|
bool blocked = false;
|
||||||
char message[32];
|
char message[32];
|
||||||
};
|
} motionAxisState;
|
||||||
|
|
||||||
MotionAxisState motionAxisState;
|
|
||||||
|
|
||||||
#define BTN_WIDTH 48
|
#define BTN_WIDTH 48
|
||||||
#define BTN_HEIGHT 39
|
#define BTN_HEIGHT 39
|
||||||
@ -706,27 +729,30 @@ static void drawCurStepValue() {
|
|||||||
tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string);
|
tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawCurZSelection() {
|
#if HAS_Z_AXIS
|
||||||
tft_string.set('Z');
|
static void drawCurZSelection() {
|
||||||
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 20);
|
tft_string.set('Z');
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 20);
|
||||||
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.queue.sync();
|
|
||||||
tft_string.set(F("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);
|
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
||||||
|
tft.queue.sync();
|
||||||
|
tft_string.set(F("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);
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
static void drawCurESelection() {
|
#if HAS_EXTRUDERS
|
||||||
tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT);
|
static void drawCurESelection() {
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT);
|
||||||
tft_string.set('E');
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.add_text(0, 0, E_BTN_COLOR , tft_string);
|
tft_string.set('E');
|
||||||
tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
|
tft.add_text(0, 0, E_BTN_COLOR , tft_string);
|
||||||
}
|
tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void drawMessage(PGM_P const msg) {
|
static void drawMessage(PGM_P const msg) {
|
||||||
tft.canvas(X_MARGIN,
|
tft.canvas(X_MARGIN,
|
||||||
@ -751,10 +777,18 @@ static void drawAxisValue(const AxisEnum axis) {
|
|||||||
xy_int_t pos;
|
xy_int_t pos;
|
||||||
uint16_t color;
|
uint16_t color;
|
||||||
switch (axis) {
|
switch (axis) {
|
||||||
case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break;
|
#if HAS_X_AXIS
|
||||||
case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break;
|
case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break;
|
||||||
case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break;
|
#endif
|
||||||
case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break;
|
#if HAS_Y_AXIS
|
||||||
|
case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break;
|
||||||
|
#endif
|
||||||
|
#if HAS_Z_AXIS
|
||||||
|
case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break;
|
||||||
|
#endif
|
||||||
|
#if HAS_EXTRUDERS
|
||||||
|
case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break;
|
||||||
|
#endif
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, FONT_LINE_HEIGHT);
|
tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, FONT_LINE_HEIGHT);
|
||||||
@ -766,53 +800,57 @@ static void drawAxisValue(const AxisEnum axis) {
|
|||||||
static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
||||||
quick_feedback();
|
quick_feedback();
|
||||||
|
|
||||||
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
|
#if HAS_EXTRUDERS
|
||||||
drawMessage(F("Too cold"));
|
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
|
||||||
return;
|
drawMessage(F("Too cold"));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const float diff = motionAxisState.currentStepSize * direction;
|
const float diff = motionAxisState.currentStepSize * direction;
|
||||||
|
|
||||||
if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
#if HAS_Z_AXIS
|
||||||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
||||||
const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
|
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||||
const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
|
const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
|
||||||
const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment,
|
const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
|
||||||
new_probe_offset = probe.offset.z + bsDiff,
|
const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment,
|
||||||
new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
|
new_probe_offset = probe.offset.z + bsDiff,
|
||||||
, do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff
|
new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
|
||||||
, new_probe_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 (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
|
||||||
if (do_probe)
|
babystep.add_steps(Z_AXIS, babystep_increment);
|
||||||
probe.offset.z = new_offs;
|
if (do_probe)
|
||||||
else
|
probe.offset.z = new_offs;
|
||||||
TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
|
else
|
||||||
drawMessage(NUL_STR); // clear the error
|
TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
|
||||||
|
drawMessage(NUL_STR); // clear the error
|
||||||
|
drawAxisValue(axis);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawMessage(GET_TEXT_F(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_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;
|
||||||
|
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawMessage(NUL_STR); // clear the error
|
||||||
|
}
|
||||||
drawAxisValue(axis);
|
drawAxisValue(axis);
|
||||||
}
|
#endif
|
||||||
else {
|
return;
|
||||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
}
|
||||||
}
|
#endif // HAS_Z_AXIS
|
||||||
#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_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;
|
|
||||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
drawMessage(NUL_STR); // clear the error
|
|
||||||
}
|
|
||||||
drawAxisValue(axis);
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ui.manual_move.processing) {
|
if (!ui.manual_move.processing) {
|
||||||
// Get motion limit from software endstops, if any
|
// Get motion limit from software endstops, if any
|
||||||
@ -822,7 +860,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||||||
// Delta limits XY based on the current offset from center
|
// Delta limits XY based on the current offset from center
|
||||||
// This assumes the center is 0,0
|
// This assumes the center is 0,0
|
||||||
#if ENABLED(DELTA)
|
#if ENABLED(DELTA)
|
||||||
if (axis != Z_AXIS && axis != E_AXIS) {
|
if (axis != Z_AXIS && TERN1(HAS_EXTRUDERS, axis != E_AXIS)) {
|
||||||
max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
|
max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
|
||||||
min = -max;
|
min = -max;
|
||||||
}
|
}
|
||||||
@ -843,35 +881,44 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||||||
drawAxisValue(axis);
|
drawAxisValue(axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void e_plus() { moveAxis(E_AXIS, 1); }
|
#if HAS_EXTRUDERS
|
||||||
static void e_minus() { moveAxis(E_AXIS, -1); }
|
static void e_plus() { moveAxis(E_AXIS, 1); }
|
||||||
static void x_minus() { moveAxis(X_AXIS, -1); }
|
static void e_minus() { moveAxis(E_AXIS, -1); }
|
||||||
static void x_plus() { moveAxis(X_AXIS, 1); }
|
#endif
|
||||||
static void y_plus() { moveAxis(Y_AXIS, 1); }
|
#if HAS_X_AXIS
|
||||||
static void y_minus() { moveAxis(Y_AXIS, -1); }
|
static void x_minus() { moveAxis(X_AXIS, -1); }
|
||||||
static void z_plus() { moveAxis(Z_AXIS, 1); }
|
static void x_plus() { moveAxis(X_AXIS, 1); }
|
||||||
static void z_minus() { moveAxis(Z_AXIS, -1); }
|
#endif
|
||||||
|
#if HAS_Y_AXIS
|
||||||
|
static void y_plus() { moveAxis(Y_AXIS, 1); }
|
||||||
|
static void y_minus() { moveAxis(Y_AXIS, -1); }
|
||||||
|
#endif
|
||||||
|
#if HAS_Z_AXIS
|
||||||
|
static void z_plus() { moveAxis(Z_AXIS, 1); }
|
||||||
|
static void z_minus() { moveAxis(Z_AXIS, -1); }
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(TOUCH_SCREEN)
|
#if ENABLED(TOUCH_SCREEN)
|
||||||
static void e_select() {
|
#if HAS_EXTRUDERS
|
||||||
if (++motionAxisState.e_selection >= EXTRUDERS)
|
static void e_select() {
|
||||||
motionAxisState.e_selection = 0;
|
if (++motionAxisState.e_selection >= EXTRUDERS)
|
||||||
|
motionAxisState.e_selection = 0;
|
||||||
quick_feedback();
|
quick_feedback();
|
||||||
drawCurESelection();
|
drawCurESelection();
|
||||||
drawAxisValue(E_AXIS);
|
drawAxisValue(E_AXIS);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void do_home() {
|
static void do_home() {
|
||||||
quick_feedback();
|
quick_feedback();
|
||||||
drawMessage(GET_TEXT_F(MSG_LEVEL_BED_HOMING));
|
drawMessage(GET_TEXT_F(MSG_LEVEL_BED_HOMING));
|
||||||
queue.inject_P(G28_STR);
|
queue.inject_P(G28_STR);
|
||||||
// Disable touch until home is done
|
// Disable touch until home is done
|
||||||
TERN_(HAS_TFT_XPT2046, touch.disable());
|
touch.disable();
|
||||||
drawAxisValue(E_AXIS);
|
TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS));
|
||||||
drawAxisValue(X_AXIS);
|
TERN_(HAS_X_AXIS, drawAxisValue(X_AXIS));
|
||||||
drawAxisValue(Y_AXIS);
|
TERN_(HAS_Y_AXIS, drawAxisValue(Y_AXIS));
|
||||||
drawAxisValue(Z_AXIS);
|
TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void step_size() {
|
static void step_size() {
|
||||||
@ -916,14 +963,14 @@ static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage
|
|||||||
else
|
else
|
||||||
tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
|
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));
|
TERN_(TOUCH_SCREEN, if (enabled) touch.add_control(BUTTON, x, y, width, height, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarlinUI::move_axis_screen() {
|
void MarlinUI::move_axis_screen() {
|
||||||
// Reset
|
// Reset
|
||||||
defer_status_screen(true);
|
defer_status_screen(true);
|
||||||
motionAxisState.blocked = false;
|
motionAxisState.blocked = false;
|
||||||
TERN_(HAS_TFT_XPT2046, touch.enable());
|
TERN_(TOUCH_SCREEN, touch.enable());
|
||||||
|
|
||||||
ui.clear_lcd();
|
ui.clear_lcd();
|
||||||
|
|
||||||
@ -949,7 +996,9 @@ void MarlinUI::move_axis_screen() {
|
|||||||
|
|
||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
uint16_t zplus_x = x;
|
uint16_t zplus_x = x;
|
||||||
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
|
#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
|
||||||
|
#endif
|
||||||
|
|
||||||
// ROW 2 -> "Ex" CurY "Z"
|
// ROW 2 -> "Ex" CurY "Z"
|
||||||
x = X_MARGIN;
|
x = X_MARGIN;
|
||||||
@ -957,8 +1006,10 @@ void MarlinUI::move_axis_screen() {
|
|||||||
|
|
||||||
motionAxisState.eNamePos.x = x;
|
motionAxisState.eNamePos.x = x;
|
||||||
motionAxisState.eNamePos.y = y;
|
motionAxisState.eNamePos.y = y;
|
||||||
drawCurESelection();
|
#if HAS_EXTRUDERS
|
||||||
TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
|
drawCurESelection();
|
||||||
|
TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
|
||||||
|
#endif
|
||||||
|
|
||||||
motionAxisState.yValuePos.x = yplus_x;
|
motionAxisState.yValuePos.x = yplus_x;
|
||||||
motionAxisState.yValuePos.y = y;
|
motionAxisState.yValuePos.y = y;
|
||||||
@ -966,7 +1017,7 @@ void MarlinUI::move_axis_screen() {
|
|||||||
|
|
||||||
motionAxisState.zTypePos.x = zplus_x;
|
motionAxisState.zTypePos.x = zplus_x;
|
||||||
motionAxisState.zTypePos.y = y;
|
motionAxisState.zTypePos.y = y;
|
||||||
drawCurZSelection();
|
TERN_(HAS_Z_AXIS, drawCurZSelection());
|
||||||
|
|
||||||
// ROW 3 -> X- HOME X+
|
// ROW 3 -> X- HOME X+
|
||||||
y += (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3 - 2;
|
y += (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3 - 2;
|
||||||
@ -974,7 +1025,7 @@ void MarlinUI::move_axis_screen() {
|
|||||||
|
|
||||||
drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
||||||
|
|
||||||
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));
|
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);
|
drawBtn(zplus_x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy);
|
||||||
|
|
||||||
@ -993,23 +1044,27 @@ void MarlinUI::move_axis_screen() {
|
|||||||
y += (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3 - 2;
|
y += (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3 - 2;
|
||||||
x = X_MARGIN;
|
x = X_MARGIN;
|
||||||
|
|
||||||
drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy);
|
#if HAS_EXTRUDERS
|
||||||
|
drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Cur E
|
// Cur E
|
||||||
motionAxisState.eValuePos.x = x;
|
motionAxisState.eValuePos.x = x;
|
||||||
motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
|
motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
|
||||||
drawAxisValue(E_AXIS);
|
TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS));
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
|
drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing;
|
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
|
#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
|
// Cur Z
|
||||||
motionAxisState.zValuePos.x = x;
|
motionAxisState.zValuePos.x = x;
|
||||||
motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
|
motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
|
||||||
drawAxisValue(Z_AXIS);
|
TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS));
|
||||||
|
|
||||||
// ROW 6 -> step_size disable steppers back
|
// ROW 6 -> step_size disable steppers back
|
||||||
y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; //
|
y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; //
|
||||||
@ -1019,7 +1074,7 @@ void MarlinUI::move_axis_screen() {
|
|||||||
|
|
||||||
if (!busy) {
|
if (!busy) {
|
||||||
drawCurStepValue();
|
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));
|
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+
|
||||||
@ -1030,7 +1085,7 @@ void MarlinUI::move_axis_screen() {
|
|||||||
// ROW 1 -> E+ Y+ CurY Z+
|
// ROW 1 -> E+ Y+ CurY Z+
|
||||||
int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
|
int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
|
||||||
|
|
||||||
drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy);
|
TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy));
|
||||||
|
|
||||||
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
@ -1044,7 +1099,9 @@ void MarlinUI::move_axis_screen() {
|
|||||||
drawAxisValue(Y_AXIS);
|
drawAxisValue(Y_AXIS);
|
||||||
|
|
||||||
x += spacing;
|
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
|
#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
|
||||||
|
#endif
|
||||||
|
|
||||||
// ROW 2 -> "Ex" X- HOME X+ "Z"
|
// ROW 2 -> "Ex" X- HOME X+ "Z"
|
||||||
y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
|
y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
|
||||||
@ -1053,14 +1110,16 @@ void MarlinUI::move_axis_screen() {
|
|||||||
|
|
||||||
motionAxisState.eNamePos.x = x;
|
motionAxisState.eNamePos.x = x;
|
||||||
motionAxisState.eNamePos.y = y;
|
motionAxisState.eNamePos.y = y;
|
||||||
drawCurESelection();
|
#if HAS_EXTRUDERS
|
||||||
TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
|
drawCurESelection();
|
||||||
|
TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
|
||||||
|
#endif
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing; //imgHome is 64x64
|
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));
|
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));
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
uint16_t xplus_x = x;
|
uint16_t xplus_x = x;
|
||||||
@ -1069,9 +1128,9 @@ void MarlinUI::move_axis_screen() {
|
|||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
motionAxisState.zTypePos.x = x;
|
motionAxisState.zTypePos.x = x;
|
||||||
motionAxisState.zTypePos.y = y;
|
motionAxisState.zTypePos.y = y;
|
||||||
drawCurZSelection();
|
TERN_(HAS_Z_AXIS, drawCurZSelection());
|
||||||
#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
||||||
if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
|
if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ROW 3 -> E- CurX Y- Z-
|
// ROW 3 -> E- CurX Y- Z-
|
||||||
@ -1079,12 +1138,12 @@ void MarlinUI::move_axis_screen() {
|
|||||||
x = X_MARGIN;
|
x = X_MARGIN;
|
||||||
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
||||||
|
|
||||||
drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy);
|
TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy));
|
||||||
|
|
||||||
// Cur E
|
// Cur E
|
||||||
motionAxisState.eValuePos.x = x;
|
motionAxisState.eValuePos.x = x;
|
||||||
motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
|
motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
|
||||||
drawAxisValue(E_AXIS);
|
TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS));
|
||||||
|
|
||||||
// Cur X
|
// Cur X
|
||||||
motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos
|
motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos
|
||||||
@ -1095,12 +1154,14 @@ void MarlinUI::move_axis_screen() {
|
|||||||
drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
|
drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing;
|
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
|
#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
|
// Cur Z
|
||||||
motionAxisState.zValuePos.x = x;
|
motionAxisState.zValuePos.x = x;
|
||||||
motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
|
motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
|
||||||
drawAxisValue(Z_AXIS);
|
TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS));
|
||||||
|
|
||||||
// ROW 4 -> step_size disable steppers back
|
// ROW 4 -> step_size disable steppers back
|
||||||
y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; //
|
y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; //
|
||||||
@ -1109,7 +1170,7 @@ void MarlinUI::move_axis_screen() {
|
|||||||
motionAxisState.stepValuePos.y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT;
|
motionAxisState.stepValuePos.y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT;
|
||||||
if (!busy) {
|
if (!busy) {
|
||||||
drawCurStepValue();
|
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));
|
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+
|
||||||
@ -1117,7 +1178,7 @@ void MarlinUI::move_axis_screen() {
|
|||||||
|
|
||||||
#endif // !TFT_COLOR_UI_PORTRAIT
|
#endif // !TFT_COLOR_UI_PORTRAIT
|
||||||
|
|
||||||
TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
|
TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_UI_320x240
|
#endif // HAS_UI_320x240
|
||||||
|
@ -124,8 +124,12 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
|||||||
celsius_t currentTemperature, targetTemperature;
|
celsius_t currentTemperature, targetTemperature;
|
||||||
|
|
||||||
if (Heater >= 0) { // HotEnd
|
if (Heater >= 0) { // HotEnd
|
||||||
currentTemperature = thermalManager.wholeDegHotend(Heater);
|
#if HAS_EXTRUDERS
|
||||||
targetTemperature = thermalManager.degTargetHotend(Heater);
|
currentTemperature = thermalManager.wholeDegHotend(Heater);
|
||||||
|
targetTemperature = thermalManager.degTargetHotend(Heater);
|
||||||
|
#else
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else if (Heater == H_BED) {
|
else if (Heater == H_BED) {
|
||||||
@ -271,31 +275,37 @@ void MarlinUI::draw_status_screen() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Coords in mask "X____Y____Z____"
|
// Coords in mask "X____Y____Z____"
|
||||||
tft_string.set("X");
|
#if HAS_X_AXIS
|
||||||
tft.add_text(coords_width / 30 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string);
|
tft_string.set("X");
|
||||||
|
tft.add_text(coords_width / 30 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string);
|
||||||
|
|
||||||
const bool nhx = axis_should_home(X_AXIS);
|
const bool nhx = axis_should_home(X_AXIS);
|
||||||
tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||||
tft_string.ltrim();
|
tft_string.ltrim();
|
||||||
tft.add_text(coords_width / 5 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
tft.add_text(coords_width / 5 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
#endif
|
||||||
|
|
||||||
tft_string.set("Y");
|
#if HAS_Y_AXIS
|
||||||
tft.add_text(11 * coords_width / 30 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string);
|
tft_string.set("Y");
|
||||||
|
tft.add_text(11 * coords_width / 30 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string);
|
||||||
|
|
||||||
const bool nhy = axis_should_home(Y_AXIS);
|
const bool nhy = axis_should_home(Y_AXIS);
|
||||||
tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||||
tft_string.ltrim();
|
tft_string.ltrim();
|
||||||
tft.add_text(8 * coords_width / 15 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
tft.add_text(8 * coords_width / 15 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
tft_string.set("Z");
|
#if HAS_Z_AXIS
|
||||||
tft.add_text(7 * coords_width / 10 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string);
|
tft_string.set("Z");
|
||||||
|
tft.add_text(7 * coords_width / 10 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string);
|
||||||
|
|
||||||
const bool nhz = axis_should_home(Z_AXIS);
|
const bool nhz = axis_should_home(Z_AXIS);
|
||||||
tft_string.set(blink && nhz ? "?" : ftostr52sp(LOGICAL_Z_POSITION(current_position.z)));
|
tft_string.set(blink && nhz ? "?" : ftostr52sp(LOGICAL_Z_POSITION(current_position.z)));
|
||||||
tft_string.ltrim();
|
tft_string.ltrim();
|
||||||
tft_string.rtrim();
|
tft_string.rtrim();
|
||||||
tft.add_text(13 * coords_width / 15 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
tft.add_text(13 * coords_width / 15 - tft_string.width() / 2, tft_string.vcenter(FONT_LINE_HEIGHT), nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
#endif
|
||||||
|
|
||||||
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
|
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
|
||||||
|
|
||||||
@ -315,19 +325,21 @@ void MarlinUI::draw_status_screen() {
|
|||||||
tft.add_text(36, tft_string.vcenter(30), color , tft_string);
|
tft.add_text(36, tft_string.vcenter(30), color , tft_string);
|
||||||
TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, x, y, component_width, 32));
|
TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, x, y, component_width, 32));
|
||||||
|
|
||||||
// Flow rate (preparing)
|
#if HAS_EXTRUDERS
|
||||||
tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder]));
|
// Flow rate (preparing)
|
||||||
tft_string.add('%');
|
tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder]));
|
||||||
component_width = 36 + tft_string.width();
|
tft_string.add('%');
|
||||||
color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
component_width = 36 + tft_string.width();
|
||||||
x = FLOWRATE_X(component_width);
|
color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
|
||||||
|
x = FLOWRATE_X(component_width);
|
||||||
|
|
||||||
// Flow rate (drawing)
|
// Flow rate (drawing)
|
||||||
tft.canvas(x, y, component_width, 32);
|
tft.canvas(x, y, component_width, 32);
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.add_image(0, 0, imgFlowRate, color);
|
tft.add_image(0, 0, imgFlowRate, color);
|
||||||
tft.add_text(36, tft_string.vcenter(30), color , tft_string);
|
tft.add_text(36, tft_string.vcenter(30), color , tft_string);
|
||||||
TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, x, y, component_width, 32, active_extruder));
|
TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, x, y, component_width, 32, active_extruder));
|
||||||
|
#endif
|
||||||
|
|
||||||
#if TFT_COLOR_UI_PORTRAIT || DISABLED(TOUCH_SCREEN)
|
#if TFT_COLOR_UI_PORTRAIT || DISABLED(TOUCH_SCREEN)
|
||||||
y += STATUS_MARGIN_SIZE + 32;
|
y += STATUS_MARGIN_SIZE + 32;
|
||||||
@ -586,16 +598,26 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con
|
|||||||
#define Z_SELECTION_Z 1
|
#define Z_SELECTION_Z 1
|
||||||
#define Z_SELECTION_Z_PROBE -1
|
#define Z_SELECTION_Z_PROBE -1
|
||||||
|
|
||||||
struct MotionAxisState {
|
struct {
|
||||||
xy_int_t xValuePos, yValuePos, zValuePos, eValuePos, stepValuePos, zTypePos, eNamePos;
|
#if HAS_X_AXIS
|
||||||
|
xy_int_t xValuePos;
|
||||||
|
#endif
|
||||||
|
#if HAS_Y_AXIS
|
||||||
|
xy_int_t yValuePos;
|
||||||
|
#endif
|
||||||
|
#if HAS_Z_AXIS
|
||||||
|
xy_int_t zValuePos, zTypePos;
|
||||||
|
int z_selection = Z_SELECTION_Z;
|
||||||
|
#endif
|
||||||
|
#if HAS_EXTRUDERS
|
||||||
|
xy_int_t eValuePos, eNamePos;
|
||||||
|
uint8_t e_selection = 0;
|
||||||
|
#endif
|
||||||
|
xy_int_t stepValuePos;
|
||||||
float currentStepSize = 10.0;
|
float currentStepSize = 10.0;
|
||||||
int z_selection = Z_SELECTION_Z;
|
|
||||||
uint8_t e_selection = 0;
|
|
||||||
bool blocked = false;
|
bool blocked = false;
|
||||||
char message[32];
|
char message[32];
|
||||||
};
|
} motionAxisState;
|
||||||
|
|
||||||
MotionAxisState motionAxisState;
|
|
||||||
|
|
||||||
#define BTN_WIDTH 64
|
#define BTN_WIDTH 64
|
||||||
#define BTN_HEIGHT 52
|
#define BTN_HEIGHT 52
|
||||||
@ -622,27 +644,30 @@ static void drawCurStepValue() {
|
|||||||
tft.add_text(tft_string.center(CUR_STEP_VALUE_WIDTH), 0, COLOR_AXIS_HOMED, tft_string);
|
tft.add_text(tft_string.center(CUR_STEP_VALUE_WIDTH), 0, COLOR_AXIS_HOMED, tft_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawCurZSelection() {
|
#if HAS_Z_AXIS
|
||||||
tft_string.set('Z');
|
static void drawCurZSelection() {
|
||||||
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 34);
|
tft_string.set('Z');
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 34);
|
||||||
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.queue.sync();
|
|
||||||
tft_string.set(F("Offset"));
|
|
||||||
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 34);
|
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
|
||||||
if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
|
||||||
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
||||||
|
tft.queue.sync();
|
||||||
|
tft_string.set(F("Offset"));
|
||||||
|
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 34);
|
||||||
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
|
if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE)
|
||||||
|
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
static void drawCurESelection() {
|
#if HAS_EXTRUDERS
|
||||||
tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT);
|
static void drawCurESelection() {
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT);
|
||||||
tft_string.set('E');
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.add_text(0, 0, E_BTN_COLOR , tft_string);
|
tft_string.set('E');
|
||||||
tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
|
tft.add_text(0, 0, E_BTN_COLOR , tft_string);
|
||||||
}
|
tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void drawMessage(PGM_P const msg) {
|
static void drawMessage(PGM_P const msg) {
|
||||||
tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 34, TFT_HEIGHT / 2, 34);
|
tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 34, TFT_HEIGHT / 2, 34);
|
||||||
@ -660,10 +685,18 @@ static void drawAxisValue(const AxisEnum axis) {
|
|||||||
xy_int_t pos;
|
xy_int_t pos;
|
||||||
uint16_t color;
|
uint16_t color;
|
||||||
switch (axis) {
|
switch (axis) {
|
||||||
case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break;
|
#if HAS_X_AXIS
|
||||||
case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break;
|
case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break;
|
||||||
case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break;
|
#endif
|
||||||
case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break;
|
#if HAS_Y_AXIS
|
||||||
|
case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break;
|
||||||
|
#endif
|
||||||
|
#if HAS_Z_AXIS
|
||||||
|
case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break;
|
||||||
|
#endif
|
||||||
|
#if HAS_EXTRUDERS
|
||||||
|
case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break;
|
||||||
|
#endif
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, BTN_HEIGHT);
|
tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, BTN_HEIGHT);
|
||||||
@ -675,53 +708,57 @@ static void drawAxisValue(const AxisEnum axis) {
|
|||||||
static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
||||||
quick_feedback();
|
quick_feedback();
|
||||||
|
|
||||||
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
|
#if HAS_EXTRUDERS
|
||||||
drawMessage(F("Too cold"));
|
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
|
||||||
return;
|
drawMessage(F("Too cold"));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const float diff = motionAxisState.currentStepSize * direction;
|
const float diff = motionAxisState.currentStepSize * direction;
|
||||||
|
|
||||||
if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
#if HAS_Z_AXIS
|
||||||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
||||||
const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
|
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||||
const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
|
const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
|
||||||
const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment,
|
const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
|
||||||
new_probe_offset = probe.offset.z + bsDiff,
|
const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment,
|
||||||
new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
|
new_probe_offset = probe.offset.z + bsDiff,
|
||||||
, do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff
|
new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
|
||||||
, new_probe_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 (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
|
||||||
if (do_probe)
|
babystep.add_steps(Z_AXIS, babystep_increment);
|
||||||
probe.offset.z = new_offs;
|
if (do_probe)
|
||||||
else
|
probe.offset.z = new_offs;
|
||||||
TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
|
else
|
||||||
drawMessage(NUL_STR); // clear the error
|
TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
|
||||||
|
drawMessage(NUL_STR); // clear the error
|
||||||
|
drawAxisValue(axis);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawMessage(GET_TEXT_F(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_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;
|
||||||
|
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawMessage(NUL_STR); // clear the error
|
||||||
|
}
|
||||||
drawAxisValue(axis);
|
drawAxisValue(axis);
|
||||||
}
|
#endif
|
||||||
else {
|
return;
|
||||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
}
|
||||||
}
|
#endif // HAS_Z_AXIS
|
||||||
#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_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;
|
|
||||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
drawMessage(NUL_STR); // clear the error
|
|
||||||
}
|
|
||||||
drawAxisValue(axis);
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ui.manual_move.processing) {
|
if (!ui.manual_move.processing) {
|
||||||
// Get motion limit from software endstops, if any
|
// Get motion limit from software endstops, if any
|
||||||
@ -731,7 +768,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||||||
// Delta limits XY based on the current offset from center
|
// Delta limits XY based on the current offset from center
|
||||||
// This assumes the center is 0,0
|
// This assumes the center is 0,0
|
||||||
#if ENABLED(DELTA)
|
#if ENABLED(DELTA)
|
||||||
if (axis != Z_AXIS && axis != E_AXIS) {
|
if (axis != Z_AXIS && TERN1(HAS_EXTRUDERS, axis != E_AXIS)) {
|
||||||
max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
|
max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
|
||||||
min = -max;
|
min = -max;
|
||||||
}
|
}
|
||||||
@ -752,35 +789,44 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||||||
drawAxisValue(axis);
|
drawAxisValue(axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void e_plus() { moveAxis(E_AXIS, 1); }
|
#if HAS_EXTRUDERS
|
||||||
static void e_minus() { moveAxis(E_AXIS, -1); }
|
static void e_plus() { moveAxis(E_AXIS, 1); }
|
||||||
static void x_minus() { moveAxis(X_AXIS, -1); }
|
static void e_minus() { moveAxis(E_AXIS, -1); }
|
||||||
static void x_plus() { moveAxis(X_AXIS, 1); }
|
#endif
|
||||||
static void y_plus() { moveAxis(Y_AXIS, 1); }
|
#if HAS_X_AXIS
|
||||||
static void y_minus() { moveAxis(Y_AXIS, -1); }
|
static void x_minus() { moveAxis(X_AXIS, -1); }
|
||||||
static void z_plus() { moveAxis(Z_AXIS, 1); }
|
static void x_plus() { moveAxis(X_AXIS, 1); }
|
||||||
static void z_minus() { moveAxis(Z_AXIS, -1); }
|
#endif
|
||||||
|
#if HAS_Y_AXIS
|
||||||
|
static void y_plus() { moveAxis(Y_AXIS, 1); }
|
||||||
|
static void y_minus() { moveAxis(Y_AXIS, -1); }
|
||||||
|
#endif
|
||||||
|
#if HAS_Z_AXIS
|
||||||
|
static void z_plus() { moveAxis(Z_AXIS, 1); }
|
||||||
|
static void z_minus() { moveAxis(Z_AXIS, -1); }
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(TOUCH_SCREEN)
|
#if ENABLED(TOUCH_SCREEN)
|
||||||
static void e_select() {
|
#if HAS_EXTRUDERS
|
||||||
if (++motionAxisState.e_selection >= EXTRUDERS)
|
static void e_select() {
|
||||||
motionAxisState.e_selection = 0;
|
if (++motionAxisState.e_selection >= EXTRUDERS)
|
||||||
|
motionAxisState.e_selection = 0;
|
||||||
quick_feedback();
|
quick_feedback();
|
||||||
drawCurESelection();
|
drawCurESelection();
|
||||||
drawAxisValue(E_AXIS);
|
drawAxisValue(E_AXIS);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void do_home() {
|
static void do_home() {
|
||||||
quick_feedback();
|
quick_feedback();
|
||||||
drawMessage(GET_TEXT_F(MSG_LEVEL_BED_HOMING));
|
drawMessage(GET_TEXT_F(MSG_LEVEL_BED_HOMING));
|
||||||
queue.inject_P(G28_STR);
|
queue.inject_P(G28_STR);
|
||||||
// Disable touch until home is done
|
// Disable touch until home is done
|
||||||
TERN_(HAS_TFT_XPT2046, touch.disable());
|
touch.disable();
|
||||||
drawAxisValue(E_AXIS);
|
TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS));
|
||||||
drawAxisValue(X_AXIS);
|
TERN_(HAS_X_AXIS, drawAxisValue(X_AXIS));
|
||||||
drawAxisValue(Y_AXIS);
|
TERN_(HAS_Y_AXIS, drawAxisValue(Y_AXIS));
|
||||||
drawAxisValue(Z_AXIS);
|
TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void step_size() {
|
static void step_size() {
|
||||||
@ -789,7 +835,7 @@ static void z_minus() { moveAxis(Z_AXIS, -1); }
|
|||||||
quick_feedback();
|
quick_feedback();
|
||||||
drawCurStepValue();
|
drawCurStepValue();
|
||||||
}
|
}
|
||||||
#endif
|
#endif // TOUCH_SCREEN
|
||||||
|
|
||||||
#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
||||||
static void z_select() {
|
static void z_select() {
|
||||||
@ -825,14 +871,14 @@ static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage
|
|||||||
tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
|
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));
|
TERN_(TOUCH_SCREEN, if (enabled) touch.add_control(BUTTON, x, y, width, height, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarlinUI::move_axis_screen() {
|
void MarlinUI::move_axis_screen() {
|
||||||
// Reset
|
// Reset
|
||||||
defer_status_screen(true);
|
defer_status_screen(true);
|
||||||
motionAxisState.blocked = false;
|
motionAxisState.blocked = false;
|
||||||
TERN_(HAS_TFT_XPT2046, touch.enable());
|
TERN_(TOUCH_SCREEN, touch.enable());
|
||||||
|
|
||||||
ui.clear_lcd();
|
ui.clear_lcd();
|
||||||
|
|
||||||
@ -842,25 +888,31 @@ void MarlinUI::move_axis_screen() {
|
|||||||
|
|
||||||
// Babysteps during printing? Select babystep for Z probe offset
|
// Babysteps during printing? Select babystep for Z probe offset
|
||||||
if (busy && ENABLED(BABYSTEP_ZPROBE_OFFSET))
|
if (busy && ENABLED(BABYSTEP_ZPROBE_OFFSET))
|
||||||
motionAxisState.z_selection = Z_SELECTION_Z_PROBE;
|
|
||||||
|
TERN_(HAS_Z_AXIS, motionAxisState.z_selection = Z_SELECTION_Z_PROBE);
|
||||||
|
|
||||||
// ROW 1 -> E- Y- CurY Z+
|
// ROW 1 -> E- Y- CurY Z+
|
||||||
int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
|
int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
|
||||||
|
|
||||||
drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy);
|
TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy));
|
||||||
|
|
||||||
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy);
|
|
||||||
|
TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy));
|
||||||
|
|
||||||
// Cur Y
|
// Cur Y
|
||||||
x += BTN_WIDTH;
|
x += BTN_WIDTH;
|
||||||
motionAxisState.yValuePos.x = x + 2;
|
#if HAS_Y_AXIS
|
||||||
motionAxisState.yValuePos.y = y;
|
motionAxisState.yValuePos.x = x + 2;
|
||||||
drawAxisValue(Y_AXIS);
|
motionAxisState.yValuePos.y = y;
|
||||||
|
drawAxisValue(Y_AXIS);
|
||||||
|
#endif
|
||||||
|
|
||||||
x += spacing;
|
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
|
#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
|
||||||
|
#endif
|
||||||
|
|
||||||
// ROW 2 -> "Ex" X- HOME X+ "Z"
|
// ROW 2 -> "Ex" X- HOME X+ "Z"
|
||||||
y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
|
y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
|
||||||
@ -869,14 +921,16 @@ void MarlinUI::move_axis_screen() {
|
|||||||
|
|
||||||
motionAxisState.eNamePos.x = x;
|
motionAxisState.eNamePos.x = x;
|
||||||
motionAxisState.eNamePos.y = y;
|
motionAxisState.eNamePos.y = y;
|
||||||
drawCurESelection();
|
#if HAS_EXTRUDERS
|
||||||
TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
|
drawCurESelection();
|
||||||
|
TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
|
||||||
|
#endif
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing; //imgHome is 64x64
|
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));
|
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));
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
uint16_t xplus_x = x;
|
uint16_t xplus_x = x;
|
||||||
@ -885,7 +939,7 @@ void MarlinUI::move_axis_screen() {
|
|||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
motionAxisState.zTypePos.x = x;
|
motionAxisState.zTypePos.x = x;
|
||||||
motionAxisState.zTypePos.y = y;
|
motionAxisState.zTypePos.y = y;
|
||||||
drawCurZSelection();
|
TERN_(HAS_Z_AXIS, drawCurZSelection());
|
||||||
#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
||||||
if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
|
if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
|
||||||
#endif
|
#endif
|
||||||
@ -895,28 +949,30 @@ void MarlinUI::move_axis_screen() {
|
|||||||
x = X_MARGIN;
|
x = X_MARGIN;
|
||||||
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
||||||
|
|
||||||
drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy);
|
TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy));
|
||||||
|
|
||||||
// Cur E
|
// Cur E
|
||||||
motionAxisState.eValuePos.x = x;
|
motionAxisState.eValuePos.x = x;
|
||||||
motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
|
motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
|
||||||
drawAxisValue(E_AXIS);
|
TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS));
|
||||||
|
|
||||||
// Cur X
|
// Cur X
|
||||||
motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos
|
motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos
|
||||||
motionAxisState.xValuePos.y = y - 10;
|
motionAxisState.xValuePos.y = y - 10;
|
||||||
drawAxisValue(X_AXIS);
|
TERN_(HAS_X_AXIS, drawAxisValue(X_AXIS));
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing;
|
x += BTN_WIDTH + spacing;
|
||||||
drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
|
drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
|
||||||
|
|
||||||
x += BTN_WIDTH + spacing;
|
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
|
#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
|
// Cur Z
|
||||||
motionAxisState.zValuePos.x = x;
|
motionAxisState.zValuePos.x = x;
|
||||||
motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
|
motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
|
||||||
drawAxisValue(Z_AXIS);
|
TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS));
|
||||||
|
|
||||||
// ROW 4 -> step_size disable steppers back
|
// ROW 4 -> step_size disable steppers back
|
||||||
y = TFT_HEIGHT - Y_MARGIN - 32;
|
y = TFT_HEIGHT - Y_MARGIN - 32;
|
||||||
@ -925,13 +981,13 @@ void MarlinUI::move_axis_screen() {
|
|||||||
motionAxisState.stepValuePos.y = y;
|
motionAxisState.stepValuePos.y = y;
|
||||||
if (!busy) {
|
if (!busy) {
|
||||||
drawCurStepValue();
|
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));
|
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);
|
drawBtn(xplus_x, TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
|
||||||
|
|
||||||
TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
|
TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_UI_480x320
|
#endif // HAS_UI_480x320
|
||||||
|
Loading…
x
Reference in New Issue
Block a user