mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-17 05:52:39 +00:00
fix: make model_id/dev_type optional instead of blocking
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "libslic3r/Print.hpp"
|
||||
|
||||
#include "DeviceCore/DevConfig.h"
|
||||
#include "DeviceCore/DevConfigUtil.h"
|
||||
#include "DeviceCore/DevExtruderSystem.h"
|
||||
#include "DeviceCore/DevFilaBlackList.h"
|
||||
#include "DeviceCore/DevFilaSystem.h"
|
||||
@@ -1648,6 +1649,11 @@ bool CalibrationPresetPage::is_blocking_printing()
|
||||
auto source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
|
||||
auto target_model = obj_->printer_type;
|
||||
|
||||
if (DevPrinterConfigUtil::is_optional_printer_model_id(source_model) ||
|
||||
DevPrinterConfigUtil::is_optional_printer_model_id(target_model)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (source_model != target_model) {
|
||||
std::vector<std::string> compatible_machine = obj_->get_compatible_machine();
|
||||
vector<std::string>::iterator it = find(compatible_machine.begin(), compatible_machine.end(), source_model);
|
||||
|
||||
@@ -59,6 +59,21 @@ public:
|
||||
/*printer*/
|
||||
// info
|
||||
static std::map<std::string, std::string> get_all_model_id_with_name();
|
||||
// A printer agent may not know the physical model. Keep that case optional so
|
||||
// model compatibility checks do not turn missing identity into a hard error.
|
||||
static bool is_optional_printer_model_id(const std::string& model_id)
|
||||
{
|
||||
if (model_id.empty())
|
||||
return true;
|
||||
if (model_id.size() != 9)
|
||||
return false;
|
||||
|
||||
static constexpr char generic_model_id[] = "orcasonar";
|
||||
return std::equal(model_id.begin(), model_id.end(), generic_model_id,
|
||||
[](char lhs, char rhs) {
|
||||
return static_cast<char>(std::tolower(static_cast<unsigned char>(lhs))) == rhs;
|
||||
});
|
||||
}
|
||||
static std::string get_printer_type(const std::string& type_str) { return get_value_from_config<std::string>(type_str, "printer_type"); }
|
||||
static std::string get_printer_display_name(const std::string& type_str) { return get_value_from_config<std::string>(type_str, "display_name"); }
|
||||
static std::string get_printer_series_str(std::string type_str) { return get_value_from_config<std::string>(type_str, "printer_series"); }
|
||||
@@ -227,4 +242,4 @@ static std::string _parse_printer_type(const std::string &type_str)
|
||||
return type_str;
|
||||
}
|
||||
|
||||
};// namespace Slic3r
|
||||
};// namespace Slic3r
|
||||
|
||||
@@ -372,6 +372,8 @@ wxString MachineObject::get_printer_type_display_str() const
|
||||
std::string display_name = DevPrinterConfigUtil::get_printer_display_name(printer_type);
|
||||
if (!display_name.empty())
|
||||
return display_name;
|
||||
else if (printer_type == "orcasonar")
|
||||
return "OrcaSonar Printer";
|
||||
else
|
||||
return _L("Unknown");
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "libslic3r/Technologies.hpp"
|
||||
#include "libslic3r/Platform.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "DeviceCore/DevConfigUtil.h"
|
||||
#include "GUI_Init.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
#include "slic3r/GUI/UserManager.hpp"
|
||||
@@ -2393,6 +2394,11 @@ bool GUI_App::is_blocking_printing(MachineObject *obj_)
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
std::string source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
|
||||
|
||||
if (DevPrinterConfigUtil::is_optional_printer_model_id(source_model) ||
|
||||
DevPrinterConfigUtil::is_optional_printer_model_id(target_model)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (source_model != target_model) {
|
||||
std::vector<std::string> compatible_machine = obj_->get_compatible_machine();
|
||||
vector<std::string>::iterator it = find(compatible_machine.begin(), compatible_machine.end(), source_model);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "GUI_App.hpp"
|
||||
#include "MainFrame.hpp"
|
||||
#include "DeviceCore/DevConfigUtil.h"
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
@@ -114,6 +115,11 @@ bool DeviceItem::is_blocking_printing(MachineObject* obj_)
|
||||
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
||||
source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
|
||||
|
||||
if (DevPrinterConfigUtil::is_optional_printer_model_id(source_model) ||
|
||||
DevPrinterConfigUtil::is_optional_printer_model_id(target_model)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (source_model != target_model) {
|
||||
std::vector<std::string> compatible_machine = obj_->get_compatible_machine();
|
||||
vector<std::string>::iterator it = find(compatible_machine.begin(), compatible_machine.end(), source_model);
|
||||
|
||||
@@ -2010,12 +2010,14 @@ bool Sidebar::priv::sync_extruder_list(bool &only_external_material, bool is_man
|
||||
std::string machine_print_name = obj->get_show_printer_type();
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
std::string target_model_id = preset_bundle->printers.get_selected_preset().get_printer_type(preset_bundle);
|
||||
Preset* machine_preset = get_printer_preset(obj);
|
||||
if (!machine_preset) {
|
||||
const bool optional_printer_model = DevPrinterConfigUtil::is_optional_printer_model_id(obj->printer_type);
|
||||
const bool optional_target_model = DevPrinterConfigUtil::is_optional_printer_model_id(target_model_id);
|
||||
Preset* machine_preset = optional_printer_model ? nullptr : get_printer_preset(obj);
|
||||
if (!optional_printer_model && !optional_target_model && !machine_preset) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << "check error: machine_preset empty";
|
||||
return false;
|
||||
}
|
||||
if (machine_print_name != target_model_id) {
|
||||
if (!optional_printer_model && !optional_target_model && machine_print_name != target_model_id) {
|
||||
MessageDialog dlg(this->plater, _L("The currently selected machine preset is inconsistent with the connected printer type.\n"
|
||||
"Are you sure to continue syncing?"), _L("Sync printer information"), wxICON_WARNING | wxYES | wxNO);
|
||||
if (dlg.ShowModal() == wxID_NO) {
|
||||
@@ -2207,6 +2209,11 @@ void Sidebar::priv::update_sync_status(const MachineObject *obj)
|
||||
return;
|
||||
}
|
||||
|
||||
if (DevPrinterConfigUtil::is_optional_printer_model_id(obj->printer_type)) {
|
||||
clear_all_sync_status();
|
||||
return;
|
||||
}
|
||||
|
||||
bool printer_synced = false;
|
||||
// 1. update printer status
|
||||
const Preset &cur_preset = wxGetApp().preset_bundle->printers.get_edited_preset();
|
||||
@@ -20490,9 +20497,14 @@ bool Plater::is_same_printer_for_connected_and_selected(bool popup_warning)
|
||||
}
|
||||
if (!check_printer_initialized(obj, true, popup_warning))
|
||||
return false;
|
||||
Preset * machine_preset = get_printer_preset(obj);
|
||||
if (!machine_preset)
|
||||
const std::string machine_model = obj->printer_type;
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
const std::string selected_model = preset_bundle ? preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle) : std::string();
|
||||
if (!DevPrinterConfigUtil::is_optional_printer_model_id(machine_model) &&
|
||||
!DevPrinterConfigUtil::is_optional_printer_model_id(selected_model) &&
|
||||
!get_printer_preset(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (wxGetApp().is_blocking_printing()) {
|
||||
if (popup_warning) {
|
||||
|
||||
@@ -63,6 +63,7 @@ std::string PrePrintChecker::get_print_status_info(PrintDialogStatus status)
|
||||
case PrintStatusRackReading: return "PrintStatusRackReading";
|
||||
case PrintStatusRackNozzleNumUnmeetWarning: return "PrintStatusRackNozzleNumUnmeetWarning";
|
||||
case PrintStatusHasUnreliableNozzleWarning: return "PrintStatusHasUnreliableNozzleWarning";
|
||||
case PrintStatusOptionalPrinterModel: return "PrintStatusOptionalPrinterModel";
|
||||
case PrintStatusWarningExtFilamentNotMatch: return "PrintStatusWarningExtFilamentNotMatch";
|
||||
case PrintStatusFilamentWarningNozzleHRC: return "PrintStatusFilamentWarningNozzleHRC";
|
||||
case PrintStatusTPUUnsupportCaliOn: return "PrintStatusTPUUnsupportCaliOn";
|
||||
@@ -104,6 +105,7 @@ wxString PrePrintChecker::get_pre_state_msg(PrintDialogStatus status)
|
||||
case PrintStatusNeedConsistencyUpgrading: return _L("Cannot send the print job to a printer whose firmware must be updated.");
|
||||
case PrintStatusBlankPlate: return _L("Cannot send a print job for an empty plate.");
|
||||
case PrintStatusTimelapseNoSdcard: return _L("Storage needs to be inserted to record timelapse.");
|
||||
case PrintStatusOptionalPrinterModel: return _L("The selected printer model could not be identified, so compatibility with the print file configuration cannot be verified. Please verify the printer preset before sending.");
|
||||
case PrintStatusMixAmsAndVtSlotWarning: return _L("You have selected both external and AMS filaments for an extruder. You will need to manually switch the external filament during printing.");
|
||||
case PrintStatusTPUUnsupportAutoCali: return _L("TPU 90A/TPU 85A is too soft and does not support automatic Flow Dynamics calibration.");
|
||||
case PrintStatusWarningKvalueNotUsed: return _L("Set dynamic flow calibration to 'OFF' to enable custom dynamic flow value.");
|
||||
@@ -379,4 +381,3 @@ bool PrinterMsgPanel::UpdateInfos(const std::vector<prePrintInfo>& infos)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -112,6 +112,7 @@ enum PrintDialogStatus : unsigned int {
|
||||
// Orca: a nozzle diameter that differs from the one the printer remembers is a warning,
|
||||
// not an error, so non-standard nozzles can still be printed with.
|
||||
PrintStatusNozzleDiameterMismatch,
|
||||
PrintStatusOptionalPrinterModel,
|
||||
PrintStatusPrinterWarningEnd,
|
||||
|
||||
// Warnings for filament
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Jobs/PlaterWorker.hpp"
|
||||
|
||||
#include "DeviceCore/DevConfig.h"
|
||||
#include "DeviceCore/DevConfigUtil.h"
|
||||
#include "DeviceCore/DevNozzleSystem.h"
|
||||
#include "DeviceCore/DevNozzleRack.h"
|
||||
#include "DeviceCore/DevExtensionTool.h"
|
||||
@@ -2315,8 +2316,10 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
||||
} else if (status == PrintDialogStatus::PrintStatusNoSdcard) {
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(false);
|
||||
}else if (status == PrintDialogStatus::PrintStatusUnsupportedPrinter) {
|
||||
}else if (status == PrintDialogStatus::PrintStatusUnsupportedPrinter ||
|
||||
status == PrintDialogStatus::PrintStatusOptionalPrinterModel) {
|
||||
wxString msg_text;
|
||||
const bool block_send = status == PrintDialogStatus::PrintStatusUnsupportedPrinter;
|
||||
try
|
||||
{
|
||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
@@ -2342,17 +2345,21 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
||||
|
||||
auto target_print_name = wxString(DevPrinterConfigUtil::get_printer_display_name(target_model_id));
|
||||
target_print_name.Replace(wxT("Bambu Lab "), wxEmptyString);
|
||||
msg_text = wxString::Format(_L("The selected printer (%s) is incompatible with the print file configuration (%s). Please adjust the printer preset in the prepare page or choose a compatible printer on this page."), sourcet_print_name, target_print_name);
|
||||
if (block_send) {
|
||||
msg_text = wxString::Format(_L("The selected printer (%s) is incompatible with the print file configuration (%s). Please adjust the printer preset in the prepare page or choose a compatible printer on this page."), sourcet_print_name, target_print_name);
|
||||
} else {
|
||||
msg_text = wxString::Format(_L("The selected printer (%s) has an unknown model, so compatibility with the print file configuration (%s) cannot be verified. Please verify the printer preset before sending."), sourcet_print_name, target_print_name);
|
||||
}
|
||||
|
||||
|
||||
msg = msg_text;
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(false);
|
||||
Enable_Send_Button(!block_send);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(false);
|
||||
Enable_Send_Button(!block_send);
|
||||
}
|
||||
|
||||
|
||||
@@ -2529,6 +2536,11 @@ bool SelectMachineDialog::is_blocking_printing(MachineObject* obj_)
|
||||
}
|
||||
}
|
||||
|
||||
if (DevPrinterConfigUtil::is_optional_printer_model_id(source_model) ||
|
||||
DevPrinterConfigUtil::is_optional_printer_model_id(target_model)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (source_model != target_model) {
|
||||
std::vector<std::string> compatible_machine = obj_->get_compatible_machine();
|
||||
vector<std::string>::iterator it = find(compatible_machine.begin(), compatible_machine.end(), source_model);
|
||||
@@ -2625,6 +2637,10 @@ bool SelectMachineDialog::is_same_printer_model()
|
||||
if(preset_bundle == nullptr) return result;
|
||||
const auto source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
|
||||
const auto target_model = obj_->printer_type;
|
||||
if (DevPrinterConfigUtil::is_optional_printer_model_id(source_model) ||
|
||||
DevPrinterConfigUtil::is_optional_printer_model_id(target_model)) {
|
||||
return true;
|
||||
}
|
||||
// Orca: ignore P1P -> P1S
|
||||
if (source_model != target_model) {
|
||||
if ((source_model == "C12" && target_model == "C11") || (source_model == "C11" && target_model == "C12") ||
|
||||
@@ -4786,6 +4802,22 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
|
||||
return;
|
||||
}
|
||||
|
||||
bool has_optional_printer_model = DevPrinterConfigUtil::is_optional_printer_model_id(obj_->printer_type);
|
||||
if (m_print_type == PrintFromType::FROM_NORMAL) {
|
||||
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
||||
has_optional_printer_model = has_optional_printer_model ||
|
||||
(preset_bundle && DevPrinterConfigUtil::is_optional_printer_model_id(
|
||||
preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle)));
|
||||
} else if (m_print_type == PrintFromType::FROM_SDCARD_VIEW && !m_required_data_plate_data_list.empty()) {
|
||||
has_optional_printer_model = has_optional_printer_model ||
|
||||
DevPrinterConfigUtil::is_optional_printer_model_id(
|
||||
m_required_data_plate_data_list[m_print_plate_idx]->printer_model_id);
|
||||
}
|
||||
|
||||
if (has_optional_printer_model) {
|
||||
show_status(PrintDialogStatus::PrintStatusOptionalPrinterModel);
|
||||
}
|
||||
|
||||
if (is_blocking_printing(obj_)) {
|
||||
show_status(PrintDialogStatus::PrintStatusUnsupportedPrinter);
|
||||
return;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "BitmapCache.hpp"
|
||||
|
||||
#include "DeviceCore/DevManager.h"
|
||||
#include "DeviceCore/DevConfigUtil.h"
|
||||
#include "DeviceCore/DevStorage.h"
|
||||
#include "slic3r/Utils/FileTransferUtils.hpp"
|
||||
|
||||
@@ -1350,6 +1351,11 @@ bool SendToPrinterDialog::is_blocking_printing(MachineObject* obj_)
|
||||
auto source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
|
||||
auto target_model = obj_->printer_type;
|
||||
|
||||
if (DevPrinterConfigUtil::is_optional_printer_model_id(source_model) ||
|
||||
DevPrinterConfigUtil::is_optional_printer_model_id(target_model)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (source_model != target_model) {
|
||||
std::vector<std::string> compatible_machine = obj_->get_compatible_machine();
|
||||
vector<std::string>::iterator it = find(compatible_machine.begin(), compatible_machine.end(), source_model);
|
||||
|
||||
@@ -1875,6 +1875,11 @@ bool SyncAmsInfoDialog::is_blocking_printing(MachineObject *obj_)
|
||||
if (m_required_data_plate_data_list.size() > 0) { source_model = m_required_data_plate_data_list[m_print_plate_idx]->printer_model_id; }
|
||||
}
|
||||
|
||||
if (DevPrinterConfigUtil::is_optional_printer_model_id(source_model) ||
|
||||
DevPrinterConfigUtil::is_optional_printer_model_id(target_model)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (source_model != target_model) {
|
||||
std::vector<std::string> compatible_machine = obj_->get_compatible_machine();
|
||||
vector<std::string>::iterator it = find(compatible_machine.begin(), compatible_machine.end(), source_model);
|
||||
@@ -1931,7 +1936,13 @@ bool SyncAmsInfoDialog::is_same_printer_model()
|
||||
if (obj_ == nullptr) { return result; }
|
||||
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
if (preset_bundle && preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle) != obj_->printer_type) {
|
||||
const std::string source_model = preset_bundle ? preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle) : std::string();
|
||||
if (DevPrinterConfigUtil::is_optional_printer_model_id(source_model) ||
|
||||
DevPrinterConfigUtil::is_optional_printer_model_id(obj_->printer_type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (preset_bundle && source_model != obj_->printer_type) {
|
||||
if ((obj_->is_support_upgrade_kit && obj_->installed_upgrade_kit) && (preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle) == "C12")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user