Browse Source

Optimize M360

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
2f57b1d529
  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/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:");
if (pref) serialprintPGM(pref);
if (ind >= 0) { SERIAL_ECHO(int(ind)); SERIAL_CHAR(':'); }
serialprintPGM(name);
SERIAL_CHAR(':');
}
static void config_line(PGM_P const name, const float val, PGM_P const pref=nullptr) {
config_prefix(name, pref);
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, ind);
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
@ -165,24 +173,13 @@ void GcodeSuite::M360() {
//
config_line(PSTR("NumExtruder"), EXTRUDERS);
#if EXTRUDERS
#define DIAM_VALUE(N) TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[N])
#if HAS_LINEAR_E_JERK
#define E_JERK_VAL(N) planner.max_e_jerk[E_INDEX_N(N)]
#elif HAS_CLASSIC_JERK
#define E_JERK_VAL(N) planner.max_jerk.e
#else
#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);
LOOP_L_N(e, EXTRUDERS) {
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)));
config_line_e(e, PSTR("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]);
config_line_e(e, PSTR("Acceleration"), planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(e)]);
config_line_e(e, PSTR("Diameter"), TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[e]));
config_line_e(e, PSTR("MaxTemp"), thermalManager.heater_maxtemp[e]);
}
#endif
}

Loading…
Cancel
Save