Optimize M360

This commit is contained in:
Scott Lahteine 2020-11-13 18:47:34 -06:00
parent 1d43e81be0
commit c710b6e06c

View File

@ -28,16 +28,24 @@
#include "../../module/motion.h" #include "../../module/motion.h"
#include "../../module/planner.h" #include "../../module/planner.h"
static void config_prefix(PGM_P const name, PGM_P const pref=nullptr) { #if EXTRUDERS
#include "../../module/temperature.h"
#endif
static void config_prefix(PGM_P const name, PGM_P const pref=nullptr, const int8_t ind=-1) {
SERIAL_ECHOPGM("Config:"); SERIAL_ECHOPGM("Config:");
if (pref) serialprintPGM(pref); if (pref) serialprintPGM(pref);
if (ind >= 0) { SERIAL_ECHO(int(ind)); SERIAL_CHAR(':'); }
serialprintPGM(name); serialprintPGM(name);
SERIAL_CHAR(':'); SERIAL_CHAR(':');
} }
static void config_line(PGM_P const name, const float val, PGM_P const pref=nullptr) { static void config_line(PGM_P const name, const float val, PGM_P const pref=nullptr, const int8_t ind=-1) {
config_prefix(name, pref); config_prefix(name, pref, ind);
SERIAL_ECHOLN(val); SERIAL_ECHOLN(val);
} }
static void config_line_e(const int8_t e, PGM_P const name, const float val) {
config_line(name, val, PSTR("Extr."), e + 1);
}
/** /**
* M360: Report Firmware configuration * M360: Report Firmware configuration
@ -52,19 +60,19 @@ void GcodeSuite::M360() {
// //
// Basics and Enabled items // Basics and Enabled items
// //
config_line(PSTR("Baudrate"), BAUDRATE); config_line(PSTR("Baudrate"), BAUDRATE);
config_line(PSTR("InputBuffer"), MAX_CMD_SIZE); config_line(PSTR("InputBuffer"), MAX_CMD_SIZE);
config_line(PSTR("PrintlineCache"), BUFSIZE); config_line(PSTR("PrintlineCache"), BUFSIZE);
config_line(PSTR("MixingExtruder"), ENABLED(MIXING_EXTRUDER)); config_line(PSTR("MixingExtruder"), ENABLED(MIXING_EXTRUDER));
config_line(PSTR("SDCard"), ENABLED(SDSUPPORT)); config_line(PSTR("SDCard"), ENABLED(SDSUPPORT));
config_line(PSTR("Fan"), ENABLED(HAS_FAN)); config_line(PSTR("Fan"), ENABLED(HAS_FAN));
config_line(PSTR("LCD"), ENABLED(HAS_DISPLAY)); config_line(PSTR("LCD"), ENABLED(HAS_DISPLAY));
config_line(PSTR("SoftwarePowerSwitch"), 1); config_line(PSTR("SoftwarePowerSwitch"), 1);
config_line(PSTR("SupportLocalFilamentchange"), ENABLED(ADVANCED_PAUSE_FEATURE)); config_line(PSTR("SupportLocalFilamentchange"), ENABLED(ADVANCED_PAUSE_FEATURE));
config_line(PSTR("CaseLights"), ENABLED(CASE_LIGHT_ENABLE)); config_line(PSTR("CaseLights"), ENABLED(CASE_LIGHT_ENABLE));
config_line(PSTR("ZProbe"), ENABLED(HAS_BED_PROBE)); config_line(PSTR("ZProbe"), ENABLED(HAS_BED_PROBE));
config_line(PSTR("Autolevel"), ENABLED(HAS_LEVELING)); config_line(PSTR("Autolevel"), ENABLED(HAS_LEVELING));
config_line(PSTR("EEPROM"), ENABLED(EEPROM_SETTINGS)); config_line(PSTR("EEPROM"), ENABLED(EEPROM_SETTINGS));
// //
// Homing Directions // Homing Directions
@ -96,15 +104,15 @@ void GcodeSuite::M360() {
PGMSTR(UNRET_STR, "RetractionUndo"); PGMSTR(UNRET_STR, "RetractionUndo");
PGMSTR(SPEED_STR, "Speed"); PGMSTR(SPEED_STR, "Speed");
// M10 Retract with swap (long) moves // M10 Retract with swap (long) moves
config_line(PSTR("Length"), fwretract.settings.retract_length, RET_STR); config_line(PSTR("Length"), fwretract.settings.retract_length, RET_STR);
config_line(SPEED_STR, fwretract.settings.retract_feedrate_mm_s, 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("ZLift"), fwretract.settings.retract_zraise, RET_STR);
config_line(PSTR("LongLength"), fwretract.settings.swap_retract_length, RET_STR); config_line(PSTR("LongLength"), fwretract.settings.swap_retract_length, RET_STR);
// M11 Recover (undo) with swap (long) moves // M11 Recover (undo) with swap (long) moves
config_line(SPEED_STR, fwretract.settings.retract_recover_feedrate_mm_s, UNRET_STR); 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("ExtraLength"), fwretract.settings.retract_recover_extra, UNRET_STR);
config_line(PSTR("ExtraLongLength"), fwretract.settings.swap_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); config_line(PSTR("LongSpeed"), fwretract.settings.swap_retract_recover_feedrate_mm_s, UNRET_STR);
#endif #endif
// //
@ -165,24 +173,13 @@ void GcodeSuite::M360() {
// //
config_line(PSTR("NumExtruder"), EXTRUDERS); config_line(PSTR("NumExtruder"), EXTRUDERS);
#if EXTRUDERS #if EXTRUDERS
#define DIAM_VALUE(N) TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[N]) LOOP_L_N(e, EXTRUDERS) {
#if HAS_LINEAR_E_JERK config_line_e(e, JERK_STR, TERN(HAS_LINEAR_E_JERK, planner.max_e_jerk[E_INDEX_N(e)], TERN(HAS_CLASSIC_JERK, planner.max_jerk.e, DEFAULT_EJERK)));
#define E_JERK_VAL(N) planner.max_e_jerk[E_INDEX_N(N)] config_line_e(e, PSTR("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]);
#elif HAS_CLASSIC_JERK config_line_e(e, PSTR("Acceleration"), planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(e)]);
#define E_JERK_VAL(N) planner.max_jerk.e config_line_e(e, PSTR("Diameter"), TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[e]));
#else config_line_e(e, PSTR("MaxTemp"), thermalManager.heater_maxtemp[e]);
#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
} }