Allow bed tramming with probe to automatically calculate points by probe limits
This commit is contained in:
@@ -1537,14 +1537,15 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_BED_TRAMMING)
|
||||
#ifndef BED_TRAMMING_INSET_LFRB
|
||||
#error "LCD_BED_TRAMMING requires BED_TRAMMING_INSET_LFRB values."
|
||||
#elif ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
#if !HAS_BED_PROBE
|
||||
#error "BED_TRAMMING_USE_PROBE requires a real probe."
|
||||
#elif ENABLED(SENSORLESS_PROBING)
|
||||
#error "BED_TRAMMING_USE_PROBE is incompatible with SENSORLESS_PROBING."
|
||||
#endif
|
||||
#else
|
||||
#ifndef BED_TRAMMING_INSET_LFRB
|
||||
#error "LCD_BED_TRAMMING requires BED_TRAMMING_INSET_LFRB values."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ typedef struct {
|
||||
} select_t;
|
||||
select_t select_page{0}, select_print{0};
|
||||
|
||||
#if ENABLED(LCD_BED_TRAMMING)
|
||||
#if ENABLED(LCD_BED_TRAMMING) && DISABLED(BED_TRAMMING_USE_PROBE)
|
||||
constexpr float bed_tramming_inset_lfbr[] = BED_TRAMMING_INSET_LFRB;
|
||||
#endif
|
||||
|
||||
@@ -2290,6 +2290,11 @@ void setFlow() { setPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr
|
||||
#if ENABLED(LCD_BED_TRAMMING)
|
||||
|
||||
void tramXY(const uint8_t point, float &x, float &y) {
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
float bed_tramming_inset_lfbr[] = {X_MIN_BED + probe.min_x(), Y_MIN_BED + probe.min_y(),
|
||||
X_MAX_BED - probe.max_x(), Y_MAX_BED - probe.max_y() };
|
||||
#endif
|
||||
|
||||
switch (point) {
|
||||
case 0:
|
||||
LCD_MESSAGE(MSG_TRAM_FL);
|
||||
|
||||
@@ -395,7 +395,12 @@ void DGUSReturnKeyCodeHandler::Command_SettingsMenu(DGUS_VP &vp, void *data) {
|
||||
}
|
||||
|
||||
static void _gotoTrammingPoint(unsigned char point) {
|
||||
constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
float lfrb[4] = {X_MIN_BED + probe.min_x(), Y_MIN_BED + probe.min_y(),
|
||||
X_MAX_BED - probe.max_x(), Y_MAX_BED - probe.max_y() };
|
||||
#else
|
||||
constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
#endif
|
||||
float x, y;
|
||||
|
||||
switch (point) {
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
#include "../../../feature/pause.h"
|
||||
#endif
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
#include "../../../module/probe.h"
|
||||
#endif
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../../../feature/powerloss.h"
|
||||
#endif
|
||||
@@ -464,7 +467,14 @@ void DGUSRxHandler::moveToPoint(DGUS_VP &vp, void *data_ptr) {
|
||||
}
|
||||
|
||||
const uint8_t point = ((uint8_t*)data_ptr)[1];
|
||||
constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
float lfrb[4] = {X_MIN_BED + probe.min_x(), Y_MIN_BED + probe.min_y(),
|
||||
X_MAX_BED - probe.max_x(), Y_MAX_BED - probe.max_y() };
|
||||
#else
|
||||
constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
#endif
|
||||
|
||||
float x, y;
|
||||
|
||||
switch (point) {
|
||||
|
||||
@@ -1048,7 +1048,12 @@ void RTSSHOW::RTS_HandleData()
|
||||
return;
|
||||
}
|
||||
|
||||
constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
#if ENABLED(LCD_BED_TRAMMING) && DISABLED(BED_TRAMMING_USE_PROBE)
|
||||
constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
#else if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
float lfrb[4] = getBedProbeLimits();
|
||||
#endif
|
||||
|
||||
//SERIAL_ECHOLNPGM_P(PSTR("BeginSwitch"));
|
||||
|
||||
switch (Checkkey)
|
||||
|
||||
@@ -922,6 +922,7 @@ namespace ExtUI {
|
||||
#if HAS_BED_PROBE
|
||||
float getProbeOffset_mm(const axis_t axis) { return probe.offset.pos[axis]; }
|
||||
void setProbeOffset_mm(const_float_t val, const axis_t axis) { probe.offset.pos[axis] = val; }
|
||||
float[4] getBedProbeLimits() {return {probe.min_x(), probe.min_y(), probe.max_x(), probe.max_y()};}
|
||||
#endif
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
|
||||
@@ -292,6 +292,7 @@ namespace ExtUI {
|
||||
#if HAS_BED_PROBE
|
||||
float getProbeOffset_mm(const axis_t);
|
||||
void setProbeOffset_mm(const_float_t, const axis_t);
|
||||
float[4] getBedProbeLimits();
|
||||
#endif
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
|
||||
@@ -94,16 +94,22 @@ static_assert(COUNT(lco) == 4 || lcodiff == 1 || lcodiff == 3, "The first two BE
|
||||
constexpr int nr_edge_points = tramming_3_points ? 3 : 4;
|
||||
constexpr int available_points = nr_edge_points + ENABLED(BED_TRAMMING_INCLUDE_CENTER);
|
||||
constexpr int center_index = TERN(BED_TRAMMING_INCLUDE_CENTER, available_points - 1, -1);
|
||||
constexpr float inset_lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
constexpr xy_pos_t lf { (X_MIN_BED) + inset_lfrb[0], (Y_MIN_BED) + inset_lfrb[1] },
|
||||
#if DISABLED(BED_TRAMMING_USE_PROBE)
|
||||
constexpr float inset_lfrb[4] = BED_TRAMMING_INSET_LFRB;
|
||||
constexpr xy_pos_t lf { (X_MIN_BED) + inset_lfrb[0], (Y_MIN_BED) + inset_lfrb[1] },
|
||||
rb { (X_MAX_BED) - inset_lfrb[2], (Y_MAX_BED) - inset_lfrb[3] };
|
||||
|
||||
#endif
|
||||
static int8_t bed_corner;
|
||||
|
||||
/**
|
||||
* Move to the next corner coordinates
|
||||
*/
|
||||
static void _lcd_goto_next_corner() {
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
xy_pos_t lf = {X_MIN_BED + probe.min_x(), Y_MIN_BED + probe.min_y() },
|
||||
rb = {X_MAX_BED - probe.max_x(), Y_MAX_BED - probe.max_y() };
|
||||
#endif
|
||||
|
||||
xy_pos_t corner_point = lf; // Left front
|
||||
|
||||
if (tramming_3_points) {
|
||||
@@ -165,11 +171,6 @@ static void _lcd_goto_next_corner() {
|
||||
|
||||
#if ENABLED(BED_TRAMMING_USE_PROBE)
|
||||
|
||||
#define VALIDATE_POINT(X, Y, STR) static_assert(Probe::build_time::can_reach((X), (Y)), \
|
||||
"BED_TRAMMING_INSET_LFRB " STR " inset is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.")
|
||||
VALIDATE_POINT(lf.x, Y_CENTER, "left"); VALIDATE_POINT(X_CENTER, lf.y, "front");
|
||||
VALIDATE_POINT(rb.x, Y_CENTER, "right"); VALIDATE_POINT(X_CENTER, rb.y, "back");
|
||||
|
||||
#ifndef PAGE_CONTAINS
|
||||
#define PAGE_CONTAINS(...) true
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user