Extended reporting options (#16741)

This commit is contained in:
Gurmeet Athwal 2020-05-06 10:04:04 +05:30 committed by GitHub
parent 9ce950e3c1
commit a4c981469e
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 268 additions and 45 deletions

View file

@ -2921,6 +2921,9 @@
* Include capabilities in M115 output
*/
#define EXTENDED_CAPABILITIES_REPORT
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)
//#define M115_GEOMETRY_REPORT
#endif
/**
* Expected Printer Check
@ -2979,6 +2982,8 @@
//#define GCODE_CASE_INSENSITIVE // Accept G-code sent to the firmware in lowercase
//#define REPETIER_GCODE_M360 // Add commands originally from Repetier FW
/**
* CNC G-code options
* Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc.

View file

@ -53,6 +53,9 @@
// AVR PROGMEM extension for sprintf_P
#define S_FMT "%S"
// AVR PROGMEM extension for string define
#define PGMSTR(NAM,STR) const char NAM[] PROGMEM = STR
#ifndef CRITICAL_SECTION_START
#define CRITICAL_SECTION_START() unsigned char _sreg = SREG; cli()
#define CRITICAL_SECTION_END() SREG = _sreg

View file

@ -36,6 +36,11 @@
#define S_FMT "%s"
#endif
// String helper
#ifndef PGMSTR
#define PGMSTR(NAM,STR) constexpr char NAM[] = STR
#endif
inline void watchdog_refresh() {
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
}

View file

@ -183,26 +183,17 @@
#include "libs/L64XX/L64XX_Marlin.h"
#endif
const char NUL_STR[] PROGMEM = "",
M112_KILL_STR[] PROGMEM = "M112 Shutdown",
G28_STR[] PROGMEM = "G28",
M21_STR[] PROGMEM = "M21",
M23_STR[] PROGMEM = "M23 %s",
M24_STR[] PROGMEM = "M24",
SP_P_STR[] PROGMEM = " P",
SP_T_STR[] PROGMEM = " T",
SP_X_STR[] PROGMEM = " X",
SP_Y_STR[] PROGMEM = " Y",
SP_Z_STR[] PROGMEM = " Z",
SP_E_STR[] PROGMEM = " E",
X_LBL[] PROGMEM = "X:",
Y_LBL[] PROGMEM = "Y:",
Z_LBL[] PROGMEM = "Z:",
E_LBL[] PROGMEM = "E:",
SP_X_LBL[] PROGMEM = " X:",
SP_Y_LBL[] PROGMEM = " Y:",
SP_Z_LBL[] PROGMEM = " Z:",
SP_E_LBL[] PROGMEM = " E:";
PGMSTR(NUL_STR, "");
PGMSTR(M112_KILL_STR, "M112 Shutdown");
PGMSTR(G28_STR, "G28");
PGMSTR(M21_STR, "M21");
PGMSTR(M23_STR, "M23 %s");
PGMSTR(M24_STR, "M24");
PGMSTR(SP_P_STR, " P"); PGMSTR(SP_T_STR, " T");
PGMSTR(X_STR, "X"); PGMSTR(Y_STR, "Y"); PGMSTR(Z_STR, "Z"); PGMSTR(E_STR, "E");
PGMSTR(X_LBL, "X:"); PGMSTR(Y_LBL, "Y:"); PGMSTR(Z_LBL, "Z:"); PGMSTR(E_LBL, "E:");
PGMSTR(SP_X_STR, " X"); PGMSTR(SP_Y_STR, " Y"); PGMSTR(SP_Z_STR, " Z"); PGMSTR(SP_E_STR, " E");
PGMSTR(SP_X_LBL, " X:"); PGMSTR(SP_Y_LBL, " Y:"); PGMSTR(SP_Z_LBL, " Z:"); PGMSTR(SP_E_LBL, " E:");
MarlinState marlin_state = MF_INITIALIZING;

View file

@ -25,8 +25,8 @@
uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE;
static const char errormagic[] PROGMEM = "Error:";
static const char echomagic[] PROGMEM = "echo:";
static PGMSTR(errormagic, "Error:");
static PGMSTR(echomagic, "echo:");
#if NUM_SERIAL > 1
int8_t serial_port_index = 0;

View file

@ -64,8 +64,8 @@ void host_action(const char * const pstr, const bool eol) {
#if ENABLED(HOST_PROMPT_SUPPORT)
const char CONTINUE_STR[] PROGMEM = "Continue",
DISMISS_STR[] PROGMEM = "Dismiss";
PGMSTR(CONTINUE_STR, "Continue");
PGMSTR(DISMISS_STR, "Dismiss");
#if HAS_RESUME_CONTINUE
extern bool wait_for_user;
@ -123,7 +123,7 @@ void host_action(const char * const pstr, const bool eol) {
//
void host_response_handler(const uint8_t response) {
#ifdef DEBUG_HOST_ACTIONS
static const char m876_prefix[] PROGMEM = "M876 Handle Re";
static PGMSTR(m876_prefix, "M876 Handle Re");
serialprintPGM(m876_prefix); SERIAL_ECHOLNPAIR("ason: ", host_prompt_reason);
serialprintPGM(m876_prefix); SERIAL_ECHOLNPAIR("sponse: ", response);
#endif

View file

@ -448,7 +448,7 @@ void GcodeSuite::G33() {
}
// Report settings
PGM_P checkingac = PSTR("Checking... AC");
PGM_P const checkingac = PSTR("Checking... AC");
serialprintPGM(checkingac);
if (verbose_level == 0) SERIAL_ECHOPGM(" (DRY-RUN)");
SERIAL_EOL();
@ -624,7 +624,7 @@ void GcodeSuite::G33() {
}
}
else { // dry run
PGM_P enddryrun = PSTR("End DRY-RUN");
PGM_P const enddryrun = PSTR("End DRY-RUN");
serialprintPGM(enddryrun);
SERIAL_ECHO_SP(35);
SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3);

View file

@ -28,21 +28,18 @@
void GcodeSuite::M111() {
if (parser.seen('S')) marlin_debug_flags = parser.byteval('S');
static const char str_debug_1[] PROGMEM = STR_DEBUG_ECHO,
str_debug_2[] PROGMEM = STR_DEBUG_INFO,
str_debug_4[] PROGMEM = STR_DEBUG_ERRORS,
str_debug_8[] PROGMEM = STR_DEBUG_DRYRUN,
str_debug_16[] PROGMEM = STR_DEBUG_COMMUNICATION
static PGMSTR(str_debug_1, STR_DEBUG_ECHO);
static PGMSTR(str_debug_2, STR_DEBUG_INFO);
static PGMSTR(str_debug_4, STR_DEBUG_ERRORS);
static PGMSTR(str_debug_8, STR_DEBUG_DRYRUN);
static PGMSTR(str_debug_16, STR_DEBUG_COMMUNICATION);
#if ENABLED(DEBUG_LEVELING_FEATURE)
, str_debug_lvl[] PROGMEM = STR_DEBUG_LEVELING
static PGMSTR(str_debug_lvl, STR_DEBUG_LEVELING);
#endif
;
static PGM_P const debug_strings[] PROGMEM = {
str_debug_1, str_debug_2, str_debug_4, str_debug_8, str_debug_16
#if ENABLED(DEBUG_LEVELING_FEATURE)
, str_debug_lvl
#endif
str_debug_1, str_debug_2, str_debug_4, str_debug_8, str_debug_16,
TERN_(DEBUG_LEVELING_FEATURE, str_debug_lvl)
};
SERIAL_ECHO_START();

View file

@ -663,6 +663,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 305: M305(); break; // M305: Set user thermistor parameters
#endif
#if ENABLED(REPETIER_GCODE_M360)
case 360: M360(); break; // M360: Firmware settings
#endif
#if ENABLED(MORGAN_SCARA)
case 360: if (M360()) return; break; // M360: SCARA Theta pos1
case 361: if (M361()) return; break; // M361: SCARA Theta pos2

View file

@ -691,6 +691,8 @@ private:
TERN_(HAS_CASE_LIGHT, static void M355());
TERN_(REPETIER_GCODE_M360, static void M360());
#if ENABLED(MORGAN_SCARA)
static bool M360();
static bool M361();

View file

@ -23,6 +23,10 @@
#include "../gcode.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(M115_GEOMETRY_REPORT)
#include "../../module/motion.h"
#endif
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)
static void cap_line(PGM_P const name, bool ena=false) {
SERIAL_ECHOPGM("Cap:");
@ -117,5 +121,28 @@ void GcodeSuite::M115() {
// CHAMBER_TEMPERATURE (M141, M191)
cap_line(PSTR("CHAMBER_TEMPERATURE"), ENABLED(HAS_HEATED_CHAMBER));
// Machine Geometry
#if ENABLED(M115_GEOMETRY_REPORT)
const xyz_pos_t dmin = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS },
dmax = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
xyz_pos_t cmin = dmin, cmax = dmax;
apply_motion_limits(cmin);
apply_motion_limits(cmax);
const xyz_pos_t lmin = dmin.asLogical(), lmax = dmax.asLogical(),
wmin = cmin.asLogical(), wmax = cmax.asLogical();
SERIAL_ECHOLNPAIR(
"area:{"
"full:{"
"min:{x:", lmin.x, ",y:", lmin.y, ",z:", lmin.z, "},"
"max:{x:", lmax.x, ",y:", lmax.y, ",z:", lmax.z, "},"
"},"
"work:{"
"min:{x:", wmin.x, ",y:", wmin.y, ",z:", wmin.z, "},"
"max:{x:", wmax.x, ",y:", wmax.y, ",z:", wmax.z, "},"
"}"
"}"
);
#endif
#endif // EXTENDED_CAPABILITIES_REPORT
}

View file

@ -0,0 +1,189 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 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 <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(REPETIER_GCODE_M360)
#include "../gcode.h"
#include "../../module/motion.h"
#include "../../module/planner.h"
static void config_prefix(PGM_P const name, PGM_P const pref=nullptr) {
SERIAL_ECHOPGM("Config:");
if (pref) serialprintPGM(pref);
serialprintPGM(name);
SERIAL_CHAR(':');
}
static void config_line(PGM_P const name, const float val, PGM_P const pref=nullptr) {
config_prefix(name, pref);
SERIAL_ECHOLN(val);
}
/**
* M360: Report Firmware configuration
* in RepRapFirmware-compatible format
*/
void GcodeSuite::M360() {
PGMSTR(X_STR, "X");
PGMSTR(Y_STR, "Y");
PGMSTR(Z_STR, "Z");
PGMSTR(JERK_STR, "Jerk");
//
// Basics and Enabled items
//
config_line(PSTR("Baudrate"), BAUDRATE);
config_line(PSTR("InputBuffer"), MAX_CMD_SIZE);
config_line(PSTR("PrintlineCache"), BUFSIZE);
config_line(PSTR("MixingExtruder"), ENABLED(MIXING_EXTRUDER));
config_line(PSTR("SDCard"), ENABLED(SDSUPPORT));
config_line(PSTR("Fan"), ENABLED(HAS_FAN));
config_line(PSTR("LCD"), ENABLED(HAS_DISPLAY));
config_line(PSTR("SoftwarePowerSwitch"), 1);
config_line(PSTR("SupportLocalFilamentchange"), ENABLED(ADVANCED_PAUSE_FEATURE));
config_line(PSTR("CaseLights"), ENABLED(CASE_LIGHT_ENABLE));
config_line(PSTR("ZProbe"), ENABLED(HAS_BED_PROBE));
config_line(PSTR("Autolevel"), ENABLED(HAS_LEVELING));
config_line(PSTR("EEPROM"), ENABLED(EEPROM_SETTINGS));
//
// Homing Directions
//
PGMSTR(H_DIR_STR, "HomeDir");
config_line(H_DIR_STR, X_HOME_DIR, X_STR);
config_line(H_DIR_STR, Y_HOME_DIR, Y_STR);
config_line(H_DIR_STR, Z_HOME_DIR, Z_STR);
//
// XYZ Axis Jerk
//
#if HAS_CLASSIC_JERK
if (planner.max_jerk.x == planner.max_jerk.y)
config_line(PSTR("XY"), planner.max_jerk.x, JERK_STR);
else {
config_line(X_STR, planner.max_jerk.x, JERK_STR);
config_line(Y_STR, planner.max_jerk.y, JERK_STR);
}
config_line(Z_STR, planner.max_jerk.z, JERK_STR);
#endif
//
// Firmware Retraction
//
config_line(PSTR("SupportG10G11"), ENABLED(FWRETRACT));
#if ENABLED(FWRETRACT)
PGMSTR(RET_STR, "Retraction");
PGMSTR(UNRET_STR, "RetractionUndo"),
PGMSTR(SPEED_STR, "Speed");
// M10 Retract with swap (long) moves
config_line(PSTR("Length"), fwretract.settings.retract_length, RET_STR);
config_line(SPEED_STR, fwretract.settings.retract_feedrate_mm_s, RET_STR);
config_line(PSTR("ZLift"), fwretract.settings.retract_zraise, RET_STR);
config_line(PSTR("LongLength"), fwretract.settings.swap_retract_length, RET_STR);
// M11 Recover (undo) with swap (long) moves
config_line(SPEED_STR, fwretract.settings.retract_recover_feedrate_mm_s, UNRET_STR);
config_line(PSTR("ExtraLength"), fwretract.settings.retract_recover_extra, UNRET_STR);
config_line(PSTR("ExtraLongLength"), fwretract.settings.swap_retract_recover_extra, UNRET_STR);
config_line(PSTR("LongSpeed"), fwretract.settings.swap_retract_recover_feedrate_mm_s, UNRET_STR);
#endif
//
// Workspace boundaries
//
const xyz_pos_t dmin = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS },
dmax = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
xyz_pos_t cmin = dmin, cmax = dmax;
apply_motion_limits(cmin);
apply_motion_limits(cmax);
const xyz_pos_t lmin = dmin.asLogical(), lmax = dmax.asLogical(),
wmin = cmin.asLogical(), wmax = cmax.asLogical();
PGMSTR(MIN_STR, "Min");
PGMSTR(MAX_STR, "Max");
PGMSTR(SIZE_STR, "Size");
config_line(MIN_STR, wmin.x, X_STR);
config_line(MIN_STR, wmin.y, Y_STR);
config_line(MIN_STR, wmin.z, Z_STR);
config_line(MAX_STR, wmax.x, X_STR);
config_line(MAX_STR, wmax.y, Y_STR);
config_line(MAX_STR, wmax.z, Z_STR);
config_line(SIZE_STR, wmax.x - wmin.x, X_STR);
config_line(SIZE_STR, wmax.y - wmin.y, Y_STR);
config_line(SIZE_STR, wmax.z - wmin.z, Z_STR);
//
// Print and Travel Acceleration
//
#define _ACCEL(A,B) _MIN(planner.settings.max_acceleration_mm_per_s2[A##_AXIS], planner.settings.B)
PGMSTR(P_ACC_STR, "PrintAccel");
PGMSTR(T_ACC_STR, "TravelAccel");
config_line(P_ACC_STR, _ACCEL(X, acceleration), X_STR);
config_line(P_ACC_STR, _ACCEL(Y, acceleration), Y_STR);
config_line(P_ACC_STR, _ACCEL(Z, acceleration), Z_STR);
config_line(T_ACC_STR, _ACCEL(X, travel_acceleration), X_STR);
config_line(T_ACC_STR, _ACCEL(Y, travel_acceleration), Y_STR);
config_line(T_ACC_STR, _ACCEL(Z, travel_acceleration), Z_STR);
config_prefix(PSTR("PrinterType"));
SERIAL_ECHOLNPGM(
TERN_(DELTA, "Delta")
TERN_(IS_SCARA, "SCARA")
TERN_(IS_CORE, "Core")
TERN_(IS_CARTESIAN, "Cartesian")
);
//
// Heated Bed
//
config_line(PSTR("HeatedBed"), ENABLED(HAS_HEATED_BED));
#if HAS_HEATED_BED
config_line(PSTR("MaxBedTemp"), BED_MAX_TARGET);
#endif
//
// Per-Extruder settings
//
config_line(PSTR("NumExtruder"), EXTRUDERS);
#if EXTRUDERS
#define DIAM_VALUE(N) TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[N])
#if HAS_LINEAR_E_JERK
#define E_JERK_VAL(N) planner.max_e_jerk[E_INDEX_N(N)]
#elif HAS_CLASSIC_JERK
#define E_JERK_VAL(N) planner.max_jerk.e
#else
#define E_JERK_VAL(N) DEFAULT_EJERK
#endif
#define _EXTR_ITEM(N) do{ \
PGMSTR(EXTR_STR, "Extr." STRINGIFY(INCREMENT(N)) ":"); \
config_line(JERK_STR, E_JERK_VAL(N), EXTR_STR); \
config_line(PSTR("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(N)], EXTR_STR); \
config_line(PSTR("Acceleration"), planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(N)], EXTR_STR); \
config_line(PSTR("Diameter"), DIAM_VALUE(N), EXTR_STR); \
config_line(PSTR("MaxTemp"), (HEATER_##N##_MAXTEMP) - (HOTEND_OVERSHOOT), EXTR_STR); \
}while(0)
REPEAT(EXTRUDERS, _EXTR_ITEM);
#endif
}
#endif

View file

@ -893,7 +893,7 @@ namespace ExtUI {
bool isMachineHomed() { return all_axes_homed(); }
PGM_P getFirmwareName_str() {
static const char firmware_name[] PROGMEM = "Marlin " SHORT_BUILD_VERSION;
static PGMSTR(firmware_name, "Marlin " SHORT_BUILD_VERSION);
return firmware_name;
}

View file

@ -1347,13 +1347,13 @@ void MarlinUI::update() {
PGM_P printing = GET_TEXT(MSG_PRINTING);
PGM_P welcome = GET_TEXT(WELCOME_MSG);
#if SERVICE_INTERVAL_1 > 0
static const char service1[] PROGMEM = { "> " SERVICE_NAME_1 "!" };
static PGMSTR(service1, "> " SERVICE_NAME_1 "!");
#endif
#if SERVICE_INTERVAL_2 > 0
static const char service2[] PROGMEM = { "> " SERVICE_NAME_2 "!" };
static PGMSTR(service2, "> " SERVICE_NAME_2 "!");
#endif
#if SERVICE_INTERVAL_3 > 0
static const char service3[] PROGMEM = { "> " SERVICE_NAME_3 "!" };
static PGMSTR(service3, "> " SERVICE_NAME_3 "!");
#endif
PGM_P msg;
if (printingIsPaused())

View file

@ -11,7 +11,7 @@ set -e
#
restore_configs
opt_set MOTHERBOARD BOARD_ESPRESSIF_ESP32
opt_enable WIFISUPPORT GCODE_MACROS BAUD_RATE_GCODE
opt_enable WIFISUPPORT GCODE_MACROS BAUD_RATE_GCODE M115_GEOMETRY_REPORT REPETIER_GCODE_M360
opt_add WIFI_SSID "\"ssid\""
opt_add WIFI_PWD "\"password\""
opt_set TX_BUFFER_SIZE 64