mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-09 07:56:24 -06:00
support klipper gcode flavor
This commit is contained in:
parent
ff760815ca
commit
cd71a86d3f
6 changed files with 24 additions and 13 deletions
|
@ -1636,7 +1636,11 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
m_config.pressure_advance.values.front());
|
m_config.pressure_advance.values.front());
|
||||||
} else {
|
} else {
|
||||||
if (m_config.enable_pressure_advance.value) {
|
if (m_config.enable_pressure_advance.value) {
|
||||||
file.write_format("M900 K%.3f ; Override pressure advance value\n",
|
if(print.config().gcode_flavor.value == gcfKlipper)
|
||||||
|
file.write_format("SET_PRESSURE_ADVANCE ADVANCE=%.3f ; Override pressure advance value\n",
|
||||||
|
m_config.pressure_advance.values.front());
|
||||||
|
else
|
||||||
|
file.write_format("M900 K%.3f ; Override pressure advance value\n",
|
||||||
m_config.pressure_advance.values.front());
|
m_config.pressure_advance.values.front());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,8 +99,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
WipeTowerWriter& disable_linear_advance() {
|
WipeTowerWriter& disable_linear_advance() {
|
||||||
m_gcode += (m_gcode_flavor == gcfRepRapSprinter || m_gcode_flavor == gcfRepRapFirmware
|
m_gcode += (m_gcode_flavor == gcfKlipper ? (std::string("SET_PRESSURE_ADVANCE ADVANCE=0\n"))
|
||||||
? (std::string("M572 D") + std::to_string(m_current_tool) + " S0\n")
|
|
||||||
: std::string("M900 K0\n"));
|
: std::string("M900 K0\n"));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ void GCodeWriter::apply_print_config(const PrintConfig &print_config)
|
||||||
{
|
{
|
||||||
this->config.apply(print_config, true);
|
this->config.apply(print_config, true);
|
||||||
m_single_extruder_multi_material = print_config.single_extruder_multi_material.value;
|
m_single_extruder_multi_material = print_config.single_extruder_multi_material.value;
|
||||||
bool is_marlin = print_config.gcode_flavor.value == gcfMarlinLegacy || print_config.gcode_flavor.value == gcfMarlinFirmware;
|
bool is_marlin = print_config.gcode_flavor.value == gcfMarlinLegacy || print_config.gcode_flavor.value == gcfMarlinFirmware || print_config.gcode_flavor.value == gcfKlipper;
|
||||||
m_max_acceleration = std::lrint(is_marlin ? print_config.machine_max_acceleration_extruding.values.front() : 0);
|
m_max_acceleration = std::lrint(is_marlin ? print_config.machine_max_acceleration_extruding.values.front() : 0);
|
||||||
m_max_jerk = std::lrint(is_marlin ? std::min(print_config.machine_max_jerk_x.values.front(), print_config.machine_max_jerk_y.values.front()) : 0);
|
m_max_jerk = std::lrint(is_marlin ? std::min(print_config.machine_max_jerk_x.values.front(), print_config.machine_max_jerk_y.values.front()) : 0);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,8 @@ std::string GCodeWriter::preamble()
|
||||||
FLAVOR_IS(gcfMarlinFirmware) ||
|
FLAVOR_IS(gcfMarlinFirmware) ||
|
||||||
FLAVOR_IS(gcfTeacup) ||
|
FLAVOR_IS(gcfTeacup) ||
|
||||||
FLAVOR_IS(gcfRepetier) ||
|
FLAVOR_IS(gcfRepetier) ||
|
||||||
FLAVOR_IS(gcfSmoothie))
|
FLAVOR_IS(gcfSmoothie) ||
|
||||||
|
FLAVOR_IS(gcfKlipper))
|
||||||
{
|
{
|
||||||
if (RELATIVE_E_AXIS) {
|
if (RELATIVE_E_AXIS) {
|
||||||
gcode << "M83 ; only support relative e\n";
|
gcode << "M83 ; only support relative e\n";
|
||||||
|
@ -196,7 +197,11 @@ std::string GCodeWriter::set_jerk_xy(unsigned int jerk)
|
||||||
m_last_jerk = jerk;
|
m_last_jerk = jerk;
|
||||||
|
|
||||||
std::ostringstream gcode;
|
std::ostringstream gcode;
|
||||||
gcode << "M205 X" << jerk << " Y" << jerk;
|
if(FLAVOR_IS(gcfKlipper))
|
||||||
|
gcode << "SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY=" << jerk;
|
||||||
|
else
|
||||||
|
gcode << "M205 X" << jerk << " Y" << jerk;
|
||||||
|
|
||||||
if (GCodeWriter::full_gcode_comment) gcode << " ; adjust jerk";
|
if (GCodeWriter::full_gcode_comment) gcode << " ; adjust jerk";
|
||||||
gcode << "\n";
|
gcode << "\n";
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,7 @@ static t_config_enum_values s_keys_map_GCodeFlavor {
|
||||||
{ "makerware", gcfMakerWare },
|
{ "makerware", gcfMakerWare },
|
||||||
{ "marlin2", gcfMarlinFirmware },
|
{ "marlin2", gcfMarlinFirmware },
|
||||||
{ "sailfish", gcfSailfish },
|
{ "sailfish", gcfSailfish },
|
||||||
|
{ "klipper", gcfKlipper },
|
||||||
{ "smoothie", gcfSmoothie },
|
{ "smoothie", gcfSmoothie },
|
||||||
{ "mach3", gcfMach3 },
|
{ "mach3", gcfMach3 },
|
||||||
{ "machinekit", gcfMachinekit },
|
{ "machinekit", gcfMachinekit },
|
||||||
|
@ -1529,7 +1530,7 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->tooltip = L("What kind of gcode the printer is compatible with");
|
def->tooltip = L("What kind of gcode the printer is compatible with");
|
||||||
def->enum_keys_map = &ConfigOptionEnum<GCodeFlavor>::get_enum_values();
|
def->enum_keys_map = &ConfigOptionEnum<GCodeFlavor>::get_enum_values();
|
||||||
def->enum_values.push_back("marlin");
|
def->enum_values.push_back("marlin");
|
||||||
//def->enum_values.push_back("reprap");
|
def->enum_values.push_back("klipper");
|
||||||
//def->enum_values.push_back("reprapfirmware");
|
//def->enum_values.push_back("reprapfirmware");
|
||||||
//def->enum_values.push_back("repetier");
|
//def->enum_values.push_back("repetier");
|
||||||
//def->enum_values.push_back("teacup");
|
//def->enum_values.push_back("teacup");
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
enum GCodeFlavor : unsigned char {
|
enum GCodeFlavor : unsigned char {
|
||||||
gcfMarlinLegacy, gcfRepRapSprinter, gcfRepRapFirmware, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlinFirmware, gcfSailfish, gcfMach3, gcfMachinekit,
|
gcfMarlinLegacy, gcfKlipper, gcfRepRapSprinter, gcfRepRapFirmware, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlinFirmware, gcfSailfish, gcfMach3, gcfMachinekit,
|
||||||
gcfSmoothie, gcfNoExtrusion,
|
gcfSmoothie, gcfNoExtrusion
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class FuzzySkinType {
|
enum class FuzzySkinType {
|
||||||
|
|
|
@ -3130,7 +3130,7 @@ 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
|
||||||
auto flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
|
auto flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
|
||||||
bool is_marlin_flavor = (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware);
|
bool is_marlin_flavor = (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfKlipper);
|
||||||
|
|
||||||
/* ! 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,
|
||||||
|
@ -3478,9 +3478,9 @@ void TabPrinter::toggle_options()
|
||||||
toggle_option("retract_restart_extra_toolchange", have_multiple_extruders && toolchange_retraction, i);
|
toggle_option("retract_restart_extra_toolchange", have_multiple_extruders && toolchange_retraction, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto gcf = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
|
||||||
if (m_active_page->title() == "Motion ability") {
|
if (m_active_page->title() == "Motion ability") {
|
||||||
assert(m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfMarlinLegacy
|
assert(gcf == gcfMarlinLegacy || gcf == gcfMarlinFirmware || gcf == gcfKlipper);
|
||||||
|| m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfMarlinFirmware);
|
|
||||||
bool silent_mode = m_config->opt_bool("silent_mode");
|
bool silent_mode = m_config->opt_bool("silent_mode");
|
||||||
int max_field = silent_mode ? 2 : 1;
|
int max_field = silent_mode ? 2 : 1;
|
||||||
//BBS: limits of BBL printer can't be edited.
|
//BBS: limits of BBL printer can't be edited.
|
||||||
|
@ -3512,7 +3512,9 @@ void TabPrinter::update_fff()
|
||||||
m_use_silent_mode = m_config->opt_bool("silent_mode");
|
m_use_silent_mode = m_config->opt_bool("silent_mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool supports_travel_acceleration = (m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfMarlinFirmware);
|
auto gcf_ =
|
||||||
|
m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
|
||||||
|
bool supports_travel_acceleration = (gcf_ == gcfMarlinFirmware || gcf_ == gcfMarlinLegacy || gcf_ == gcfKlipper);
|
||||||
if (m_supports_travel_acceleration != supports_travel_acceleration) {
|
if (m_supports_travel_acceleration != supports_travel_acceleration) {
|
||||||
m_rebuild_kinematics_page = true;
|
m_rebuild_kinematics_page = true;
|
||||||
m_supports_travel_acceleration = supports_travel_acceleration;
|
m_supports_travel_acceleration = supports_travel_acceleration;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue