Bed Distance Sensor (#24554)

This commit is contained in:
Mark
2022-08-06 14:14:58 +08:00
committed by Scott Lahteine
parent a0462eb017
commit b02c3258b5
24 changed files with 409 additions and 9 deletions

View File

@ -36,6 +36,10 @@
#include "../../feature/bedlevel/bedlevel.h"
#endif
#if ENABLED(BD_SENSOR)
#include "../../feature/bedlevel/bdl/bdl.h"
#endif
#if ENABLED(SENSORLESS_HOMING)
#include "../../feature/tmc_util.h"
#endif
@ -202,7 +206,9 @@ void GcodeSuite::G28() {
DEBUG_SECTION(log_G28, "G28", DEBUGGING(LEVELING));
if (DEBUGGING(LEVELING)) log_machine_info();
/*
TERN_(BD_SENSOR, bdl.config_state = 0);
/**
* Set the laser power to false to stop the planner from processing the current power setting.
*/
#if ENABLED(LASER_FEATURE)

View File

@ -577,6 +577,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 100: M100(); break; // M100: Free Memory Report
#endif
#if ENABLED(BD_SENSOR)
case 102: M102(); break; // M102: Configure Bed Distance Sensor
#endif
#if HAS_EXTRUDERS
case 104: M104(); break; // M104: Set hot end temperature
case 109: M109(); break; // M109: Wait for hotend temperature to reach target

View File

@ -132,6 +132,8 @@
*
* M100 - Watch Free Memory (for debugging) (Requires M100_FREE_MEMORY_WATCHER)
*
* M102 - Configure Bed Distance Sensor. (Requires BD_SENSOR)
*
* M104 - Set extruder target temp.
* M105 - Report current temperatures.
* M106 - Set print fan speed.
@ -705,6 +707,11 @@ private:
static void M100();
#endif
#if ENABLED(BD_SENSOR)
static void M102();
static void M102_report(const bool forReplay=true);
#endif
#if HAS_EXTRUDERS
static void M104_M109(const bool isM109);
FORCE_INLINE static void M104() { M104_M109(false); }

View File

@ -0,0 +1,57 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* 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 <https://www.gnu.org/licenses/>.
*
*/
/**
* M102.cpp - Configure Bed Distance Sensor
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(BD_SENSOR)
#include "../gcode.h"
#include "../../feature/bedlevel/bdl/bdl.h"
/**
* M102: Configure the Bed Distance Sensor
*
* M102 S<10ths> : Set adjustable Z height in 10ths of a mm (e.g., 'M102 S4' enables adjusting for Z <= 0.4mm.)
* M102 S0 : Disable adjustable Z height.
*
* Negative S values are commands:
* M102 S-1 : Read sensor information
* M102 S-5 : Read raw Calibration data
* M102 S-6 : Start Calibration
*/
void GcodeSuite::M102() {
if (parser.seenval('S'))
bdl.config_state = parser.value_int();
else
M102_report();
}
void GcodeSuite::M102_report(const bool forReplay/*=true*/) {
report_heading(forReplay, F("Bed Distance Sensor"));
SERIAL_ECHOLNPGM(" M102 S", bdl.config_state);
}
#endif // BD_SENSOR