Browse Source

Optimize M360

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
c710b6e06c
  1. 39
      Marlin/src/gcode/host/M360.cpp

39
Marlin/src/gcode/host/M360.cpp

@ -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
@ -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
} }

Loading…
Cancel
Save