Duplicated Marlin firmware flavor to 'Marlin (legacy)' and 'Marlin Firmware'

The two flavors should be identical after this commit, except that GCodeProcessor.cpp was not updated. This shall be done in a later step.
This commit is contained in:
Lukas Matena 2021-03-30 12:46:09 +02:00
parent 7fb9610d3a
commit 151a76ee92
7 changed files with 23 additions and 12 deletions

View File

@ -784,7 +784,8 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessor::Result* re
namespace DoExport { namespace DoExport {
static void init_gcode_processor(const PrintConfig& config, GCodeProcessor& processor, bool& silent_time_estimator_enabled) static void init_gcode_processor(const PrintConfig& config, GCodeProcessor& processor, bool& silent_time_estimator_enabled)
{ {
silent_time_estimator_enabled = (config.gcode_flavor == gcfMarlin) && config.silent_mode; silent_time_estimator_enabled = (config.gcode_flavor == gcfMarlin || config.gcode_flavor == gcfMarlinFirmware)
&& config.silent_mode;
processor.reset(); processor.reset();
processor.apply_config(config); processor.apply_config(config);
processor.enable_stealth_time_estimator(silent_time_estimator_enabled); processor.enable_stealth_time_estimator(silent_time_estimator_enabled);
@ -1355,7 +1356,7 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
bbox_prime.offset(0.5f); bbox_prime.offset(0.5f);
bool overlap = bbox_prime.overlap(bbox_print); bool overlap = bbox_prime.overlap(bbox_print);
if (print.config().gcode_flavor == gcfMarlin) { if (print.config().gcode_flavor == gcfMarlin || print.config().gcode_flavor == gcfMarlinFirmware) {
_write(file, this->retract()); _write(file, this->retract());
_write(file, "M300 S800 P500\n"); // Beep for 500ms, tone 800Hz. _write(file, "M300 S800 P500\n"); // Beep for 500ms, tone 800Hz.
if (overlap) { if (overlap) {
@ -1558,7 +1559,8 @@ 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. // 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) void GCode::print_machine_envelope(FILE *file, Print &print)
{ {
if (print.config().gcode_flavor.value == gcfMarlin && print.config().machine_limits_usage.value == MachineLimitsUsage::EmitToGCode) { if ((print.config().gcode_flavor.value == gcfMarlin || print.config().gcode_flavor.value == gcfMarlinFirmware)
&& 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", 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_x.values.front() + 0.5),
int(print.config().machine_max_acceleration_y.values.front() + 0.5), int(print.config().machine_max_acceleration_y.values.front() + 0.5),

View File

@ -342,7 +342,7 @@ public:
WipeTowerWriter& speed_override_backup() WipeTowerWriter& speed_override_backup()
{ {
// This is only supported by Prusa at this point (https://github.com/prusa3d/PrusaSlicer/issues/3114) // This is only supported by Prusa at this point (https://github.com/prusa3d/PrusaSlicer/issues/3114)
if (m_gcode_flavor == gcfMarlin) if (m_gcode_flavor == gcfMarlin || m_gcode_flavor == gcfMarlinFirmware)
m_gcode += "M220 B\n"; m_gcode += "M220 B\n";
return *this; return *this;
} }
@ -350,7 +350,7 @@ public:
// Let the firmware restore the active speed override value. // Let the firmware restore the active speed override value.
WipeTowerWriter& speed_override_restore() WipeTowerWriter& speed_override_restore()
{ {
if (m_gcode_flavor == gcfMarlin) if (m_gcode_flavor == gcfMarlin || m_gcode_flavor == gcfMarlinFirmware)
m_gcode += "M220 R\n"; m_gcode += "M220 R\n";
return *this; return *this;
} }

View File

@ -20,7 +20,8 @@ void GCodeWriter::apply_print_config(const PrintConfig &print_config)
this->config.apply(print_config, true); this->config.apply(print_config, true);
m_extrusion_axis = this->config.get_extrusion_axis(); m_extrusion_axis = this->config.get_extrusion_axis();
m_single_extruder_multi_material = print_config.single_extruder_multi_material.value; 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_usage.value == MachineLimitsUsage::EmitToGCode) ? bool is_marlin = print_config.gcode_flavor.value == gcfMarlin || print_config.gcode_flavor.value == gcfMarlinFirmware;
m_max_acceleration = std::lrint((is_marlin && print_config.machine_limits_usage.value == MachineLimitsUsage::EmitToGCode) ?
print_config.machine_max_acceleration_extruding.values.front() : 0); print_config.machine_max_acceleration_extruding.values.front() : 0);
} }
@ -49,6 +50,7 @@ std::string GCodeWriter::preamble()
if (FLAVOR_IS(gcfRepRapSprinter) || if (FLAVOR_IS(gcfRepRapSprinter) ||
FLAVOR_IS(gcfRepRapFirmware) || FLAVOR_IS(gcfRepRapFirmware) ||
FLAVOR_IS(gcfMarlin) || FLAVOR_IS(gcfMarlin) ||
FLAVOR_IS(gcfMarlinFirmware) ||
FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfTeacup) ||
FLAVOR_IS(gcfRepetier) || FLAVOR_IS(gcfRepetier) ||
FLAVOR_IS(gcfSmoothie)) FLAVOR_IS(gcfSmoothie))

View File

@ -1293,7 +1293,7 @@ std::string Print::validate(std::string* warning) const
} }
if (m_config.gcode_flavor != gcfRepRapSprinter && m_config.gcode_flavor != gcfRepRapFirmware && if (m_config.gcode_flavor != gcfRepRapSprinter && m_config.gcode_flavor != gcfRepRapFirmware &&
m_config.gcode_flavor != gcfRepetier && m_config.gcode_flavor != gcfMarlin) m_config.gcode_flavor != gcfRepetier && m_config.gcode_flavor != gcfMarlin && m_config.gcode_flavor != gcfMarlinFirmware)
return L("The Wipe Tower is currently only supported for the Marlin, RepRap/Sprinter, RepRapFirmware and Repetier G-code flavors."); return L("The Wipe Tower is currently only supported for the Marlin, RepRap/Sprinter, RepRapFirmware and Repetier G-code flavors.");
if (! m_config.use_relative_e_distances) if (! m_config.use_relative_e_distances)
return L("The Wipe Tower is currently only supported with the relative extruder addressing (use_relative_e_distances=1)."); return L("The Wipe Tower is currently only supported with the relative extruder addressing (use_relative_e_distances=1).");

View File

@ -1103,6 +1103,7 @@ void PrintConfigDef::init_fff_params()
def->enum_values.push_back("teacup"); def->enum_values.push_back("teacup");
def->enum_values.push_back("makerware"); def->enum_values.push_back("makerware");
def->enum_values.push_back("marlin"); def->enum_values.push_back("marlin");
def->enum_values.push_back("marlinfirmware");
def->enum_values.push_back("sailfish"); def->enum_values.push_back("sailfish");
def->enum_values.push_back("mach3"); def->enum_values.push_back("mach3");
def->enum_values.push_back("machinekit"); def->enum_values.push_back("machinekit");
@ -1113,7 +1114,8 @@ void PrintConfigDef::init_fff_params()
def->enum_labels.push_back("Repetier"); def->enum_labels.push_back("Repetier");
def->enum_labels.push_back("Teacup"); def->enum_labels.push_back("Teacup");
def->enum_labels.push_back("MakerWare (MakerBot)"); def->enum_labels.push_back("MakerWare (MakerBot)");
def->enum_labels.push_back("Marlin"); def->enum_labels.push_back("Marlin (legacy)");
def->enum_labels.push_back("Marlin Firmware");
def->enum_labels.push_back("Sailfish (MakerBot)"); def->enum_labels.push_back("Sailfish (MakerBot)");
def->enum_labels.push_back("Mach3/LinuxCNC"); def->enum_labels.push_back("Mach3/LinuxCNC");
def->enum_labels.push_back("Machinekit"); def->enum_labels.push_back("Machinekit");
@ -3631,6 +3633,7 @@ std::string FullPrintConfig::validate()
this->gcode_flavor.value != gcfRepRapSprinter && this->gcode_flavor.value != gcfRepRapSprinter &&
this->gcode_flavor.value != gcfRepRapFirmware && this->gcode_flavor.value != gcfRepRapFirmware &&
this->gcode_flavor.value != gcfMarlin && this->gcode_flavor.value != gcfMarlin &&
this->gcode_flavor.value != gcfMarlinFirmware &&
this->gcode_flavor.value != gcfMachinekit && this->gcode_flavor.value != gcfMachinekit &&
this->gcode_flavor.value != gcfRepetier) this->gcode_flavor.value != gcfRepetier)
return "--use-firmware-retraction is only supported by Marlin, Smoothie, RepRapFirmware, Repetier and Machinekit firmware"; return "--use-firmware-retraction is only supported by Marlin, Smoothie, RepRapFirmware, Repetier and Machinekit firmware";

View File

@ -24,7 +24,7 @@
namespace Slic3r { namespace Slic3r {
enum GCodeFlavor : unsigned char { enum GCodeFlavor : unsigned char {
gcfRepRapSprinter, gcfRepRapFirmware, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlin, gcfSailfish, gcfMach3, gcfMachinekit, gcfRepRapSprinter, gcfRepRapFirmware, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlin, gcfMarlinFirmware, gcfSailfish, gcfMach3, gcfMachinekit,
gcfSmoothie, gcfNoExtrusion, gcfSmoothie, gcfNoExtrusion,
}; };
@ -121,6 +121,7 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<GCodeFlavor>::get
keys_map["teacup"] = gcfTeacup; keys_map["teacup"] = gcfTeacup;
keys_map["makerware"] = gcfMakerWare; keys_map["makerware"] = gcfMakerWare;
keys_map["marlin"] = gcfMarlin; keys_map["marlin"] = gcfMarlin;
keys_map["marlinfirmware"] = gcfMarlinFirmware;
keys_map["sailfish"] = gcfSailfish; keys_map["sailfish"] = gcfSailfish;
keys_map["smoothie"] = gcfSmoothie; keys_map["smoothie"] = gcfSmoothie;
keys_map["mach3"] = gcfMach3; keys_map["mach3"] = gcfMach3;

View File

@ -2582,7 +2582,8 @@ PageShp TabPrinter::build_kinematics_page()
void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/) void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/)
{ {
size_t n_before_extruders = 2; // Count of pages before Extruder pages size_t n_before_extruders = 2; // Count of pages before Extruder pages
bool is_marlin_flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfMarlin; auto flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
bool is_marlin_flavor = (flavor == gcfMarlin || flavor == gcfMarlinFirmware);
/* ! Freeze/Thaw in this function is needed to avoid call OnPaint() for erased pages /* ! Freeze/Thaw in this function is needed to avoid call OnPaint() for erased pages
* and be cause of application crash, when try to change Preset in moment, * and be cause of application crash, when try to change Preset in moment,
@ -2852,7 +2853,8 @@ void TabPrinter::toggle_options()
if (m_active_page->title() == "General") { if (m_active_page->title() == "General") {
toggle_option("single_extruder_multi_material", have_multiple_extruders); toggle_option("single_extruder_multi_material", have_multiple_extruders);
bool is_marlin_flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfMarlin; auto flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
bool is_marlin_flavor = flavor == gcfMarlin || flavor == gcfMarlinFirmware;
// Disable silent mode for non-marlin firmwares. // Disable silent mode for non-marlin firmwares.
toggle_option("silent_mode", is_marlin_flavor); toggle_option("silent_mode", is_marlin_flavor);
} }
@ -2920,7 +2922,8 @@ void TabPrinter::toggle_options()
} }
if (m_active_page->title() == "Machine limits" && m_machine_limits_description_line) { if (m_active_page->title() == "Machine limits" && m_machine_limits_description_line) {
assert(m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfMarlin); assert(m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfMarlin
|| m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfMarlinFirmware);
const auto *machine_limits_usage = m_config->option<ConfigOptionEnum<MachineLimitsUsage>>("machine_limits_usage"); const auto *machine_limits_usage = m_config->option<ConfigOptionEnum<MachineLimitsUsage>>("machine_limits_usage");
bool enabled = machine_limits_usage->value != MachineLimitsUsage::Ignore; bool enabled = machine_limits_usage->value != MachineLimitsUsage::Ignore;
bool silent_mode = m_config->opt_bool("silent_mode"); bool silent_mode = m_config->opt_bool("silent_mode");