Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2926,6 +2926,9 @@
* Include capabilities in M115 output
*/
#define EXTENDED_CAPABILITIES_REPORT
#if ENABLED(EXTENDED_CAPABILITIES_REPORT)
//#define M115_GEOMETRY_REPORT
#endif

/**
* Expected Printer Check
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/HAL/AVR/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/HAL/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
31 changes: 11 additions & 20 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/core/serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/feature/host_actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/calibrate/G33.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
23 changes: 10 additions & 13 deletions Marlin/src/gcode/control/M111.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
#if ENABLED(DEBUG_LEVELING_FEATURE)
, str_debug_lvl[] PROGMEM = STR_DEBUG_LEVELING
#endif
;
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)
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();
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@ class GcodeSuite {

TERN_(HAS_CASE_LIGHT, static void M355());

TERN_(REPETIER_GCODE_M360, static void M360());

#if ENABLED(MORGAN_SCARA)
static bool M360();
static bool M361();
Expand Down
27 changes: 27 additions & 0 deletions Marlin/src/gcode/host/M115.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:");
Expand Down Expand Up @@ -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
}
Loading