Klipper: Adding the new firmware flavor:

- added the new option
- allowed machine limits page
- added a check for Klipper + 'emit limits to gcode' (Print::validate so far)
This commit is contained in:
Lukas Matena 2023-03-09 14:05:04 +01:00
parent 3ff600bed0
commit 42f1217f6e
4 changed files with 13 additions and 5 deletions

View file

@ -502,6 +502,10 @@ std::string Print::validate(std::string* warning) const
return _u8L("The Spiral Vase option can only be used when printing single material objects."); return _u8L("The Spiral Vase option can only be used when printing single material objects.");
} }
if (m_config.machine_limits_usage == MachineLimitsUsage::EmitToGCode && m_config.gcode_flavor == gcfKlipper)
return L("Machine limits cannot be emitted to G-Code when Klipper firmware flavor is used. "
"Change the value of machine_limits_usage.");
// Cache of layer height profiles for checking: // Cache of layer height profiles for checking:
// 1) Whether all layers are synchronized if printing with wipe tower and / or unsynchronized supports. // 1) Whether all layers are synchronized if printing with wipe tower and / or unsynchronized supports.
// 2) Whether layer height is constant for Organic supports. // 2) Whether layer height is constant for Organic supports.

View file

@ -48,6 +48,7 @@ static const t_config_enum_values s_keys_map_GCodeFlavor {
{ "makerware", gcfMakerWare }, { "makerware", gcfMakerWare },
{ "marlin", gcfMarlinLegacy }, { "marlin", gcfMarlinLegacy },
{ "marlin2", gcfMarlinFirmware }, { "marlin2", gcfMarlinFirmware },
{ "klipper", gcfKlipper },
{ "sailfish", gcfSailfish }, { "sailfish", gcfSailfish },
{ "smoothie", gcfSmoothie }, { "smoothie", gcfSmoothie },
{ "mach3", gcfMach3 }, { "mach3", gcfMach3 },
@ -1406,6 +1407,7 @@ void PrintConfigDef::init_fff_params()
{ "makerware", "MakerWare (MakerBot)" }, { "makerware", "MakerWare (MakerBot)" },
{ "marlin", "Marlin (legacy)" }, { "marlin", "Marlin (legacy)" },
{ "marlin2", "Marlin 2" }, { "marlin2", "Marlin 2" },
{ "klipper", "Klipper" },
{ "sailfish", "Sailfish (MakerBot)" }, { "sailfish", "Sailfish (MakerBot)" },
{ "mach3", "Mach3/LinuxCNC" }, { "mach3", "Mach3/LinuxCNC" },
{ "machinekit", "Machinekit" }, { "machinekit", "Machinekit" },
@ -4421,8 +4423,9 @@ std::string validate(const FullPrintConfig &cfg)
cfg.gcode_flavor.value != gcfMarlinLegacy && cfg.gcode_flavor.value != gcfMarlinLegacy &&
cfg.gcode_flavor.value != gcfMarlinFirmware && cfg.gcode_flavor.value != gcfMarlinFirmware &&
cfg.gcode_flavor.value != gcfMachinekit && cfg.gcode_flavor.value != gcfMachinekit &&
cfg.gcode_flavor.value != gcfRepetier) cfg.gcode_flavor.value != gcfRepetier &&
return "--use-firmware-retraction is only supported by Marlin, Smoothie, RepRapFirmware, Repetier and Machinekit firmware"; cfg.gcode_flavor.value != gcfKlipper)
return "--use-firmware-retraction is only supported by Marlin, Klipper, Smoothie, RepRapFirmware, Repetier and Machinekit firmware";
if (cfg.use_firmware_retraction.value) if (cfg.use_firmware_retraction.value)
for (unsigned char wipe : cfg.wipe.values) for (unsigned char wipe : cfg.wipe.values)

View file

@ -32,7 +32,7 @@
namespace Slic3r { namespace Slic3r {
enum GCodeFlavor : unsigned char { enum GCodeFlavor : unsigned char {
gcfRepRapSprinter, gcfRepRapFirmware, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlinLegacy, gcfMarlinFirmware, gcfSailfish, gcfMach3, gcfMachinekit, gcfRepRapSprinter, gcfRepRapFirmware, gcfRepetier, gcfTeacup, gcfMakerWare, gcfMarlinLegacy, gcfMarlinFirmware, gcfKlipper, gcfSailfish, gcfMach3, gcfMachinekit,
gcfSmoothie, gcfNoExtrusion, gcfSmoothie, gcfNoExtrusion,
}; };

View file

@ -2866,7 +2866,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 show_mach_limits = (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfRepRapFirmware); bool show_mach_limits = (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfRepRapFirmware || 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,
@ -3102,7 +3102,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(flavor == gcfMarlinLegacy assert(flavor == gcfMarlinLegacy
|| flavor == gcfMarlinFirmware || flavor == gcfMarlinFirmware
|| flavor == gcfRepRapFirmware); || flavor == gcfRepRapFirmware
|| flavor == gcfKlipper);
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");