mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-04-06 00:32:05 +02:00
ENH: support AMS switching for A series; clean class AMSSetting
jira: [STUDIO-14068] [STUDIO-14330] Change-Id: I6281fbf56f3bf406ef28103998790a2a98c3f5c0 (cherry picked from commit 8ee02ec73076691c482ea6d089a49ea1c99ad10c)
This commit is contained in:
4
resources/images/dev_ams_rearrange.svg
Normal file
4
resources/images/dev_ams_rearrange.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6.5 2C9.2943 2 11.6009 4.0839 11.9526 6.78232C11.9678 6.89888 11.8753 7 11.7577 7H10.6444C10.5435 7 10.4589 6.92471 10.442 6.82525C10.1213 4.93749 8.47912 3.5 6.5 3.5C4.29086 3.5 2.5 5.29086 2.5 7.5C2.5 9.47912 3.93749 11.1213 5.82525 11.442C5.92471 11.4589 6 11.5435 6 11.6444V12.7567C6 12.8743 5.89887 12.9668 5.78231 12.9516C3.08393 12.6 1 10.2943 1 7.5C1 4.46243 3.46243 2 6.5 2Z" fill="#FF6F00"/>
|
||||
<path d="M11.1644 9.76271C11.0849 9.87751 10.9151 9.87751 10.8356 9.76271L8.6194 6.5639C8.5275 6.43126 8.62243 6.25 8.7838 6.25L13.2162 6.25C13.3776 6.25 13.4725 6.43126 13.3806 6.5639L11.1644 9.76271Z" fill="#FF6F00"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 735 B |
5
resources/images/dev_ams_upgrading.svg
Normal file
5
resources/images/dev_ams_upgrading.svg
Normal file
@@ -0,0 +1,5 @@
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#paint0_angular_7367_5549_clip_path)" data-figma-skip-parse="true"><g transform="matrix(0.0056875 0 0 0.0056875 6 6)"><foreignObject x="-1102.56" y="-1102.56" width="2205.13" height="2205.13"><div xmlns="http://www.w3.org/1999/xhtml" style="background:conic-gradient(from 90deg,rgba(0, 174, 66, 0) 0deg,rgba(0, 174, 66, 1) 360deg);height:100%;width:100%;opacity:1"></div></foreignObject></g></g><path d="M11.6875 6C11.6875 9.14112 9.14112 11.6875 6 11.6875C2.85888 11.6875 0.3125 9.14112 0.3125 6C0.3125 2.85888 2.85888 0.3125 6 0.3125C9.14112 0.3125 11.6875 2.85888 11.6875 6ZM6 9.9375C8.17462 9.9375 9.9375 8.17462 9.9375 6C9.9375 3.82538 8.17462 2.0625 6 2.0625C3.82538 2.0625 2.0625 3.82538 2.0625 6C2.0625 8.17462 3.82538 9.9375 6 9.9375Z" data-figma-gradient-fill="{"type":"GRADIENT_ANGULAR","stops":[{"color":{"r":0.0,"g":0.68235296010971069,"b":0.25882354378700256,"a":0.0},"position":0.0},{"color":{"r":0.0,"g":0.68235296010971069,"b":0.25882354378700256,"a":1.0},"position":1.0}],"stopsVar":[{"color":{"r":0.0,"g":0.68235296010971069,"b":0.25882354378700256,"a":0.0},"position":0.0},{"color":{"r":0.0,"g":0.68235296010971069,"b":0.25882354378700256,"a":1.0},"position":1.0}],"transform":{"m00":11.375000953674316,"m01":0.0,"m02":0.31250,"m10":0.0,"m11":11.375000953674316,"m12":0.31250},"opacity":1.0,"blendMode":"NORMAL","visible":true}"/>
|
||||
<defs>
|
||||
<clipPath id="paint0_angular_7367_5549_clip_path"><path d="M11.6875 6C11.6875 9.14112 9.14112 11.6875 6 11.6875C2.85888 11.6875 0.3125 9.14112 0.3125 6C0.3125 2.85888 2.85888 0.3125 6 0.3125C9.14112 0.3125 11.6875 2.85888 11.6875 6ZM6 9.9375C8.17462 9.9375 9.9375 8.17462 9.9375 6C9.9375 3.82538 8.17462 2.0625 6 2.0625C3.82538 2.0625 2.0625 3.82538 2.0625 6C2.0625 8.17462 3.82538 9.9375 6 9.9375Z"/></clipPath></defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
@@ -2,6 +2,16 @@
|
||||
#include "GUI_App.hpp"
|
||||
#include "I18N.hpp"
|
||||
|
||||
#include "slic3r/GUI/DeviceCore/DevExtruderSystem.h"
|
||||
#include "slic3r/GUI/DeviceCore/DevFilaSystem.h"
|
||||
#include "slic3r/GUI/DeviceCore/DevManager.h"
|
||||
|
||||
#include "slic3r/GUI/MsgDialog.hpp"
|
||||
|
||||
#include "slic3r/GUI/Widgets/AnimaController.hpp"
|
||||
#include "slic3r/GUI/Widgets/Label.hpp"
|
||||
#include "slic3r/GUI/Widgets/ComboBox.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
AMSSetting::AMSSetting(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style)
|
||||
@@ -18,7 +28,7 @@ void AMSSetting::create()
|
||||
m_sizer_main = new wxBoxSizer(wxVERTICAL);
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
|
||||
auto m_static_ams_settings = new wxStaticText(this, wxID_ANY, _L("AMS Settings"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_static_ams_settings = new wxStaticText(this, wxID_ANY, _L("AMS Settings"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_static_ams_settings->SetFont(::Label::Head_14);
|
||||
m_static_ams_settings->SetForegroundColour(AMS_SETTING_GREY800);
|
||||
|
||||
@@ -27,6 +37,12 @@ void AMSSetting::create()
|
||||
m_panel_body->SetBackgroundColour(*wxWHITE);
|
||||
wxBoxSizer *m_sizerl_body = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_ams_type = new AMSSettingTypePanel(m_panel_body, this);
|
||||
m_ams_type->Show(false);
|
||||
|
||||
//m_ams_arrange_order = new AMSSettingArrangeAMSOrder(m_panel_body);
|
||||
//m_ams_arrange_order->Show(false);
|
||||
|
||||
m_panel_Insert_material = new wxPanel(m_panel_body, wxID_ANY, wxDefaultPosition, wxSize(-1, -1), wxTAB_TRAVERSAL);
|
||||
m_panel_Insert_material->SetBackgroundColour(*wxWHITE);
|
||||
wxBoxSizer* m_sizer_main_Insert_material = new wxBoxSizer(wxVERTICAL);
|
||||
@@ -35,7 +51,7 @@ void AMSSetting::create()
|
||||
wxBoxSizer *m_sizer_Insert_material = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_checkbox_Insert_material_auto_read = new ::CheckBox(m_panel_Insert_material);
|
||||
m_checkbox_Insert_material_auto_read->Bind(wxEVT_TOGGLEBUTTON, &AMSSetting::on_insert_material_read, this);
|
||||
m_sizer_Insert_material->Add(m_checkbox_Insert_material_auto_read, 0, wxTOP, 1);
|
||||
m_sizer_Insert_material->Add(m_checkbox_Insert_material_auto_read, 0, wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
m_sizer_Insert_material->Add(0, 0, 0, wxLEFT, 12);
|
||||
|
||||
@@ -45,13 +61,10 @@ void AMSSetting::create()
|
||||
m_title_Insert_material_auto_read->SetFont(::Label::Head_13);
|
||||
m_title_Insert_material_auto_read->SetForegroundColour(AMS_SETTING_GREY800);
|
||||
m_title_Insert_material_auto_read->Wrap(AMS_SETTING_BODY_WIDTH);
|
||||
m_sizer_Insert_material->Add(m_title_Insert_material_auto_read, 0, wxALL | wxEXPAND, 0);
|
||||
|
||||
|
||||
m_sizer_Insert_material->Add(m_title_Insert_material_auto_read, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);
|
||||
|
||||
wxBoxSizer *m_sizer_Insert_material_tip = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_sizer_Insert_material_tip_inline = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_sizer_Insert_material_tip->Add(0, 0, 0, wxLEFT, 10);
|
||||
|
||||
// tip line1
|
||||
@@ -90,22 +103,20 @@ void AMSSetting::create()
|
||||
m_sizer_Insert_material_tip->Add(m_sizer_Insert_material_tip_inline, 1, wxALIGN_CENTER, 0);
|
||||
|
||||
m_sizer_main_Insert_material->Add(m_sizer_Insert_material, 0, wxEXPAND | wxTOP, FromDIP(4));
|
||||
m_sizer_main_Insert_material->Add(m_sizer_Insert_material_tip, 0, wxEXPAND | wxLEFT | wxTOP, 18);
|
||||
m_sizer_main_Insert_material->Add(m_sizer_Insert_material_tip, 0, wxEXPAND | wxLEFT | wxTOP, FromDIP(10));
|
||||
m_panel_Insert_material->SetSizer(m_sizer_main_Insert_material);
|
||||
|
||||
// checkbox area 2
|
||||
wxBoxSizer *m_sizer_starting = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_checkbox_starting_auto_read = new ::CheckBox(m_panel_body);
|
||||
m_checkbox_starting_auto_read->Bind(wxEVT_TOGGLEBUTTON, &AMSSetting::on_starting_read, this);
|
||||
m_sizer_starting->Add(m_checkbox_starting_auto_read, 0, wxTOP, 1);
|
||||
m_sizer_starting->Add(m_checkbox_starting_auto_read, 0, wxALIGN_CENTER_VERTICAL);
|
||||
m_sizer_starting->Add(0, 0, 0, wxLEFT, 12);
|
||||
m_title_starting_auto_read = new wxStaticText(m_panel_body, wxID_ANY, _L("Power on update"), wxDefaultPosition,wxDefaultSize, 0);
|
||||
m_title_starting_auto_read->SetFont(::Label::Head_13);
|
||||
m_title_starting_auto_read->SetForegroundColour(AMS_SETTING_GREY800);
|
||||
m_title_starting_auto_read->Wrap(AMS_SETTING_BODY_WIDTH);
|
||||
m_sizer_starting->Add(m_title_starting_auto_read, 1, wxEXPAND, 0);
|
||||
|
||||
|
||||
m_sizer_starting->Add(m_title_starting_auto_read, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);
|
||||
|
||||
wxBoxSizer *m_sizer_starting_tip = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_sizer_starting_tip->Add(0, 0, 0, wxLEFT, 10);
|
||||
@@ -136,13 +147,13 @@ void AMSSetting::create()
|
||||
wxBoxSizer* m_sizer_remain = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_checkbox_remain = new ::CheckBox(m_panel_body);
|
||||
m_checkbox_remain->Bind(wxEVT_TOGGLEBUTTON, &AMSSetting::on_remain, this);
|
||||
m_sizer_remain->Add(m_checkbox_remain, 0, wxTOP, 1);
|
||||
m_sizer_remain->Add(m_checkbox_remain, 0, wxALIGN_CENTER_VERTICAL);
|
||||
m_sizer_remain->Add(0, 0, 0, wxLEFT, 12);
|
||||
m_title_remain = new wxStaticText(m_panel_body, wxID_ANY, _L("Update remaining capacity"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_title_remain->SetFont(::Label::Head_13);
|
||||
m_title_remain->SetForegroundColour(AMS_SETTING_GREY800);
|
||||
m_title_remain->Wrap(AMS_SETTING_BODY_WIDTH);
|
||||
m_sizer_remain->Add(m_title_remain, 1, wxEXPAND, 0);
|
||||
m_sizer_remain->Add(m_title_remain, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);
|
||||
|
||||
|
||||
|
||||
@@ -164,13 +175,13 @@ void AMSSetting::create()
|
||||
wxBoxSizer* m_sizer_switch_filament = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_checkbox_switch_filament = new ::CheckBox(m_panel_body);
|
||||
m_checkbox_switch_filament->Bind(wxEVT_TOGGLEBUTTON, &AMSSetting::on_switch_filament, this);
|
||||
m_sizer_switch_filament->Add(m_checkbox_switch_filament, 0, wxTOP, 1);
|
||||
m_sizer_switch_filament->Add(m_checkbox_switch_filament, 0, wxALIGN_CENTER_VERTICAL);
|
||||
m_sizer_switch_filament->Add(0, 0, 0, wxLEFT, 12);
|
||||
m_title_switch_filament = new wxStaticText(m_panel_body, wxID_ANY, _L("AMS filament backup"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_title_switch_filament->SetFont(::Label::Head_13);
|
||||
m_title_switch_filament->SetForegroundColour(AMS_SETTING_GREY800);
|
||||
m_title_switch_filament->Wrap(AMS_SETTING_BODY_WIDTH);
|
||||
m_sizer_switch_filament->Add(m_title_switch_filament, 1, wxEXPAND, 0);
|
||||
m_sizer_switch_filament->Add(m_title_switch_filament, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);
|
||||
|
||||
|
||||
|
||||
@@ -242,22 +253,17 @@ void AMSSetting::create()
|
||||
m_sizer_remain_block->Add(m_sizer_remain_tip, 0, wxLEFT, 18);
|
||||
m_sizer_remain_block->Add(0, 0, 0, wxTOP, 15);
|
||||
|
||||
m_sizerl_body->Add(m_panel_Insert_material, 0, 0, 0);
|
||||
m_sizerl_body->Add(m_sizer_starting, 0, wxEXPAND | wxTOP, FromDIP(8));
|
||||
m_sizerl_body->Add(0, 0, 0, wxTOP, 8);
|
||||
m_sizerl_body->Add(m_sizer_starting_tip, 0, wxLEFT, 18);
|
||||
m_sizerl_body->Add(0, 0, 0, wxTOP, 15);
|
||||
m_sizerl_body->Add(m_sizer_remain_block, 0, wxEXPAND, 0);
|
||||
m_sizerl_body->Add(m_sizer_switch_filament, 0, wxEXPAND | wxTOP, FromDIP(8));
|
||||
m_sizerl_body->Add(0, 0, 0, wxTOP, 8);
|
||||
m_sizerl_body->Add(m_sizer_switch_filament_tip, 0, wxLEFT, 18);
|
||||
m_sizerl_body->Add(0, 0, 0, wxTOP, 6);
|
||||
m_sizerl_body->Add(0, 0, 0, wxTOP, FromDIP(5));
|
||||
m_sizerl_body->Add(m_sizer_air_print, 0, wxEXPAND | wxTOP, FromDIP(8));
|
||||
m_sizerl_body->Add(0, 0, 0, wxTOP, 8);
|
||||
m_sizerl_body->Add(m_sizer_air_print_tip, 0, wxLEFT, 18);
|
||||
m_sizerl_body->Add(0, 0, 0, wxTOP, 6);
|
||||
m_sizerl_body->Add(0, 0, 0, wxTOP, FromDIP(5));
|
||||
m_sizerl_body->AddSpacer(FromDIP(12));
|
||||
m_sizerl_body->Add(m_ams_type, 0, wxEXPAND | wxTOP | wxBOTTOM, FromDIP(12));
|
||||
//m_sizerl_body->Add(m_ams_arrange_order, 0, wxEXPAND | wxTOP | wxBOTTOM, FromDIP(12));
|
||||
m_sizerl_body->Add(m_panel_Insert_material, 0, wxEXPAND | wxTOP, FromDIP(12));
|
||||
m_sizerl_body->Add(m_sizer_starting, 0, wxEXPAND | wxTOP, FromDIP(12));
|
||||
m_sizerl_body->Add(m_sizer_starting_tip, 0, wxEXPAND | wxTOP, FromDIP(12));
|
||||
m_sizerl_body->Add(m_sizer_remain_block, 0, wxEXPAND | wxTOP, FromDIP(12));
|
||||
m_sizerl_body->Add(m_sizer_switch_filament, 0, wxEXPAND | wxTOP, FromDIP(12));
|
||||
m_sizerl_body->Add(m_sizer_switch_filament_tip, 0, wxEXPAND | wxTOP, FromDIP(12));
|
||||
m_sizerl_body->Add(m_sizer_air_print, 0, wxEXPAND | wxTOP, FromDIP(12));
|
||||
m_sizerl_body->Add(m_sizer_air_print_tip, 0, wxEXPAND | wxTOP, FromDIP(12));
|
||||
m_sizerl_body->Add(m_panel_img, 1, wxEXPAND | wxALL, FromDIP(5));
|
||||
|
||||
m_panel_body->SetSizer(m_sizerl_body);
|
||||
@@ -274,17 +280,85 @@ void AMSSetting::create()
|
||||
|
||||
this->Centre(wxBOTH);
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
}
|
||||
|
||||
Bind(wxEVT_SHOW, [this](auto& e) {
|
||||
if (this->IsShown()) {
|
||||
if (ams_support_remain) {
|
||||
m_sizer_remain_block->Show(true);
|
||||
}
|
||||
else {
|
||||
m_sizer_remain_block->Show(false);
|
||||
}
|
||||
void AMSSetting::UpdateByObj(MachineObject* obj)
|
||||
{
|
||||
this->m_obj = obj;
|
||||
if (!obj) {
|
||||
this->Show(false);
|
||||
return;
|
||||
}
|
||||
|
||||
update_ams_img(obj);
|
||||
|
||||
m_ams_type->Update(obj);
|
||||
//m_ams_arrange_order->Update(obj);
|
||||
update_insert_material_read_mode(obj);
|
||||
m_sizer_remain_block->Show(obj->is_support_update_remain);
|
||||
update_starting_read_mode(obj->GetFilaSystem()->IsDetectOnPowerupEnabled());
|
||||
update_remain_mode(obj->GetFilaSystem()->IsDetectRemainEnabled());
|
||||
update_switch_filament(obj->GetFilaSystem()->IsAutoRefillEnabled());
|
||||
update_air_printing_detection(obj);
|
||||
|
||||
update_firmware_switching_status();// on fila_firmware_switch
|
||||
}
|
||||
|
||||
void AMSSetting::update_firmware_switching_status()
|
||||
{
|
||||
if (!m_obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto fila_firmware_switch = m_obj->GetFilaSystem()->GetAmsFirmwareSwitch().lock();
|
||||
if (fila_firmware_switch->GetSuppotedFirmwares().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_switching == fila_firmware_switch->IsSwitching()) {
|
||||
return;
|
||||
}
|
||||
m_switching = fila_firmware_switch->IsSwitching();
|
||||
|
||||
// BFS: Update all children
|
||||
auto children = GetChildren();
|
||||
while (!children.IsEmpty()) {
|
||||
auto win = children.front();
|
||||
children.pop_front();
|
||||
|
||||
// do something with win
|
||||
if (win == m_static_ams_settings || win == m_ams_type) {
|
||||
continue;
|
||||
}
|
||||
});
|
||||
|
||||
if (dynamic_cast<wxStaticText*>(win) != nullptr ||
|
||||
dynamic_cast<CheckBox*>(win) != nullptr) {
|
||||
win->Enable(!m_switching);
|
||||
}
|
||||
|
||||
for (auto child : win->GetChildren()) {
|
||||
children.push_back(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AMSSetting::update_insert_material_read_mode(MachineObject* obj)
|
||||
{
|
||||
if (obj) {
|
||||
auto setting = obj->GetFilaSystem()->GetAmsSystemSetting().IsDetectOnInsertEnabled();
|
||||
if (!setting.has_value()) {
|
||||
m_panel_Insert_material->Show(false);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string extra_ams_str = (boost::format("ams_f1/%1%") % 0).str();
|
||||
auto extra_ams_it = obj->module_vers.find(extra_ams_str);
|
||||
if (extra_ams_it != obj->module_vers.end()) {
|
||||
update_insert_material_read_mode(setting.value(), extra_ams_it->second.sw_ver);
|
||||
} else {
|
||||
update_insert_material_read_mode(setting.value(), "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AMSSetting::update_insert_material_read_mode(bool selected, std::string version)
|
||||
@@ -320,12 +394,27 @@ void AMSSetting::update_insert_material_read_mode(bool selected, std::string ver
|
||||
Fit();
|
||||
}
|
||||
|
||||
void AMSSetting::update_ams_img(std::string ams_icon_str)
|
||||
void AMSSetting::update_ams_img(MachineObject* obj_)
|
||||
{
|
||||
if (!obj_) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string ams_icon_str = DevPrinterConfigUtil::get_printer_ams_img(obj_->printer_type);
|
||||
if (auto ams_switch = obj_->GetFilaSystem()->GetAmsFirmwareSwitch().lock();
|
||||
ams_switch->GetCurrentFirmwareIdxSel() == 1) {
|
||||
ams_icon_str = "ams_icon";// A series support AMS
|
||||
}
|
||||
|
||||
// transfer to dark mode icon
|
||||
if (wxGetApp().dark_mode()&& ams_icon_str=="extra_icon") {
|
||||
ams_icon_str += "_dark";
|
||||
}
|
||||
m_am_img->SetBitmap(create_scaled_bitmap(ams_icon_str, nullptr, 126));
|
||||
|
||||
if (ams_icon_str != m_ams_img_name) {
|
||||
m_am_img->SetBitmap(create_scaled_bitmap(ams_icon_str, nullptr, 126));
|
||||
m_am_img->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void AMSSetting::update_starting_read_mode(bool selected)
|
||||
@@ -345,7 +434,7 @@ void AMSSetting::update_starting_read_mode(bool selected)
|
||||
|
||||
void AMSSetting::update_remain_mode(bool selected)
|
||||
{
|
||||
if (obj->is_support_update_remain) {
|
||||
if (m_obj->is_support_update_remain) {
|
||||
m_checkbox_remain->Show();
|
||||
m_title_remain->Show();
|
||||
m_tip_remain_line1->Show();
|
||||
@@ -362,7 +451,7 @@ void AMSSetting::update_remain_mode(bool selected)
|
||||
|
||||
void AMSSetting::update_switch_filament(bool selected)
|
||||
{
|
||||
if (obj->is_support_filament_backup) {
|
||||
if (m_obj->is_support_filament_backup) {
|
||||
m_checkbox_switch_filament->Show();
|
||||
m_title_switch_filament->Show();
|
||||
m_tip_switch_filament_line1->Show();
|
||||
@@ -376,28 +465,24 @@ void AMSSetting::update_switch_filament(bool selected)
|
||||
m_checkbox_switch_filament->SetValue(selected);
|
||||
}
|
||||
|
||||
void AMSSetting::update_air_printing_detection(bool selected)
|
||||
|
||||
void AMSSetting::update_air_printing_detection(MachineObject* obj)
|
||||
{
|
||||
if (false/*obj->is_support_air_print_detection*/) {
|
||||
if(!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj->is_support_air_print_detection) {
|
||||
m_checkbox_air_print->Show();
|
||||
m_title_air_print->Show();
|
||||
m_tip_air_print_line->Show();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
m_checkbox_air_print->Hide();
|
||||
m_title_air_print->Hide();
|
||||
m_tip_air_print_line->Hide();
|
||||
}
|
||||
Layout();
|
||||
m_checkbox_air_print->SetValue(selected);
|
||||
}
|
||||
|
||||
|
||||
void AMSSetting::on_select_ok(wxMouseEvent &event)
|
||||
{
|
||||
if (obj) {
|
||||
obj->command_ams_calibrate(ams_id);
|
||||
}
|
||||
m_checkbox_air_print->SetValue(obj->ams_air_print_status);
|
||||
}
|
||||
|
||||
void AMSSetting::on_insert_material_read(wxCommandEvent &event)
|
||||
@@ -420,7 +505,7 @@ void AMSSetting::on_insert_material_read(wxCommandEvent &event)
|
||||
bool tray_read_opt = m_checkbox_Insert_material_auto_read->GetValue();
|
||||
bool remain_opt = m_checkbox_remain->GetValue();
|
||||
|
||||
obj->command_ams_user_settings(ams_id, start_read_opt, tray_read_opt, remain_opt);
|
||||
m_obj->command_ams_user_settings(start_read_opt, tray_read_opt, remain_opt);
|
||||
|
||||
m_sizer_Insert_material_tip_inline->Layout();
|
||||
Layout();
|
||||
@@ -446,7 +531,7 @@ void AMSSetting::on_starting_read(wxCommandEvent &event)
|
||||
bool tray_read_opt = m_checkbox_Insert_material_auto_read->GetValue();
|
||||
bool remain_opt = m_checkbox_remain->GetValue();
|
||||
|
||||
obj->command_ams_user_settings(ams_id, start_read_opt, tray_read_opt, remain_opt);
|
||||
m_obj->command_ams_user_settings(start_read_opt, tray_read_opt, remain_opt);
|
||||
|
||||
m_sizer_starting_tip_inline->Layout();
|
||||
Layout();
|
||||
@@ -460,47 +545,239 @@ void AMSSetting::on_remain(wxCommandEvent& event)
|
||||
bool start_read_opt = m_checkbox_starting_auto_read->GetValue();
|
||||
bool tray_read_opt = m_checkbox_Insert_material_auto_read->GetValue();
|
||||
bool remain_opt = m_checkbox_remain->GetValue();
|
||||
obj->command_ams_user_settings(ams_id, start_read_opt, tray_read_opt, remain_opt);
|
||||
m_obj->command_ams_user_settings(start_read_opt, tray_read_opt, remain_opt);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void AMSSetting::on_switch_filament(wxCommandEvent& event)
|
||||
{
|
||||
bool switch_filament = m_checkbox_switch_filament->GetValue();
|
||||
obj->command_ams_switch_filament(switch_filament);
|
||||
m_obj->command_ams_switch_filament(switch_filament);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void AMSSetting::on_air_print_detect(wxCommandEvent& event)
|
||||
{
|
||||
bool air_print_detect = m_checkbox_air_print->GetValue();
|
||||
obj->command_ams_air_print_detect(air_print_detect);
|
||||
m_obj->command_ams_air_print_detect(air_print_detect);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
wxString AMSSetting::append_title(wxString text)
|
||||
{
|
||||
wxString lab;
|
||||
auto * widget = new wxStaticText(m_panel_body, wxID_ANY, text, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
||||
widget->SetForegroundColour(*wxBLACK);
|
||||
widget->Wrap(AMS_SETTING_BODY_WIDTH);
|
||||
widget->SetMinSize(wxSize(AMS_SETTING_BODY_WIDTH, -1));
|
||||
lab = widget->GetLabel();
|
||||
widget->Destroy();
|
||||
return lab;
|
||||
}
|
||||
|
||||
wxStaticText *AMSSetting::append_text(wxString text)
|
||||
{
|
||||
auto *widget = new wxStaticText(m_panel_body, wxID_ANY, text, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
||||
widget->Wrap(250);
|
||||
widget->SetMinSize(wxSize(250, -1));
|
||||
return widget;
|
||||
}
|
||||
|
||||
void AMSSetting::on_dpi_changed(const wxRect &suggested_rect)
|
||||
{
|
||||
//m_button_auto_demarcate->SetMinSize(AMS_SETTING_BUTTON_SIZE);
|
||||
if (!m_ams_img_name.empty()) {
|
||||
m_am_img->SetBitmap(create_scaled_bitmap(m_ams_img_name, nullptr, 126));
|
||||
m_am_img->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
AMSSettingTypePanel::AMSSettingTypePanel(wxWindow* parent, AMSSetting* setting_dlg)
|
||||
: wxPanel(parent), m_setting_dlg(setting_dlg)
|
||||
{
|
||||
CreateGui();
|
||||
}
|
||||
|
||||
AMSSettingTypePanel::~AMSSettingTypePanel()
|
||||
{
|
||||
if (m_switching_icon->IsPlaying()) {
|
||||
m_switching_icon->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
void AMSSettingTypePanel::CreateGui()
|
||||
{
|
||||
wxBoxSizer* h_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
Label* title = new Label(this, ::Label::Head_13, _L("AMS Type"));
|
||||
title->SetBackgroundColour(*wxWHITE);
|
||||
|
||||
m_type_combobox = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(240, -1), 0, nullptr, wxCB_READONLY);
|
||||
m_type_combobox->SetMinSize(wxSize(240, -1));
|
||||
m_type_combobox->Bind(wxEVT_COMBOBOX, &AMSSettingTypePanel::OnAmsTypeChanged, this);
|
||||
|
||||
m_switching_tips = new Label(this, ::Label::Body_14);
|
||||
m_switching_tips->SetBackgroundColour(*wxWHITE);
|
||||
m_switching_tips->Show(false);
|
||||
|
||||
std::vector<std::string> list{ "ams_rfid_1", "ams_rfid_2", "ams_rfid_3", "ams_rfid_4" };
|
||||
m_switching_icon = new AnimaIcon(this, wxID_ANY, list, "refresh_printer", 100);
|
||||
m_switching_icon->SetMinSize(wxSize(FromDIP(20), FromDIP(20)));
|
||||
|
||||
h_sizer->Add(title, 0);
|
||||
h_sizer->AddStretchSpacer();
|
||||
h_sizer->Add(m_type_combobox, 0, wxEXPAND);
|
||||
h_sizer->Add(m_switching_icon, 0, wxALIGN_CENTER);
|
||||
h_sizer->Add(m_switching_tips, 0, wxEXPAND | wxLEFT | wxALIGN_CENTER, FromDIP(8));
|
||||
SetSizer(h_sizer);
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
|
||||
void AMSSettingTypePanel::Update(const MachineObject* obj)
|
||||
{
|
||||
if (!obj) {
|
||||
Show(false);
|
||||
return;
|
||||
}
|
||||
|
||||
m_ams_firmware_switch = obj->GetFilaSystem()->GetAmsFirmwareSwitch();
|
||||
auto ptr = m_ams_firmware_switch.lock();
|
||||
if (!ptr) {
|
||||
Show(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ptr->SupportSwitchFirmware()) {
|
||||
Show(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptr->IsSwitching()) {
|
||||
int display_percent = obj->get_upgrade_percent();
|
||||
if (display_percent == 100 || display_percent == 0) {
|
||||
display_percent = 1;// special case, sometimes it's switching but percent is 0 or 100
|
||||
}
|
||||
const auto& tips = _L("Switching") + " " + wxString::Format("%d%%", display_percent);
|
||||
m_switching_tips->SetLabel(tips);
|
||||
m_switching_icon->Play();
|
||||
m_switching_tips->Show(true);
|
||||
m_switching_icon->Show(true);
|
||||
m_type_combobox->Show(false);
|
||||
} else {
|
||||
int current_idx = ptr->GetCurrentFirmwareIdxSel();
|
||||
auto ams_firmwares = ptr->GetSuppotedFirmwares();
|
||||
if (m_ams_firmwares != ams_firmwares || m_ams_firmware_current_idx != current_idx) {
|
||||
m_ams_firmware_current_idx = current_idx;
|
||||
m_ams_firmwares = ams_firmwares;
|
||||
|
||||
m_type_combobox->Clear();
|
||||
for (auto ams_firmware : m_ams_firmwares) {
|
||||
if (m_ams_firmware_current_idx == ams_firmware.first) {
|
||||
m_type_combobox->Append(_L(ams_firmware.second.m_name));
|
||||
} else {
|
||||
m_type_combobox->Append(_L(ams_firmware.second.m_name));
|
||||
}
|
||||
}
|
||||
m_type_combobox->SetSelection(m_ams_firmware_current_idx);
|
||||
}
|
||||
|
||||
if(m_switching_icon->IsPlaying()) {
|
||||
m_switching_icon->Stop();
|
||||
}
|
||||
|
||||
m_switching_tips->Show(false);
|
||||
m_switching_icon->Show(false);
|
||||
m_type_combobox->Show(true);
|
||||
}
|
||||
|
||||
Show(true);
|
||||
Layout();
|
||||
}
|
||||
|
||||
void AMSSettingTypePanel::OnAmsTypeChanged(wxCommandEvent& event)
|
||||
{
|
||||
auto part = m_ams_firmware_switch.lock();
|
||||
if (!part) {
|
||||
event.Skip();
|
||||
return;
|
||||
}
|
||||
|
||||
int new_selection_idx = m_type_combobox->GetSelection();
|
||||
if (new_selection_idx == part->GetCurrentFirmwareIdxSel()) {
|
||||
event.Skip();
|
||||
return;
|
||||
}
|
||||
|
||||
auto obj_ = part->GetFilaSystem()->GetOwner();
|
||||
if (obj_) {
|
||||
if (obj_->is_in_printing() || obj_->is_in_upgrading()) {
|
||||
MessageDialog dlg(this, _L("The printer is busy and cannot switch AMS type."), SLIC3R_APP_NAME + _L("Info"), wxOK | wxICON_INFORMATION);
|
||||
dlg.ShowModal();
|
||||
m_type_combobox->SetSelection(part->GetCurrentFirmwareIdxSel());
|
||||
return;
|
||||
}
|
||||
|
||||
auto ext = obj_->GetExtderSystem()->GetCurrentExtder();
|
||||
if (ext && ext->HasFilamentInExt()) {
|
||||
MessageDialog dlg(this, _L("Please unload all filament before switching."), SLIC3R_APP_NAME + _L("Info"), wxOK | wxICON_INFORMATION);
|
||||
dlg.SetButtonLabel(wxID_OK, _L("Confirm"));
|
||||
dlg.ShowModal();
|
||||
m_type_combobox->SetSelection(part->GetCurrentFirmwareIdxSel());
|
||||
if (m_setting_dlg) {
|
||||
m_setting_dlg->EndModal(wxID_OK);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
MessageDialog dlg(this, _L("AMS type switching needs firmware update, taking about 30s. Switch now ?"), SLIC3R_APP_NAME + _L("Info"), wxOK | wxCANCEL | wxICON_INFORMATION);
|
||||
dlg.SetButtonLabel(wxID_OK, _L("Confirm"));
|
||||
int rtn = dlg.ShowModal();
|
||||
if (rtn != wxID_OK) {
|
||||
m_type_combobox->SetSelection(part->GetCurrentFirmwareIdxSel());
|
||||
return;
|
||||
}
|
||||
|
||||
part->CrtlSwitchFirmware(new_selection_idx);
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
#if 0 /*used option*/
|
||||
AMSSettingArrangeAMSOrder::AMSSettingArrangeAMSOrder(wxWindow* parent)
|
||||
: wxPanel(parent)
|
||||
{
|
||||
CreateGui();
|
||||
}
|
||||
|
||||
void AMSSettingArrangeAMSOrder::CreateGui()
|
||||
{
|
||||
wxBoxSizer* h_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
Label* title = new Label(this, ::Label::Head_13, _L("Arrange AMS Order"));
|
||||
title->SetBackgroundColour(*wxWHITE);
|
||||
|
||||
m_btn_rearrange = new ScalableButton(this, wxID_ANY, "dev_ams_rearrange");
|
||||
m_btn_rearrange->SetBackgroundColour(*wxWHITE);
|
||||
m_btn_rearrange->SetMinSize(wxSize(FromDIP(13), FromDIP(13)));
|
||||
m_btn_rearrange->Bind(wxEVT_BUTTON, &AMSSettingArrangeAMSOrder::OnBtnRearrangeClicked, this);
|
||||
h_sizer->Add(title, 0);
|
||||
h_sizer->AddStretchSpacer();
|
||||
h_sizer->Add(m_btn_rearrange, 0, wxEXPAND | wxALIGN_CENTER_VERTICAL);
|
||||
SetSizer(h_sizer);
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
|
||||
void AMSSettingArrangeAMSOrder::Update(const MachineObject* obj)
|
||||
{
|
||||
if (obj) {
|
||||
m_ams_firmware_switch = obj->GetFilaSystem()->GetAmsFirmwareSwitch();
|
||||
if (auto ptr = m_ams_firmware_switch.lock(); ptr->SupportSwitchFirmware()) {
|
||||
Show(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Show(false);
|
||||
}
|
||||
|
||||
void AMSSettingArrangeAMSOrder::OnBtnRearrangeClicked(wxCommandEvent& event)
|
||||
{
|
||||
auto part = m_ams_firmware_switch.lock();
|
||||
if (part) {
|
||||
MessageDialog dlg(this, _L("AMS ID will be reset. If you want a specific ID sequence, "
|
||||
"disconnect all AMS before resetting and connect them "
|
||||
"in the desired order after resetting."),
|
||||
SLIC3R_APP_NAME + _L("Info"), wxOK | wxCANCEL | wxICON_INFORMATION);
|
||||
int rtn = dlg.ShowModal();
|
||||
if (rtn == wxID_OK) {
|
||||
part->GetFilaSystem()->CtrlAmsReset();
|
||||
}
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
#endif
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "Widgets/Label.hpp"
|
||||
#include "Widgets/CheckBox.hpp"
|
||||
|
||||
#include "slic3r/GUI/DeviceCore/DevFilaAmsSetting.h"
|
||||
|
||||
#define AMS_SETTING_DEF_COLOUR wxColour(255, 255, 255)
|
||||
#define AMS_SETTING_GREY800 wxColour(50, 58, 61)
|
||||
#define AMS_SETTING_GREY700 wxColour(107, 107, 107)
|
||||
@@ -19,38 +21,53 @@
|
||||
#define AMS_SETTING_BUTTON_SIZE wxSize(FromDIP(150), FromDIP(24))
|
||||
#define AMS_F1_SUPPORT_INSERTION_UPDATE_DEFAULT std::string("00.00.07.89")
|
||||
|
||||
class AnimaIcon;
|
||||
class ComboBox;
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
class AMSSettingTypePanel;
|
||||
class AMSSetting : public DPIDialog
|
||||
{
|
||||
public:
|
||||
AMSSetting(wxWindow *parent, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
|
||||
~AMSSetting();
|
||||
void create();
|
||||
|
||||
void update_insert_material_read_mode(bool selected, std::string version);
|
||||
void update_ams_img(std::string ams_icon_str);
|
||||
void update_starting_read_mode(bool selected);
|
||||
void update_remain_mode(bool selected);
|
||||
void update_switch_filament(bool selected);
|
||||
void update_air_printing_detection(bool selected);
|
||||
void on_select_ok(wxMouseEvent& event);
|
||||
void on_insert_material_read(wxCommandEvent &event);
|
||||
void on_starting_read(wxCommandEvent &event);
|
||||
void on_remain(wxCommandEvent& event);
|
||||
void on_switch_filament(wxCommandEvent& event);
|
||||
void on_air_print_detect(wxCommandEvent& event);
|
||||
wxString append_title(wxString text);
|
||||
wxStaticText *append_text(wxString text);
|
||||
MachineObject *obj{nullptr};
|
||||
bool ams_support_remain{false};
|
||||
wxStaticBitmap* m_am_img;
|
||||
int ams_id { 0 };
|
||||
public:
|
||||
void UpdateByObj(MachineObject* obj);
|
||||
|
||||
protected:
|
||||
void create();
|
||||
|
||||
void update_ams_img(MachineObject* obj);
|
||||
void update_starting_read_mode(bool selected);
|
||||
void update_remain_mode(bool selected);
|
||||
void update_switch_filament(bool selected);
|
||||
void update_insert_material_read_mode(MachineObject* obj);
|
||||
void update_insert_material_read_mode(bool selected, std::string version);
|
||||
void update_air_printing_detection(MachineObject* obj);
|
||||
|
||||
void update_firmware_switching_status();
|
||||
|
||||
// event handlers
|
||||
void on_insert_material_read(wxCommandEvent& event);
|
||||
void on_starting_read(wxCommandEvent& event);
|
||||
void on_remain(wxCommandEvent& event);
|
||||
void on_switch_filament(wxCommandEvent& event);
|
||||
void on_air_print_detect(wxCommandEvent& event);
|
||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||
|
||||
protected:
|
||||
MachineObject *m_obj{nullptr};
|
||||
|
||||
wxStaticText* m_static_ams_settings = nullptr;
|
||||
|
||||
bool m_switching = false;
|
||||
AMSSettingTypePanel* m_ams_type;
|
||||
//AMSSettingArrangeAMSOrder* m_ams_arrange_order;
|
||||
|
||||
wxStaticBitmap* m_am_img;
|
||||
std::string m_ams_img_name;
|
||||
|
||||
wxPanel * m_panel_body;
|
||||
wxPanel* m_panel_Insert_material;
|
||||
CheckBox * m_checkbox_Insert_material_auto_read;
|
||||
@@ -86,6 +103,52 @@ protected:
|
||||
wxBoxSizer *m_sizer_remain_block;
|
||||
};
|
||||
|
||||
class AMSSettingTypePanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
AMSSettingTypePanel(wxWindow* parent, AMSSetting* setting_dlg);
|
||||
~AMSSettingTypePanel();
|
||||
|
||||
public:
|
||||
void Update(const MachineObject* obj);
|
||||
|
||||
private:
|
||||
void CreateGui();
|
||||
void OnAmsTypeChanged(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
std::weak_ptr<DevAmsSystemFirmwareSwitch> m_ams_firmware_switch;
|
||||
|
||||
int m_ams_firmware_current_idx{ -1 };
|
||||
std::unordered_map<int, DevAmsSystemFirmwareSwitch::DevAmsSystemFirmware> m_ams_firmwares;
|
||||
|
||||
// widgets
|
||||
AMSSetting* m_setting_dlg;
|
||||
ComboBox* m_type_combobox;
|
||||
Label* m_switching_tips;
|
||||
AnimaIcon* m_switching_icon;
|
||||
};
|
||||
|
||||
#if 0
|
||||
class AMSSettingArrangeAMSOrder : public wxPanel
|
||||
{
|
||||
public:
|
||||
AMSSettingArrangeAMSOrder(wxWindow* parent);
|
||||
|
||||
public:
|
||||
void Update(const MachineObject* obj);
|
||||
void Rescale() { m_btn_rearrange->msw_rescale(); Layout(); };
|
||||
|
||||
private:
|
||||
void CreateGui();
|
||||
void OnBtnRearrangeClicked(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
std::weak_ptr<DevAmsSystemFirmwareSwitch> m_ams_firmware_switch;
|
||||
ScalableButton* m_btn_rearrange;
|
||||
};
|
||||
#endif
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@ list(APPEND SLIC3R_GUI_SOURCES
|
||||
GUI/DeviceCore/DevFan.h
|
||||
GUI/DeviceCore/DevFilaAmsSetting.h
|
||||
GUI/DeviceCore/DevFilaAmsSetting.cpp
|
||||
GUI/DeviceCore/DevFilaAmsSettingCtrl.cpp
|
||||
GUI/DeviceCore/DevFilaBlackList.h
|
||||
GUI/DeviceCore/DevFilaBlackList.cpp
|
||||
GUI/DeviceCore/DevFilaSystem.h
|
||||
GUI/DeviceCore/DevFilaSystem.cpp
|
||||
GUI/DeviceCore/DevFilaSystemCtrl.cpp
|
||||
GUI/DeviceCore/DevFirmware.h
|
||||
GUI/DeviceCore/DevFirmware.cpp
|
||||
GUI/DeviceCore/DevPrintOptions.h
|
||||
|
||||
@@ -9,6 +9,53 @@ using namespace nlohmann;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
DevCtrlInfo::DevCtrlInfo(MachineObject* obj, int sequence_id, const json& req_json,
|
||||
int interval_max, int interval_min)
|
||||
{
|
||||
m_request_dev_id = obj->get_dev_id();
|
||||
m_request_seq = sequence_id;
|
||||
m_request_time = time(nullptr);
|
||||
m_request_json = req_json;
|
||||
m_request_interval_max = interval_max;
|
||||
m_request_interval_min = interval_min;
|
||||
}
|
||||
|
||||
bool DevCtrlInfo::CheckCanUpdateData(const nlohmann::json& jj)
|
||||
{
|
||||
if (m_request_json.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_time_out) {
|
||||
return true;
|
||||
}
|
||||
if (time(nullptr) - m_request_time > m_request_interval_max) {
|
||||
OnTimeOut();
|
||||
return true;
|
||||
}
|
||||
if (time(nullptr) - m_request_time < m_request_interval_min) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_received) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
if (jj.contains("sequence_id") && jj["sequence_id"].is_string()) {
|
||||
int sequence_id = stoi(jj["sequence_id"].get<std::string>());
|
||||
if (sequence_id >= m_request_seq) {
|
||||
OnReceived();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (...) {
|
||||
;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int DevCtrl::command_select_extruder(int id)
|
||||
{
|
||||
json j;
|
||||
|
||||
@@ -10,6 +10,33 @@ namespace Slic3r
|
||||
//Previous definitions
|
||||
class MachineObject;
|
||||
|
||||
class DevCtrlInfo
|
||||
{
|
||||
public:
|
||||
DevCtrlInfo() {};
|
||||
DevCtrlInfo(MachineObject* obj, int sequence_id, const json& req_json, int interval_max = 3, int interval_min = 0);
|
||||
|
||||
public:
|
||||
bool CheckCanUpdateData(const nlohmann::json& jj);
|
||||
|
||||
private:
|
||||
void OnTimeOut() { m_time_out = true;}
|
||||
void OnReceived() { m_received = true;} ;
|
||||
|
||||
private:
|
||||
bool m_time_out = false;
|
||||
bool m_received = false;
|
||||
|
||||
std::string m_request_dev_id = "";
|
||||
|
||||
time_t m_request_time = 0;
|
||||
int m_request_seq = 0;
|
||||
json m_request_json = json();
|
||||
|
||||
// check
|
||||
int m_request_interval_max = 3;
|
||||
int m_request_interval_min = 0;
|
||||
};
|
||||
|
||||
class DevCtrl
|
||||
{
|
||||
|
||||
@@ -1,13 +1,70 @@
|
||||
#include "DevFilaAmsSetting.h"
|
||||
#include "DevUtil.h"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
void DevAmsSystemSetting::Reset()
|
||||
{
|
||||
SetDetectOnInsertEnabled(false);
|
||||
m_enable_detect_on_insert.reset();
|
||||
SetDetectOnPowerupEnabled(false);
|
||||
SetDetectRemainEnabled(false);
|
||||
SetAutoRefillEnabled(false);
|
||||
}
|
||||
|
||||
void DevAmsSystemFirmwareSwitch::Reset()
|
||||
{
|
||||
m_status.clear();
|
||||
m_current_firmware_run = DevAmsSystemFirmware();
|
||||
m_current_firmware_sel = DevAmsSystemFirmware();
|
||||
m_firmwares.clear();
|
||||
}
|
||||
|
||||
void DevAmsSystemFirmwareSwitch::ParseFirmwareSwitch(const nlohmann::json& j)
|
||||
{
|
||||
if (!m_ctrl_switching.CheckCanUpdateData(j.contains("upgrade") ? j["upgrade"] :j)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (j.contains("print")) {
|
||||
const auto& print_jj = j["print"];
|
||||
if (print_jj.contains("upgrade_state")) {
|
||||
const auto& upgrade_jj = print_jj["upgrade_state"];
|
||||
if (upgrade_jj.contains("mc_for_ams_firmware")) {
|
||||
const auto& mc_for_ams_firmware_jj = upgrade_jj["mc_for_ams_firmware"];
|
||||
if (mc_for_ams_firmware_jj.contains("firmware")) {
|
||||
m_firmwares.clear();
|
||||
const auto& firmwares = mc_for_ams_firmware_jj["firmware"];
|
||||
for (auto item : firmwares) {
|
||||
DevAmsSystemFirmware firmware;
|
||||
DevJsonValParser::ParseVal(item, "id", firmware.m_firmare_idx);
|
||||
DevJsonValParser::ParseVal(item, "name", firmware.m_name);
|
||||
DevJsonValParser::ParseVal(item, "version", firmware.m_version);
|
||||
m_firmwares[firmware.m_firmare_idx] = firmware;
|
||||
}
|
||||
}
|
||||
|
||||
if (mc_for_ams_firmware_jj.contains("current_firmware_id")) {
|
||||
int idx = DevJsonValParser::GetVal(mc_for_ams_firmware_jj, "current_firmware_id", -1);
|
||||
if (m_firmwares.count(idx) != 0) {
|
||||
m_current_firmware_sel = m_firmwares[idx];
|
||||
} else {
|
||||
m_current_firmware_sel = DevAmsSystemFirmware();
|
||||
}
|
||||
}
|
||||
|
||||
if (mc_for_ams_firmware_jj.contains("current_run_firmware_id")) {
|
||||
auto idx = DevJsonValParser::GetVal(mc_for_ams_firmware_jj, "current_run_firmware_id", IDX_DC);
|
||||
if (m_firmwares.count(idx) != 0) {
|
||||
m_current_firmware_run = m_firmwares[idx];
|
||||
} else {
|
||||
m_current_firmware_run = DevAmsSystemFirmware();
|
||||
}
|
||||
}
|
||||
|
||||
DevJsonValParser::ParseVal(mc_for_ams_firmware_jj, "status", m_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
#pragma once
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "DevCtrl.h"
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
@@ -11,7 +13,7 @@ public:
|
||||
|
||||
public:
|
||||
// getters
|
||||
bool IsDetectOnInsertEnabled() const { return m_enable_detect_on_insert; };
|
||||
std::optional<bool> IsDetectOnInsertEnabled() const { return m_enable_detect_on_insert; };
|
||||
bool IsDetectOnPowerupEnabled() const { return m_enable_detect_on_powerup; }
|
||||
bool IsDetectRemainEnabled() const { return m_enable_detect_remain; }
|
||||
bool IsAutoRefillEnabled() const { return m_enable_auto_refill; }
|
||||
@@ -26,10 +28,74 @@ public:
|
||||
private:
|
||||
DevFilaSystem* m_owner = nullptr;
|
||||
|
||||
bool m_enable_detect_on_insert = false;
|
||||
std::optional<bool> m_enable_detect_on_insert = false;
|
||||
bool m_enable_detect_on_powerup = false;
|
||||
bool m_enable_detect_remain = false;
|
||||
bool m_enable_auto_refill = false;
|
||||
};
|
||||
|
||||
class DevAmsSystemFirmwareSwitch
|
||||
{
|
||||
public:
|
||||
enum DevAmsSystemIdx : int
|
||||
{
|
||||
IDX_DC = -1,
|
||||
IDX_LITE = 0,
|
||||
IDX_AMS_AMS2_AMSHT = 1,
|
||||
};
|
||||
|
||||
struct DevAmsSystemFirmware
|
||||
{
|
||||
DevAmsSystemIdx m_firmare_idx = IDX_DC;
|
||||
std::string m_name;
|
||||
std::string m_version;
|
||||
|
||||
public:
|
||||
bool operator==(const DevAmsSystemFirmware& o) const
|
||||
{
|
||||
return (m_firmare_idx == o.m_firmare_idx) &&
|
||||
(m_name == o.m_name) &&
|
||||
(m_version == o.m_version);
|
||||
};
|
||||
};
|
||||
|
||||
public:
|
||||
static std::shared_ptr<DevAmsSystemFirmwareSwitch> Create(DevFilaSystem* owner)
|
||||
{
|
||||
return std::shared_ptr<DevAmsSystemFirmwareSwitch>(new DevAmsSystemFirmwareSwitch(owner));
|
||||
};
|
||||
|
||||
protected:
|
||||
DevAmsSystemFirmwareSwitch(DevFilaSystem* owner) : m_owner(owner) {};
|
||||
|
||||
public:
|
||||
DevFilaSystem* GetFilaSystem() const { return m_owner; };
|
||||
bool SupportSwitchFirmware() const { return !m_firmwares.empty();};
|
||||
|
||||
DevAmsSystemIdx GetCurrentFirmwareIdxSel() const { return m_current_firmware_sel.m_firmare_idx; };
|
||||
DevAmsSystemIdx GetCurrentFirmwareIdxRun() const { return m_current_firmware_run.m_firmare_idx; };
|
||||
std::unordered_map<int, DevAmsSystemFirmware> GetSuppotedFirmwares() const { return m_firmwares;};
|
||||
|
||||
bool IsSwitching() const { return m_status == "SWITCHING";};
|
||||
bool IsIdle() const { return m_status == "IDLE";};
|
||||
|
||||
// commands
|
||||
int CrtlSwitchFirmware(int firmware_idx);
|
||||
|
||||
// setters
|
||||
void Reset();
|
||||
void ParseFirmwareSwitch(const nlohmann::json& j);
|
||||
|
||||
private:
|
||||
DevFilaSystem* m_owner = nullptr;
|
||||
|
||||
std::string m_status;
|
||||
|
||||
DevAmsSystemFirmware m_current_firmware_run;
|
||||
DevAmsSystemFirmware m_current_firmware_sel;
|
||||
std::unordered_map<int, DevAmsSystemFirmware> m_firmwares;
|
||||
|
||||
DevCtrlInfo m_ctrl_switching;
|
||||
};
|
||||
|
||||
}// namespace Slic3r
|
||||
29
src/slic3r/GUI/DeviceCore/DevFilaAmsSettingCtrl.cpp
Normal file
29
src/slic3r/GUI/DeviceCore/DevFilaAmsSettingCtrl.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "DevFilaAmsSetting.h"
|
||||
#include "DevFilaSystem.h"
|
||||
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
int DevAmsSystemFirmwareSwitch::CrtlSwitchFirmware(int firmware_idx)
|
||||
{
|
||||
if (!m_owner) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
MachineObject* obj_ = m_owner->GetOwner();
|
||||
|
||||
json command_json;
|
||||
command_json["upgrade"]["command"] = "mc_for_ams_firmware_upgrade";
|
||||
command_json["upgrade"]["sequence_id"] = std::to_string(obj_->m_sequence_id++);
|
||||
command_json["upgrade"]["src_id"] = 1;// 1-Studio
|
||||
command_json["upgrade"]["id"] = firmware_idx;
|
||||
|
||||
int rtn = obj_->publish_json(command_json);
|
||||
if (rtn == 0) {
|
||||
m_status = "SWITCHING";
|
||||
m_ctrl_switching = DevCtrlInfo(obj_, obj_->m_sequence_id - 1, command_json, 3, 1);
|
||||
}
|
||||
|
||||
return rtn;
|
||||
};
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "DevFilaAmsSetting.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <wx/string.h>
|
||||
#include <wx/colour.h>
|
||||
|
||||
@@ -150,6 +151,8 @@ public:
|
||||
~DevFilaSystem();
|
||||
|
||||
public:
|
||||
MachineObject* GetOwner() const { return m_owner; }
|
||||
|
||||
bool HasAms() const { return !amsList.empty(); }
|
||||
bool IsAmsSettingUp() const;
|
||||
|
||||
@@ -167,10 +170,16 @@ public:
|
||||
|
||||
/* AMS settings*/
|
||||
DevAmsSystemSetting& GetAmsSystemSetting() { return m_ams_system_setting; }
|
||||
bool IsDetectOnInsertEnabled() const { return m_ams_system_setting.IsDetectOnInsertEnabled(); };
|
||||
std::optional<bool> IsDetectOnInsertEnabled() const { return m_ams_system_setting.IsDetectOnInsertEnabled(); };
|
||||
bool IsDetectOnPowerupEnabled() const { return m_ams_system_setting.IsDetectOnPowerupEnabled(); }
|
||||
bool IsDetectRemainEnabled() const { return m_ams_system_setting.IsDetectRemainEnabled(); }
|
||||
bool IsAutoRefillEnabled() const { return m_ams_system_setting.IsAutoRefillEnabled(); }
|
||||
|
||||
std::weak_ptr<DevAmsSystemFirmwareSwitch> GetAmsFirmwareSwitch() const { return m_ams_firmware_switch;}
|
||||
|
||||
public:
|
||||
// ctrls
|
||||
int CtrlAmsReset() const;
|
||||
|
||||
public:
|
||||
static bool IsBBL_Filament(std::string tag_uid);
|
||||
@@ -184,6 +193,7 @@ private:
|
||||
std::map<std::string, DevAms*> amsList; // key: ams[id], start with 0
|
||||
|
||||
DevAmsSystemSetting m_ams_system_setting{ this };
|
||||
std::shared_ptr<DevAmsSystemFirmwareSwitch> m_ams_firmware_switch = DevAmsSystemFirmwareSwitch::Create(this);
|
||||
};// class DevFilaSystem
|
||||
|
||||
|
||||
|
||||
19
src/slic3r/GUI/DeviceCore/DevFilaSystemCtrl.cpp
Normal file
19
src/slic3r/GUI/DeviceCore/DevFilaSystemCtrl.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "DevFilaSystem.h"
|
||||
|
||||
#include "slic3r/GUI/DeviceManager.hpp"// TODO: remove this include
|
||||
#include "DevUtil.h"
|
||||
|
||||
using namespace nlohmann;
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
int DevFilaSystem::CtrlAmsReset() const
|
||||
{
|
||||
json jj_command;
|
||||
jj_command["print"]["command"] = "ams_reset";
|
||||
jj_command["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
return m_owner->publish_json(jj_command);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -724,7 +724,7 @@ std::string MachineObject::get_lifecycle_type_str()
|
||||
return "product";
|
||||
}
|
||||
|
||||
bool MachineObject::is_in_upgrading()
|
||||
bool MachineObject::is_in_upgrading() const
|
||||
{
|
||||
return upgrade_display_state == DevFirmwareUpgradingState::UpgradingInProgress;
|
||||
}
|
||||
@@ -734,7 +734,7 @@ bool MachineObject::is_upgrading_avalable()
|
||||
return upgrade_display_state == DevFirmwareUpgradingState::UpgradingAvaliable;
|
||||
}
|
||||
|
||||
int MachineObject::get_upgrade_percent()
|
||||
int MachineObject::get_upgrade_percent() const
|
||||
{
|
||||
if (upgrade_progress.empty())
|
||||
return 0;
|
||||
@@ -1006,6 +1006,10 @@ void MachineObject::parse_home_flag(int flag)
|
||||
}
|
||||
|
||||
is_support_air_print_detection = ((flag >> 29) & 0x1) != 0;
|
||||
if (auto ptr = m_fila_system->GetAmsFirmwareSwitch().lock();
|
||||
ptr->GetCurrentFirmwareIdxRun() == DevAmsSystemFirmwareSwitch::IDX_AMS_AMS2_AMSHT) {
|
||||
is_support_air_print_detection = false;// special case, for the firmware, air print is not supported
|
||||
}
|
||||
ams_air_print_status = ((flag >> 28) & 0x1) != 0;
|
||||
|
||||
/*if (!is_support_p1s_plus) {
|
||||
@@ -1555,12 +1559,12 @@ int MachineObject::command_ams_change_filament(bool load, std::string ams_id, st
|
||||
return this->publish_json(j);
|
||||
}
|
||||
|
||||
int MachineObject::command_ams_user_settings(int ams_id, bool start_read_opt, bool tray_read_opt, bool remain_flag)
|
||||
int MachineObject::command_ams_user_settings(bool start_read_opt, bool tray_read_opt, bool remain_flag)
|
||||
{
|
||||
json j;
|
||||
j["print"]["command"] = "ams_user_setting";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["ams_id"] = ams_id;
|
||||
j["print"]["ams_id"] = -1; // all ams
|
||||
j["print"]["startup_read_option"] = start_read_opt;
|
||||
j["print"]["tray_read_option"] = tray_read_opt;
|
||||
j["print"]["calibrate_remain_flag"] = remain_flag;
|
||||
@@ -2778,6 +2782,13 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
}
|
||||
} catch (...) {}
|
||||
|
||||
try {
|
||||
if (auto ptr = m_fila_system->GetAmsFirmwareSwitch().lock()) {
|
||||
ptr->ParseFirmwareSwitch(j);
|
||||
}
|
||||
} catch (...) {
|
||||
BOOST_LOG_TRIVIAL(error) << "parse_json: failed to parse firmware switch info";
|
||||
}
|
||||
|
||||
if (j.contains("print")) {
|
||||
json jj = j["print"];
|
||||
@@ -2858,6 +2869,10 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
|
||||
if (jj.contains("support_update_remain")) {
|
||||
if (jj["support_update_remain"].is_boolean()) {
|
||||
is_support_update_remain = jj["support_update_remain"].get<bool>();
|
||||
if (auto ptr = m_fila_system->GetAmsFirmwareSwitch().lock();
|
||||
ptr->GetCurrentFirmwareIdxRun() == DevAmsSystemFirmwareSwitch::IDX_AMS_AMS2_AMSHT) {
|
||||
is_support_update_remain = true;// special case, for the firmware, remain is supported
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5415,11 +5430,6 @@ bool MachineObject::HasAms() const
|
||||
return m_fila_system->HasAms();
|
||||
}
|
||||
|
||||
bool MachineObject::IsDetectOnInsertEnabled() const
|
||||
{
|
||||
return m_fila_system->GetAmsSystemSetting().IsDetectOnInsertEnabled();
|
||||
}
|
||||
|
||||
void change_the_opacity(wxColour& colour)
|
||||
{
|
||||
if (colour.Alpha() == 255) {
|
||||
|
||||
@@ -292,12 +292,6 @@ public:
|
||||
bool is_multi_extruders() const;
|
||||
int get_extruder_id_by_ams_id(const std::string& ams_id);
|
||||
|
||||
/* ams settings*/
|
||||
bool IsDetectOnInsertEnabled() const;;
|
||||
//bool IsDetectOnPowerupEnabled() const { return m_enable_detect_on_powerup; }
|
||||
//bool IsDetectRemainEnabled() const { return m_enable_detect_remain; }
|
||||
//bool IsAutoRefillEnabled() const { return m_enable_auto_refill; }
|
||||
|
||||
[[nodiscard]] bool is_nozzle_flow_type_supported() const { return is_enable_np; };
|
||||
[[nodiscard]] wxString get_nozzle_replace_url() const;
|
||||
|
||||
@@ -368,9 +362,9 @@ public:
|
||||
|
||||
std::string get_firmware_type_str();
|
||||
std::string get_lifecycle_type_str();
|
||||
bool is_in_upgrading();
|
||||
bool is_in_upgrading() const;
|
||||
bool is_upgrading_avalable();
|
||||
int get_upgrade_percent();
|
||||
int get_upgrade_percent() const;
|
||||
std::string get_ota_version();
|
||||
bool check_version_valid();
|
||||
wxString get_upgrade_result_str(int upgrade_err_code);
|
||||
@@ -724,7 +718,7 @@ public:
|
||||
// ams controls
|
||||
//int command_ams_switch(int tray_index, int old_temp = 210, int new_temp = 210);
|
||||
int command_ams_change_filament(bool load, std::string ams_id, std::string slot_id, int old_temp = 210, int new_temp = 210);
|
||||
int command_ams_user_settings(int ams_id, bool start_read_opt, bool tray_read_opt, bool remain_flag = false);
|
||||
int command_ams_user_settings(bool start_read_opt, bool tray_read_opt, bool remain_flag = false);
|
||||
int command_ams_switch_filament(bool switch_filament);
|
||||
int command_ams_air_print_detect(bool air_print_detect);
|
||||
int command_ams_calibrate(int ams_id);
|
||||
|
||||
@@ -3230,16 +3230,8 @@ void StatusPanel::update_extruder_status(MachineObject* obj)
|
||||
void StatusPanel::update_ams(MachineObject *obj)
|
||||
{
|
||||
// update obj in sub dlg
|
||||
if (m_ams_setting_dlg) {
|
||||
m_ams_setting_dlg->obj = obj;
|
||||
|
||||
if (obj && m_ams_setting_dlg->IsShown()) {
|
||||
update_ams_insert_material(obj);
|
||||
m_ams_setting_dlg->update_starting_read_mode(obj->GetFilaSystem()->IsDetectOnPowerupEnabled());
|
||||
m_ams_setting_dlg->update_remain_mode(obj->GetFilaSystem()->IsDetectRemainEnabled());
|
||||
m_ams_setting_dlg->update_switch_filament(obj->GetFilaSystem()->IsAutoRefillEnabled());
|
||||
m_ams_setting_dlg->update_air_printing_detection(obj->ams_air_print_status);
|
||||
}
|
||||
if (m_ams_setting_dlg && m_ams_setting_dlg->IsShown()) {
|
||||
m_ams_setting_dlg->UpdateByObj(obj);
|
||||
}
|
||||
if (m_filament_setting_dlg) { m_filament_setting_dlg->obj = obj; }
|
||||
|
||||
@@ -3287,10 +3279,8 @@ void StatusPanel::update_ams(MachineObject *obj)
|
||||
|
||||
if (obj->GetFilaSystem()->GetAmsList().empty() || obj->ams_exist_bits == 0) {
|
||||
m_ams_control->show_auto_refill(false);
|
||||
m_ams_control->enable_ams_setting(false);
|
||||
} else {
|
||||
m_ams_control->show_auto_refill(true);
|
||||
m_ams_control->enable_ams_setting(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3417,17 +3407,6 @@ void StatusPanel::update_ams(MachineObject *obj)
|
||||
update_ams_control_state(curr_ams_id, curr_can_id);
|
||||
}
|
||||
|
||||
void StatusPanel::update_ams_insert_material(MachineObject* obj) {
|
||||
std::string extra_ams_str = (boost::format("ams_f1/%1%") % 0).str();
|
||||
auto extra_ams_it = obj->module_vers.find(extra_ams_str);
|
||||
if (extra_ams_it != obj->module_vers.end()) {
|
||||
m_ams_setting_dlg->update_insert_material_read_mode(obj->GetFilaSystem()->IsDetectOnInsertEnabled(), extra_ams_it->second.sw_ver);
|
||||
}
|
||||
else {
|
||||
m_ams_setting_dlg->update_insert_material_read_mode(obj->GetFilaSystem()->IsDetectOnInsertEnabled(), "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void StatusPanel::update_ams_control_state(std::string ams_id, std::string slot_id)
|
||||
{
|
||||
@@ -4312,25 +4291,13 @@ void StatusPanel::on_ams_filament_backup(SimpleEvent& event)
|
||||
|
||||
void StatusPanel::on_ams_setting_click(SimpleEvent &event)
|
||||
{
|
||||
if (!m_ams_setting_dlg) m_ams_setting_dlg = new AMSSetting((wxWindow *) this, wxID_ANY);
|
||||
if (obj) {
|
||||
update_ams_insert_material(obj);
|
||||
m_ams_setting_dlg->update_starting_read_mode(obj->GetFilaSystem()->IsDetectOnPowerupEnabled());
|
||||
m_ams_setting_dlg->update_ams_img(DevPrinterConfigUtil::get_printer_ams_img(obj->printer_type));
|
||||
std::string ams_id = m_ams_control->GetCurentShowAms();
|
||||
if (obj->GetFilaSystem()->GetAmsList().size() == 0) {
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
int ams_id_int = atoi(ams_id.c_str());
|
||||
m_ams_setting_dlg->ams_id = ams_id_int;
|
||||
m_ams_setting_dlg->ams_support_remain = obj->is_support_update_remain;
|
||||
m_ams_setting_dlg->Show();
|
||||
}
|
||||
catch (...) {
|
||||
;
|
||||
}
|
||||
if (!m_ams_setting_dlg) {
|
||||
m_ams_setting_dlg = new AMSSetting((wxWindow*)this, wxID_ANY);
|
||||
}
|
||||
|
||||
m_ams_setting_dlg->UpdateByObj(obj);
|
||||
m_ams_setting_dlg->Show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -759,7 +759,6 @@ protected:
|
||||
void update_ams(MachineObject* obj);
|
||||
void update_filament_loading_panel(MachineObject* obj);
|
||||
|
||||
void update_ams_insert_material(MachineObject* obj);
|
||||
void update_extruder_status(MachineObject* obj);
|
||||
void update_ams_control_state(std::string ams_id, std::string slot_id);
|
||||
void update_cali(MachineObject* obj);
|
||||
|
||||
@@ -1636,9 +1636,6 @@ void AMSControl::auto_refill(wxCommandEvent& event)
|
||||
|
||||
void AMSControl::on_ams_setting_click(wxMouseEvent &event)
|
||||
{
|
||||
for (auto i = 0; i < m_ams_info.size(); i++) {
|
||||
if (m_ams_info[i].ams_id == m_current_ams) { m_ams_info[i].current_action = AMSAction::AMS_ACTION_CALI; }
|
||||
}
|
||||
post_event(SimpleEvent(EVT_AMS_SETTINGS));
|
||||
}
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ int AMSinfo::get_humidity_display_idx() const
|
||||
}
|
||||
}
|
||||
|
||||
assert(false && "Invalid AMS type for humidity display");
|
||||
//assert(false && "Invalid AMS type for humidity display");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,3 +75,8 @@ void AnimaIcon::Enable()
|
||||
{
|
||||
if (m_bitmap) { m_bitmap->SetBitmap(m_image_enable); }
|
||||
}
|
||||
|
||||
bool AnimaIcon::IsRunning() const
|
||||
{
|
||||
return m_timer ? m_timer->IsRunning() : false;
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
void Play();
|
||||
void Stop();
|
||||
void Enable();
|
||||
bool IsPlaying() const { return IsRunning(); };
|
||||
bool IsRunning() const;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user