ENH:add log

jira: STUDIO-10445
Change-Id: If1c2b41b0f93a2f1f8bde4b3aa543a9ddeaccc08
This commit is contained in:
zhou.xu 2025-02-14 18:44:11 +08:00 committed by lane.wei
parent ea1d7c8105
commit 4166a156ea
2 changed files with 16 additions and 7 deletions

View File

@ -1901,11 +1901,12 @@ void PresetBundle::get_ams_cobox_infos(AMSComboInfo& combox_info)
unsigned int PresetBundle::sync_ams_list(unsigned int &unknowns, bool use_map, std::map<int, AMSMapInfo> &maps,bool enable_append, MergeFilamentInfo &merge_info)
{
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "use_map:" << use_map << " enable_append:" << enable_append;
std::vector<std::string> ams_filament_presets;
std::vector<std::string> ams_filament_colors;
std::vector<AMSMapInfo> ams_array_maps;
ams_multi_color_filment.clear();
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": filament_ams_list size: %1%") % filament_ams_list.size();
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": filament_ams_list size: %1%") % filament_ams_list.size();
struct AmsInfo
{
bool valid{false};
@ -1954,7 +1955,7 @@ unsigned int PresetBundle::sync_ams_list(unsigned int &unknowns, bool use_map, s
auto iter = std::find_if(filaments.begin(), filaments.end(), [this, &filament_id](auto &f) {
return f.is_compatible && filaments.get_preset_base(f) == &f && f.filament_id == filament_id; });
if (iter == filaments.end()) {
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": filament_id %1% not found or system or compatible") % filament_id;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": filament_id %1% not found or system or compatible") % filament_id;
auto filament_type = ams.opt_string("filament_type", 0u);
if (!filament_type.empty()) {
filament_type = "Generic " + filament_type;

View File

@ -1151,16 +1151,19 @@ bool Sidebar::priv::sync_extruder_list(bool &only_external_material)
return false;
}
if (!plater->check_printer_initialized(obj))
if (!plater->check_printer_initialized(obj)) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " check_printer_initialized fail";
return false;
}
std::string machine_print_name = obj->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)
if (!machine_preset) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << "check error: machine_preset empty";
return false;
}
if (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);
@ -10727,8 +10730,10 @@ bool Plater::try_sync_preset_with_connected_printer(int& nozzle_diameter)
return false;
MachineObject* obj = dev->get_selected_machine();
if (!obj || !obj->is_info_ready() || obj->m_extder_data.extders.size() <= 0)
if (!obj || !obj->is_info_ready() || obj->m_extder_data.extders.size() <= 0) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " obj may empty";
return false;
}
if (!obj->is_online()) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "obj->is_online(): " << obj->is_online();
auto printer_name = get_selected_printer_name_in_combox();
@ -10750,8 +10755,10 @@ bool Plater::try_sync_preset_with_connected_printer(int& nozzle_diameter)
// can not find the preset for connected printer, return false
Preset* machine_preset = get_printer_preset(obj);
if (!machine_preset)
if (!machine_preset) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " machine_preset is empty";
return false;
}
std::string printer_model = machine_preset->config.option<ConfigOptionString>("printer_model")->value;
bool sync_printer_preset = false;
@ -10774,6 +10781,7 @@ bool Plater::try_sync_preset_with_connected_printer(int& nozzle_diameter)
if (dlg.ShowModal() == wxID_YES) {
sync_printer_preset = true;
} else {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " sync_after_load_file_show_flag";
return false;
}
}