Encapsulate probe as singleton class (#16751)
This commit is contained in:
@ -453,7 +453,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_PrintTune, nullptr),
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe_offset.z, DGUSScreenVariableHandler::HandleProbeOffsetZChanged, &DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, DGUSScreenVariableHandler::HandleProbeOffsetZChanged, &DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, DGUSScreenVariableHandler::HandleLiveAdjustZ, nullptr),
|
||||
#endif
|
||||
|
@ -453,7 +453,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_PrintTune, nullptr),
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe_offset.z, DGUSScreenVariableHandler::HandleProbeOffsetZChanged, &DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, DGUSScreenVariableHandler::HandleProbeOffsetZChanged, &DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, DGUSScreenVariableHandler::HandleLiveAdjustZ, nullptr),
|
||||
#endif
|
||||
|
@ -285,7 +285,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
|
||||
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_ReallyAbort, nullptr),
|
||||
VPHELPER(VP_SD_Print_Setting, nullptr, DGUSScreenVariableHandler::DGUSLCD_SD_PrintTune, nullptr),
|
||||
#if HAS_BED_PROBE
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe_offset.z, DGUSScreenVariableHandler::HandleProbeOffsetZChanged, &DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
VPHELPER(VP_SD_Print_ProbeOffsetZ, &probe.offset.z, DGUSScreenVariableHandler::HandleProbeOffsetZChanged, &DGUSScreenVariableHandler::DGUSLCD_SendFloatAsIntValueToDisplay<2>),
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, DGUSScreenVariableHandler::HandleLiveAdjustZ, nullptr),
|
||||
#endif
|
||||
|
@ -733,7 +733,7 @@ namespace ExtUI {
|
||||
#if EXTRUDERS > 1
|
||||
&& (linked_nozzles || active_extruder == 0)
|
||||
#endif
|
||||
) probe_offset.z += mm;
|
||||
) probe.offset.z += mm;
|
||||
#else
|
||||
UNUSED(mm);
|
||||
#endif
|
||||
@ -771,7 +771,7 @@ namespace ExtUI {
|
||||
|
||||
float getZOffset_mm() {
|
||||
#if HAS_BED_PROBE
|
||||
return probe_offset.z;
|
||||
return probe.offset.z;
|
||||
#elif ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
return (planner.steps_to_mm[Z_AXIS] * babystep.axis_total[BS_TODO_AXIS(Z_AXIS)]);
|
||||
#else
|
||||
@ -782,7 +782,7 @@ namespace ExtUI {
|
||||
void setZOffset_mm(const float value) {
|
||||
#if HAS_BED_PROBE
|
||||
if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
|
||||
probe_offset.z = value;
|
||||
probe.offset.z = value;
|
||||
#elif ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
babystep.add_mm(Z_AXIS, (value - getZOffset_mm()));
|
||||
#else
|
||||
|
@ -406,7 +406,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
|
||||
ui.encoderPosition = 0;
|
||||
|
||||
const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment,
|
||||
new_probe_offset = probe_offset.z + diff,
|
||||
new_probe_offset = probe.offset.z + diff,
|
||||
new_offs =
|
||||
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
|
||||
do_probe ? new_probe_offset : hotend_offset[active_extruder].z - diff
|
||||
@ -418,7 +418,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
|
||||
|
||||
babystep.add_steps(Z_AXIS, babystep_increment);
|
||||
|
||||
if (do_probe) probe_offset.z = new_offs;
|
||||
if (do_probe) probe.offset.z = new_offs;
|
||||
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
|
||||
else hotend_offset[active_extruder].z = new_offs;
|
||||
#endif
|
||||
@ -432,10 +432,10 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
|
||||
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_HOTEND_OFFSET_Z), LCD_Z_OFFSET_FUNC(hotend_offset[active_extruder].z));
|
||||
else
|
||||
#endif
|
||||
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), LCD_Z_OFFSET_FUNC(probe_offset.z));
|
||||
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), LCD_Z_OFFSET_FUNC(probe.offset.z));
|
||||
|
||||
#if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY)
|
||||
if (do_probe) _lcd_zoffset_overlay_gfx(probe_offset.z);
|
||||
if (do_probe) _lcd_zoffset_overlay_gfx(probe.offset.z);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -497,9 +497,11 @@ void menu_cancelobject();
|
||||
void menu_probe_offsets() {
|
||||
START_MENU();
|
||||
BACK_ITEM(MSG_ADVANCED_SETTINGS);
|
||||
EDIT_ITEM(float51sign, MSG_ZPROBE_XOFFSET, &probe_offset.x, -(X_BED_SIZE), X_BED_SIZE);
|
||||
EDIT_ITEM(float51sign, MSG_ZPROBE_YOFFSET, &probe_offset.y, -(Y_BED_SIZE), Y_BED_SIZE);
|
||||
EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe_offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
||||
#if HAS_PROBE_XY_OFFSET
|
||||
EDIT_ITEM(float51sign, MSG_ZPROBE_XOFFSET, &probe.offset.x, -(X_BED_SIZE), X_BED_SIZE);
|
||||
EDIT_ITEM(float51sign, MSG_ZPROBE_YOFFSET, &probe.offset.y, -(Y_BED_SIZE), Y_BED_SIZE);
|
||||
#endif
|
||||
EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe.offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
||||
END_MENU();
|
||||
}
|
||||
#endif
|
||||
|
@ -279,7 +279,7 @@ void menu_bed_leveling() {
|
||||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||
SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
|
||||
#elif HAS_BED_PROBE
|
||||
EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe_offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
||||
EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe.offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
||||
#endif
|
||||
|
||||
#if ENABLED(LEVEL_BED_CORNERS)
|
||||
|
@ -317,14 +317,11 @@ void menu_configuration() {
|
||||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||
SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
|
||||
#elif HAS_BED_PROBE
|
||||
EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe_offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
||||
EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe.offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
||||
#endif
|
||||
|
||||
const bool busy = printer_busy();
|
||||
if (!busy) {
|
||||
//
|
||||
// Delta Calibration
|
||||
//
|
||||
#if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION)
|
||||
SUBMENU(MSG_DELTA_CALIBRATE, menu_delta_calibrate);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user