Show correct units in M503

This commit is contained in:
Scott Lahteine 2018-05-08 05:42:14 -05:00
parent 9076a9314f
commit 5c120222a4

View File

@ -1904,6 +1904,16 @@ void MarlinSettings::reset() {
void say_M603() { SERIAL_ECHOPGM(" M603 "); } void say_M603() { SERIAL_ECHOPGM(" M603 "); }
#endif #endif
inline void say_units(const bool colon=false) {
serialprintPGM(
#if ENABLED(INCH_MODE_SUPPORT)
parser.linear_unit_factor != 1.0 ? PSTR(" (in)") :
#endif
PSTR(" (mm)")
);
if (colon) SERIAL_ECHOLNPGM(":");
}
/** /**
* M503 - Report current settings in RAM * M503 - Report current settings in RAM
* *
@ -1920,13 +1930,15 @@ void MarlinSettings::reset() {
#define VOLUMETRIC_UNIT(N) (float(N) / (parser.volumetric_enabled ? parser.volumetric_unit_factor : parser.linear_unit_factor)) #define VOLUMETRIC_UNIT(N) (float(N) / (parser.volumetric_enabled ? parser.volumetric_unit_factor : parser.linear_unit_factor))
SERIAL_ECHOPGM(" G2"); SERIAL_ECHOPGM(" G2");
SERIAL_CHAR(parser.linear_unit_factor == 1.0 ? '1' : '0'); SERIAL_CHAR(parser.linear_unit_factor == 1.0 ? '1' : '0');
SERIAL_ECHOPGM(" ; Units in "); SERIAL_ECHOPGM(" ;");
serialprintPGM(parser.linear_unit_factor == 1.0 ? PSTR("mm\n") : PSTR("inches\n")); say_units();
#else #else
#define LINEAR_UNIT(N) (N) #define LINEAR_UNIT(N) (N)
#define VOLUMETRIC_UNIT(N) (N) #define VOLUMETRIC_UNIT(N) (N)
SERIAL_ECHOLNPGM(" G21 ; Units in mm"); SERIAL_ECHOPGM(" G21 ;");
say_units();
#endif #endif
SERIAL_EOL();
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
@ -2338,7 +2350,8 @@ void MarlinSettings::reset() {
#if HAS_BED_PROBE #if HAS_BED_PROBE
if (!forReplay) { if (!forReplay) {
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOLNPGM("Z-Probe Offset (mm):"); SERIAL_ECHOPGM("Z-Probe Offset");
say_units(true);
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOLNPAIR(" M851 Z", LINEAR_UNIT(zprobe_zoffset)); SERIAL_ECHOLNPAIR(" M851 Z", LINEAR_UNIT(zprobe_zoffset));