M154 Position Auto-Report (#18427)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
@ -796,6 +796,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
||||
if (!gcode.autoreport_paused) {
|
||||
TERN_(AUTO_REPORT_TEMPERATURES, thermalManager.auto_reporter.tick());
|
||||
TERN_(AUTO_REPORT_SD_STATUS, card.auto_reporter.tick());
|
||||
TERN_(AUTO_REPORT_POSITION, position_auto_reporter.tick());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -565,6 +565,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 193: M193(); break; // M193: Wait for cooler temperature to reach target
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_REPORT_POSITION)
|
||||
case 154: M154(); break; // M155: Set position auto-report interval
|
||||
#endif
|
||||
|
||||
#if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR)
|
||||
case 155: M155(); break; // M155: Set temperature auto-report interval
|
||||
#endif
|
||||
|
@ -159,6 +159,7 @@
|
||||
* M145 - Set heatup values for materials on the LCD. H<hotend> B<bed> F<fan speed> for S<material> (0=PLA, 1=ABS)
|
||||
* M149 - Set temperature units. (Requires TEMPERATURE_UNITS_SUPPORT)
|
||||
* M150 - Set Status LED Color as R<red> U<green> B<blue> W<white> P<bright>. Values 0-255. (Requires BLINKM, RGB_LED, RGBW_LED, NEOPIXEL_LED, PCA9533, or PCA9632).
|
||||
* M154 - Auto-report position with interval of S<seconds>. (Requires AUTO_REPORT_POSITION)
|
||||
* M155 - Auto-report temperatures with interval of S<seconds>. (Requires AUTO_REPORT_TEMPERATURES)
|
||||
* M163 - Set a single proportion for a mixing extruder. (Requires MIXING_EXTRUDER)
|
||||
* M164 - Commit the mix and save to a virtual tool (current, or as specified by 'S'). (Requires MIXING_EXTRUDER)
|
||||
@ -721,6 +722,10 @@ private:
|
||||
static void M150();
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_REPORT_POSITION)
|
||||
static void M154();
|
||||
#endif
|
||||
|
||||
#if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR)
|
||||
static void M155();
|
||||
#endif
|
||||
|
@ -82,6 +82,9 @@ void GcodeSuite::M115() {
|
||||
// Volumetric Extrusion (M200)
|
||||
cap_line(PSTR("VOLUMETRIC"), DISABLED(NO_VOLUMETRICS));
|
||||
|
||||
// AUTOREPORT_POS (M154)
|
||||
cap_line(PSTR("AUTOREPORT_POS"), ENABLED(AUTO_REPORT_POSITION));
|
||||
|
||||
// AUTOREPORT_TEMP (M155)
|
||||
cap_line(PSTR("AUTOREPORT_TEMP"), ENABLED(AUTO_REPORT_TEMPERATURES));
|
||||
|
||||
|
40
Marlin/src/gcode/host/M154.cpp
Normal file
40
Marlin/src/gcode/host/M154.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(AUTO_REPORT_POSITION)
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/motion.h"
|
||||
|
||||
/**
|
||||
* M154: Set position auto-report interval. M154 S<seconds>
|
||||
*/
|
||||
void GcodeSuite::M154() {
|
||||
|
||||
if (parser.seenval('S'))
|
||||
position_auto_reporter.set_interval(parser.value_byte());
|
||||
|
||||
}
|
||||
|
||||
#endif // AUTO_REPORT_POSITION
|
@ -2231,7 +2231,7 @@
|
||||
#if !HAS_TEMP_SENSOR
|
||||
#undef AUTO_REPORT_TEMPERATURES
|
||||
#endif
|
||||
#if EITHER(AUTO_REPORT_TEMPERATURES, AUTO_REPORT_SD_STATUS)
|
||||
#if ANY(AUTO_REPORT_TEMPERATURES, AUTO_REPORT_SD_STATUS, AUTO_REPORT_POSITION)
|
||||
#define HAS_AUTO_REPORTING 1
|
||||
#endif
|
||||
|
||||
|
@ -230,6 +230,11 @@ void report_current_position_projected() {
|
||||
stepper.report_a_position(planner.position);
|
||||
}
|
||||
|
||||
#if ENABLED(AUTO_REPORT_POSITION)
|
||||
//struct PositionReport { void report() { report_current_position_projected(); } };
|
||||
AutoReporter<PositionReport> position_auto_reporter;
|
||||
#endif
|
||||
|
||||
#if EITHER(FULL_REPORT_TO_HOST_FEATURE, REALTIME_REPORTING_COMMANDS)
|
||||
|
||||
M_StateEnum M_State_grbl = M_INIT;
|
||||
|
@ -211,6 +211,12 @@ void report_real_position();
|
||||
void report_current_position();
|
||||
void report_current_position_projected();
|
||||
|
||||
#if ENABLED(AUTO_REPORT_POSITION)
|
||||
#include "../libs/autoreport.h"
|
||||
struct PositionReport { static void report() { report_current_position_projected(); } };
|
||||
extern AutoReporter<PositionReport> position_auto_reporter;
|
||||
#endif
|
||||
|
||||
#if EITHER(FULL_REPORT_TO_HOST_FEATURE, REALTIME_REPORTING_COMMANDS)
|
||||
#define HAS_GRBL_STATE 1
|
||||
/**
|
||||
|
Reference in New Issue
Block a user