Skip to content

Commit 37e1c11

Browse files
authored
Merge pull request prusa3d#2657 from FormerLurker/MK3
Add arc interpolation features (G2/G3) and M214 command for controlling settings
2 parents 554bb02 + 7515db1 commit 37e1c11

14 files changed

+369
-200
lines changed

Firmware/ConfigurationStore.cpp

+86-69
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ static bool EEPROM_writeData(uint8_t* pos, uint8_t* value, uint8_t size, const c
3434
#ifdef DEBUG_EEPROM_WRITE
3535
printf_P(PSTR("EEPROM_WRITE_VAR addr=0x%04x size=0x%02x name=%s\n"), pos, size, name);
3636
#endif //DEBUG_EEPROM_WRITE
37-
while (size--)
38-
{
37+
while (size--)
38+
{
3939

4040
eeprom_update_byte(pos, *value);
4141
if (eeprom_read_byte(pos) != *value) {
4242
SERIAL_ECHOLNPGM("EEPROM Error");
4343
return false;
4444
}
4545

46-
pos++;
47-
value++;
48-
}
46+
pos++;
47+
value++;
48+
}
4949
return true;
5050
}
5151

@@ -89,8 +89,8 @@ void Config_StoreSettings()
8989
void Config_PrintSettings(uint8_t level)
9090
{ // Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown
9191
#ifdef TMC2130
92-
printf_P(PSTR(
93-
"%SSteps per unit:\n%S M92 X%.2f Y%.2f Z%.2f E%.2f\n"
92+
printf_P(PSTR(
93+
"%SSteps per unit:\n%S M92 X%.2f Y%.2f Z%.2f E%.2f\n"
9494
"%SUStep resolution: \n%S M350 X%d Y%d Z%d E%d\n"
9595
"%SMaximum feedrates - normal (mm/s):\n%S M203 X%.2f Y%.2f Z%.2f E%.2f\n"
9696
"%SMaximum feedrates - stealth (mm/s):\n%S M203 X%.2f Y%.2f Z%.2f E%.2f\n"
@@ -125,50 +125,54 @@ void Config_PrintSettings(uint8_t level)
125125
echomagic, echomagic, cs.minimumfeedrate, cs.mintravelfeedrate, cs.minsegmenttime, cs.max_jerk[X_AXIS], cs.max_jerk[Y_AXIS], cs.max_jerk[Z_AXIS], cs.max_jerk[E_AXIS],
126126
echomagic, echomagic, cs.add_homing[X_AXIS], cs.add_homing[Y_AXIS], cs.add_homing[Z_AXIS]
127127
#endif //TMC2130
128-
);
128+
);
129129
#ifdef PIDTEMP
130-
printf_P(PSTR("%SPID settings:\n%S M301 P%.2f I%.2f D%.2f\n"),
131-
echomagic, echomagic, cs.Kp, unscalePID_i(cs.Ki), unscalePID_d(cs.Kd));
130+
printf_P(PSTR("%SPID settings:\n%S M301 P%.2f I%.2f D%.2f\n"),
131+
echomagic, echomagic, cs.Kp, unscalePID_i(cs.Ki), unscalePID_d(cs.Kd));
132132
#endif
133133
#ifdef PIDTEMPBED
134-
printf_P(PSTR("%SPID heatbed settings:\n%S M304 P%.2f I%.2f D%.2f\n"),
135-
echomagic, echomagic, cs.bedKp, unscalePID_i(cs.bedKi), unscalePID_d(cs.bedKd));
134+
printf_P(PSTR("%SPID heatbed settings:\n%S M304 P%.2f I%.2f D%.2f\n"),
135+
echomagic, echomagic, cs.bedKp, unscalePID_i(cs.bedKi), unscalePID_d(cs.bedKd));
136136
#endif
137137
#ifdef FWRETRACT
138-
printf_P(PSTR(
139-
"%SRetract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)\n%S M207 S%.2f F%.2f Z%.2f\n"
140-
"%SRecover: S=Extra length (mm) F:Speed (mm/m)\n%S M208 S%.2f F%.2f\n"
141-
"%SAuto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries\n%S M209 S%d\n"
142-
),
143-
echomagic, echomagic, cs.retract_length, cs.retract_feedrate*60, cs.retract_zlift,
144-
echomagic, echomagic, cs.retract_recover_length, cs.retract_recover_feedrate*60,
145-
echomagic, echomagic, (cs.autoretract_enabled ? 1 : 0)
146-
);
138+
printf_P(PSTR(
139+
"%SRetract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)\n%S M207 S%.2f F%.2f Z%.2f\n"
140+
"%SRecover: S=Extra length (mm) F:Speed (mm/m)\n%S M208 S%.2f F%.2f\n"
141+
"%SAuto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries\n%S M209 S%d\n"
142+
),
143+
echomagic, echomagic, cs.retract_length, cs.retract_feedrate*60, cs.retract_zlift,
144+
echomagic, echomagic, cs.retract_recover_length, cs.retract_recover_feedrate*60,
145+
echomagic, echomagic, (cs.autoretract_enabled ? 1 : 0)
146+
);
147147
#if EXTRUDERS > 1
148-
printf_P(PSTR("%SMulti-extruder settings:\n%S Swap retract length (mm): %.2f\n%S Swap rec. addl. length (mm): %.2f\n"),
149-
echomagic, echomagic, retract_length_swap, echomagic, retract_recover_length_swap);
148+
printf_P(PSTR("%SMulti-extruder settings:\n%S Swap retract length (mm): %.2f\n%S Swap rec. addl. length (mm): %.2f\n"),
149+
echomagic, echomagic, retract_length_swap, echomagic, retract_recover_length_swap);
150150
#endif
151-
if (cs.volumetric_enabled) {
152-
printf_P(PSTR("%SFilament settings:\n%S M200 D%.2f\n"),
153-
echomagic, echomagic, cs.filament_size[0]);
151+
if (cs.volumetric_enabled) {
152+
printf_P(PSTR("%SFilament settings:\n%S M200 D%.2f\n"),
153+
echomagic, echomagic, cs.filament_size[0]);
154154
#if EXTRUDERS > 1
155-
printf_P(PSTR("%S M200 T1 D%.2f\n"),
156-
echomagic, echomagic, cs.filament_size[1]);
155+
printf_P(PSTR("%S M200 T1 D%.2f\n"),
156+
echomagic, echomagic, cs.filament_size[1]);
157157
#if EXTRUDERS > 2
158-
printf_P(PSTR("%S M200 T1 D%.2f\n"),
159-
echomagic, echomagic, cs.filament_size[2]);
158+
printf_P(PSTR("%S M200 T1 D%.2f\n"),
159+
echomagic, echomagic, cs.filament_size[2]);
160160
#endif
161161
#endif
162162
} else {
163163
printf_P(PSTR("%SFilament settings: Disabled\n"), echomagic);
164164
}
165165
#endif
166-
if (level >= 10) {
166+
if (level >= 10) {
167167
#ifdef LIN_ADVANCE
168-
printf_P(PSTR("%SLinear advance settings:%S M900 K%.2f\n"),
168+
printf_P(PSTR("%SLinear advance settings:%S M900 K%.2f\n"),
169169
echomagic, echomagic, extruder_advance_K);
170170
#endif //LIN_ADVANCE
171-
}
171+
}
172+
// Arc Interpolation Settings
173+
printf_P(PSTR(
174+
"%SArc Settings: P:Max length(mm) S:Min length (mm) N:Corrections R:Min segments F:Segments/sec.\n%S M214 P%.2f S%.2f N%d R%d F%d\n"),
175+
echomagic, echomagic, cs.mm_per_arc_segment, cs.min_mm_per_arc_segment, cs.n_arc_correction, cs.min_arc_segments, cs.arc_segments_per_sec);
172176
}
173177
#endif
174178

@@ -184,7 +188,7 @@ static_assert (false, "zprobe_zoffset was not initialized in printers in field t
184188
"0.0, if this is not acceptable, increment EEPROM_VERSION to force use default_conf");
185189
#endif
186190

187-
static_assert (sizeof(M500_conf) == 196, "sizeof(M500_conf) has changed, ensure that EEPROM_VERSION has been incremented, "
191+
static_assert (sizeof(M500_conf) == 209, "sizeof(M500_conf) has changed, ensure that EEPROM_VERSION has been incremented, "
188192
"or if you added members in the end of struct, ensure that historically uninitialized values will be initialized."
189193
"If this is caused by change to more then 8bit processor, decide whether make this struct packed to save EEPROM,"
190194
"leave as it is to keep fast code, or reorder struct members to pack more tightly.");
@@ -233,6 +237,11 @@ static const M500_conf default_conf PROGMEM =
233237
{16,16,16,16},
234238
#endif
235239
DEFAULT_TRAVEL_ACCELERATION,
240+
DEFAULT_MM_PER_ARC_SEGMENT,
241+
DEFAULT_MIN_MM_PER_ARC_SEGMENT,
242+
DEFAULT_N_ARC_CORRECTION,
243+
DEFAULT_MIN_ARC_SEGMENTS,
244+
DEFAULT_ARC_SEGMENTS_PER_SEC
236245
};
237246

238247

@@ -252,7 +261,7 @@ static bool is_uninitialized(void* addr, uint8_t len)
252261
//! @retval false Failed. Default settings has been retrieved, because of older version or corrupted data.
253262
bool Config_RetrieveSettings()
254263
{
255-
bool previous_settings_retrieved = true;
264+
bool previous_settings_retrieved = true;
256265
char ver[4]=EEPROM_VERSION;
257266
EEPROM_readData(reinterpret_cast<uint8_t*>(EEPROM_M500_base->version), reinterpret_cast<uint8_t*>(cs.version), sizeof(cs.version), "cs.version"); //read stored version
258267
// SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << cs.version << "]");
@@ -262,7 +271,7 @@ bool Config_RetrieveSettings()
262271
EEPROM_readData(reinterpret_cast<uint8_t*>(EEPROM_M500_base), reinterpret_cast<uint8_t*>(&cs), sizeof(cs), "cs");
263272
calculate_extruder_multipliers();
264273

265-
//if max_feedrate_silent and max_acceleration_units_per_sq_second_silent were never stored to eeprom, use default values:
274+
//if max_feedrate_silent and max_acceleration_units_per_sq_second_silent were never stored to eeprom, use default values:
266275
for (uint8_t i = 0; i < (sizeof(cs.max_feedrate_silent)/sizeof(cs.max_feedrate_silent[0])); ++i)
267276
{
268277
const uint32_t erased = 0xffffffff;
@@ -273,74 +282,82 @@ bool Config_RetrieveSettings()
273282
memcpy_P(&cs.max_acceleration_units_per_sq_second_silent[i],&default_conf.max_acceleration_units_per_sq_second_silent[i],sizeof(cs.max_acceleration_units_per_sq_second_silent[i]));
274283
}
275284
}
285+
// Initialize arc interpolation settings if they are not already
286+
if (is_uninitialized(&cs.mm_per_arc_segment, sizeof(cs.mm_per_arc_segment))) cs.mm_per_arc_segment = default_conf.mm_per_arc_segment;
287+
if (is_uninitialized(&cs.min_mm_per_arc_segment, sizeof(cs.min_mm_per_arc_segment))) cs.min_mm_per_arc_segment = default_conf.min_mm_per_arc_segment;
288+
if (is_uninitialized(&cs.n_arc_correction, sizeof(cs.n_arc_correction))) cs.n_arc_correction = default_conf.n_arc_correction;
289+
if (is_uninitialized(&cs.min_arc_segments, sizeof(cs.min_arc_segments))) cs.min_arc_segments = default_conf.min_arc_segments;
290+
if (is_uninitialized(&cs.arc_segments_per_sec, sizeof(cs.arc_segments_per_sec))) cs.arc_segments_per_sec = default_conf.arc_segments_per_sec;
291+
276292

277293
#ifdef TMC2130
278-
for (uint8_t j = X_AXIS; j <= Y_AXIS; j++)
279-
{
280-
if (cs.max_feedrate_normal[j] > NORMAL_MAX_FEEDRATE_XY)
281-
cs.max_feedrate_normal[j] = NORMAL_MAX_FEEDRATE_XY;
282-
if (cs.max_feedrate_silent[j] > SILENT_MAX_FEEDRATE_XY)
283-
cs.max_feedrate_silent[j] = SILENT_MAX_FEEDRATE_XY;
284-
if (cs.max_acceleration_units_per_sq_second_normal[j] > NORMAL_MAX_ACCEL_XY)
285-
cs.max_acceleration_units_per_sq_second_normal[j] = NORMAL_MAX_ACCEL_XY;
286-
if (cs.max_acceleration_units_per_sq_second_silent[j] > SILENT_MAX_ACCEL_XY)
287-
cs.max_acceleration_units_per_sq_second_silent[j] = SILENT_MAX_ACCEL_XY;
288-
}
294+
for (uint8_t j = X_AXIS; j <= Y_AXIS; j++)
295+
{
296+
if (cs.max_feedrate_normal[j] > NORMAL_MAX_FEEDRATE_XY)
297+
cs.max_feedrate_normal[j] = NORMAL_MAX_FEEDRATE_XY;
298+
if (cs.max_feedrate_silent[j] > SILENT_MAX_FEEDRATE_XY)
299+
cs.max_feedrate_silent[j] = SILENT_MAX_FEEDRATE_XY;
300+
if (cs.max_acceleration_units_per_sq_second_normal[j] > NORMAL_MAX_ACCEL_XY)
301+
cs.max_acceleration_units_per_sq_second_normal[j] = NORMAL_MAX_ACCEL_XY;
302+
if (cs.max_acceleration_units_per_sq_second_silent[j] > SILENT_MAX_ACCEL_XY)
303+
cs.max_acceleration_units_per_sq_second_silent[j] = SILENT_MAX_ACCEL_XY;
304+
}
289305

290-
if(cs.axis_ustep_resolution[X_AXIS] == 0xff){ cs.axis_ustep_resolution[X_AXIS] = TMC2130_USTEPS_XY; }
291-
if(cs.axis_ustep_resolution[Y_AXIS] == 0xff){ cs.axis_ustep_resolution[Y_AXIS] = TMC2130_USTEPS_XY; }
292-
if(cs.axis_ustep_resolution[Z_AXIS] == 0xff){ cs.axis_ustep_resolution[Z_AXIS] = TMC2130_USTEPS_Z; }
293-
if(cs.axis_ustep_resolution[E_AXIS] == 0xff){ cs.axis_ustep_resolution[E_AXIS] = TMC2130_USTEPS_E; }
294-
295-
tmc2130_set_res(X_AXIS, cs.axis_ustep_resolution[X_AXIS]);
296-
tmc2130_set_res(Y_AXIS, cs.axis_ustep_resolution[Y_AXIS]);
297-
tmc2130_set_res(Z_AXIS, cs.axis_ustep_resolution[Z_AXIS]);
298-
tmc2130_set_res(E_AXIS, cs.axis_ustep_resolution[E_AXIS]);
306+
if(cs.axis_ustep_resolution[X_AXIS] == 0xff){ cs.axis_ustep_resolution[X_AXIS] = TMC2130_USTEPS_XY; }
307+
if(cs.axis_ustep_resolution[Y_AXIS] == 0xff){ cs.axis_ustep_resolution[Y_AXIS] = TMC2130_USTEPS_XY; }
308+
if(cs.axis_ustep_resolution[Z_AXIS] == 0xff){ cs.axis_ustep_resolution[Z_AXIS] = TMC2130_USTEPS_Z; }
309+
if(cs.axis_ustep_resolution[E_AXIS] == 0xff){ cs.axis_ustep_resolution[E_AXIS] = TMC2130_USTEPS_E; }
310+
311+
tmc2130_set_res(X_AXIS, cs.axis_ustep_resolution[X_AXIS]);
312+
tmc2130_set_res(Y_AXIS, cs.axis_ustep_resolution[Y_AXIS]);
313+
tmc2130_set_res(Z_AXIS, cs.axis_ustep_resolution[Z_AXIS]);
314+
tmc2130_set_res(E_AXIS, cs.axis_ustep_resolution[E_AXIS]);
299315
#endif //TMC2130
300316

301317
if(is_uninitialized(&cs.travel_acceleration, sizeof(cs.travel_acceleration)))
302318
cs.travel_acceleration = cs.acceleration;
303319

304320
reset_acceleration_rates();
305321

306-
// Call updatePID (similar to when we have processed M301)
307-
updatePID();
322+
// Call updatePID (similar to when we have processed M301)
323+
updatePID();
308324
SERIAL_ECHO_START;
309325
SERIAL_ECHOLNPGM("Stored settings retrieved");
310326
}
311327
else
312328
{
313329
Config_ResetDefault();
314-
//Return false to inform user that eeprom version was changed and firmware is using default hardcoded settings now.
315-
//In case that storing to eeprom was not used yet, do not inform user that hardcoded settings are used.
316-
if (eeprom_read_byte(reinterpret_cast<uint8_t*>(&(EEPROM_M500_base->version[0]))) != 0xFF ||
317-
eeprom_read_byte(reinterpret_cast<uint8_t*>(&(EEPROM_M500_base->version[1]))) != 0xFF ||
318-
eeprom_read_byte(reinterpret_cast<uint8_t*>(&(EEPROM_M500_base->version[2]))) != 0xFF)
319-
{
320-
previous_settings_retrieved = false;
321-
}
330+
//Return false to inform user that eeprom version was changed and firmware is using default hardcoded settings now.
331+
//In case that storing to eeprom was not used yet, do not inform user that hardcoded settings are used.
332+
if (eeprom_read_byte(reinterpret_cast<uint8_t*>(&(EEPROM_M500_base->version[0]))) != 0xFF ||
333+
eeprom_read_byte(reinterpret_cast<uint8_t*>(&(EEPROM_M500_base->version[1]))) != 0xFF ||
334+
eeprom_read_byte(reinterpret_cast<uint8_t*>(&(EEPROM_M500_base->version[2]))) != 0xFF)
335+
{
336+
previous_settings_retrieved = false;
337+
}
322338
}
323339
#ifdef EEPROM_CHITCHAT
324340
Config_PrintSettings();
325341
#endif
326-
return previous_settings_retrieved;
342+
return previous_settings_retrieved;
327343
}
328344
#endif
329345

330346
void Config_ResetDefault()
331347
{
332348
memcpy_P(&cs,&default_conf, sizeof(cs));
333349

334-
// steps per sq second need to be updated to agree with the units per sq second
350+
// steps per sq second need to be updated to agree with the units per sq second
335351
reset_acceleration_rates();
336352

337353
#ifdef PIDTEMP
338354
updatePID();
339355
#endif//PIDTEMP
340356

341-
calculate_extruder_multipliers();
357+
calculate_extruder_multipliers();
342358

343359
SERIAL_ECHO_START;
344360
SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
345361

346362
}
363+

Firmware/ConfigurationStore.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ typedef struct
3939
unsigned long max_acceleration_units_per_sq_second_silent[4];
4040
unsigned char axis_ustep_resolution[4];
4141
float travel_acceleration; //!< travel acceleration mm/s^2
42+
// Arc Interpolation Settings, configurable via M214
43+
float mm_per_arc_segment;
44+
float min_mm_per_arc_segment;
45+
unsigned char n_arc_correction; // If equal to zero, this is disabled
46+
unsigned short min_arc_segments; // If equal to zero, this is disabled
47+
unsigned short arc_segments_per_sec; // If equal to zero, this is disabled
4248
} M500_conf;
4349

4450
extern M500_conf cs;
@@ -62,5 +68,4 @@ FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_Prin
6268
inline uint8_t calibration_status() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS); }
6369
inline void calibration_status_store(uint8_t status) { eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS, status); }
6470
inline bool calibration_status_pinda() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA); }
65-
6671
#endif//CONFIG_STORE_H

Firmware/Configuration_adv.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,7 @@
289289
//#define LA_DEBUG_LOGIC // @wavexx: setup logic channels for isr debugging
290290
#endif
291291

292-
// Arc interpretation settings:
293-
#define MM_PER_ARC_SEGMENT 1
294-
#define N_ARC_CORRECTION 25
292+
// Arc interpretation settings : Moved to the variant files.
295293

296294
const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
297295

Firmware/Marlin_main.cpp

100755100644
+48-12
Original file line numberDiff line numberDiff line change
@@ -4162,6 +4162,7 @@ extern uint8_t st_backlash_y;
41624162
//!@n M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop], stays in mm regardless of M200 setting
41634163
//!@n M208 - set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec]
41644164
//!@n M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
4165+
//!@n M214 - Set Arc Parameters (Use M500 to store in eeprom) P<MM_PER_ARC_SEGMENT> S<MIN_MM_PER_ARC_SEGMENT> R<MIN_ARC_SEGMENTS> F<ARC_SEGMENTS_PER_SEC>
41654166
//!@n M218 - set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>
41664167
//!@n M220 S<factor in percent>- set speed factor override percentage
41674168
//!@n M221 S<factor in percent>- set extrude factor override percentage
@@ -4900,6 +4901,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
49004901
#### Parameters
49014902
- `X` - The position to move to on the X axis
49024903
- `Y` - The position to move to on the Y axis
4904+
- 'Z' - The position to move to on the Z axis
49034905
- `I` - The point in X space from the current X position to maintain a constant distance from
49044906
- `J` - The point in Y space from the current Y position to maintain a constant distance from
49054907
- `E` - The amount to extrude between the starting point and ending point
@@ -7502,9 +7504,46 @@ SERIAL_PROTOCOLPGM("\n\n");
75027504
}
75037505

75047506
}break;
7505-
#endif // FWRETRACT
7507+
#endif // FWRETRACT
7508+
/*!
7509+
### M214 - Set Arc configuration values (Use M500 to store in eeprom)
7510+
7511+
#### Usage
75067512
7513+
M214 [P] [S] [N] [R] [F]
75077514
7515+
#### Parameters
7516+
- `P` - A float representing the max and default millimeters per arc segment. Must be greater than 0.
7517+
- `S` - A float representing the minimum allowable millimeters per arc segment. Set to 0 to disable
7518+
- `N` - An int representing the number of arcs to draw before correcting the small angle approximation. Set to 0 to disable.
7519+
- `R` - An int representing the minimum number of segments per arcs of any radius,
7520+
except when the results in segment lengths greater than or less than the minimum
7521+
and maximum segment length. Set to 0 to disable.
7522+
- 'F' - An int representing the number of segments per second, unless this results in segment lengths
7523+
greater than or less than the minimum and maximum segment length. Set to 0 to disable.
7524+
*/
7525+
case 214: //!@n M214 - Set Arc Parameters (Use M500 to store in eeprom) P<MM_PER_ARC_SEGMENT> S<MIN_MM_PER_ARC_SEGMENT> R<MIN_ARC_SEGMENTS> F<ARC_SEGMENTS_PER_SEC>
7526+
{
7527+
// Extract all possible parameters if they appear
7528+
float p = code_seen('P') ? code_value_float() : cs.mm_per_arc_segment;
7529+
float s = code_seen('S') ? code_value_float() : cs.min_mm_per_arc_segment;
7530+
unsigned char n = code_seen('N') ? code_value() : cs.n_arc_correction;
7531+
unsigned short r = code_seen('R') ? code_value() : cs.min_arc_segments;
7532+
unsigned short f = code_seen('F') ? code_value() : cs.arc_segments_per_sec;
7533+
7534+
// Ensure mm_per_arc_segment is greater than 0, and that min_mm_per_arc_segment is sero or greater than or equal to mm_per_arc_segment
7535+
if (p <=0 || s < 0 || p < s)
7536+
{
7537+
// Should we display some error here?
7538+
break;
7539+
}
7540+
7541+
cs.mm_per_arc_segment = p;
7542+
cs.min_mm_per_arc_segment = s;
7543+
cs.n_arc_correction = n;
7544+
cs.min_arc_segments = r;
7545+
cs.arc_segments_per_sec = f;
7546+
}break;
75087547
#if EXTRUDERS > 1
75097548

75107549
/*!
@@ -9642,17 +9681,14 @@ void prepare_move()
96429681
}
96439682

96449683
void prepare_arc_move(bool isclockwise) {
9645-
float r = hypot(offset[X_AXIS], offset[Y_AXIS]); // Compute arc radius for mc_arc
9646-
9647-
// Trace the arc
9648-
mc_arc(current_position, destination, offset, X_AXIS, Y_AXIS, Z_AXIS, feedrate*feedmultiply/60/100.0, r, isclockwise, active_extruder);
9649-
9650-
// As far as the parser is concerned, the position is now == target. In reality the
9651-
// motion control system might still be processing the action and the real tool position
9652-
// in any intermediate location.
9653-
set_current_to_destination();
9654-
9655-
previous_millis_cmd.start();
9684+
float r = hypot(offset[X_AXIS], offset[Y_AXIS]); // Compute arc radius for mc_arc
9685+
// Trace the arc
9686+
mc_arc(current_position, destination, offset, feedrate * feedmultiply / 60 / 100.0, r, isclockwise, active_extruder);
9687+
// As far as the parser is concerned, the position is now == target. In reality the
9688+
// motion control system might still be processing the action and the real tool position
9689+
// in any intermediate location.
9690+
set_current_to_destination();
9691+
previous_millis_cmd.start();
96569692
}
96579693

96589694
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1

0 commit comments

Comments
 (0)