MCPcopy Create free account
hub / github.com/MarlinFirmware/Marlin / get_destination_from_command

Method get_destination_from_command

Marlin/src/gcode/gcode.cpp:165–243  ·  view source on GitHub ↗

* Set XYZ...E destination and feedrate from the current G-Code command * * - Set destination from included axis codes * - Set to current for missing axis codes * - Set the feedrate, if included */

Source from the content-addressed store, hash-verified

163 * - Set the feedrate, if included
164 */
165void GcodeSuite::get_destination_from_command() {
166 xyze_bool_t seen{false};
167
168 #if ENABLED(CANCEL_OBJECTS)
169 const bool &skip_move = cancelable.state.skipping;
170 #else
171 constexpr bool skip_move = false;
172 #endif
173
174 // Get new XYZ position, whether absolute or relative
175 LOOP_NUM_AXES(i) {
176 if ( (seen[i] = parser.seenval(AXIS_CHAR(i))) ) {
177 const float v = parser.value_axis_units((AxisEnum)i);
178 if (skip_move)
179 destination[i] = current_position[i];
180 else
181 destination[i] = axis_is_relative(AxisEnum(i)) ? current_position[i] + v : LOGICAL_TO_NATIVE(v, i);
182 }
183 else
184 destination[i] = current_position[i];
185 }
186
187 #if HAS_EXTRUDERS
188 // Get new E position, whether absolute or relative
189 if ( (seen.e = parser.seenval('E')) ) {
190 const float v = parser.value_axis_units(E_AXIS);
191 destination.e = axis_is_relative(E_AXIS) ? current_position.e + v : v;
192 }
193 else
194 destination.e = current_position.e;
195 #endif
196
197 #if ENABLED(POWER_LOSS_RECOVERY) && !PIN_EXISTS(POWER_LOSS)
198 // Only update power loss recovery on moves with E
199 if (recovery.enabled && card.isStillPrinting() && seen.e && (seen.x || seen.y))
200 recovery.save();
201 #endif
202
203 if (parser.floatval('F') > 0) {
204 const float fr_mm_min = parser.value_linear_units();
205 feedrate_mm_s = MMM_TO_MMS(fr_mm_min);
206 // Update the cutter feed rate for use by M4 I set inline moves.
207 TERN_(LASER_FEATURE, cutter.feedrate_mm_m = fr_mm_min);
208 }
209
210 #if ALL(PRINTCOUNTER, HAS_EXTRUDERS)
211 if (!DEBUGGING(DRYRUN) && !skip_move)
212 print_job_timer.incFilamentUsed(destination.e - current_position.e);
213 #endif
214
215 // Get ABCDHI mixing factors
216 #if ALL(MIXING_EXTRUDER, DIRECT_MIXING_IN_G1)
217 M165();
218 #endif
219
220 #if ENABLED(LASER_FEATURE)
221 if (cutter.cutter_mode == CUTTER_MODE_CONTINUOUS || cutter.cutter_mode == CUTTER_MODE_DYNAMIC) {
222 // Set the cutter power in the planner to configure this move

Callers

nothing calls this directly

Calls 14

seenvalMethod · 0.80
value_axis_unitsMethod · 0.80
isStillPrintingMethod · 0.80
floatvalMethod · 0.80
value_linear_unitsMethod · 0.80
incFilamentUsedMethod · 0.80
seenMethod · 0.80
value_floatMethod · 0.80
power_to_rangeMethod · 0.80
inline_powerMethod · 0.80
upower_to_ocrMethod · 0.80
apply_powerMethod · 0.80

Tested by

no test coverage detected