mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 09:02:06 +00:00
Add Repetier Gcode Flavor as option (#13126)
* Fixed PrintConfig.hpp order so Repetier outputs, updated ConfigWizard to use gcode_flavor value rather than static Add Repetier to enum values and labels Update to add Repetier base profile to the setup wizard Re-order gcode_flavors in PrintConfig.hpp and PrintConfig.cpp to match Revise ConfigWizard.cpp to use gcode_flavor rather than list order Add Repetier profiles and include in custom.json (profile disables m73 and stop emit machine limits which Repetier doesn't use) * Fix JSON formatting in Custom.json * Add support for pressure advance in Repetier flavor * Add Repetier flavor show motion ability tab is visible * Refactor jerk handling for Repetier flavor * Update resources/profiles/Custom/machine/MyRepetier 0.4 nozzle.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update resources/profiles/Custom/machine/fdm_repetier_common.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/libslic3r/PrintConfig.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * add back localisation flag for Klipper * tidy up indentation and braces * Space indentation for Repetier profiles changed to tab * Fix space indentation in Custom.json file for Repetier profiles --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ian Bassi <ian.bassi@outlook.com> Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
@@ -267,6 +267,21 @@ std::string GCodeWriter::set_jerk_xy(double jerk)
|
||||
jerk = m_max_jerk_y;
|
||||
|
||||
gcode << "SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY=" << jerk;
|
||||
|
||||
} else if (FLAVOR_IS(gcfRepetier)) {
|
||||
// Repetier uses M207 for temporary Jerk and combines X/Y into a single 'X' parameter.
|
||||
double jerk_xy = jerk;
|
||||
|
||||
// Clamp against the X machine limit
|
||||
if (m_max_jerk_x > 0 && jerk_xy > m_max_jerk_x)
|
||||
jerk_xy = m_max_jerk_x;
|
||||
|
||||
// Clamp against the Y machine limit as well to be safe
|
||||
if (m_max_jerk_y > 0 && jerk_xy > m_max_jerk_y)
|
||||
jerk_xy = m_max_jerk_y;
|
||||
|
||||
// Output the lowest safe limit using ONLY the X parameter
|
||||
gcode << "M207 X" << jerk_xy;
|
||||
} else {
|
||||
double jerk_x = jerk;
|
||||
double jerk_y = jerk;
|
||||
@@ -278,7 +293,7 @@ std::string GCodeWriter::set_jerk_xy(double jerk)
|
||||
|
||||
gcode << "M205 X" << jerk_x << " Y" << jerk_y;
|
||||
}
|
||||
|
||||
//the is_bbl check should be in the else statement above so that it doesn't inadverently added Z & E to klipper
|
||||
if (m_is_bbl_printers)
|
||||
gcode << std::setprecision(2) << " Z" << m_max_jerk_z << " E" << m_max_jerk_e;
|
||||
|
||||
@@ -365,6 +380,10 @@ std::string GCodeWriter::set_pressure_advance(double pa) const
|
||||
gcode << "SET_PRESSURE_ADVANCE ADVANCE=" << std::setprecision(4) << pa << "; Override pressure advance value\n";
|
||||
else if(FLAVOR_IS(gcfRepRapFirmware))
|
||||
gcode << ("M572 D0 S") << std::setprecision(4) << pa << "; Override pressure advance value\n";
|
||||
else if (FLAVOR_IS(gcfRepetier))
|
||||
// Repetier M233: X is quadratic (K), Y is linear (L).
|
||||
// Applying the value to both parameters simultaneously.
|
||||
gcode << "M233 X" << std::setprecision(4) << pa << " Y" << std::setprecision(4) << pa << " ; Override pressure advance value\n";
|
||||
else
|
||||
gcode << "M900 K" <<std::setprecision(4)<< pa << "; Override pressure advance value\n";
|
||||
}
|
||||
|
||||
@@ -141,14 +141,14 @@ CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(AuthorizationType)
|
||||
|
||||
static t_config_enum_values s_keys_map_GCodeFlavor {
|
||||
{ "marlin", gcfMarlinLegacy },
|
||||
{ "reprap", gcfRepRapSprinter },
|
||||
{ "klipper", gcfKlipper },
|
||||
{ "reprapfirmware", gcfRepRapFirmware },
|
||||
{ "repetier", gcfRepetier },
|
||||
{ "marlin2", gcfMarlinFirmware },
|
||||
{ "reprap", gcfRepRapSprinter },
|
||||
{ "teacup", gcfTeacup },
|
||||
{ "makerware", gcfMakerWare },
|
||||
{ "marlin2", gcfMarlinFirmware },
|
||||
{ "sailfish", gcfSailfish },
|
||||
{ "klipper", gcfKlipper },
|
||||
{ "smoothie", gcfSmoothie },
|
||||
{ "mach3", gcfMach3 },
|
||||
{ "machinekit", gcfMachinekit },
|
||||
@@ -3706,10 +3706,11 @@ void PrintConfigDef::init_fff_params()
|
||||
def->enum_values.push_back("marlin");
|
||||
def->enum_values.push_back("klipper");
|
||||
def->enum_values.push_back("reprapfirmware");
|
||||
//def->enum_values.push_back("repetier");
|
||||
def->enum_values.push_back("repetier");
|
||||
def->enum_values.push_back("marlin2");
|
||||
//def->enum_values.push_back("reprap");
|
||||
//def->enum_values.push_back("teacup");
|
||||
//def->enum_values.push_back("makerware");
|
||||
def->enum_values.push_back("marlin2");
|
||||
//def->enum_values.push_back("sailfish");
|
||||
//def->enum_values.push_back("mach3");
|
||||
//def->enum_values.push_back("machinekit");
|
||||
@@ -3718,11 +3719,11 @@ void PrintConfigDef::init_fff_params()
|
||||
def->enum_labels.push_back("Marlin(legacy)");
|
||||
def->enum_labels.push_back(L("Klipper"));
|
||||
def->enum_labels.push_back("RepRapFirmware");
|
||||
def->enum_labels.push_back("Repetier");
|
||||
def->enum_labels.push_back("Marlin 2");
|
||||
//def->enum_labels.push_back("RepRap/Sprinter");
|
||||
//def->enum_labels.push_back("Repetier");
|
||||
//def->enum_labels.push_back("Teacup");
|
||||
//def->enum_labels.push_back("MakerWare (MakerBot)");
|
||||
def->enum_labels.push_back("Marlin 2");
|
||||
//def->enum_labels.push_back("Sailfish (MakerBot)");
|
||||
//def->enum_labels.push_back("Mach3/LinuxCNC");
|
||||
//def->enum_labels.push_back("Machinekit");
|
||||
|
||||
@@ -31,8 +31,19 @@
|
||||
namespace Slic3r {
|
||||
|
||||
enum GCodeFlavor : unsigned char {
|
||||
gcfMarlinLegacy, gcfKlipper, gcfRepRapFirmware, gcfMarlinFirmware, gcfRepRapSprinter, gcfRepetier, gcfTeacup, gcfMakerWare, gcfSailfish, gcfMach3, gcfMachinekit,
|
||||
gcfSmoothie, gcfNoExtrusion
|
||||
gcfMarlinLegacy,
|
||||
gcfKlipper,
|
||||
gcfRepRapFirmware,
|
||||
gcfRepetier,
|
||||
gcfMarlinFirmware,
|
||||
gcfRepRapSprinter,
|
||||
gcfTeacup,
|
||||
gcfMakerWare,
|
||||
gcfSailfish,
|
||||
gcfMach3,
|
||||
gcfMachinekit,
|
||||
gcfSmoothie,
|
||||
gcfNoExtrusion
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1253,9 +1253,19 @@ PageFirmware::PageFirmware(ConfigWizard *parent)
|
||||
void PageFirmware::apply_custom_config(DynamicPrintConfig &config)
|
||||
{
|
||||
auto sel = gcode_picker->GetSelection();
|
||||
if (sel >= 0 && (size_t)sel < gcode_opt.enum_labels.size()) {
|
||||
auto *opt = new ConfigOptionEnum<GCodeFlavor>(static_cast<GCodeFlavor>(sel));
|
||||
config.set_key_value("gcode_flavor", opt);
|
||||
|
||||
// Safety check: ensure selection index is within bounds
|
||||
if (sel >= 0 && (size_t) sel < gcode_opt.enum_values.size()) {
|
||||
std::string selected_flavor_str = gcode_opt.enum_values[sel];
|
||||
// Ensure the default value exists to prevent null pointer crashes
|
||||
if (gcode_opt.default_value) {
|
||||
//Clone the fully initialized option (preserves the dictionary map)
|
||||
ConfigOption* opt = gcode_opt.default_value->clone();
|
||||
// Deserialize the string safely
|
||||
opt->deserialize(selected_flavor_str);
|
||||
// Save it to the printer configuration
|
||||
config.set_key_value("gcode_flavor", opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4851,7 +4851,7 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/)
|
||||
{
|
||||
size_t n_before_extruders = 2; // Count of pages before Extruder pages
|
||||
auto flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
|
||||
bool is_marlin_flavor = (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfKlipper || flavor == gcfRepRapFirmware);
|
||||
bool is_marlin_flavor = (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfKlipper || flavor == gcfRepRapFirmware || flavor == gcfRepetier);
|
||||
|
||||
/* ! 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,
|
||||
|
||||
Reference in New Issue
Block a user