Trying to implement a klipper-friendly profile.

remove M300, M907
using SET_PRESSURE_ADVANCE, PAUSE, ACTIVATE_EXTRUDER instead of g-code
maybe it's not a good idea...
This commit is contained in:
supermerill 2020-01-14 18:47:57 +01:00
parent 088c62246b
commit 873e4fea31
7 changed files with 26 additions and 8 deletions

View File

@ -1373,7 +1373,8 @@ void GCode::_do_export(Print &print, FILE *file)
bbox_prime.offset(0.5f); bbox_prime.offset(0.5f);
// Beep for 500ms, tone 800Hz. Yet better, play some Morse. // Beep for 500ms, tone 800Hz. Yet better, play some Morse.
_write(file, this->retract()); _write(file, this->retract());
_write(file, "M300 S800 P500\n"); if(print.config().gcode_flavor.value != gcfKlipper)
_write(file, "M300 S800 P500\n");
if (bbox_prime.overlap(bbox_print)) { if (bbox_prime.overlap(bbox_print)) {
// Wait for the user to remove the priming extrusions, otherwise they would // Wait for the user to remove the priming extrusions, otherwise they would
// get covered by the print. // get covered by the print.
@ -1888,7 +1889,10 @@ void GCode::process_layer(
// && !MMU1 // && !MMU1
) { ) {
//! FIXME_in_fw show message during print pause //! FIXME_in_fw show message during print pause
gcode += "M601\n"; // pause print if (print.config().gcode_flavor.value == gcfKlipper)
gcode += "PAUSE\n";
else
gcode += "M601\n"; // pause print
gcode += "M117 Change filament for Extruder " + std::to_string(m600_before_extruder) + "\n"; gcode += "M117 Change filament for Extruder " + std::to_string(m600_before_extruder) + "\n";
} }
else else

View File

@ -102,7 +102,12 @@ public:
} }
WipeTowerWriter& disable_linear_advance() { WipeTowerWriter& disable_linear_advance() {
m_gcode += (m_gcode_flavor == gcfRepRap ? std::string("M572 D0 S0\n") : std::string("M900 K0\n")); if(m_gcode_flavor == gcfRepRap)
m_gcode += std::string("M572 D0 S0\n");
else if(m_gcode_flavor == gcfKlipper)
m_gcode += std::string("SET_PRESSURE_ADVANCE ADVANCE=0\n");
else
m_gcode += std::string("M900 K0\n");
return *this; return *this;
} }
@ -399,6 +404,8 @@ public:
// Set digital trimpot motor // Set digital trimpot motor
WipeTowerWriter& set_extruder_trimpot(int current) WipeTowerWriter& set_extruder_trimpot(int current)
{ {
if (m_gcode_flavor == gcfKlipper)
return *this;
if (m_gcode_flavor == gcfRepRap) if (m_gcode_flavor == gcfRepRap)
m_gcode += "M906 E"; m_gcode += "M906 E";
else else

View File

@ -1195,6 +1195,7 @@ namespace Slic3r {
// see: http://reprap.org/wiki/G-code#G4:_Dwell // see: http://reprap.org/wiki/G-code#G4:_Dwell
if ((dialect == gcfRepetier) || if ((dialect == gcfRepetier) ||
(dialect == gcfMarlin) || (dialect == gcfMarlin) ||
(dialect == gcfKlipper) ||
(dialect == gcfSmoothie) || (dialect == gcfSmoothie) ||
(dialect == gcfRepRap)) (dialect == gcfRepRap))
{ {

View File

@ -19,7 +19,7 @@ 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 = (print_config.gcode_flavor.value == gcfMarlin) ? m_max_acceleration = (print_config.gcode_flavor.value == gcfMarlin || print_config.gcode_flavor.value == gcfKlipper) ?
print_config.machine_max_acceleration_extruding.values.front() : 0; print_config.machine_max_acceleration_extruding.values.front() : 0;
} }
@ -44,7 +44,8 @@ std::string GCodeWriter::preamble()
gcode << "G21 ; set units to millimeters\n"; gcode << "G21 ; set units to millimeters\n";
gcode << "G90 ; use absolute coordinates\n"; gcode << "G90 ; use absolute coordinates\n";
} }
if (FLAVOR_IS(gcfRepRap) || FLAVOR_IS(gcfMarlin) || FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfRepetier) || FLAVOR_IS(gcfSmoothie)) { if (FLAVOR_IS(gcfRepRap) || FLAVOR_IS(gcfMarlin) || FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfRepetier) || FLAVOR_IS(gcfSmoothie)
|| FLAVOR_IS(gcfKlipper)) {
if (this->config.use_relative_e_distances) { if (this->config.use_relative_e_distances) {
gcode << "M83 ; use relative distances for extrusion\n"; gcode << "M83 ; use relative distances for extrusion\n";
} else { } else {
@ -241,7 +242,8 @@ std::string GCodeWriter::update_progress(unsigned int num, unsigned int tot, boo
std::string GCodeWriter::toolchange_prefix() const std::string GCodeWriter::toolchange_prefix() const
{ {
return FLAVOR_IS(gcfMakerWare) ? "M135 T" : return FLAVOR_IS(gcfMakerWare) ? "M135 T" :
FLAVOR_IS(gcfSailfish) ? "M108 T" : "T"; FLAVOR_IS(gcfSailfish) ? "M108 T" :
FLAVOR_IS(gcfKlipper) ? "ACTIVATE_EXTRUDER EXTRUDER=extruder" : "T";
} }
std::string GCodeWriter::toolchange(unsigned int extruder_id) std::string GCodeWriter::toolchange(unsigned int extruder_id)

View File

@ -1278,7 +1278,8 @@ std::string Print::validate() const
"and use filaments of the same diameter."); "and use filaments of the same diameter.");
} }
if (m_config.gcode_flavor != gcfRepRap && m_config.gcode_flavor != gcfRepetier && m_config.gcode_flavor != gcfMarlin) if (m_config.gcode_flavor != gcfRepRap && m_config.gcode_flavor != gcfRepetier && m_config.gcode_flavor != gcfMarlin
&& m_config.gcode_flavor != gcfKlipper)
return L("The Wipe Tower is currently only supported for the Marlin, RepRap/Sprinter and Repetier G-code flavors."); return L("The Wipe Tower is currently only supported for the Marlin, RepRap/Sprinter 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

@ -1390,6 +1390,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("klipper");
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");
@ -1400,6 +1401,7 @@ void PrintConfigDef::init_fff_params()
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");
def->enum_labels.push_back("Klipper");
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");

View File

@ -42,7 +42,7 @@ enum WipeAlgo {
}; };
enum GCodeFlavor : unsigned char { enum GCodeFlavor : unsigned char {
gcfRepRap, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlin, gcfSailfish, gcfMach3, gcfMachinekit, gcfRepRap, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlin, gcfKlipper, gcfSailfish, gcfMach3, gcfMachinekit,
gcfSmoothie, gcfNoExtrusion, gcfSmoothie, gcfNoExtrusion,
}; };
@ -129,6 +129,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["klipper"] = gcfKlipper;
keys_map["sailfish"] = gcfSailfish; keys_map["sailfish"] = gcfSailfish;
keys_map["smoothie"] = gcfSmoothie; keys_map["smoothie"] = gcfSmoothie;
keys_map["mach3"] = gcfMach3; keys_map["mach3"] = gcfMach3;