2016-07-14 20:40:11 +00:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 14:00:57 +00:00
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2016-07-14 20:40:11 +00:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-28 04:57:50 +00:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2016-07-14 20:40:11 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2020-07-23 03:20:14 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2016-07-14 20:40:11 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-07-30 01:56:26 +00:00
|
|
|
#include "utility.h"
|
2017-09-06 11:28:32 +00:00
|
|
|
|
2020-01-03 01:01:38 +00:00
|
|
|
#include "../MarlinCore.h"
|
2017-09-06 11:28:32 +00:00
|
|
|
#include "../module/temperature.h"
|
2016-07-14 20:40:11 +00:00
|
|
|
|
2016-07-30 01:56:26 +00:00
|
|
|
void safe_delay(millis_t ms) {
|
2016-07-14 20:40:11 +00:00
|
|
|
while (ms > 50) {
|
|
|
|
ms -= 50;
|
|
|
|
delay(50);
|
2022-07-03 15:32:47 +00:00
|
|
|
thermalManager.task();
|
2016-07-14 20:40:11 +00:00
|
|
|
}
|
|
|
|
delay(ms);
|
2022-07-03 15:32:47 +00:00
|
|
|
thermalManager.task(); // This keeps us safe if too many small safe_delay() calls are made
|
2016-07-14 20:40:11 +00:00
|
|
|
}
|
2016-08-20 23:05:54 +00:00
|
|
|
|
2020-02-21 02:09:37 +00:00
|
|
|
// A delay to provide brittle hosts time to receive bytes
|
|
|
|
#if ENABLED(SERIAL_OVERRUN_PROTECTION)
|
|
|
|
|
|
|
|
#include "../gcode/gcode.h" // for set_autoreport_paused
|
|
|
|
|
|
|
|
void serial_delay(const millis_t ms) {
|
|
|
|
const bool was = gcode.set_autoreport_paused(true);
|
|
|
|
safe_delay(ms);
|
|
|
|
gcode.set_autoreport_paused(was);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-09-06 11:28:32 +00:00
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
|
|
|
|
#include "../module/probe.h"
|
|
|
|
#include "../module/motion.h"
|
2022-07-27 09:24:50 +00:00
|
|
|
#include "../module/planner.h"
|
2019-06-11 10:58:43 +00:00
|
|
|
#include "../libs/numtostr.h"
|
2017-09-06 11:28:32 +00:00
|
|
|
#include "../feature/bedlevel/bedlevel.h"
|
|
|
|
|
|
|
|
void log_machine_info() {
|
2018-08-25 02:03:21 +00:00
|
|
|
SERIAL_ECHOLNPGM("Machine Type: "
|
2020-09-04 01:12:53 +00:00
|
|
|
TERN_(DELTA, "Delta")
|
|
|
|
TERN_(IS_SCARA, "SCARA")
|
|
|
|
TERN_(IS_CORE, "Core")
|
2021-11-23 21:24:24 +00:00
|
|
|
TERN_(MARKFORGED_XY, "MarkForgedXY")
|
|
|
|
TERN_(MARKFORGED_YX, "MarkForgedYX")
|
2020-09-04 01:12:53 +00:00
|
|
|
TERN_(IS_CARTESIAN, "Cartesian")
|
2018-08-25 02:03:21 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPGM("Probe: "
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(PROBE_MANUALLY, "PROBE_MANUALLY")
|
|
|
|
TERN_(NOZZLE_AS_PROBE, "NOZZLE_AS_PROBE")
|
|
|
|
TERN_(FIX_MOUNTED_PROBE, "FIX_MOUNTED_PROBE")
|
|
|
|
TERN_(HAS_Z_SERVO_PROBE, TERN(BLTOUCH, "BLTOUCH", "SERVO PROBE"))
|
2022-08-06 06:14:58 +00:00
|
|
|
TERN_(BD_SENSOR, "BD_SENSOR")
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(TOUCH_MI_PROBE, "TOUCH_MI_PROBE")
|
|
|
|
TERN_(Z_PROBE_SLED, "Z_PROBE_SLED")
|
|
|
|
TERN_(Z_PROBE_ALLEN_KEY, "Z_PROBE_ALLEN_KEY")
|
|
|
|
TERN_(SOLENOID_PROBE, "SOLENOID_PROBE")
|
2021-12-27 21:28:27 +00:00
|
|
|
TERN_(MAGLEV4, "MAGLEV4")
|
|
|
|
IF_DISABLED(PROBE_SELECTED, "NONE")
|
2018-08-25 02:03:21 +00:00
|
|
|
);
|
2017-09-06 11:28:32 +00:00
|
|
|
|
|
|
|
#if HAS_BED_PROBE
|
2018-11-17 13:36:39 +00:00
|
|
|
|
2020-01-03 23:46:26 +00:00
|
|
|
#if !HAS_PROBE_XY_OFFSET
|
2021-09-09 09:57:05 +00:00
|
|
|
SERIAL_ECHOPGM("Probe Offset X0 Y0 Z", probe.offset.z, " (");
|
2020-01-03 23:46:26 +00:00
|
|
|
#else
|
2021-09-09 09:57:05 +00:00
|
|
|
SERIAL_ECHOPGM_P(PSTR("Probe Offset X"), probe.offset_xy.x, SP_Y_STR, probe.offset_xy.y, SP_Z_STR, probe.offset.z);
|
2020-02-01 10:21:36 +00:00
|
|
|
if (probe.offset_xy.x > 0)
|
2020-01-03 23:46:26 +00:00
|
|
|
SERIAL_ECHOPGM(" (Right");
|
2020-02-01 10:21:36 +00:00
|
|
|
else if (probe.offset_xy.x < 0)
|
2020-01-03 23:46:26 +00:00
|
|
|
SERIAL_ECHOPGM(" (Left");
|
2020-02-01 10:21:36 +00:00
|
|
|
else if (probe.offset_xy.y != 0)
|
2020-01-03 23:46:26 +00:00
|
|
|
SERIAL_ECHOPGM(" (Middle");
|
|
|
|
else
|
|
|
|
SERIAL_ECHOPGM(" (Aligned With");
|
|
|
|
|
2020-03-08 04:20:41 +00:00
|
|
|
if (probe.offset_xy.y > 0)
|
2021-09-27 16:03:07 +00:00
|
|
|
SERIAL_ECHOF(F(TERN(IS_SCARA, "-Distal", "-Back")));
|
2020-03-08 04:20:41 +00:00
|
|
|
else if (probe.offset_xy.y < 0)
|
2021-09-27 16:03:07 +00:00
|
|
|
SERIAL_ECHOF(F(TERN(IS_SCARA, "-Proximal", "-Front")));
|
2020-02-01 10:21:36 +00:00
|
|
|
else if (probe.offset_xy.x != 0)
|
2020-01-03 23:46:26 +00:00
|
|
|
SERIAL_ECHOPGM("-Center");
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM(" & ");
|
|
|
|
|
|
|
|
#endif
|
2018-11-17 13:36:39 +00:00
|
|
|
|
2021-09-27 16:03:07 +00:00
|
|
|
SERIAL_ECHOF(probe.offset.z < 0 ? F("Below") : probe.offset.z > 0 ? F("Above") : F("Same Z as"));
|
2017-09-06 11:28:32 +00:00
|
|
|
SERIAL_ECHOLNPGM(" Nozzle)");
|
2020-01-03 23:46:26 +00:00
|
|
|
|
2017-09-06 11:28:32 +00:00
|
|
|
#endif
|
|
|
|
|
2019-02-25 02:29:03 +00:00
|
|
|
#if HAS_ABL_OR_UBL
|
2020-03-08 04:20:41 +00:00
|
|
|
SERIAL_ECHOPGM("Auto Bed Leveling: "
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(AUTO_BED_LEVELING_LINEAR, "LINEAR")
|
|
|
|
TERN_(AUTO_BED_LEVELING_BILINEAR, "BILINEAR")
|
|
|
|
TERN_(AUTO_BED_LEVELING_3POINT, "3POINT")
|
|
|
|
TERN_(AUTO_BED_LEVELING_UBL, "UBL")
|
2020-03-08 04:20:41 +00:00
|
|
|
);
|
2020-03-01 16:36:15 +00:00
|
|
|
|
2017-10-13 22:21:25 +00:00
|
|
|
if (planner.leveling_active) {
|
2017-09-06 11:28:32 +00:00
|
|
|
SERIAL_ECHOLNPGM(" (enabled)");
|
2018-01-23 17:43:38 +00:00
|
|
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
|
if (planner.z_fade_height)
|
2021-09-09 09:57:05 +00:00
|
|
|
SERIAL_ECHOLNPGM("Z Fade: ", planner.z_fade_height);
|
2018-01-23 17:43:38 +00:00
|
|
|
#endif
|
2017-09-06 11:28:32 +00:00
|
|
|
#if ABL_PLANAR
|
2021-06-05 07:18:47 +00:00
|
|
|
SERIAL_ECHOPGM("ABL Adjustment");
|
2022-04-01 05:10:38 +00:00
|
|
|
LOOP_NUM_AXES(a) {
|
2022-04-04 01:13:11 +00:00
|
|
|
SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&SP_AXIS_STR[a]));
|
2022-03-11 23:12:03 +00:00
|
|
|
serial_offset(planner.get_axis_position_mm(AxisEnum(a)) - current_position[a]);
|
2019-09-29 09:25:39 +00:00
|
|
|
}
|
2018-01-23 17:43:38 +00:00
|
|
|
#else
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
|
SERIAL_ECHOPGM("UBL Adjustment Z");
|
|
|
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
|
|
SERIAL_ECHOPGM("ABL Adjustment Z");
|
|
|
|
#endif
|
2022-06-07 00:23:55 +00:00
|
|
|
const float rz = bedlevel.get_z_correction(current_position);
|
2018-01-23 17:43:38 +00:00
|
|
|
SERIAL_ECHO(ftostr43sign(rz, '+'));
|
|
|
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
|
if (planner.z_fade_height) {
|
2021-09-09 09:57:05 +00:00
|
|
|
SERIAL_ECHOPGM(" (", ftostr43sign(rz * planner.fade_scaling_factor_for_z(current_position.z), '+'));
|
2018-01-23 17:43:38 +00:00
|
|
|
SERIAL_CHAR(')');
|
|
|
|
}
|
|
|
|
#endif
|
2017-09-06 11:28:32 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SERIAL_ECHOLNPGM(" (disabled)");
|
|
|
|
|
|
|
|
SERIAL_EOL();
|
|
|
|
|
|
|
|
#elif ENABLED(MESH_BED_LEVELING)
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM("Mesh Bed Leveling");
|
2017-10-13 22:21:25 +00:00
|
|
|
if (planner.leveling_active) {
|
2017-09-06 11:28:32 +00:00
|
|
|
SERIAL_ECHOLNPGM(" (enabled)");
|
2022-06-07 00:23:55 +00:00
|
|
|
const float z_offset = bedlevel.get_z_offset(),
|
|
|
|
z_correction = bedlevel.get_z_correction(current_position);
|
|
|
|
SERIAL_ECHOPGM("MBL Adjustment Z", ftostr43sign(z_offset + z_correction, '+'));
|
2018-01-23 17:43:38 +00:00
|
|
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
|
if (planner.z_fade_height) {
|
2021-09-09 09:57:05 +00:00
|
|
|
SERIAL_ECHOPGM(" (", ftostr43sign(
|
2022-06-07 00:23:55 +00:00
|
|
|
z_offset + z_correction * planner.fade_scaling_factor_for_z(current_position.z), '+'
|
2018-01-23 17:43:38 +00:00
|
|
|
));
|
|
|
|
SERIAL_CHAR(')');
|
|
|
|
}
|
|
|
|
#endif
|
2017-09-06 11:28:32 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
SERIAL_ECHOPGM(" (disabled)");
|
|
|
|
|
|
|
|
SERIAL_EOL();
|
|
|
|
|
|
|
|
#endif // MESH_BED_LEVELING
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // DEBUG_LEVELING_FEATURE
|