Skip to content

Commit

Permalink
Fixup of 8df0181 (turning off the export of machine limits)
Browse files Browse the repository at this point in the history
This should solve #1212 for good
  • Loading branch information
lukasmatena committed Oct 6, 2020
1 parent 6ed25f6 commit b42a12d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/libslic3r/GCode.cpp
Expand Up @@ -819,7 +819,7 @@ namespace DoExport {
// this->print_machine_envelope(file, print);
// shall be adjusted as well to produce a G-code block compatible with the particular firmware flavor.
if (config.gcode_flavor.value == gcfMarlin) {
if (config.machine_limits_type.value != MachineLimitsUsage::Ignore) {
if (config.machine_limits_usage.value != MachineLimitsUsage::Ignore) {
normal_time_estimator.set_max_acceleration((float)config.machine_max_acceleration_extruding.values[0]);
normal_time_estimator.set_retract_acceleration((float)config.machine_max_acceleration_retracting.values[0]);
normal_time_estimator.set_minimum_feedrate((float)config.machine_min_extruding_rate.values[0]);
Expand All @@ -844,7 +844,7 @@ namespace DoExport {
silent_time_estimator.set_dialect(config.gcode_flavor);
silent_time_estimator.set_extrusion_axis(config.get_extrusion_axis()[0]);

if (config.machine_limits_type.value != MachineLimitsUsage::Ignore) {
if (config.machine_limits_usage.value != MachineLimitsUsage::Ignore) {
/* "Stealth mode" values can be just a copy of "normal mode" values
* (when they aren't input for a printer preset).
* Thus, use back value from values, instead of second one, which could be absent
Expand Down Expand Up @@ -1700,7 +1700,7 @@ static bool custom_gcode_sets_temperature(const std::string &gcode, const int mc
// Do not process this piece of G-code by the time estimator, it already knows the values through another sources.
void GCode::print_machine_envelope(FILE *file, Print &print)
{
if (print.config().gcode_flavor.value == gcfMarlin && print.config().machine_limits_type.value == MachineLimitsUsage::EmitToGCode) {
if (print.config().gcode_flavor.value == gcfMarlin && print.config().machine_limits_usage.value == MachineLimitsUsage::EmitToGCode) {
fprintf(file, "M201 X%d Y%d Z%d E%d ; sets maximum accelerations, mm/sec^2\n",
int(print.config().machine_max_acceleration_x.values.front() + 0.5),
int(print.config().machine_max_acceleration_y.values.front() + 0.5),
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/GCode/GCodeProcessor.cpp
Expand Up @@ -505,7 +505,7 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
m_filament_diameters[i] = static_cast<float>(config.filament_diameter.values[i]);
}

if (config.machine_limits_type.value != MachineLimitsUsage::Ignore)
if (config.machine_limits_usage.value != MachineLimitsUsage::Ignore)
m_time_processor.machine_limits = reinterpret_cast<const MachineEnvelopeConfig&>(config);

// Filament load / unload times are not specific to a firmware flavor. Let anybody use it if they find it useful.
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/GCodeWriter.cpp
Expand Up @@ -20,7 +20,7 @@ void GCodeWriter::apply_print_config(const PrintConfig &print_config)
this->config.apply(print_config, true);
m_extrusion_axis = this->config.get_extrusion_axis();
m_single_extruder_multi_material = print_config.single_extruder_multi_material.value;
m_max_acceleration = std::lrint((print_config.gcode_flavor.value == gcfMarlin && print_config.machine_limits_type.value == MachineLimitsUsage::EmitToGCode) ?
m_max_acceleration = std::lrint((print_config.gcode_flavor.value == gcfMarlin && print_config.machine_limits_usage.value == MachineLimitsUsage::EmitToGCode) ?
print_config.machine_max_acceleration_extruding.values.front() : 0);
}

Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/PrintConfig.hpp
Expand Up @@ -615,7 +615,7 @@ class MachineEnvelopeConfig : public StaticPrintConfig
STATIC_PRINT_CONFIG_CACHE(MachineEnvelopeConfig)
public:
// Allowing the machine limits to be completely ignored or used just for time estimator.
ConfigOptionEnum<MachineLimitsUsage> machine_limits_type;
ConfigOptionEnum<MachineLimitsUsage> machine_limits_usage;
// M201 X... Y... Z... E... [mm/sec^2]
ConfigOptionFloats machine_max_acceleration_x;
ConfigOptionFloats machine_max_acceleration_y;
Expand Down Expand Up @@ -643,7 +643,7 @@ class MachineEnvelopeConfig : public StaticPrintConfig
protected:
void initialize(StaticCacheBase &cache, const char *base_ptr)
{
OPT_PTR(machine_limits_type);
OPT_PTR(machine_limits_usage);
OPT_PTR(machine_max_acceleration_x);
OPT_PTR(machine_max_acceleration_y);
OPT_PTR(machine_max_acceleration_z);
Expand Down

0 comments on commit b42a12d

Please sign in to comment.