Skip to content

Commit

Permalink
🩹 Use 'M205 D' when 'B' is an axis
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 7, 2023
1 parent 98c9ecd commit 87d7449
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions Marlin/src/gcode/config/M200-M205.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ void GcodeSuite::M203_report(const bool forReplay/*=true*/) {
/**
* M204: Set Accelerations in units/sec^2 (M204 P1200 R3000 T3000)
*
* P = Printing moves
* R = Retract only (no X, Y, Z) moves
* T = Travel (non printing) moves
* P<accel> Printing moves
* R<accel> Retract only (no X, Y, Z) moves
* T<accel> Travel (non printing) moves
*/
void GcodeSuite::M204() {
if (!parser.seen("PRST"))
Expand All @@ -247,24 +247,37 @@ void GcodeSuite::M204_report(const bool forReplay/*=true*/) {
);
}

#if AXIS_COLLISION('B')
#define M205_MIN_SEG_TIME_PARAM 'D'
#define M205_MIN_SEG_TIME_STR "D"
#warning "Use 'M205 D' for Minimum Segment Time."
#else
#define M205_MIN_SEG_TIME_PARAM 'B'
#define M205_MIN_SEG_TIME_STR "B"
#endif

/**
* M205: Set Advanced Settings
*
* B = Min Segment Time (µs)
* S = Min Feed Rate (units/s)
* T = Min Travel Feed Rate (units/s)
* X = Max X Jerk (units/sec^2)
* Y = Max Y Jerk (units/sec^2)
* Z = Max Z Jerk (units/sec^2)
* E = Max E Jerk (units/sec^2)
* J = Junction Deviation (mm) (If not using CLASSIC_JERK)
* B<µs> : Min Segment Time
* S<units/s> : Min Feed Rate
* T<units/s> : Min Travel Feed Rate
*
* With CLASSIC_JERK:
* X<units/sec^2> : Max X Jerk
* Y<units/sec^2> : Max Y Jerk
* Z<units/sec^2> : Max Z Jerk
* ... : etc
* E<units/sec^2> : Max E Jerk
*
* Without CLASSIC_JERK:
* J(mm) : Junction Deviation
*/
void GcodeSuite::M205() {
if (!parser.seen("BST" TERN_(HAS_JUNCTION_DEVIATION, "J") TERN_(HAS_CLASSIC_JERK, "XYZE")))
return M205_report();
if (!parser.seen_any()) return M205_report();

//planner.synchronize();
if (parser.seenval('B')) planner.settings.min_segment_time_us = parser.value_ulong();
if (parser.seenval(M205_MIN_SEG_TIME_PARAM)) planner.settings.min_segment_time_us = parser.value_ulong();
if (parser.seenval('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units();
if (parser.seenval('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units();
#if HAS_JUNCTION_DEVIATION
Expand Down Expand Up @@ -304,7 +317,7 @@ void GcodeSuite::M205() {

void GcodeSuite::M205_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, F(
"Advanced (B<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate>"
"Advanced (" M205_MIN_SEG_TIME_STR "<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate>"
TERN_(HAS_JUNCTION_DEVIATION, " J<junc_dev>")
#if HAS_CLASSIC_JERK
NUM_AXIS_GANG(
Expand All @@ -317,7 +330,7 @@ void GcodeSuite::M205_report(const bool forReplay/*=true*/) {
")"
));
SERIAL_ECHOLNPGM_P(
PSTR(" M205 B"), LINEAR_UNIT(planner.settings.min_segment_time_us)
PSTR(" M205 " M205_MIN_SEG_TIME_STR), LINEAR_UNIT(planner.settings.min_segment_time_us)
, PSTR(" S"), LINEAR_UNIT(planner.settings.min_feedrate_mm_s)
, SP_T_STR, LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s)
#if HAS_JUNCTION_DEVIATION
Expand Down

0 comments on commit 87d7449

Please sign in to comment.