New GCode Parser - Implementation

This commit is contained in:
Scott Lahteine
2017-05-20 03:03:08 -05:00
parent 002a06c507
commit f4028fe088
13 changed files with 1110 additions and 733 deletions

View File

@ -178,6 +178,10 @@ MarlinSettings settings;
#include "temperature.h"
#include "ultralcd.h"
#if ENABLED(INCH_MODE_SUPPORT) || (ENABLED(ULTIPANEL) && ENABLED(TEMPERATURE_UNITS_SUPPORT))
#include "gcode.h"
#endif
#if ENABLED(MESH_BED_LEVELING)
#include "mesh_bed_leveling.h"
#endif
@ -1331,13 +1335,12 @@ void MarlinSettings::reset() {
*/
CONFIG_ECHO_START;
#if ENABLED(INCH_MODE_SUPPORT)
extern float linear_unit_factor, volumetric_unit_factor;
#define LINEAR_UNIT(N) ((N) / linear_unit_factor)
#define VOLUMETRIC_UNIT(N) ((N) / (volumetric_enabled ? volumetric_unit_factor : linear_unit_factor))
#define LINEAR_UNIT(N) ((N) / parser.linear_unit_factor)
#define VOLUMETRIC_UNIT(N) ((N) / (volumetric_enabled ? parser.volumetric_unit_factor : parser.linear_unit_factor))
SERIAL_ECHOPGM(" G2");
SERIAL_CHAR(linear_unit_factor == 1.0 ? '1' : '0');
SERIAL_CHAR(parser.linear_unit_factor == 1.0 ? '1' : '0');
SERIAL_ECHOPGM(" ; Units in ");
serialprintPGM(linear_unit_factor == 1.0 ? PSTR("mm\n") : PSTR("inches\n"));
serialprintPGM(parser.linear_unit_factor == 1.0 ? PSTR("mm\n") : PSTR("inches\n"));
#else
#define LINEAR_UNIT(N) N
#define VOLUMETRIC_UNIT(N) N
@ -1351,13 +1354,11 @@ void MarlinSettings::reset() {
CONFIG_ECHO_START;
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
extern TempUnit input_temp_units;
extern float to_temp_units(const float &f);
#define TEMP_UNIT(N) to_temp_units(N)
#define TEMP_UNIT(N) parser.to_temp_units(N)
SERIAL_ECHOPGM(" M149 ");
SERIAL_CHAR(input_temp_units == TEMPUNIT_K ? 'K' : input_temp_units == TEMPUNIT_F ? 'F' : 'C');
SERIAL_CHAR(parser.temp_units_code());
SERIAL_ECHOPGM(" ; Units in ");
serialprintPGM(input_temp_units == TEMPUNIT_K ? PSTR("Kelvin\n") : input_temp_units == TEMPUNIT_F ? PSTR("Fahrenheit\n") : PSTR("Celsius\n"));
serialprintPGM(parser.temp_units_name());
#else
#define TEMP_UNIT(N) N
SERIAL_ECHOLNPGM(" M149 C ; Units in Celsius\n");