mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 23:31:13 -06:00
ENH:calibration
1.adjust interaction of calibration add select my device add select multi-amstray modify ams selector 2.add some x1c calibration command Change-Id: I403446cc0cd3ae5e1dec5d2dc97920ff334522da
This commit is contained in:
parent
032bf107b8
commit
d53bd3394a
25 changed files with 3001 additions and 1122 deletions
|
@ -2,12 +2,12 @@
|
|||
#include "I18N.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
#define REFRESH_INTERVAL 1000
|
||||
CalibrationPanel::CalibrationPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxPanel(parent, id, pos, size, style)
|
||||
{
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
|
||||
//init_bitmaps();
|
||||
init_tabpanel();
|
||||
|
||||
wxBoxSizer* sizer_main = new wxBoxSizer(wxVERTICAL);
|
||||
|
@ -15,6 +15,9 @@ CalibrationPanel::CalibrationPanel(wxWindow* parent, wxWindowID id, const wxPoin
|
|||
|
||||
SetSizerAndFit(sizer_main);
|
||||
Layout();
|
||||
|
||||
init_timer();
|
||||
Bind(wxEVT_TIMER, &CalibrationPanel::on_timer, this);
|
||||
}
|
||||
|
||||
void CalibrationPanel::init_tabpanel() {
|
||||
|
@ -25,8 +28,8 @@ void CalibrationPanel::init_tabpanel() {
|
|||
m_tabpanel = new Tabbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, sizer_side_tools, wxNB_LEFT | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
||||
m_tabpanel->SetBackgroundColour(*wxWHITE);
|
||||
|
||||
//m_pa_panel = new CalibrationWizard(m_tabpanel);
|
||||
//m_tabpanel->AddPage(m_pa_panel, _L("Pressure Adavance"), "", true);
|
||||
m_pa_panel = new PressureAdvanceWizard(m_tabpanel);
|
||||
m_tabpanel->AddPage(m_pa_panel, _L("Pressure Adavance"), "", true);
|
||||
|
||||
m_flow_panel = new FlowRateWizard(m_tabpanel);
|
||||
m_tabpanel->AddPage(m_flow_panel, _L("Flow Rate"), "", false);
|
||||
|
@ -35,39 +38,38 @@ void CalibrationPanel::init_tabpanel() {
|
|||
m_tabpanel->AddPage(m_volumetric_panel, _L("Max Volumetric Speed"), "", false);
|
||||
|
||||
m_temp_panel = new TemperatureWizard(m_tabpanel);
|
||||
m_tabpanel->AddPage(m_temp_panel, _L("Temperature"), "", true);
|
||||
|
||||
//m_vfa_panel = new CalibrationWizard(m_tabpanel);
|
||||
//m_tabpanel->AddPage(m_vfa_panel, _L("VFA"), "", false);
|
||||
|
||||
//m_tabpanel->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, [this](wxBookCtrlEvent& e) {
|
||||
// CalibrationWizard* page = static_cast<CalibrationWizard*>(m_tabpanel->GetCurrentPage());
|
||||
// if (page->get_frist_page()) {
|
||||
// page->update_comboboxes();
|
||||
// }
|
||||
// }, m_tabpanel->GetId());
|
||||
m_tabpanel->AddPage(m_temp_panel, _L("Temperature"), "", false);
|
||||
}
|
||||
|
||||
void CalibrationPanel::update_obj(MachineObject* obj) {
|
||||
if (obj) {
|
||||
if (m_pa_panel)
|
||||
m_pa_panel->update_obj(obj);
|
||||
if (m_flow_panel) {
|
||||
m_flow_panel->update_obj(obj);
|
||||
m_flow_panel->update_ams(obj);
|
||||
}
|
||||
if (m_volumetric_panel) {
|
||||
m_volumetric_panel->update_obj(obj);
|
||||
m_volumetric_panel->update_ams(obj);
|
||||
}
|
||||
if (m_temp_panel) {
|
||||
m_temp_panel->update_obj(obj);
|
||||
m_temp_panel->update_ams(obj);
|
||||
m_temp_panel->update_progress();
|
||||
}
|
||||
if (m_vfa_panel) {
|
||||
m_vfa_panel->update_obj(obj);
|
||||
}
|
||||
void CalibrationPanel::init_timer()
|
||||
{
|
||||
m_refresh_timer = new wxTimer();
|
||||
m_refresh_timer->SetOwner(this);
|
||||
m_refresh_timer->Start(REFRESH_INTERVAL);
|
||||
wxPostEvent(this, wxTimerEvent());
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_timer(wxTimerEvent& event) {
|
||||
// todo only update at CalibrationPanel
|
||||
update_all();
|
||||
}
|
||||
|
||||
void CalibrationPanel::update_all() {
|
||||
if (m_pa_panel) {
|
||||
m_pa_panel->update_printer_selections();
|
||||
m_pa_panel->update_print_progress();
|
||||
}
|
||||
if (m_flow_panel) {
|
||||
m_flow_panel->update_printer_selections();
|
||||
m_flow_panel->update_print_progress();
|
||||
}
|
||||
if (m_volumetric_panel) {
|
||||
m_volumetric_panel->update_printer_selections();
|
||||
m_volumetric_panel->update_print_progress();
|
||||
}
|
||||
if (m_temp_panel) {
|
||||
m_temp_panel->update_printer_selections();
|
||||
m_temp_panel->update_print_progress();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,14 +12,12 @@ public:
|
|||
CalibrationPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||
~CalibrationPanel() {};
|
||||
Tabbook* get_tabpanel() { return m_tabpanel; };
|
||||
void update_obj(MachineObject* obj);
|
||||
void update_all();
|
||||
|
||||
protected:
|
||||
void init_bitmaps();
|
||||
void init_tabpanel();
|
||||
|
||||
//void show_wizard();
|
||||
//CalibrationWizard* get_current_wizard();
|
||||
void init_timer();
|
||||
void on_timer(wxTimerEvent& event);
|
||||
|
||||
private:
|
||||
Tabbook* m_tabpanel{ nullptr };
|
||||
|
@ -30,6 +28,8 @@ private:
|
|||
CalibrationWizard* m_volumetric_panel{ nullptr };
|
||||
TemperatureWizard* m_temp_panel{ nullptr };
|
||||
CalibrationWizard* m_vfa_panel{ nullptr };
|
||||
|
||||
wxTimer* m_refresh_timer = nullptr;
|
||||
};
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,17 +1,57 @@
|
|||
#ifndef slic3r_GUI_CalibrationWizard_hpp_
|
||||
#define slic3r_GUI_CalibrationWizard_hpp_
|
||||
|
||||
#include "GUI_Utils.hpp"
|
||||
#include "DeviceManager.hpp"
|
||||
#include "CalibrationWizardPage.hpp"
|
||||
#include "Widgets/ComboBox.hpp"
|
||||
#include "Widgets/TextInput.hpp"
|
||||
#include "Widgets/AMSControl.hpp"
|
||||
#include "AMSMaterialsSetting.hpp"
|
||||
#include "Widgets/ProgressBar.hpp"
|
||||
#include "SavePresetDialog.hpp"
|
||||
#include "PresetComboBoxes.hpp"
|
||||
#include "../slic3r/Utils/CalibUtils.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
wxDECLARE_EVENT(EVT_CALIBRATION_TRAY_SELECTION_CHANGED, SimpleEvent);
|
||||
|
||||
enum FilamentSelectMode {
|
||||
FSMCheckBoxMode,
|
||||
FSMRadioMode
|
||||
};
|
||||
class FilamentComboBox : public wxPanel
|
||||
{
|
||||
public:
|
||||
FilamentComboBox(wxWindow* parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
|
||||
~FilamentComboBox() {};
|
||||
|
||||
void set_select_mode(FilamentSelectMode mode);
|
||||
FilamentSelectMode get_select_mode() { return m_mode; }
|
||||
void load_tray_from_ams(int id, DynamicPrintConfig& tray);
|
||||
void update_from_preset();
|
||||
int get_tray_id() { return m_tray_id; }
|
||||
CalibrateFilamentComboBox* GetComboBox() { return m_comboBox; }
|
||||
CheckBox* GetCheckBox() { return m_checkBox; }
|
||||
void SetCheckBox(CheckBox* cb) { m_checkBox = cb; }
|
||||
wxRadioButton* GetRadioBox() { return m_radioBox; }
|
||||
void SetRadioBox(wxRadioButton* btn) { m_radioBox = btn; }
|
||||
virtual bool Show(bool show = true);
|
||||
virtual bool Enable(bool enable);
|
||||
virtual void SetValue(bool value);
|
||||
|
||||
protected:
|
||||
int m_tray_id;
|
||||
|
||||
CheckBox* m_checkBox{nullptr};
|
||||
//RadioBox* m_radioBox;
|
||||
wxRadioButton* m_radioBox{ nullptr };
|
||||
CalibrateFilamentComboBox* m_comboBox{ nullptr };
|
||||
FilamentSelectMode m_mode{ FSMRadioMode };
|
||||
};
|
||||
|
||||
typedef std::vector<FilamentComboBox*> FilamentComboBoxList;
|
||||
|
||||
class CalibrationWizard : public wxPanel {
|
||||
public:
|
||||
CalibrationWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||
|
@ -19,70 +59,125 @@ public:
|
|||
CalibrationWizardPage* get_curr_page() { return m_curr_page; }
|
||||
CalibrationWizardPage* get_frist_page() { return m_first_page; }
|
||||
void show_page(CalibrationWizardPage* page);
|
||||
void update_obj(MachineObject* rhs_obj) { obj = rhs_obj; }
|
||||
void show_send_progress_bar(bool show);
|
||||
void update_printer_selections();
|
||||
void update_ams(MachineObject* obj);
|
||||
void update_progress();
|
||||
void update_print_progress();
|
||||
void update_filaments_from_preset();
|
||||
|
||||
protected:
|
||||
virtual void create_pages() = 0;
|
||||
virtual bool start_calibration(std::string tray_id) = 0;
|
||||
virtual void save_calibration_result() {};
|
||||
virtual void update_calibration_value() = 0;
|
||||
virtual bool start_calibration(std::vector<int> tray_ids) = 0;
|
||||
virtual bool save_calibration_result() = 0;
|
||||
virtual bool recommend_input_value();
|
||||
|
||||
protected:
|
||||
wxPanel* m_background_panel;
|
||||
MachineObject* curr_obj{ nullptr };
|
||||
std::vector<MachineObject*> obj_list{ nullptr };
|
||||
|
||||
wxScrolledWindow* m_scrolledWindow;
|
||||
wxBoxSizer* m_all_pages_sizer;
|
||||
|
||||
CalibrationWizardPage* m_curr_page{ nullptr };
|
||||
CalibrationWizardPage* m_first_page{ nullptr };
|
||||
|
||||
// preset panel
|
||||
wxPanel* m_presets_panel;
|
||||
AMSControl* m_ams_control;
|
||||
wxPanel* m_select_ams_mode_panel;
|
||||
//RadioBox* m_ams_radiobox;
|
||||
//RadioBox* m_ext_spool_radiobox;
|
||||
wxRadioButton* m_ams_radiobox;
|
||||
wxRadioButton* m_ext_spool_radiobox;
|
||||
bool m_filament_from_ext_spool{ false };
|
||||
wxPanel* m_muilti_ams_panel;
|
||||
std::vector<AMSItem*> m_ams_item_list;
|
||||
wxPanel* m_filament_list_panel;
|
||||
ScalableButton* m_ams_sync_button;
|
||||
FilamentComboBoxList m_filament_comboBox_list;
|
||||
wxPanel* m_virtual_panel;
|
||||
FilamentComboBox* m_virtual_tray_comboBox;
|
||||
ComboBox* m_comboBox_printer;
|
||||
ComboBox* m_comboBox_filament;
|
||||
ComboBox* m_comboBox_nozzle_dia;
|
||||
ComboBox* m_comboBox_bed_type;
|
||||
ComboBox* m_comboBox_process;
|
||||
Preset* m_printer_preset{nullptr};
|
||||
Preset* m_filament_preset{ nullptr };
|
||||
Preset* m_print_preset{ nullptr };
|
||||
wxStaticText* m_from_text;
|
||||
wxStaticText* m_to_text;
|
||||
wxStaticText* m_step_text;
|
||||
TextInput* m_from_value;
|
||||
TextInput* m_to_value;
|
||||
TextInput* m_step;
|
||||
BBLStatusBarSend* m_progress_bar;
|
||||
TextInput* m_nozzle_temp;
|
||||
TextInput* m_bed_temp;
|
||||
TextInput* m_max_volumetric_speed;
|
||||
wxStaticText* m_filaments_incompatible_tips;
|
||||
wxStaticText* m_bed_type_incompatible_tips;
|
||||
wxPanel* m_send_progress_panel;
|
||||
std::shared_ptr<BBLStatusBarSend> m_send_progress_bar; // for send
|
||||
|
||||
MachineObject* obj{ nullptr };
|
||||
// print panel
|
||||
wxPanel* m_print_panel;
|
||||
wxStaticText* m_staticText_progress_percent;
|
||||
wxStaticText* m_staticText_progress_left_time;
|
||||
wxStaticText* m_staticText_layers;
|
||||
ScalableButton* m_button_pause_resume;
|
||||
ScalableButton* m_button_abort;
|
||||
ProgressBar* m_print_gauge_progress; // for print
|
||||
PageButton* m_btn_next;
|
||||
PageButton* m_btn_recali;
|
||||
|
||||
// save panel
|
||||
wxPanel* m_save_panel;
|
||||
|
||||
CalibrationWizardPage* m_curr_page{ nullptr };
|
||||
CalibrationWizardPage* m_first_page{ nullptr };
|
||||
|
||||
void add_presets_panel_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
|
||||
void add_progress_bar_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
|
||||
void show_progress_bar(bool show);
|
||||
wxString get_presets_incompatible() { return wxString(); }
|
||||
void add_print_panel_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
|
||||
void add_send_progress_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
|
||||
|
||||
void on_select_printer(wxCommandEvent& evt);
|
||||
void on_select_filament(wxCommandEvent& evt);
|
||||
void reset_printing_values();
|
||||
bool save_presets(const std::string& config_key, ConfigOption* config_value);
|
||||
int get_bed_temp(DynamicPrintConfig* config);
|
||||
FilamentSelectMode get_ams_select_mode() { if (!m_filament_comboBox_list.empty()) return m_filament_comboBox_list[0]->get_select_mode(); return FilamentSelectMode::FSMRadioMode; }
|
||||
void set_ams_select_mode(FilamentSelectMode mode) { for (auto fcb : m_filament_comboBox_list) fcb->set_select_mode(mode); };
|
||||
std::vector<int> get_selected_tray();
|
||||
FilamentComboBoxList get_selected_filament_comboBox();
|
||||
|
||||
virtual void on_select_printer(wxCommandEvent& evt);
|
||||
void on_select_nozzle(wxCommandEvent& evt);
|
||||
void on_select_tray(SimpleEvent& evt);
|
||||
void on_select_bed_type(wxCommandEvent& evt);
|
||||
void on_select_process(wxCommandEvent& evt);
|
||||
void on_click_btn_prev(IntEvent& event);
|
||||
void on_click_btn_next(IntEvent& event);
|
||||
void on_subtask_abort(wxCommandEvent& event);
|
||||
void on_subtask_pause_resume(wxCommandEvent& event);
|
||||
void on_choose_ams(wxCommandEvent& event);
|
||||
void on_choose_ext_spool(wxCommandEvent& event);
|
||||
void on_update_ams_filament(bool dialog = true);
|
||||
void on_switch_ams(std::string ams_id);
|
||||
|
||||
private:
|
||||
void create_presets_panel();
|
||||
void create_progress_bar();
|
||||
void create_print_panel();
|
||||
void create_save_panel();
|
||||
void create_send_progress_bar();
|
||||
|
||||
void init_printer_selections();
|
||||
void init_filaments_selections();
|
||||
void init_presets_selections();
|
||||
void init_nozzle_selections();
|
||||
void init_bed_type_selections();
|
||||
void init_process_selections();
|
||||
void init_presets_selections();
|
||||
};
|
||||
|
||||
class PressureAdvanceWizard : public CalibrationWizard{};
|
||||
|
||||
class FlowRateWizard : public CalibrationWizard {
|
||||
class PressureAdvanceWizard : public CalibrationWizard{
|
||||
public:
|
||||
FlowRateWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||
~FlowRateWizard() {};
|
||||
PressureAdvanceWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||
~PressureAdvanceWizard() {};
|
||||
protected:
|
||||
virtual void create_pages() override;
|
||||
virtual bool start_calibration(std::string tray_id) override;
|
||||
virtual void update_calibration_value() override;
|
||||
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
||||
virtual bool save_calibration_result() override;
|
||||
virtual bool recommend_input_value() override;
|
||||
private:
|
||||
// page 1
|
||||
CalibrationWizardPage* m_page1;
|
||||
|
@ -92,21 +187,44 @@ private:
|
|||
|
||||
// page 3
|
||||
CalibrationWizardPage* m_page3;
|
||||
TextInput* m_k_val;
|
||||
TextInput* m_n_val;
|
||||
};
|
||||
|
||||
class FlowRateWizard : public CalibrationWizard {
|
||||
public:
|
||||
FlowRateWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||
~FlowRateWizard() {};
|
||||
protected:
|
||||
void create_low_end_pages();
|
||||
void create_high_end_pages();
|
||||
virtual void create_pages() override;
|
||||
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
||||
virtual bool save_calibration_result() override;
|
||||
virtual bool recommend_input_value() override;
|
||||
|
||||
virtual void on_select_printer(wxCommandEvent& evt) override;
|
||||
private:
|
||||
// page 1
|
||||
CalibrationWizardPage* m_page1{ nullptr };
|
||||
|
||||
// page 2
|
||||
CalibrationWizardPage* m_page2{ nullptr };
|
||||
|
||||
// page 3
|
||||
CalibrationWizardPage* m_page3{ nullptr };
|
||||
CalibrationWizardPage* m_high_end_page3{ nullptr };
|
||||
ComboBox* m_optimal_block_coarse;
|
||||
|
||||
// page 4
|
||||
CalibrationWizardPage* m_page4;
|
||||
AMSControl* m_readonly_ams_control;
|
||||
TextInput* m_readonly_printer;
|
||||
TextInput* m_readonly_filament;
|
||||
TextInput* m_readonly_bed_type;
|
||||
TextInput* m_readonly_process;
|
||||
CalibrationWizardPage* m_page4{ nullptr };
|
||||
//BBLStatusBarSend* m_progress_bar2;
|
||||
|
||||
// page 5
|
||||
CalibrationWizardPage* m_page5;
|
||||
CalibrationWizardPage* m_page5{ nullptr };
|
||||
ComboBox* m_optimal_block_fine;
|
||||
|
||||
void create_readonly_presets_panel();
|
||||
void on_fine_tune(wxCommandEvent&);
|
||||
};
|
||||
|
||||
class MaxVolumetricSpeedWizard : public CalibrationWizard {
|
||||
|
@ -115,8 +233,9 @@ public:
|
|||
~MaxVolumetricSpeedWizard() {};
|
||||
protected:
|
||||
virtual void create_pages() override;
|
||||
virtual bool start_calibration(std::string tray_id) override;
|
||||
virtual void update_calibration_value() override;
|
||||
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
||||
virtual bool save_calibration_result() override;
|
||||
virtual bool recommend_input_value() override;
|
||||
private:
|
||||
// page 1
|
||||
CalibrationWizardPage* m_page1;
|
||||
|
@ -135,9 +254,9 @@ public:
|
|||
~TemperatureWizard() {};
|
||||
protected:
|
||||
virtual void create_pages() override;
|
||||
virtual bool start_calibration(std::string tray_id) override;
|
||||
virtual void save_calibration_result();
|
||||
virtual void update_calibration_value() override;
|
||||
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
||||
virtual bool save_calibration_result() override;
|
||||
virtual bool recommend_input_value() override;
|
||||
private:
|
||||
// page 1
|
||||
CalibrationWizardPage* m_page1;
|
||||
|
@ -145,6 +264,9 @@ private:
|
|||
// page 2
|
||||
CalibrationWizardPage* m_page2;
|
||||
TextInput* m_optimal_temp;
|
||||
|
||||
// page 3
|
||||
CalibrationWizardPage* m_page3;
|
||||
};
|
||||
|
||||
class VFAWizard : public CalibrationWizard {};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "CalibrationWizardPage.hpp"
|
||||
#include "CalibrationWizard.hpp"
|
||||
#include "I18N.hpp"
|
||||
#include "Widgets/Label.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
|
@ -11,12 +11,12 @@ PageButton::PageButton(wxWindow* parent, wxString text, ButtonType type)
|
|||
: m_type(type),
|
||||
Button(parent, text)
|
||||
{
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(AMS_CONTROL_DISABLE_COLOUR, StateColor::Disabled),
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Disabled),
|
||||
std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal));
|
||||
|
||||
StateColor btn_bg_white(std::pair<wxColour, int>(AMS_CONTROL_DISABLE_COLOUR, StateColor::Disabled),
|
||||
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Disabled),
|
||||
std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal));
|
||||
|
@ -59,9 +59,8 @@ PageButton::PageButton(wxWindow* parent, wxString text, ButtonType type)
|
|||
SetCornerRadius(FromDIP(12));
|
||||
}
|
||||
|
||||
CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, bool has_split_line, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||
: m_has_middle_line(has_split_line),
|
||||
wxPanel(parent, id, pos, size, style)
|
||||
CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxPanel(parent, id, pos, size, style)
|
||||
{
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
|
||||
|
@ -90,40 +89,21 @@ CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, bool has_split_li
|
|||
|
||||
page_sizer->Add(m_top_sizer, 0, wxEXPAND, 0);
|
||||
|
||||
wxBoxSizer* horiz_sizer;
|
||||
horiz_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_content_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_left_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
horiz_sizer->Add(m_left_sizer, 1, wxEXPAND, 0);
|
||||
page_sizer->Add(m_content_sizer, 0, wxEXPAND, 0);
|
||||
|
||||
auto middle_line = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(1, -1), wxTAB_TRAVERSAL);
|
||||
middle_line->SetBackgroundColour(wxColour(0, 0, 0));
|
||||
page_sizer->AddStretchSpacer();
|
||||
|
||||
horiz_sizer->Add(middle_line, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(20));
|
||||
|
||||
if (!has_split_line) {
|
||||
middle_line->Hide();
|
||||
}
|
||||
|
||||
auto right_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_right_content_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
right_sizer->Add(m_right_content_sizer, 0, wxEXPAND, 0);
|
||||
|
||||
m_right_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_right_btn_sizer->Add(0, 0, 1, wxEXPAND, 0);
|
||||
m_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_btn_sizer->Add(0, 0, 1, wxEXPAND, 0);
|
||||
m_btn_prev = new PageButton(this, "Back", Back);
|
||||
m_right_btn_sizer->Add(m_btn_prev, 0);
|
||||
m_right_btn_sizer->AddSpacer(FromDIP(10));
|
||||
m_btn_sizer->Add(m_btn_prev, 0);
|
||||
m_btn_sizer->AddSpacer(FromDIP(10));
|
||||
m_btn_next = new PageButton(this, "Next", Next);
|
||||
m_right_btn_sizer->Add(m_btn_next, 0);
|
||||
m_btn_sizer->Add(m_btn_next, 0);
|
||||
|
||||
right_sizer->Add(m_right_btn_sizer, 0, wxEXPAND, 0);
|
||||
|
||||
horiz_sizer->Add(right_sizer, 1, wxEXPAND, 0);
|
||||
|
||||
page_sizer->Add(horiz_sizer, 1, wxEXPAND, 0);
|
||||
page_sizer->Add(m_btn_sizer, 0, wxEXPAND, 0);
|
||||
|
||||
this->SetSizer(page_sizer);
|
||||
this->Layout();
|
||||
|
|
|
@ -34,7 +34,7 @@ private:
|
|||
class CalibrationWizardPage : public wxPanel
|
||||
{
|
||||
public:
|
||||
CalibrationWizardPage(wxWindow* parent, bool has_split_line, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||
CalibrationWizardPage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||
~CalibrationWizardPage() {};
|
||||
|
||||
CalibrationWizardPage* get_prev_page() { return m_prev_page; }
|
||||
|
@ -49,8 +49,8 @@ public:
|
|||
}
|
||||
|
||||
wxBoxSizer* get_top_vsizer() { return m_top_sizer; }
|
||||
wxBoxSizer* get_left_vsizer() { return m_left_sizer; }
|
||||
wxBoxSizer* get_right_content_vsizer() { return m_right_content_sizer; }
|
||||
wxBoxSizer* get_content_vsizer() { return m_content_sizer; }
|
||||
wxBoxSizer* get_btn_hsizer() { return m_btn_sizer; }
|
||||
PageButton* get_prev_btn() { return m_btn_prev; }
|
||||
PageButton* get_next_btn() { return m_btn_next; }
|
||||
|
||||
|
@ -58,14 +58,11 @@ public:
|
|||
void set_page_index(wxString index) { m_index->SetLabel(index); }
|
||||
|
||||
private:
|
||||
bool m_has_middle_line;
|
||||
|
||||
wxStaticText* m_title;
|
||||
wxStaticText* m_index;
|
||||
wxBoxSizer* m_top_sizer;
|
||||
wxBoxSizer* m_left_sizer;
|
||||
wxBoxSizer* m_right_content_sizer;
|
||||
wxBoxSizer* m_right_btn_sizer;
|
||||
wxBoxSizer* m_content_sizer;
|
||||
wxBoxSizer* m_btn_sizer;
|
||||
PageButton* m_btn_prev;
|
||||
PageButton* m_btn_next;
|
||||
|
||||
|
|
|
@ -1941,6 +1941,126 @@ int MachineObject::command_start_calibration(bool vibration, bool bed_leveling,
|
|||
}
|
||||
}
|
||||
|
||||
int MachineObject::command_start_pa_calibration(const CalibDatas &pa_data)
|
||||
{
|
||||
pa_calib_results.clear();
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
||||
for (int i = 0; i < pa_data.calib_datas.size(); ++i) {
|
||||
j["print"]["filaments"][i]["bed_temp"] = pa_data.calib_datas[i].bed_temp;
|
||||
j["print"]["filaments"][i]["tray_id"] = pa_data.calib_datas[i].tray_id;
|
||||
j["print"]["filaments"][i]["filament_id"] = pa_data.calib_datas[i].filament_id;
|
||||
j["print"]["filaments"][i]["setting_id"] = pa_data.calib_datas[i].setting_id;
|
||||
j["print"]["filaments"][i]["nozzle_temp"] = pa_data.calib_datas[i].nozzle_temp;
|
||||
j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(pa_data.calib_datas[i].max_volumetric_speed);
|
||||
}
|
||||
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int MachineObject::command_set_pa_calibration(const std::vector<PACalibResult>& pa_calib_values)
|
||||
{
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali_set";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
||||
for (int i = 0; i < pa_calib_values.size(); ++i) {
|
||||
j["print"]["filaments"][i]["tray_id"] = pa_calib_values[i].tray_id;
|
||||
j["print"]["filaments"][i]["filament_id"] = pa_calib_values[i].filament_id;
|
||||
j["print"]["filaments"][i]["setting_id"] = pa_calib_values[i].setting_id;
|
||||
j["print"]["filaments"][i]["name"] = pa_calib_values[i].name;
|
||||
j["print"]["filaments"][i]["k_value"] = std::to_string(pa_calib_values[i].k_value);
|
||||
j["print"]["filaments"][i]["n_coef"] = std::to_string(pa_calib_values[i].n_coef);
|
||||
}
|
||||
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int MachineObject::command_delete_pa_calibration(const PACalibResult& pa_calib)
|
||||
{
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali_del";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["tray_id"] = pa_calib.tray_id;
|
||||
j["print"]["filament_id"] = pa_calib.filament_id;
|
||||
j["print"]["setting_id"] = pa_calib.setting_id;
|
||||
j["print"]["name"] = pa_calib.name;
|
||||
j["print"]["k_value"] = std::to_string(pa_calib.k_value);
|
||||
j["print"]["n_coef"] = std::to_string(pa_calib.n_coef);
|
||||
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int MachineObject::command_get_pa_calibration_infos(const std::string& filament_id)
|
||||
{
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali_get";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["sequence_id"] = filament_id;
|
||||
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int MachineObject::command_get_pa_calibration_result()
|
||||
{
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali_get_result";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int MachineObject::command_start_flow_ratio_calibration(const CalibDatas& calib_data)
|
||||
{
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
json j;
|
||||
j["print"]["command"] = "flowrate_cali";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
||||
for (int i = 0; i < calib_data.calib_datas.size(); ++i) {
|
||||
j["print"]["filaments"][i]["bed_temp"] = calib_data.calib_datas[i].bed_temp;
|
||||
j["print"]["filaments"][i]["tray_id"] = calib_data.calib_datas[i].tray_id;
|
||||
j["print"]["filaments"][i]["filament_id"] = calib_data.calib_datas[i].filament_id;
|
||||
j["print"]["filaments"][i]["setting_id"] = calib_data.calib_datas[i].setting_id;
|
||||
j["print"]["filaments"][i]["nozzle_temp"] = calib_data.calib_datas[i].nozzle_temp;
|
||||
j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(calib_data.calib_datas[i].max_volumetric_speed);
|
||||
}
|
||||
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int MachineObject::command_get_flow_ratio_calibration_result()
|
||||
{
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||
json j;
|
||||
j["print"]["command"] = "flowrate_get_result";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int MachineObject::command_unload_filament()
|
||||
{
|
||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")
|
||||
|
@ -3669,6 +3789,74 @@ int MachineObject::parse_json(std::string payload)
|
|||
extrusion_cali_set_tray_id = curr_tray_id;
|
||||
extrusion_cali_set_hold_start = std::chrono::system_clock::now();
|
||||
}
|
||||
else if (jj["command"].get<std::string>() == "extrusion_cali_get") {
|
||||
if (jj["filaments"].is_array()) {
|
||||
try {
|
||||
pa_calib_tab.clear();
|
||||
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
||||
PACalibResult pa_calib_result;
|
||||
pa_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
|
||||
pa_calib_result.setting_id = (*it)["setting_id"].get<std::string>();
|
||||
pa_calib_result.name = (*it)["name"].get<std::string>();
|
||||
|
||||
if ((*it)["k_value"].is_number_float())
|
||||
pa_calib_result.k_value = (*it)["k_value"].get<float>();
|
||||
else if ((*it)["k_value"].is_string())
|
||||
pa_calib_result.k_value = stof((*it)["k_value"].get<std::string>().c_str());
|
||||
|
||||
if ((*it)["n_coef"].is_number_float())
|
||||
pa_calib_result.n_coef = (*it)["n_coef"].get<float>();
|
||||
else if ((*it)["n_coef"].is_string())
|
||||
pa_calib_result.n_coef = stof((*it)["n_coef"].get<std::string>().c_str());
|
||||
|
||||
pa_calib_tab.push_back(pa_calib_result);
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (jj["command"].get<std::string>() == "extrusion_cali_get_result") {
|
||||
if (jj["filaments"].is_array()) {
|
||||
try {
|
||||
pa_calib_results.clear();
|
||||
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
||||
PACalibResult pa_calib_result;
|
||||
pa_calib_result.tray_id = (*it)["tray_id"].get<int>();
|
||||
pa_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
|
||||
pa_calib_result.setting_id = (*it)["setting_id"].get<std::string>();
|
||||
if ((*it)["k_value"].is_number_float())
|
||||
pa_calib_result.k_value = (*it)["k_value"].get<float>();
|
||||
else if ((*it)["k_value"].is_string())
|
||||
pa_calib_result.k_value = stof((*it)["k_value"].get<std::string>().c_str());
|
||||
|
||||
if ((*it)["n_coef"].is_number_float())
|
||||
pa_calib_result.n_coef = (*it)["n_coef"].get<float>();
|
||||
else if ((*it)["n_coef"].is_string())
|
||||
pa_calib_result.n_coef = stof((*it)["n_coef"].get<std::string>().c_str());
|
||||
|
||||
pa_calib_results.push_back(pa_calib_result);
|
||||
}
|
||||
} catch (...) {}
|
||||
}
|
||||
}
|
||||
else if (jj["command"].get<std::string>() == "flowrate_get_result") {
|
||||
if (jj["filaments"].is_array()) {
|
||||
try {
|
||||
flow_ratio_results.clear();
|
||||
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
||||
FlowRatioCalibResult flow_ratio_calib_result;
|
||||
flow_ratio_calib_result.tray_id = (*it)["tray_id"].get<int>();
|
||||
flow_ratio_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
|
||||
flow_ratio_calib_result.setting_id = (*it)["setting_id"].get<std::string>();
|
||||
flow_ratio_calib_result.flow_ratio = stof((*it)["flow_ratio"].get<std::string>().c_str());
|
||||
|
||||
flow_ratio_results.push_back(flow_ratio_calib_result);
|
||||
}
|
||||
} catch (...) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -308,6 +308,41 @@ public:
|
|||
static wxString get_hms_msg_level_str(HMSMessageLevel level);
|
||||
};
|
||||
|
||||
class CalibDatas
|
||||
{
|
||||
public:
|
||||
struct CalibData
|
||||
{
|
||||
int tray_id;
|
||||
int bed_temp;
|
||||
int nozzle_temp;
|
||||
std::string filament_id;
|
||||
std::string setting_id;
|
||||
float max_volumetric_speed;
|
||||
};
|
||||
|
||||
std::vector<CalibData> calib_datas;
|
||||
};
|
||||
|
||||
class PACalibResult
|
||||
{
|
||||
public:
|
||||
int tray_id;
|
||||
std::string filament_id;
|
||||
std::string setting_id;
|
||||
std::string name;
|
||||
float k_value;
|
||||
float n_coef;
|
||||
};
|
||||
|
||||
class FlowRatioCalibResult
|
||||
{
|
||||
public:
|
||||
int tray_id;
|
||||
std::string filament_id;
|
||||
std::string setting_id;
|
||||
float flow_ratio;
|
||||
};
|
||||
|
||||
#define UpgradeNoError 0
|
||||
#define UpgradeDownloadFailed -1
|
||||
|
@ -608,6 +643,10 @@ public:
|
|||
int total_layers = 0;
|
||||
bool is_support_layer_num { false };
|
||||
|
||||
std::vector<PACalibResult> pa_calib_tab;
|
||||
std::vector<PACalibResult> pa_calib_results;
|
||||
std::vector<FlowRatioCalibResult> flow_ratio_results;
|
||||
|
||||
std::vector<int> stage_list_info;
|
||||
int stage_curr = 0;
|
||||
int m_push_count = 0;
|
||||
|
@ -766,6 +805,17 @@ public:
|
|||
bool is_support_command_calibration();
|
||||
int command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali);
|
||||
|
||||
// PA calibration
|
||||
int command_start_pa_calibration(const CalibDatas& pa_data);
|
||||
int command_set_pa_calibration(const std::vector<PACalibResult>& pa_calib_values);
|
||||
int command_delete_pa_calibration(const PACalibResult& pa_calib);
|
||||
int command_get_pa_calibration_infos(const std::string& filament_id = "");
|
||||
int command_get_pa_calibration_result();
|
||||
|
||||
// flow ratio calibration
|
||||
int command_start_flow_ratio_calibration(const CalibDatas& calib_data);
|
||||
int command_get_flow_ratio_calibration_result();
|
||||
|
||||
int command_unload_filament();
|
||||
|
||||
// camera control
|
||||
|
|
|
@ -1967,7 +1967,7 @@ void GUI_App::init_networking_callbacks()
|
|||
|
||||
auto sel = this->m_device_manager->get_selected_machine();
|
||||
if ((sel == obj || sel == nullptr) && obj->is_ams_need_update) {
|
||||
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj->amsList);
|
||||
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1991,7 +1991,7 @@ void GUI_App::init_networking_callbacks()
|
|||
if (obj) {
|
||||
obj->parse_json(msg);
|
||||
if (this->m_device_manager->get_selected_machine() == obj && obj->is_ams_need_update) {
|
||||
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj->amsList);
|
||||
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "slic3r/GUI/Plater.hpp"
|
||||
#include "slic3r/GUI/GUI.hpp"
|
||||
#include "slic3r/GUI/GUI_App.hpp"
|
||||
#include "slic3r/GUI/MainFrame.hpp"
|
||||
#include "bambu_networking.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
@ -461,6 +462,12 @@ void PrintJob::process()
|
|||
} else {
|
||||
BOOST_LOG_TRIVIAL(error) << "print_job: send ok.";
|
||||
wxCommandEvent* evt = new wxCommandEvent(m_print_job_completed_id);
|
||||
if (m_print_job_completed_id == wxGetApp().plater()->get_send_calibration_finished_event()) {
|
||||
int sel = wxGetApp().mainframe->get_calibration_curr_tab();
|
||||
if (sel >= 0) {
|
||||
evt->SetInt(sel);
|
||||
}
|
||||
}
|
||||
evt->SetString(m_dev_id);
|
||||
wxQueueEvent(m_plater, evt);
|
||||
m_job_finished = true;
|
||||
|
|
|
@ -2998,6 +2998,12 @@ void MainFrame::request_select_tab(TabPosition pos)
|
|||
wxQueueEvent(this, evt);
|
||||
}
|
||||
|
||||
int MainFrame::get_calibration_curr_tab() {
|
||||
if (m_calibration)
|
||||
return m_calibration->get_tabpanel()->GetSelection();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Set a camera direction, zoom to all objects.
|
||||
void MainFrame::select_view(const std::string& direction)
|
||||
{
|
||||
|
|
|
@ -306,6 +306,7 @@ public:
|
|||
void select_tab(wxPanel* panel);
|
||||
void select_tab(size_t tab = size_t(-1));
|
||||
void request_select_tab(TabPosition pos);
|
||||
int get_calibration_curr_tab();
|
||||
void select_view(const std::string& direction);
|
||||
// Propagate changed configuration from the Tab to the Plater and save changes to the AppConfig
|
||||
void on_config_changed(DynamicPrintConfig* cfg) const ;
|
||||
|
|
|
@ -153,7 +153,7 @@ MonitorPanel::~MonitorPanel()
|
|||
if (!dev) return;
|
||||
MachineObject *obj_ = dev->get_selected_machine();
|
||||
if (obj_)
|
||||
GUI::wxGetApp().sidebar().load_ams_list(obj_->dev_id, obj_->amsList);
|
||||
GUI::wxGetApp().sidebar().load_ams_list(obj_->dev_id, obj_);
|
||||
}
|
||||
|
||||
void MonitorPanel::init_tabpanel()
|
||||
|
@ -315,7 +315,7 @@ void MonitorPanel::on_update_all(wxMouseEvent &event)
|
|||
|
||||
MachineObject *obj_ = dev->get_selected_machine();
|
||||
if (obj_)
|
||||
GUI::wxGetApp().sidebar().load_ams_list(obj_->dev_id, obj_->amsList);
|
||||
GUI::wxGetApp().sidebar().load_ams_list(obj_->dev_id, obj_);
|
||||
|
||||
Layout();
|
||||
Refresh();
|
||||
|
@ -459,9 +459,6 @@ void MonitorPanel::update_all()
|
|||
m_hms_panel->update(obj);
|
||||
}
|
||||
|
||||
auto cali_panel = static_cast<CalibrationPanel*>(wxGetApp().mainframe->m_calibration);
|
||||
if(cali_panel)
|
||||
cali_panel->update_obj(obj);
|
||||
#if !BBL_RELEASE_TO_PUBLIC
|
||||
if (m_upgrade_panel->IsShown()) {
|
||||
m_upgrade_panel->update(obj);
|
||||
|
@ -490,7 +487,7 @@ bool MonitorPanel::Show(bool show)
|
|||
dev->load_last_machine();
|
||||
obj = dev->get_selected_machine();
|
||||
if (obj)
|
||||
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj->amsList);
|
||||
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj);
|
||||
} else {
|
||||
obj->reset_update_time();
|
||||
}
|
||||
|
|
|
@ -1368,21 +1368,47 @@ void Sidebar::on_bed_type_change(BedType bed_type)
|
|||
m_bed_type_list->SetSelection(sel_idx);
|
||||
}
|
||||
|
||||
void Sidebar::load_ams_list(std::string const &device, std::map<std::string, Ams *> const &list)
|
||||
void Sidebar::load_ams_list(std::string const &device, MachineObject* obj)
|
||||
{
|
||||
std::vector<DynamicPrintConfig> filament_ams_list;
|
||||
std::map<int, DynamicPrintConfig> filament_ams_list;
|
||||
|
||||
if (!obj) {
|
||||
p->ams_list_device = device;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": %1% items") % filament_ams_list.size();
|
||||
wxGetApp().preset_bundle->filament_ams_list = filament_ams_list;
|
||||
for (auto c : p->combos_filament)
|
||||
c->update();
|
||||
return;
|
||||
}
|
||||
|
||||
auto vt_tray = obj->vt_tray;
|
||||
bool is_support_virtual_tray = obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY);
|
||||
if (is_support_virtual_tray) {
|
||||
DynamicPrintConfig vt_tray_config;
|
||||
vt_tray_config.set_key_value("filament_id", new ConfigOptionStrings{ vt_tray.setting_id });
|
||||
vt_tray_config.set_key_value("filament_type", new ConfigOptionStrings{ vt_tray.type });
|
||||
vt_tray_config.set_key_value("tray_name", new ConfigOptionStrings{ std::string("Ext")});
|
||||
vt_tray_config.set_key_value("filament_colour", new ConfigOptionStrings{ "#" + vt_tray.color.substr(0, 8) });
|
||||
vt_tray_config.set_key_value("filament_exist", new ConfigOptionBools{ vt_tray.is_exists });
|
||||
|
||||
filament_ams_list.emplace(VIRTUAL_TRAY_ID, std::move(vt_tray_config));
|
||||
}
|
||||
|
||||
auto list = obj->amsList;
|
||||
for (auto ams : list) {
|
||||
char n = ams.first.front() - '0' + 'A';
|
||||
for (auto tray : ams.second->trayList) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__
|
||||
<< boost::format(": ams %1% tray %2% id %3% color %4%") % ams.first % tray.first % tray.second->setting_id % tray.second->color;
|
||||
char t = tray.first.front() - '0' + '1';
|
||||
DynamicPrintConfig ams;
|
||||
ams.set_key_value("filament_id", new ConfigOptionStrings{tray.second->setting_id});
|
||||
ams.set_key_value("filament_type", new ConfigOptionStrings{tray.second->type});
|
||||
ams.set_key_value("tray_name", new ConfigOptionStrings{std::string(1, n) + std::string(1, t)});
|
||||
ams.set_key_value("filament_colour", new ConfigOptionStrings{"#" + tray.second->color.substr(0, 8)});
|
||||
filament_ams_list.emplace_back(std::move(ams));
|
||||
DynamicPrintConfig tray_config;
|
||||
tray_config.set_key_value("filament_id", new ConfigOptionStrings{tray.second->setting_id});
|
||||
tray_config.set_key_value("filament_type", new ConfigOptionStrings{tray.second->type});
|
||||
tray_config.set_key_value("tray_name", new ConfigOptionStrings{std::string(1, n) + std::string(1, t)});
|
||||
tray_config.set_key_value("filament_colour", new ConfigOptionStrings{ "#" + tray.second->color.substr(0, 8) });
|
||||
tray_config.set_key_value("filament_exist", new ConfigOptionBools{ tray.second->is_exists });
|
||||
|
||||
filament_ams_list.emplace(((n - 'A') * 4 + t - '1'), std::move(tray_config));
|
||||
}
|
||||
}
|
||||
p->ams_list_device = device;
|
||||
|
@ -1425,9 +1451,11 @@ void Sidebar::sync_ams_list()
|
|||
auto res = dlg.ShowModal();
|
||||
if (res == wxID_CANCEL) return;
|
||||
list2.resize(list.size());
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
auto filament_id = list[i].opt_string("filament_id", 0u);
|
||||
list[i].set_key_value("filament_changed", new ConfigOptionBool{res == wxID_YES || list2[i] != filament_id});
|
||||
auto iter = list.begin();
|
||||
for (int i = 0; i < list.size(); ++i, ++iter) {
|
||||
auto & ams = iter->second;
|
||||
auto filament_id = ams.opt_string("filament_id", 0u);
|
||||
ams.set_key_value("filament_changed", new ConfigOptionBool{res == wxID_YES || list2[i] != filament_id});
|
||||
list2[i] = filament_id;
|
||||
}
|
||||
unsigned int unknowns = 0;
|
||||
|
@ -10294,18 +10322,12 @@ int Plater::export_config_3mf(int plate_idx, Export3mfProgressFn proFn)
|
|||
//BBS
|
||||
void Plater::send_calibration_job_finished(wxCommandEvent & evt)
|
||||
{
|
||||
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) return;
|
||||
dev->set_selected_machine(evt.GetString().ToStdString());
|
||||
|
||||
p->hide_select_machine_dlg();
|
||||
p->main_frame->request_select_tab(MainFrame::TabPosition::tpCalibration);
|
||||
//jump to monitor and select device status panel
|
||||
auto curr_calibration = p->main_frame->m_calibration;
|
||||
if (curr_calibration) {
|
||||
// todo select current tab
|
||||
auto calibration_wizard = static_cast<CalibrationWizard*>(curr_calibration->get_tabpanel()->GetPage(curr_calibration->get_tabpanel()->GetSelection()));
|
||||
calibration_wizard->show_page(calibration_wizard->get_curr_page()->get_next_page());
|
||||
auto calibration_panel = p->main_frame->m_calibration;
|
||||
if (calibration_panel) {
|
||||
auto curr_wizard = static_cast<CalibrationWizard*>(calibration_panel->get_tabpanel()->GetPage(evt.GetInt()));
|
||||
curr_wizard->show_send_progress_bar(false);
|
||||
curr_wizard->show_page(curr_wizard->get_curr_page()->get_next_page());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ public:
|
|||
void on_filaments_change(size_t num_filaments);
|
||||
// BBS
|
||||
void on_bed_type_change(BedType bed_type);
|
||||
void load_ams_list(std::string const & device, std::map<std::string, Ams *> const &list);
|
||||
void load_ams_list(std::string const & device, MachineObject* obj);
|
||||
void sync_ams_list();
|
||||
|
||||
ObjectList* obj_list();
|
||||
|
|
|
@ -231,11 +231,12 @@ int PresetComboBox::update_ams_color()
|
|||
if (color.empty()) return -1;
|
||||
} else {
|
||||
auto &ams_list = wxGetApp().preset_bundle->filament_ams_list;
|
||||
if (idx >= ams_list.size()) {
|
||||
auto iter = ams_list.find(idx);
|
||||
if (iter == ams_list.end()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": ams %1% out of range %2%") % idx % ams_list.size();
|
||||
return -1;
|
||||
}
|
||||
color = ams_list[idx].opt_string("filament_colour", 0u);
|
||||
color = iter->second.opt_string("filament_colour", 0u);
|
||||
}
|
||||
DynamicPrintConfig *cfg = &wxGetApp().preset_bundle->project_config;
|
||||
auto colors = static_cast<ConfigOptionStrings*>(cfg->option("filament_colour")->clone());
|
||||
|
@ -374,13 +375,14 @@ void PresetComboBox::add_ams_filaments(std::string selected, bool alias_name)
|
|||
set_label_marker(Append(separator(L("AMS filaments")), wxNullBitmap));
|
||||
m_first_ams_filament = GetCount();
|
||||
auto &filaments = m_collection->get_presets();
|
||||
for (auto &f : m_preset_bundle->filament_ams_list) {
|
||||
std::string filament_id = f.opt_string("filament_id", 0u);
|
||||
for (auto &entry : m_preset_bundle->filament_ams_list) {
|
||||
auto & tray = entry.second;
|
||||
std::string filament_id = tray.opt_string("filament_id", 0u);
|
||||
if (filament_id.empty()) continue;
|
||||
auto iter = std::find_if(filaments.begin(), filaments.end(),
|
||||
[&filament_id](auto &f) { return f.is_compatible && f.is_system && f.filament_id == filament_id; });
|
||||
if (iter == filaments.end()) {
|
||||
auto filament_type = "Generic " + f.opt_string("filament_type", 0u);
|
||||
auto filament_type = "Generic " + tray.opt_string("filament_type", 0u);
|
||||
iter = std::find_if(filaments.begin(), filaments.end(),
|
||||
[&filament_type](auto &f) { return f.is_compatible && f.is_system && boost::algorithm::starts_with(f.name, filament_type); });
|
||||
}
|
||||
|
@ -389,10 +391,10 @@ void PresetComboBox::add_ams_filaments(std::string selected, bool alias_name)
|
|||
continue;
|
||||
}
|
||||
const_cast<Preset&>(*iter).is_visible = true;
|
||||
auto color = f.opt_string("filament_colour", 0u);
|
||||
auto name = f.opt_string("tray_name", 0u);
|
||||
auto color = tray.opt_string("filament_colour", 0u);
|
||||
auto name = tray.opt_string("tray_name", 0u);
|
||||
wxBitmap bmp(*get_extruder_color_icon(color, name, 24, 16));
|
||||
int item_id = Append(get_preset_name(*iter), bmp.ConvertToImage(), &m_first_ams_filament + (&f - &m_preset_bundle->filament_ams_list.front()));
|
||||
int item_id = Append(get_preset_name(*iter), bmp.ConvertToImage(), &m_first_ams_filament + entry.first);
|
||||
//validate_selection(id->value == selected); // can not select
|
||||
}
|
||||
m_last_ams_filament = GetCount();
|
||||
|
@ -623,7 +625,7 @@ bool PresetComboBox::selection_is_changed_according_to_physical_printers()
|
|||
// ---------------------------------
|
||||
|
||||
PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset_type) :
|
||||
PresetComboBox(parent, preset_type, wxSize(15 * wxGetApp().em_unit(), 30 * wxGetApp().em_unit() / 10))
|
||||
PresetComboBox(parent, preset_type, wxSize(25 * wxGetApp().em_unit(), 30 * wxGetApp().em_unit() / 10))
|
||||
{
|
||||
GetDropDown().SetUseContentWidth(true);
|
||||
|
||||
|
@ -1012,7 +1014,7 @@ void PlaterPresetComboBox::update()
|
|||
}
|
||||
|
||||
if (m_type == Preset::TYPE_FILAMENT)
|
||||
add_ams_filaments(into_u8(selected_user_preset), true);
|
||||
add_ams_filaments(into_u8(selected_user_preset.empty() ? selected_system_preset : selected_user_preset), true);
|
||||
|
||||
//BBS: add project embedded preset logic
|
||||
if (!project_embedded_presets.empty())
|
||||
|
@ -1373,4 +1375,142 @@ void TabPresetComboBox::update_dirty()
|
|||
#endif /* __APPLE __ */
|
||||
}
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
} // namespace GUI
|
||||
GUI::CalibrateFilamentComboBox::CalibrateFilamentComboBox(wxWindow *parent)
|
||||
: PlaterPresetComboBox(parent, Preset::TYPE_FILAMENT)
|
||||
{
|
||||
clr_picker->SetBackgroundColour(*wxWHITE);
|
||||
clr_picker->SetBitmap(*get_extruder_color_icon("#FFFFFFFF", "", 16, 16));
|
||||
clr_picker->SetToolTip("");
|
||||
clr_picker->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {});
|
||||
}
|
||||
|
||||
GUI::CalibrateFilamentComboBox::~CalibrateFilamentComboBox()
|
||||
{
|
||||
}
|
||||
|
||||
void GUI::CalibrateFilamentComboBox::load_tray(DynamicPrintConfig &config)
|
||||
{
|
||||
m_tray_name = config.opt_string("tray_name", 0u);
|
||||
m_filament_id = config.opt_string("filament_id", 0u);
|
||||
m_filament_type = config.opt_string("filament_type", 0u);
|
||||
m_filament_color = config.opt_string("filament_colour", 0u);
|
||||
m_filament_exist = config.opt_bool("filament_exist", 0u);
|
||||
wxColor clr(m_filament_color);
|
||||
clr_picker->SetBitmap(*get_extruder_color_icon(m_filament_color, m_tray_name, 16, 16));
|
||||
#ifdef __WXOSX__
|
||||
clr_picker->SetLabel(clr_picker->GetLabel()); // Let setBezelStyle: be called
|
||||
clr_picker->Refresh();
|
||||
#endif
|
||||
if (!m_filament_exist) {
|
||||
SetValue(_L("Empty"));
|
||||
clr_picker->SetBitmap(*get_extruder_color_icon("#F0F0F0FF", m_tray_name, 16, 16));
|
||||
} else {
|
||||
auto &filaments = m_collection->get_presets();
|
||||
auto iter = std::find_if(filaments.begin(), filaments.end(), [this](auto &f) { return f.is_compatible && f.is_system && f.filament_id == m_filament_id; });
|
||||
if (iter == filaments.end() && !m_filament_type.empty()) {
|
||||
auto filament_type = "Generic " + m_filament_type;
|
||||
iter = std::find_if(filaments.begin(), filaments.end(),
|
||||
[&filament_type](auto &f) { return f.is_compatible && f.is_system && boost::algorithm::starts_with(f.name, filament_type); });
|
||||
}
|
||||
if (iter != filaments.end()) {
|
||||
m_selected_preset = &*iter;
|
||||
SetValue(get_preset_name(*iter));
|
||||
}
|
||||
else
|
||||
SetValue(_L("Incompatible"));
|
||||
Enable();
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::CalibrateFilamentComboBox::update()
|
||||
{
|
||||
if (m_preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA)
|
||||
return;
|
||||
|
||||
// Otherwise fill in the list from scratch.
|
||||
this->Freeze();
|
||||
this->Clear();
|
||||
invalidate_selection();
|
||||
|
||||
const Preset* selected_filament_preset = nullptr;
|
||||
|
||||
std::map<wxString, wxBitmap*> nonsys_presets;
|
||||
std::map<wxString, wxBitmap*> project_embedded_presets;
|
||||
std::map<wxString, wxBitmap*> system_presets;
|
||||
|
||||
wxString selected_preset = m_selected_preset ? get_preset_name(*m_selected_preset) : GetValue();
|
||||
if (!m_selected_preset)
|
||||
m_selected_preset = m_collection->find_preset(selected_preset.ToStdString());
|
||||
wxString tooltip;
|
||||
const std::deque<Preset>& presets = m_collection->get_presets();
|
||||
|
||||
for (size_t i = presets.front().is_visible ? 0 : m_collection->num_default_presets(); i < presets.size(); ++i)
|
||||
{
|
||||
const Preset& preset = presets[i];
|
||||
auto name = get_preset_name(preset);
|
||||
bool is_selected = m_selected_preset == &preset;
|
||||
if (m_preset_bundle->calibrate_filaments.empty()) {
|
||||
Thaw();
|
||||
return;
|
||||
}
|
||||
bool is_compatible = m_preset_bundle->calibrate_filaments.find(&preset) != m_preset_bundle->calibrate_filaments.end();
|
||||
;
|
||||
if (!preset.is_visible || (!is_compatible && !is_selected))
|
||||
continue;
|
||||
|
||||
if (is_selected) {
|
||||
tooltip = get_tooltip(preset);
|
||||
}
|
||||
|
||||
wxBitmap* bmp = get_bmp(preset);
|
||||
assert(bmp);
|
||||
|
||||
if (preset.is_default || preset.is_system)
|
||||
system_presets.emplace(name, bmp);
|
||||
else if (preset.is_project_embedded)
|
||||
project_embedded_presets.emplace(name, bmp);
|
||||
else
|
||||
nonsys_presets.emplace(name, bmp);
|
||||
}
|
||||
|
||||
if (!nonsys_presets.empty())
|
||||
{
|
||||
set_label_marker(Append(separator(L("User presets")), wxNullBitmap));
|
||||
for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
|
||||
Append(it->first, *it->second);
|
||||
validate_selection(it->first == selected_preset);
|
||||
}
|
||||
}
|
||||
if (!system_presets.empty())
|
||||
{
|
||||
set_label_marker(Append(separator(L("System presets")), wxNullBitmap));
|
||||
for (std::map<wxString, wxBitmap*>::iterator it = system_presets.begin(); it != system_presets.end(); ++it) {
|
||||
Append(it->first, *it->second);
|
||||
validate_selection(it->first == selected_preset);
|
||||
}
|
||||
}
|
||||
|
||||
update_selection();
|
||||
Thaw();
|
||||
|
||||
if (!tooltip.IsEmpty()) {
|
||||
#ifdef __WXMSW__
|
||||
SetToolTip(NULL);
|
||||
#endif
|
||||
SetToolTip(tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::CalibrateFilamentComboBox::OnSelect(wxCommandEvent &evt)
|
||||
{
|
||||
std::string preset_name = m_collection->get_preset_name_by_alias(evt.GetString().ToUTF8().data());
|
||||
m_selected_preset = m_collection->find_preset(preset_name);
|
||||
SimpleEvent e(EVT_CALIBRATION_TRAY_SELECTION_CHANGED);
|
||||
auto cali_tab = wxGetApp().mainframe->m_calibration->get_tabpanel();
|
||||
auto calibration_wizard = static_cast<CalibrationWizard*>(cali_tab->GetPage(cali_tab->GetSelection()));
|
||||
e.SetEventObject(calibration_wizard);
|
||||
wxPostEvent(calibration_wizard, e);
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
|
|
@ -214,6 +214,32 @@ public:
|
|||
Preset::Type type() const { return m_type; }
|
||||
};
|
||||
|
||||
// ---------------------------------
|
||||
// *** CalibrateFilamentComboBox ***
|
||||
// ---------------------------------
|
||||
|
||||
class CalibrateFilamentComboBox : public PlaterPresetComboBox
|
||||
{
|
||||
public:
|
||||
CalibrateFilamentComboBox(wxWindow *parent);
|
||||
~CalibrateFilamentComboBox();
|
||||
|
||||
void load_tray(DynamicPrintConfig & config);
|
||||
|
||||
void update() override;
|
||||
void OnSelect(wxCommandEvent &evt) override;
|
||||
const Preset* get_selected_preset() { return m_selected_preset; }
|
||||
bool is_tray_exist() { return m_filament_exist; }
|
||||
|
||||
private:
|
||||
std::string m_tray_name;
|
||||
std::string m_filament_id;
|
||||
std::string m_filament_type;
|
||||
std::string m_filament_color;
|
||||
bool m_filament_exist{false};
|
||||
const Preset* m_selected_preset = nullptr;
|
||||
};
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
||||
|
|
|
@ -2925,7 +2925,7 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
|
|||
obj->command_request_push_all();
|
||||
dev->set_selected_machine(m_printer_last_select, true);
|
||||
// Has changed machine unrecoverably
|
||||
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj->amsList);
|
||||
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj);
|
||||
update_select_layout(obj);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(error) << "on_selection_changed dev_id not found";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue