2016-07-14 22:40:11 +02:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2019-06-28 06:57:50 +02:00
|
|
|
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2016-07-14 22:40:11 +02:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-28 06:57:50 +02:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2016-07-14 22:40:11 +02: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
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-07-30 03:56:26 +02:00
|
|
|
#include "utility.h"
|
2017-09-06 13:28:32 +02:00
|
|
|
|
2020-01-03 02:01:38 +01:00
|
|
|
#include "../MarlinCore.h"
|
2017-09-06 13:28:32 +02:00
|
|
|
#include "../module/temperature.h"
|
2016-07-14 22:40:11 +02:00
|
|
|
|
2016-07-30 03:56:26 +02:00
|
|
|
void safe_delay(millis_t ms) {
|
2016-07-14 22:40:11 +02:00
|
|
|
while (ms > 50) {
|
|
|
|
ms -= 50;
|
|
|
|
delay(50);
|
|
|
|
thermalManager.manage_heater();
|
|
|
|
}
|
|
|
|
delay(ms);
|
2017-04-29 00:36:31 +02:00
|
|
|
thermalManager.manage_heater(); // This keeps us safe if too many small safe_delay() calls are made
|
2016-07-14 22:40:11 +02:00
|
|
|
}
|
2016-08-21 01:05:54 +02:00
|
|
|
|
2017-09-06 13:28:32 +02:00
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
|
|
|
|
#include "../module/probe.h"
|
|
|
|
#include "../module/motion.h"
|
|
|
|
#include "../module/stepper.h"
|
2019-06-11 12:58:43 +02:00
|
|
|
#include "../libs/numtostr.h"
|
2017-09-06 13:28:32 +02:00
|
|
|
#include "../feature/bedlevel/bedlevel.h"
|
|
|
|
|
|
|
|
void log_machine_info() {
|
2018-08-25 04:03:21 +02:00
|
|
|
SERIAL_ECHOLNPGM("Machine Type: "
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
"Delta"
|
|
|
|
#elif IS_SCARA
|
|
|
|
"SCARA"
|
|
|
|
#elif IS_CORE
|
|
|
|
"Core"
|
|
|
|
#else
|
|
|
|
"Cartesian"
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPGM("Probe: "
|
|
|
|
#if ENABLED(PROBE_MANUALLY)
|
|
|
|
"PROBE_MANUALLY"
|
2019-12-24 07:03:08 +01:00
|
|
|
#elif ENABLED(NOZZLE_AS_PROBE)
|
|
|
|
"NOZZLE_AS_PROBE"
|
2018-08-25 04:03:21 +02:00
|
|
|
#elif ENABLED(FIX_MOUNTED_PROBE)
|
|
|
|
"FIX_MOUNTED_PROBE"
|
|
|
|
#elif ENABLED(BLTOUCH)
|
|
|
|
"BLTOUCH"
|
|
|
|
#elif HAS_Z_SERVO_PROBE
|
|
|
|
"SERVO PROBE"
|
2019-06-15 05:19:48 +02:00
|
|
|
#elif ENABLED(TOUCH_MI_PROBE)
|
|
|
|
"TOUCH_MI_PROBE"
|
2018-08-25 04:03:21 +02:00
|
|
|
#elif ENABLED(Z_PROBE_SLED)
|
|
|
|
"Z_PROBE_SLED"
|
|
|
|
#elif ENABLED(Z_PROBE_ALLEN_KEY)
|
|
|
|
"Z_PROBE_ALLEN_KEY"
|
2019-06-23 00:54:37 +02:00
|
|
|
#elif ENABLED(SOLENOID_PROBE)
|
|
|
|
"SOLENOID_PROBE"
|
2018-08-25 04:03:21 +02:00
|
|
|
#else
|
|
|
|
"NONE"
|
|
|
|
#endif
|
|
|
|
);
|
2017-09-06 13:28:32 +02:00
|
|
|
|
|
|
|
#if HAS_BED_PROBE
|
2018-11-17 14:36:39 +01:00
|
|
|
|
2020-01-04 00:46:26 +01:00
|
|
|
#if !HAS_PROBE_XY_OFFSET
|
|
|
|
SERIAL_ECHOPAIR("Probe Offset X0 Y0 Z", probe_offset.z, " (");
|
|
|
|
#else
|
|
|
|
SERIAL_ECHOPAIR_P(PSTR("Probe Offset X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z);
|
|
|
|
if (probe_offset.x > 0)
|
|
|
|
SERIAL_ECHOPGM(" (Right");
|
|
|
|
else if (probe_offset.x < 0)
|
|
|
|
SERIAL_ECHOPGM(" (Left");
|
|
|
|
else if (probe_offset.y != 0)
|
|
|
|
SERIAL_ECHOPGM(" (Middle");
|
|
|
|
else
|
|
|
|
SERIAL_ECHOPGM(" (Aligned With");
|
|
|
|
|
|
|
|
if (probe_offset.y > 0) {
|
|
|
|
#if IS_SCARA
|
|
|
|
SERIAL_ECHOPGM("-Distal");
|
|
|
|
#else
|
|
|
|
SERIAL_ECHOPGM("-Back");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if (probe_offset.y < 0) {
|
|
|
|
#if IS_SCARA
|
|
|
|
SERIAL_ECHOPGM("-Proximal");
|
|
|
|
#else
|
|
|
|
SERIAL_ECHOPGM("-Front");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if (probe_offset.x != 0)
|
|
|
|
SERIAL_ECHOPGM("-Center");
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM(" & ");
|
|
|
|
|
|
|
|
#endif
|
2018-11-17 14:36:39 +01:00
|
|
|
|
2019-09-29 11:25:39 +02:00
|
|
|
if (probe_offset.z < 0)
|
2020-01-04 00:46:26 +01:00
|
|
|
SERIAL_ECHOPGM("Below");
|
2019-09-29 11:25:39 +02:00
|
|
|
else if (probe_offset.z > 0)
|
2020-01-04 00:46:26 +01:00
|
|
|
SERIAL_ECHOPGM("Above");
|
2017-09-06 13:28:32 +02:00
|
|
|
else
|
2020-01-04 00:46:26 +01:00
|
|
|
SERIAL_ECHOPGM("Same Z as");
|
2017-09-06 13:28:32 +02:00
|
|
|
SERIAL_ECHOLNPGM(" Nozzle)");
|
2020-01-04 00:46:26 +01:00
|
|
|
|
2017-09-06 13:28:32 +02:00
|
|
|
#endif
|
|
|
|
|
2019-02-25 03:29:03 +01:00
|
|
|
#if HAS_ABL_OR_UBL
|
2018-08-25 04:03:21 +02:00
|
|
|
SERIAL_ECHOLNPGM("Auto Bed Leveling: "
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
|
|
|
"LINEAR"
|
|
|
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
|
|
"BILINEAR"
|
|
|
|
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
|
|
|
|
"3POINT"
|
|
|
|
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
|
"UBL"
|
|
|
|
#endif
|
|
|
|
);
|
2017-10-14 00:21:25 +02:00
|
|
|
if (planner.leveling_active) {
|
2017-09-06 13:28:32 +02:00
|
|
|
SERIAL_ECHOLNPGM(" (enabled)");
|
2018-01-23 18:43:38 +01:00
|
|
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
|
if (planner.z_fade_height)
|
|
|
|
SERIAL_ECHOLNPAIR("Z Fade: ", planner.z_fade_height);
|
|
|
|
#endif
|
2017-09-06 13:28:32 +02:00
|
|
|
#if ABL_PLANAR
|
|
|
|
SERIAL_ECHOPGM("ABL Adjustment X");
|
2019-09-29 11:25:39 +02:00
|
|
|
LOOP_XYZ(a) {
|
|
|
|
float v = planner.get_axis_position_mm(AxisEnum(a)) - current_position[a];
|
2020-01-09 01:31:57 +01:00
|
|
|
SERIAL_CHAR(' ', 'X' + char(a));
|
2019-09-29 11:25:39 +02:00
|
|
|
if (v > 0) SERIAL_CHAR('+');
|
|
|
|
SERIAL_ECHO(v);
|
|
|
|
}
|
2018-01-23 18:43:38 +01:00
|
|
|
#else
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
|
SERIAL_ECHOPGM("UBL Adjustment Z");
|
2019-09-29 11:25:39 +02:00
|
|
|
const float rz = ubl.get_z_correction(current_position);
|
2018-01-23 18:43:38 +01:00
|
|
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
|
|
SERIAL_ECHOPGM("ABL Adjustment Z");
|
|
|
|
const float rz = bilinear_z_offset(current_position);
|
|
|
|
#endif
|
|
|
|
SERIAL_ECHO(ftostr43sign(rz, '+'));
|
|
|
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
|
if (planner.z_fade_height) {
|
2019-09-29 11:25:39 +02:00
|
|
|
SERIAL_ECHOPAIR(" (", ftostr43sign(rz * planner.fade_scaling_factor_for_z(current_position.z), '+'));
|
2018-01-23 18:43:38 +01:00
|
|
|
SERIAL_CHAR(')');
|
|
|
|
}
|
|
|
|
#endif
|
2017-09-06 13:28:32 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SERIAL_ECHOLNPGM(" (disabled)");
|
|
|
|
|
|
|
|
SERIAL_EOL();
|
|
|
|
|
|
|
|
#elif ENABLED(MESH_BED_LEVELING)
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM("Mesh Bed Leveling");
|
2017-10-14 00:21:25 +02:00
|
|
|
if (planner.leveling_active) {
|
2017-09-06 13:28:32 +02:00
|
|
|
SERIAL_ECHOLNPGM(" (enabled)");
|
2019-09-29 11:25:39 +02:00
|
|
|
SERIAL_ECHOPAIR("MBL Adjustment Z", ftostr43sign(mbl.get_z(current_position), '+'));
|
2018-01-23 18:43:38 +01:00
|
|
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
|
if (planner.z_fade_height) {
|
|
|
|
SERIAL_ECHOPAIR(" (", ftostr43sign(
|
2019-09-29 11:25:39 +02:00
|
|
|
mbl.get_z(current_position, planner.fade_scaling_factor_for_z(current_position.z)), '+'
|
2018-01-23 18:43:38 +01:00
|
|
|
));
|
|
|
|
SERIAL_CHAR(')');
|
|
|
|
}
|
|
|
|
#endif
|
2017-09-06 13:28:32 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
SERIAL_ECHOPGM(" (disabled)");
|
|
|
|
|
|
|
|
SERIAL_EOL();
|
|
|
|
|
|
|
|
#endif // MESH_BED_LEVELING
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // DEBUG_LEVELING_FEATURE
|