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