diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 9a3e67af3c7b..2bef15410d13 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -37,7 +37,7 @@ * * Advanced settings can be found in Configuration_adv.h */ -#define CONFIGURATION_H_VERSION 020008 +#define CONFIGURATION_H_VERSION 02000801 //=========================================================================== //============================= Getting Started ============================= diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 057273f1abb5..93a0e244c63f 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -32,7 +32,7 @@ * * Basic settings can be found in Configuration.h */ -#define CONFIGURATION_ADV_H_VERSION 020008 +#define CONFIGURATION_ADV_H_VERSION 02000801 //=========================================================================== //============================= Thermal Settings ============================ @@ -3416,6 +3416,11 @@ */ #define AUTO_REPORT_TEMPERATURES +/** + * Auto-report position with M154 S + */ +//#define AUTO_REPORT_POSITION + /** * Include capabilities in M115 output */ diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 08d79685399b..5cd0269bac2c 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -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 diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 7a3976a7bdfe..0ca6c82c2ae2 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -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 diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index dc0b89e098fe..cdf04cd0f275 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -159,6 +159,7 @@ * M145 - Set heatup values for materials on the LCD. H B F for S (0=PLA, 1=ABS) * M149 - Set temperature units. (Requires TEMPERATURE_UNITS_SUPPORT) * M150 - Set Status LED Color as R U B W P. Values 0-255. (Requires BLINKM, RGB_LED, RGBW_LED, NEOPIXEL_LED, PCA9533, or PCA9632). + * M154 - Auto-report position with interval of S. (Requires AUTO_REPORT_POSITION) * M155 - Auto-report temperatures with interval of S. (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 @@ class GcodeSuite { 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 diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index 4f18e5504d05..ef4c8983cdd7 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -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)); diff --git a/Marlin/src/gcode/host/M154.cpp b/Marlin/src/gcode/host/M154.cpp new file mode 100644 index 000000000000..156e6b69b624 --- /dev/null +++ b/Marlin/src/gcode/host/M154.cpp @@ -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 . + * + */ + +#include "../../inc/MarlinConfigPre.h" + +#if ENABLED(AUTO_REPORT_POSITION) + +#include "../gcode.h" +#include "../../module/motion.h" + +/** + * M154: Set position auto-report interval. M154 S + */ +void GcodeSuite::M154() { + + if (parser.seenval('S')) + position_auto_reporter.set_interval(parser.value_byte()); + +} + +#endif // AUTO_REPORT_POSITION diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 8c115fbab6f1..6de9c40ac7ad 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -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 diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f0695fe16825..90bd9f080ff5 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-05-15" + #define STRING_DISTRIBUTION_DATE "2021-05-16" #endif /** @@ -52,7 +52,7 @@ * to alert users to major changes. */ -#define MARLIN_HEX_VERSION 020008 +#define MARLIN_HEX_VERSION 02000801 #ifndef REQUIRED_CONFIGURATION_H_VERSION #define REQUIRED_CONFIGURATION_H_VERSION MARLIN_HEX_VERSION #endif diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 6ca8dc054c2e..171d9520cb7b 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -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 position_auto_reporter; +#endif + #if EITHER(FULL_REPORT_TO_HOST_FEATURE, REALTIME_REPORTING_COMMANDS) M_StateEnum M_State_grbl = M_INIT; diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index c734fbdf341e..e01978c8526e 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -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 position_auto_reporter; +#endif + #if EITHER(FULL_REPORT_TO_HOST_FEATURE, REALTIME_REPORTING_COMMANDS) #define HAS_GRBL_STATE 1 /** diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 98c4b761e008..7bbf29e630f3 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -56,7 +56,7 @@ opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO NUM_SERVOS 1 \ FIL_RUNOUT3_STATE HIGH opt_enable VIKI2 BOOT_MARLIN_LOGO_ANIMATED SDSUPPORT AUTO_REPORT_SD_STATUS \ Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE \ - EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL \ + EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL AUTO_REPORT_POSITION \ NO_VOLUMETRICS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES AUTOTEMP G38_PROBE_TARGET JOYSTICK \ DIRECT_STEPPING DETECT_BROKEN_ENDSTOP \ FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE Z_SAFE_HOMING FIL_RUNOUT3_PULLUP diff --git a/ini/features.ini b/ini/features.ini index 586af1653fcd..6a2ccbedac97 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -182,6 +182,7 @@ CNC_COORDINATE_SYSTEMS = src_filter=+ EXPECTED_PRINTER_CHECK = src_filter=+ HOST_KEEPALIVE_FEATURE = src_filter=+ +AUTO_REPORT_POSITION = src_filter=+ REPETIER_GCODE_M360 = src_filter=+ HAS_GCODE_M876 = src_filter=+ HAS_RESUME_CONTINUE = src_filter=+ diff --git a/platformio.ini b/platformio.ini index e743eb2db454..4d69ca12dfd2 100644 --- a/platformio.ini +++ b/platformio.ini @@ -198,6 +198,7 @@ default_src_filter = + - - + - - - + - - - -