From 187ff619bb596db84ab27dde9c13ad342be3d296 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 13 Nov 2023 16:49:48 +0100 Subject: [PATCH] Added a dialog informing the users that they need updated firmware when exporting binary gcode --- src/slic3r/GUI/Plater.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index e1dd6bf1a7..345108e9a9 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -6713,7 +6713,7 @@ void Plater::apply_cut_object_to_model(size_t obj_idx, const ModelObjectPtrs& ne -wxString check_binary_vs_ascii_gcode_extension(PrinterTechnology pt, const std::string& ext, bool binary_output) +static wxString check_binary_vs_ascii_gcode_extension(PrinterTechnology pt, const std::string& ext, bool binary_output) { wxString err_out; if (pt == ptFFF) { @@ -6737,6 +6737,33 @@ wxString check_binary_vs_ascii_gcode_extension(PrinterTechnology pt, const std:: +// This function should be deleted when binary G-codes become more common. The dialog is there to make the +// transition period easier for the users, because bgcode files are not recognized by older firmwares +// without any error message. +static void alert_when_exporting_binary_gcode(bool binary_output, const std::string& printer_notes) +{ + if (boost::algorithm::contains(printer_notes, "PRINTER_VENDOR_PRUSA3D") + && (boost::algorithm::contains(printer_notes, "PRINTER_MODEL_XL") + || boost::algorithm::contains(printer_notes, "PRINTER_MODEL_MINI") + || boost::algorithm::contains(printer_notes, "PRINTER_MODEL_MK4"))) + { + AppConfig* app_config = wxGetApp().app_config; + wxWindow* parent = wxGetApp().mainframe; + const std::string option_key = "dont_warn_about_firmware_version_when_exporting_binary_gcode"; + + if (app_config->get(option_key) != "1") { + RichMessageDialog dialog(parent, _L("You are exporting binary G-code for a Prusa printer. Please, make sure that your printer " + "is running firmware version 5.1.0-alpha2 or later. Older firmwares are not able to handle binary G-codes."), + _L("Exporting binary G-code"), wxICON_WARNING | wxOK); + dialog.ShowCheckBox(_L("Don't show again")); + if (dialog.ShowModal() == wxID_OK && dialog.IsCheckBoxChecked()) + app_config->set(option_key, "1"); + } + } +} + + + void Plater::export_gcode(bool prefer_removable) { if (p->model.objects.empty()) @@ -6823,6 +6850,9 @@ void Plater::export_gcode(bool prefer_removable) } } #endif + alert_when_exporting_binary_gcode(wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_bool("gcode_binary"), + wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_string("printer_notes")); + } } @@ -7380,6 +7410,9 @@ void Plater::send_gcode() } } + alert_when_exporting_binary_gcode(wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_bool("gcode_binary"), + wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_string("printer_notes")); + upload_job.upload_data.upload_path = dlg.filename(); upload_job.upload_data.post_action = dlg.post_action(); upload_job.upload_data.group = dlg.group();