NEW:optimize printer config files

jira:[STUDIO-4051]

Change-Id: I77cb16e62546eae63a73f8d12d7f11f496555197
This commit is contained in:
tao wang 2023-09-07 16:25:03 +08:00 committed by Lane.Wei
parent aa87c4fd34
commit 1a24681885
25 changed files with 123 additions and 143 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

View File

@ -38,12 +38,16 @@
"support_chamber_temp_edit":false,
"support_extrusion_cali":false
},
"model_id": "BL-P001",
"model_id":"BL-P001",
"compatible_machine":["BL-P002", "C11", "C12", "C13"],
"printer_type": "3DPrinter-X1-Carbon",
"printer_thumbnail_image": "printer_thumbnail",
"printer_connect_help_image": "input_access_code_x1",
"printer_use_ams_image":"ams_icon"
"printer_type":"3DPrinter-X1-Carbon",
"printer_thumbnail_image":"printer_thumbnail",
"printer_connect_help_image":"input_access_code_x1",
"printer_use_ams_image":"ams_icon",
"use_ams_type":"generic",
"printer_arch":"core_xy",
"printer_series":"series_x1",
"has_cali_line":true
},
"01.01.01.00": {
"print": {

View File

@ -43,7 +43,11 @@
"printer_type": "3DPrinter-X1",
"printer_thumbnail_image": "printer_thumbnail",
"printer_connect_help_image": "input_access_code_x1",
"printer_use_ams_image":"ams_icon"
"printer_use_ams_image":"ams_icon",
"use_ams_type":"generic",
"printer_arch" : "core_xy",
"printer_series":"series_x1",
"has_cali_line":true
},
"01.01.01.00": {
"print": {

View File

@ -41,7 +41,11 @@
"ftp_folder" : "sdcard/",
"printer_thumbnail_image": "printer_thumbnail_p1p",
"printer_connect_help_image": "input_access_code_p1p",
"printer_use_ams_image":"ams_icon"
"printer_use_ams_image":"ams_icon",
"use_ams_type":"generic",
"printer_arch" : "core_xy",
"printer_series":"series_p1p",
"has_cali_line":false
},
"01.02.00.00": {
"print": {

View File

@ -41,7 +41,11 @@
"ftp_folder" : "sdcard/",
"printer_thumbnail_image": "printer_thumbnail_p1s",
"printer_connect_help_image": "input_access_code_p1p",
"printer_use_ams_image":"ams_icon"
"printer_use_ams_image":"ams_icon",
"use_ams_type":"generic",
"printer_arch" : "core_xy",
"printer_series":"series_p1p",
"has_cali_line":false
},
"01.02.99.10" : {
"print": {

View File

@ -46,7 +46,11 @@
"printer_type": "C13",
"printer_thumbnail_image": "printer_thumbnail",
"printer_connect_help_image": "input_access_code_x1",
"printer_use_ams_image":"ams_icon"
"printer_use_ams_image":"ams_icon",
"use_ams_type":"generic",
"printer_arch" : "core_xy",
"printer_series":"series_x1",
"has_cali_line":true
},
"01.05.06.06": {
"rv2166": "00.00.21.20"

View File

@ -43,6 +43,9 @@
"printer_thumbnail_image": "printer_thumbnail_n1",
"printer_connect_help_image": "input_access_code_n1",
"printer_use_ams_image":"extra_icon",
"printer_arch" : "i3"
"use_ams_type":"f1",
"printer_arch" : "i3",
"printer_series":"series_p1p",
"has_cali_line":false
}
}

View File

@ -759,7 +759,7 @@ BedType Preset::get_default_bed_type(PresetBundle* preset_bundle)
}
std::string model_id = this->get_printer_type(preset_bundle);
if (model_id == "BL-P001" || model_id == "BL-P002") {
if (model_id == "BL-P001" || model_id == "BL-P002" || model_id == "C13") {
return BedType::btPC;
} else if (model_id == "C11") {
return BedType::btPEI;
@ -770,7 +770,7 @@ BedType Preset::get_default_bed_type(PresetBundle* preset_bundle)
bool Preset::has_cali_lines(PresetBundle* preset_bundle)
{
std::string model_id = this->get_printer_type(preset_bundle);
if (model_id == "BL-P001" || model_id == "BL-P002") {
if (model_id == "BL-P001" || model_id == "BL-P002" || model_id == "C13") {
return true;
}
return false;

View File

@ -202,6 +202,11 @@ const std::string& var_dir()
std::string var(const std::string &file_name)
{
boost::system::error_code ec;
if (boost::filesystem::exists(file_name, ec)) {
return file_name;
}
auto file = (boost::filesystem::path(g_var_dir) / file_name).make_preferred();
return file.string();
}

View File

@ -323,12 +323,6 @@ void AMSMaterialsSetting::create_panel_kn(wxWindow* parent)
m_n_param->Hide();
m_input_n_val->Hide();
// hide n (P1P old logic)
//if (!this->obj || !this->obj->is_high_printer_type()) {
// m_n_param->Hide();
// m_input_n_val->Hide();
//}
sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
sizer->Add(m_ratio_text, 0, wxLEFT | wxRIGHT | wxEXPAND, FromDIP(20));
sizer->Add(0, 0, 0, wxTOP, FromDIP(16));
@ -447,7 +441,7 @@ void AMSMaterialsSetting::on_select_reset(wxCommandEvent& event) {
}
// set k / n value
if (!obj->is_high_printer_type()) {
if (obj->get_printer_series() != PrinterSeries::SERIES_X1) {
// set extrusion cali ratio
int cali_tray_id = ams_id * 4 + tray_id;
@ -566,7 +560,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
wxString k_text = m_input_k_val->GetTextCtrl()->GetValue();
wxString n_text = m_input_n_val->GetTextCtrl()->GetValue();
if (!obj->is_high_printer_type() && !ExtrusionCalibration::check_k_validation(k_text)) {
if ((obj->get_printer_series() != PrinterSeries::SERIES_X1) && !ExtrusionCalibration::check_k_validation(k_text)) {
wxString k_tips = _L("Please input a valid value (K in 0~0.5)");
wxString kn_tips = _L("Please input a valid value (K in 0~0.5, N in 0.6~2.0)");
MessageDialog msg_dlg(nullptr, k_tips, wxEmptyString, wxICON_WARNING | wxOK);
@ -591,7 +585,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
;
}
if (obj->is_high_printer_type()) {
if (obj->get_printer_series() == PrinterSeries::SERIES_X1) {
PACalibIndexInfo select_index_info;
select_index_info.tray_id = tray_id;
select_index_info.nozzle_diameter = obj->nozzle_diameter;
@ -630,7 +624,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
;
}
if (obj->is_high_printer_type()) {
if (obj->get_printer_series() == PrinterSeries::SERIES_X1) {
PACalibIndexInfo select_index_info;
select_index_info.tray_id = cali_tray_id;
select_index_info.nozzle_diameter = obj->nozzle_diameter;
@ -729,7 +723,7 @@ void AMSMaterialsSetting::update_widgets()
else
m_panel_normal->Hide();
m_panel_kn->Show();
} else if (obj && (obj->ams_support_virtual_tray || obj->is_high_printer_type())) {
} else if (obj && (obj->ams_support_virtual_tray || (obj->get_printer_series() == PrinterSeries::SERIES_X1))) {
m_panel_normal->Show();
m_panel_kn->Show();
} else {
@ -863,7 +857,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
m_readonly_filament->Hide();
}
if (obj->is_high_printer_type()) {
if (obj->get_printer_series() == PrinterSeries::SERIES_X1) {
m_title_pa_profile->Show();
m_comboBox_cali_result->Show();
m_input_k_val->Disable();
@ -1007,7 +1001,7 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
m_pa_profile_items.clear();
m_comboBox_cali_result->SetValue(wxEmptyString);
if (this->obj->is_high_printer_type()) {
if (obj->get_printer_series() == PrinterSeries::SERIES_X1) {
m_input_k_val->GetTextCtrl()->SetValue(wxEmptyString);
std::vector<PACalibResult> cali_history = this->obj->pa_calib_tab;
for (auto cali_item : cali_history) {

View File

@ -594,7 +594,7 @@ wxString get_fail_reason(int code)
m_simplebook->SetSelection(0);
m_bind_job = std::make_shared<BindJob>(m_status_bar, wxGetApp().plater(), m_machine_info->dev_id, m_machine_info->dev_ip, m_machine_info->bind_sec_link);
if (m_machine_info && (m_machine_info->printer_type == "BL-P001" || m_machine_info->printer_type == "BL-P002")) {
if (m_machine_info && (m_machine_info->get_printer_series() == PrinterSeries::SERIES_X1)) {
m_bind_job->set_improved(false);
}
else {
@ -614,7 +614,7 @@ void BindMachineDialog::on_dpi_changed(const wxRect &suggested_rect)
void BindMachineDialog::update_machine_info(MachineObject* info)
{
m_machine_info = info;
if (m_machine_info && (m_machine_info->printer_type == "BL-P001" || m_machine_info->printer_type == "BL-P002")) {
if (m_machine_info && (m_machine_info->get_printer_series() == PrinterSeries::SERIES_X1)) {
m_button_bind->Enable(true);
m_panel_agreement->Hide();
}

View File

@ -383,10 +383,22 @@ wxString MachineObject::get_printer_type_display_str()
std::string MachineObject::get_printer_thumbnail_img_str()
{
std::string img_str = get_preset_printer_thumbnail_img(printer_type);
if (!img_str.empty())
return img_str;
else
return "printer_thumbnail";
std::string img_url;
if (!img_str.empty()) {
img_url = Slic3r::resources_dir() + "\\printers\\image\\" + img_str;
if (fs::exists(img_url + ".svg")) {
return img_url;
}
else {
img_url = img_str;
}
}
else {
img_url = "printer_thumbnail";
}
return img_url;
}
std::string MachineObject::get_ftp_folder()
@ -450,16 +462,12 @@ bool MachineObject::is_lan_mode_printer()
return result;
}
bool MachineObject::is_high_printer_type()
{
return get_printer_series() == PrinterSeries::SERIES_X1;
}
PrinterSeries MachineObject::get_printer_series() const
{
if (printer_type == "BL-P001" || printer_type == "BL-P002")
std::string series = DeviceManager::get_printer_series(printer_type);
if (series == "series_x1")
return PrinterSeries::SERIES_X1;
else if (printer_type == "C11" || printer_type == "C12")
else if (series == "series_p1p")
return PrinterSeries::SERIES_P1P;
else
return PrinterSeries::SERIES_P1P;
@ -470,6 +478,11 @@ PrinterArch MachineObject::get_printer_arch() const
return DeviceManager::get_printer_arch(printer_type);
}
std::string MachineObject::get_printer_ams_type() const
{
return DeviceManager::get_printer_ams_type(printer_type);
}
void MachineObject::reload_printer_settings()
{
print_json.load_compatible_settings("", "");
@ -2191,7 +2204,7 @@ int MachineObject::command_unload_filament()
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
return this->publish_json(j.dump());
}
else if (printer_type == "C11" || (get_printer_series() == PrinterSeries::SERIES_X1 && ams_support_virtual_tray) ) {
else if (get_printer_series() == PrinterSeries::SERIES_P1P || (get_printer_series() == PrinterSeries::SERIES_X1 && ams_support_virtual_tray) ) {
std::string gcode = DeviceManager::load_gcode(printer_type, "ams_unload.gcode");
if (gcode.empty()) {
return -1;
@ -2508,15 +2521,6 @@ bool MachineObject::is_info_ready()
return false;
}
bool MachineObject::is_function_supported(PrinterFunction func)
{
std::string func_name;
switch (func) {
default:
return true;
}
return DeviceManager::is_function_supported(printer_type, func_name);
}
std::vector<std::string> MachineObject::get_resolution_supported()
{
@ -2530,7 +2534,7 @@ std::vector<std::string> MachineObject::get_compatible_machine()
bool MachineObject::is_camera_busy_off()
{
if (printer_type == "C11" || printer_type == "C12")
if (get_printer_series() == PrinterSeries::SERIES_P1P)
return is_in_prepare() || is_in_upgrading();
return false;
}
@ -5185,7 +5189,6 @@ void DeviceManager::load_last_machine()
}
}
json DeviceManager::function_table = json::object();
json DeviceManager::filaments_blacklist = json::object();
@ -5229,33 +5232,23 @@ std::string DeviceManager::get_printer_thumbnail_img(std::string type_str)
{
return get_string_from_config(type_str, "printer_thumbnail_image");
}
std::string DeviceManager::get_printer_ams_type(std::string type_str)
{
return get_string_from_config(type_str, "use_ams_type");
}
std::string DeviceManager::get_printer_series(std::string type_str)
{
return get_string_from_config(type_str, "printer_series");
}
std::string DeviceManager::get_printer_diagram_img(std::string type_str)
{
return get_string_from_config(type_str, "printer_connect_help_image");
}
std::string DeviceManager::get_printer_ams_img(std::string type_str)
{
return get_string_from_config(type_str, "printer_use_ams_image");
}
bool DeviceManager::is_function_supported(std::string type_str, std::string function_name)
{
if (DeviceManager::function_table.contains("printers")) {
for (auto printer : DeviceManager::function_table["printers"]) {
if (printer.contains("model_id") && printer["model_id"].get<std::string>() == type_str) {
if (printer.contains("func")) {
if (printer["func"].contains(function_name))
return printer["func"][function_name].get<bool>();
}
}
}
}
return true;
}
std::vector<std::string> DeviceManager::get_resolution_supported(std::string type_str)
{
std::vector<std::string> resolution_supported;
@ -5301,23 +5294,6 @@ std::vector<std::string> DeviceManager::get_compatible_machine(std::string type_
return compatible_machine;
}
bool DeviceManager::load_functional_config(std::string config_file)
{
std::ifstream json_file(config_file.c_str());
try {
if (json_file.is_open()) {
json_file >> DeviceManager::function_table;
return true;
} else {
BOOST_LOG_TRIVIAL(error) << "load functional config failed, file = " << config_file;
}
}
catch(...) {
BOOST_LOG_TRIVIAL(error) << "load functional config failed, file = " << config_file;
return false;
}
return true;
}
bool DeviceManager::load_filaments_blacklist_config(std::string config_file)
{

View File

@ -407,12 +407,13 @@ public:
void erase_user_access_code();
std::string get_user_access_code();
bool is_lan_mode_printer();
bool is_high_printer_type();
//PRINTER_TYPE printer_type = PRINTER_3DPrinter_UKNOWN;
std::string printer_type; /* model_id */
PrinterSeries get_printer_series() const;
PrinterArch get_printer_arch() const;
std::string get_printer_ams_type() const;
void reload_printer_settings();
std::string printer_thumbnail_img;
@ -869,7 +870,6 @@ public:
void set_online_state(bool on_off);
bool is_online() { return m_is_online; }
bool is_info_ready();
bool is_function_supported(PrinterFunction func);
bool is_camera_busy_off();
std::vector<std::string> get_resolution_supported();
@ -951,14 +951,14 @@ public:
static std::string parse_printer_type(std::string type_str);
static std::string get_printer_display_name(std::string type_str);
static std::string get_printer_thumbnail_img(std::string type_str);
static std::string get_printer_ams_type(std::string type_str);
static std::string get_printer_series(std::string type_str);
static std::string get_printer_diagram_img(std::string type_str);
static std::string get_printer_ams_img(std::string type_str);
static PrinterArch get_printer_arch(std::string type_str);
static std::string get_ftp_folder(std::string type_str);
static bool is_function_supported(std::string type_str, std::string function_name);
static std::vector<std::string> get_resolution_supported(std::string type_str);
static std::vector<std::string> get_compatible_machine(std::string type_str);
static bool load_functional_config(std::string config_file);
static bool load_filaments_blacklist_config(std::string config_file);
static void check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, bool& in_blacklist, std::string& ac, std::string& info);
static std::string load_gcode(std::string type_str, std::string gcode_file);

View File

@ -1261,8 +1261,6 @@ void GUI_App::post_init()
hms_query->check_hms_info();
});
std::string functional_config_file = Slic3r::resources_dir() + "/config.json";
DeviceManager::load_functional_config(encode_path(functional_config_file.c_str()));
std::string filaments_blacklist_config_file = Slic3r::resources_dir() + "/printers/filaments_blacklist.json";
DeviceManager::load_filaments_blacklist_config(encode_path(filaments_blacklist_config_file.c_str()));

View File

@ -1093,16 +1093,8 @@ InputIpAddressDialog::InputIpAddressDialog(wxWindow* parent)
m_trouble_shoot = new wxHyperlinkCtrl(this, wxID_ANY, "How to trouble shooting", "");
m_img_help1 = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("lan_mode_help_x1", this, 198), wxDefaultPosition, wxSize(FromDIP(352), FromDIP(198)), 0);
m_img_help = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("input_access_code_x1_en", this, 198), wxDefaultPosition, wxSize(FromDIP(352), -1), 0);
m_img_help2 = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("input_access_code_p1p_en", this, 118), wxDefaultPosition, wxSize(FromDIP(352), FromDIP(118)), 0);
m_img_help3 = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("input_access_code_n1_en", this, 198), wxDefaultPosition, wxSize(FromDIP(352), FromDIP(118)), 0);
m_img_help1->Hide();
m_img_help2->Hide();
m_img_help3->Hide();
auto m_sizer_button = new wxBoxSizer(wxHORIZONTAL);
@ -1210,9 +1202,7 @@ InputIpAddressDialog::InputIpAddressDialog(wxWindow* parent)
m_sizer_main_right->Add(0, 0, 0, wxTOP, FromDIP(12));
m_sizer_main_right->Add(m_tip3, 0, wxRIGHT | wxEXPAND, FromDIP(18));
m_sizer_main_right->Add(0, 0, 0, wxTOP, FromDIP(4));
m_sizer_main_right->Add(m_img_help1, 0, 0, 0);
m_sizer_main_right->Add(m_img_help2, 0, 0, 0);
m_sizer_main_right->Add(m_img_help3, 0, 0, 0);
m_sizer_main_right->Add(m_img_help, 0, 0, 0);
m_sizer_main_right->Add(0, 0, 0, wxTOP, FromDIP(12));
m_sizer_main_right->Add(m_input_tip_area, 0, wxRIGHT|wxEXPAND, FromDIP(18));
m_sizer_main_right->Add(0, 0, 0, wxTOP, FromDIP(4));
@ -1288,22 +1278,11 @@ void InputIpAddressDialog::set_machine_obj(MachineObject* obj)
m_input_ip->GetTextCtrl()->SetLabelText(m_obj->dev_ip);
m_input_access_code->GetTextCtrl()->SetLabelText(m_obj->get_access_code());
if (m_obj->printer_type == "C11" || m_obj->printer_type == "C12") {
m_img_help1->Hide();
m_img_help2->Show();
m_img_help3->Hide();
}
else if (m_obj->printer_type == "BL-P001" || m_obj->printer_type == "BL-P002") {
m_img_help1->Show();
m_img_help2->Hide();
m_img_help3->Hide();
}
else if (m_obj->printer_type == "N1") {
m_img_help1->Hide();
m_img_help2->Hide();
m_img_help3->Show();
}
std::string img_str = DeviceManager::get_printer_diagram_img(m_obj->printer_type);
auto diagram_bmp = create_scaled_bitmap(img_str + "_en", this, 198);
m_img_help->SetBitmap(diagram_bmp);
auto str_ip = m_input_ip->GetTextCtrl()->GetValue();
auto str_access_code = m_input_access_code->GetTextCtrl()->GetValue();
if (isIp(str_ip.ToStdString()) && str_access_code.Length() == 8) {

View File

@ -212,9 +212,7 @@ public:
Label* m_test_wrong_msg{ nullptr };
TextInput* m_input_ip{ nullptr };
TextInput* m_input_access_code{ nullptr };
wxStaticBitmap* m_img_help1{ nullptr };
wxStaticBitmap* m_img_help2{ nullptr };
wxStaticBitmap* m_img_help3{ nullptr };
wxStaticBitmap* m_img_help{ nullptr };
wxStaticBitmap* m_img_step1{ nullptr };
wxStaticBitmap* m_img_step2{ nullptr };
wxStaticBitmap* m_img_step3{ nullptr };

View File

@ -1081,10 +1081,10 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
wxBoxSizer* m_sizer_material_tips = new wxBoxSizer(wxHORIZONTAL);
enable_ams_mapping = new ScalableBitmap(this, "enable_ams", 16);
auto img_amsmapping_tip = new wxStaticBitmap(m_scrollable_region, wxID_ANY, enable_ams_mapping->bmp(), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0);
img_amsmapping_tip = new wxStaticBitmap(m_scrollable_region, wxID_ANY, enable_ams_mapping->bmp(), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0);
m_sizer_material_tips->Add(img_amsmapping_tip, 0, wxALIGN_CENTER | wxLEFT, FromDIP(5));
img_amsmapping_tip->Bind(wxEVT_ENTER_WINDOW, [this, img_amsmapping_tip](auto& e) {
img_amsmapping_tip->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {
wxPoint img_pos = img_amsmapping_tip->ClientToScreen(wxPoint(0, 0));
wxPoint popup_pos(img_pos.x, img_pos.y + img_amsmapping_tip->GetRect().height);
m_mapping_tutorial_popup.Position(popup_pos, wxSize(0, 0));
@ -1101,7 +1101,6 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
img_amsmapping_tip->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) {
m_mapping_tutorial_popup.Dismiss();
});
amsmapping_tip = img_amsmapping_tip;
m_sizer_material = new wxGridSizer(0, 4, 0, FromDIP(5));
@ -1124,8 +1123,8 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_ams_backup_tip->Hide();
img_ams_backup->Hide();
m_ams_backup_tip->Bind(wxEVT_ENTER_WINDOW, [this, img_amsmapping_tip](auto& e) {SetCursor(wxCURSOR_HAND); });
img_ams_backup->Bind(wxEVT_ENTER_WINDOW, [this, img_amsmapping_tip](auto& e) {SetCursor(wxCURSOR_HAND); });
m_ams_backup_tip->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); });
img_ams_backup->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); });
m_ams_backup_tip->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
img_ams_backup->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
@ -1543,12 +1542,12 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par
sizer_checkbox->Add(text, 0, wxALIGN_CENTER, 0);
enable_ams = new ScalableBitmap(this, "enable_ams", 16);
auto img_ams_tip = new wxStaticBitmap(checkbox, wxID_ANY, enable_ams->bmp(), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0);
sizer_checkbox->Add(img_ams_tip, 0, wxALIGN_CENTER | wxLEFT, FromDIP(5));
img_use_ams_tip = new wxStaticBitmap(checkbox, wxID_ANY, enable_ams->bmp(), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0);
sizer_checkbox->Add(img_use_ams_tip, 0, wxALIGN_CENTER | wxLEFT, FromDIP(5));
img_ams_tip->Bind(wxEVT_ENTER_WINDOW, [this, img_ams_tip](auto& e) {
wxPoint img_pos = img_ams_tip->ClientToScreen(wxPoint(0, 0));
wxPoint popup_pos(img_pos.x, img_pos.y + img_ams_tip->GetRect().height);
img_use_ams_tip->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {
wxPoint img_pos = img_use_ams_tip->ClientToScreen(wxPoint(0, 0));
wxPoint popup_pos(img_pos.x, img_pos.y + img_use_ams_tip->GetRect().height);
m_mapping_tip_popup.Position(popup_pos, wxSize(0, 0));
m_mapping_tip_popup.Popup();
@ -1560,10 +1559,9 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par
}
});
img_ams_tip->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) {
img_use_ams_tip->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) {
m_mapping_tip_popup.Dismiss();
});
ams_tip = img_ams_tip;
checkbox->SetSizer(sizer_checkbox);
checkbox->Layout();
@ -3046,6 +3044,12 @@ void SelectMachineDialog::update_ams_check(MachineObject* obj)
{
if (obj && obj->ams_support_use_ams && obj->has_ams()) {
select_use_ams->Show();
if (obj->get_printer_ams_type() == "generic") {
img_use_ams_tip->Show();
}
else {
img_use_ams_tip->Hide();
}
} else {
select_use_ams->Hide();
}
@ -3358,9 +3362,9 @@ void SelectMachineDialog::on_dpi_changed(const wxRect &suggested_rect)
ams_editable->msw_rescale();
ams_editable_light->msw_rescale();
enable_ams_mapping->msw_rescale();
amsmapping_tip->SetBitmap(enable_ams_mapping->bmp());
img_amsmapping_tip->SetBitmap(enable_ams_mapping->bmp());
enable_ams->msw_rescale();
ams_tip->SetBitmap(enable_ams->bmp());
img_use_ams_tip->SetBitmap(enable_ams->bmp());
m_button_refresh->SetMinSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
m_button_refresh->SetCornerRadius(FromDIP(12));

View File

@ -340,6 +340,7 @@ protected:
wxStaticBitmap* m_staticbitmap{ nullptr };
wxStaticBitmap* m_bitmap_last_plate{ nullptr };
wxStaticBitmap* m_bitmap_next_plate{ nullptr };
wxStaticBitmap* img_amsmapping_tip{nullptr};
ThumbnailPanel* m_thumbnailPanel{ nullptr };
wxWindow* select_bed{ nullptr };
wxWindow* select_flow{ nullptr };
@ -383,9 +384,8 @@ protected:
ScalableBitmap * print_time{nullptr};
wxStaticBitmap * weightimg{nullptr};
ScalableBitmap * print_weight{nullptr};
wxStaticBitmap * amsmapping_tip{nullptr};
ScalableBitmap * enable_ams_mapping{nullptr};
wxStaticBitmap * ams_tip{nullptr};
wxStaticBitmap * img_use_ams_tip{nullptr};
wxStaticBitmap * img_ams_backup{nullptr};
ScalableBitmap * enable_ams{nullptr};

View File

@ -2336,7 +2336,7 @@ void StatusPanel::update_ams(MachineObject *obj)
}
if (m_filament_setting_dlg) { m_filament_setting_dlg->obj = obj; }
if (obj->is_high_printer_type() && last_cali_version != obj->cali_version) {
if ( (obj->get_printer_series() == PrinterSeries::SERIES_X1) && last_cali_version != obj->cali_version) {
last_cali_version = obj->cali_version;
CalibUtils::emit_get_PA_calib_info(obj->nozzle_diameter, "");
}
@ -2345,6 +2345,11 @@ void StatusPanel::update_ams(MachineObject *obj)
bool is_support_filament_backup = obj->is_support_filament_backup;
AMSModel ams_mode = AMSModel::GENERIC_AMS;
if (obj) {
if (obj->get_printer_ams_type() == "f1") { ams_mode = AMSModel::EXTRA_AMS; }
else if(obj->get_printer_ams_type() == "generic") { ams_mode = AMSModel::GENERIC_AMS; }
}
if (!obj
|| !obj->is_connected()
|| obj->amsList.empty()
@ -2359,17 +2364,15 @@ void StatusPanel::update_ams(MachineObject *obj)
BOOST_LOG_TRIVIAL(trace) << "machine object" << obj->dev_name << " was disconnected, set show_ams_group is false";
}
if (obj->printer_type == "N1") { ams_mode = AMSModel::EXTRA_AMS; }
m_ams_control->SetAmsModel(AMSModel::NO_AMS, ams_mode);
m_ams_control->SetAmsModel(AMSModel::NO_AMS, ams_mode);
show_ams_group(false);
m_ams_control->show_auto_refill(false);
}
else {
if (obj->printer_type == "N1") { ams_mode = AMSModel::EXTRA_AMS; }
m_ams_control->SetAmsModel(ams_mode, ams_mode);
m_ams_control->SetAmsModel(ams_mode, ams_mode);
show_ams_group(true);
if (!is_support_filament_backup) {