Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xs
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2018-08-03 17:26:28 +0300
committerbubnikv <bubnikv@gmail.com>2018-08-03 17:26:28 +0300
commit0454adc19415499635b5d268c5d928f5bbe3b71e (patch)
treeeb371ee7ac12496e5d4417347bd809c415fd85e4 /xs
parent6fe2f963b1b10cf2e26e4f92e55b85ff32ec2027 (diff)
Added support for the upstream Marlin interpretation of the M204 code.
Fix of https://github.com/prusa3d/Slic3r/issues/1089 M204 S.. T..: T is interpreted by the firmware and Slic3r time estimator the old way (as acceleration when retracting) only if an S code is found at the same line. This allows PrusaResearch to interpret the legacy G-codes generated by our older Slic3r with older Slic3r profiles. M204 P.. R.. T..: T is ignored, P is interpreted as acceleration when extruding, R is interpreted as acceleration when retracting. This will be the format the Slic3r 1.41.0 will produce from the Machine Limits page. In the future both MK3 firmware and Slic3r will likely be extended to support the separate travel acceleration. This change is in sync with the Prusa3D firmware: https://github.com/prusa3d/Prusa-Firmware/commit/dd4c4b39b4359d61a3329c54bea58df119a731c6 Slic3r will now export M204 P[machine_max_acceleration_extruding] R[machine_max_acceleration_retracting] T[machine_max_acceleration_extruding] before the custom start G-code, which will be correctly interpreted by both the new Prusa3D firmware and the Slic3r's time estimator. To support our legacy MK2 firmware before we merge the commit above, we may just insert the following line into the custom start G-code section to override the block inserted by Slic3r automatically before the custom start G-code: M204 S[machine_max_acceleration_extruding] T[machine_max_acceleration_retracting]
Diffstat (limited to 'xs')
-rw-r--r--xs/src/libslic3r/GCode.cpp5
-rw-r--r--xs/src/libslic3r/GCodeTimeEstimator.cpp22
2 files changed, 21 insertions, 6 deletions
diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp
index 308b1ea04..261c8e59d 100644
--- a/xs/src/libslic3r/GCode.cpp
+++ b/xs/src/libslic3r/GCode.cpp
@@ -1012,9 +1012,10 @@ void GCode::print_machine_envelope(FILE *file, Print &print)
int(print.config.machine_max_feedrate_y.values.front() + 0.5),
int(print.config.machine_max_feedrate_z.values.front() + 0.5),
int(print.config.machine_max_feedrate_e.values.front() + 0.5));
- fprintf(file, "M204 S%d T%d ; sets acceleration (S) and retract acceleration (T), mm/sec^2\n",
+ fprintf(file, "M204 P%d R%d T%d ; sets acceleration (P, T) and retract acceleration (R), mm/sec^2\n",
int(print.config.machine_max_acceleration_extruding.values.front() + 0.5),
- int(print.config.machine_max_acceleration_retracting.values.front() + 0.5));
+ int(print.config.machine_max_acceleration_retracting.values.front() + 0.5),
+ int(print.config.machine_max_acceleration_extruding.values.front() + 0.5));
fprintf(file, "M205 X%.2lf Y%.2lf Z%.2lf E%.2lf ; sets the jerk limits, mm/sec\n",
print.config.machine_max_jerk_x.values.front(),
print.config.machine_max_jerk_y.values.front(),
diff --git a/xs/src/libslic3r/GCodeTimeEstimator.cpp b/xs/src/libslic3r/GCodeTimeEstimator.cpp
index 5543b5cc9..749aac88b 100644
--- a/xs/src/libslic3r/GCodeTimeEstimator.cpp
+++ b/xs/src/libslic3r/GCodeTimeEstimator.cpp
@@ -1164,11 +1164,25 @@ namespace Slic3r {
{
PROFILE_FUNC();
float value;
- if (line.has_value('S', value))
+ if (line.has_value('S', value)) {
+ // Legacy acceleration format. This format is used by the legacy Marlin, MK2 or MK3 firmware,
+ // and it is also generated by Slic3r to control acceleration per extrusion type
+ // (there is a separate acceleration settings in Slicer for perimeter, first layer etc).
set_acceleration(value);
-
- if (line.has_value('T', value))
- set_retract_acceleration(value);
+ if (line.has_value('T', value))
+ set_retract_acceleration(value);
+ } else {
+ // New acceleration format, compatible with the upstream Marlin.
+ if (line.has_value('P', value))
+ set_acceleration(value);
+ if (line.has_value('R', value))
+ set_retract_acceleration(value);
+ if (line.has_value('T', value)) {
+ // Interpret the T value as the travel acceleration in the new Marlin format.
+ //FIXME Prusa3D firmware currently does not support travel acceleration value independent from the extruding acceleration value.
+ // set_travel_acceleration(value);
+ }
+ }
}
void GCodeTimeEstimator::_processM205(const GCodeReader::GCodeLine& line)