FIX: Modify calibration protocol
jira: none Change-Id: Ib0fdf4fd1ab514c2db4d1731ad0d37d3dc38fce5
This commit is contained in:
parent
65c00e00fe
commit
d479d1186a
|
@ -26,7 +26,7 @@ namespace Slic3r { namespace GUI {
|
|||
|
||||
wxDEFINE_EVENT(EVT_SET_FINISH_MAPPING, wxCommandEvent);
|
||||
|
||||
MaterialItem::MaterialItem(wxWindow *parent, wxColour mcolour, wxString mname)
|
||||
MaterialItem::MaterialItem(wxWindow *parent, wxColour mcolour, wxString mname)
|
||||
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
|
||||
{
|
||||
m_arraw_bitmap_gray = ScalableBitmap(this, "drop_down", 12);
|
||||
|
@ -113,17 +113,17 @@ void MaterialItem::on_normal()
|
|||
}
|
||||
|
||||
|
||||
void MaterialItem::paintEvent(wxPaintEvent &evt)
|
||||
{
|
||||
void MaterialItem::paintEvent(wxPaintEvent &evt)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
render(dc);
|
||||
|
||||
//PrepareDC(buffdc);
|
||||
//PrepareDC(dc);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MaterialItem::render(wxDC &dc)
|
||||
void MaterialItem::render(wxDC &dc)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
wxSize size = GetSize();
|
||||
|
@ -309,7 +309,7 @@ AmsMapingPopup::AmsMapingPopup(wxWindow *parent)
|
|||
title_panel->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
||||
title_panel->SetSize(wxSize(-1, FromDIP(30)));
|
||||
title_panel->SetMinSize(wxSize(-1, FromDIP(30)));
|
||||
|
||||
|
||||
|
||||
wxBoxSizer *title_sizer_h= new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer *title_sizer_v = new wxBoxSizer(wxVERTICAL);
|
||||
|
@ -435,13 +435,13 @@ AmsMapingPopup::AmsMapingPopup(wxWindow *parent)
|
|||
return out_txt;
|
||||
}
|
||||
|
||||
void AmsMapingPopup::update_materials_list(std::vector<std::string> list)
|
||||
{
|
||||
void AmsMapingPopup::update_materials_list(std::vector<std::string> list)
|
||||
{
|
||||
m_materials_list = list;
|
||||
}
|
||||
|
||||
void AmsMapingPopup::set_tag_texture(std::string texture)
|
||||
{
|
||||
void AmsMapingPopup::set_tag_texture(std::string texture)
|
||||
{
|
||||
m_tag_material = texture;
|
||||
}
|
||||
|
||||
|
@ -625,7 +625,7 @@ void AmsMapingPopup::update(MachineObject* obj)
|
|||
auto ams_mapping_item_container = new MappingContainer(nozzle_id == 0? m_right_marea_panel:m_left_marea_panel);
|
||||
ams_mapping_item_container->SetSizer(sizer_mapping_list);
|
||||
ams_mapping_item_container->Layout();
|
||||
|
||||
|
||||
m_has_unmatch_filament = false;
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "ams_mapping ams id " << ams_iter->first.c_str();
|
||||
|
@ -729,9 +729,9 @@ std::vector<TrayData> AmsMapingPopup::parse_ams_mapping(std::map<std::string, Am
|
|||
}
|
||||
|
||||
void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data, wxWindow* container, wxBoxSizer* sizer)
|
||||
{
|
||||
{
|
||||
sizer->Add(0,0,0,wxLEFT,FromDIP(6));
|
||||
|
||||
|
||||
for (auto i = 0; i < tray_data.size(); i++) {
|
||||
|
||||
// set button
|
||||
|
@ -761,7 +761,7 @@ void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data, wxWindow*
|
|||
Dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// temp
|
||||
if (tray_data[i].type == EMPTY) {
|
||||
|
@ -834,12 +834,12 @@ void AmsMapingPopup::OnDismiss()
|
|||
|
||||
}
|
||||
|
||||
bool AmsMapingPopup::ProcessLeftDown(wxMouseEvent &event)
|
||||
bool AmsMapingPopup::ProcessLeftDown(wxMouseEvent &event)
|
||||
{
|
||||
return PopupWindow::ProcessLeftDown(event);
|
||||
}
|
||||
|
||||
void AmsMapingPopup::paintEvent(wxPaintEvent &evt)
|
||||
void AmsMapingPopup::paintEvent(wxPaintEvent &evt)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
dc.SetPen(wxColour(0xAC, 0xAC, 0xAC));
|
||||
|
@ -847,7 +847,7 @@ void AmsMapingPopup::paintEvent(wxPaintEvent &evt)
|
|||
dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0);
|
||||
}
|
||||
|
||||
MappingItem::MappingItem(wxWindow *parent)
|
||||
MappingItem::MappingItem(wxWindow *parent)
|
||||
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
|
@ -859,27 +859,27 @@ void AmsMapingPopup::paintEvent(wxPaintEvent &evt)
|
|||
Bind(wxEVT_PAINT, &MappingItem::paintEvent, this);
|
||||
}
|
||||
|
||||
MappingItem::~MappingItem()
|
||||
MappingItem::~MappingItem()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void MappingItem::send_event(int fliament_id)
|
||||
void MappingItem::send_event(int fliament_id)
|
||||
{
|
||||
wxCommandEvent event(EVT_SET_FINISH_MAPPING);
|
||||
event.SetInt(m_tray_data.id);
|
||||
|
||||
wxString param = wxString::Format("%d|%d|%d|%d|%s|%d|%d|%d", m_coloul.Red(), m_coloul.Green(), m_coloul.Blue(), m_coloul.Alpha(), m_tray_index, fliament_id,
|
||||
wxString param = wxString::Format("%d|%d|%d|%d|%s|%d|%d|%d", m_coloul.Red(), m_coloul.Green(), m_coloul.Blue(), m_coloul.Alpha(), m_tray_index, fliament_id,
|
||||
m_tray_data.ams_id, m_tray_data.slot_id);
|
||||
event.SetString(param);
|
||||
|
||||
|
||||
if (send_win) {
|
||||
event.SetEventObject(send_win);
|
||||
wxPostEvent(send_win, event);
|
||||
}
|
||||
}
|
||||
|
||||
void MappingItem::msw_rescale()
|
||||
void MappingItem::msw_rescale()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -995,7 +995,7 @@ void MappingItem::doRender(wxDC &dc)
|
|||
}
|
||||
|
||||
|
||||
AmsMapingTipPopup::AmsMapingTipPopup(wxWindow *parent)
|
||||
AmsMapingTipPopup::AmsMapingTipPopup(wxWindow *parent)
|
||||
:PopupWindow(parent, wxBORDER_NONE)
|
||||
{
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
|
@ -1095,7 +1095,7 @@ void AmsMapingTipPopup::paintEvent(wxPaintEvent &evt)
|
|||
|
||||
void AmsMapingTipPopup::OnDismiss() {}
|
||||
|
||||
bool AmsMapingTipPopup::ProcessLeftDown(wxMouseEvent &event) {
|
||||
bool AmsMapingTipPopup::ProcessLeftDown(wxMouseEvent &event) {
|
||||
return PopupWindow::ProcessLeftDown(event); }
|
||||
|
||||
|
||||
|
@ -1118,7 +1118,7 @@ AmsHumidityTipPopup::AmsHumidityTipPopup(wxWindow* parent)
|
|||
m_staticText_note->SetMinSize(wxSize(FromDIP(680), -1));
|
||||
m_staticText_note->SetMaxSize(wxSize(FromDIP(680), -1));
|
||||
m_staticText_note->Wrap(FromDIP(680));
|
||||
|
||||
|
||||
|
||||
Bind(wxEVT_LEFT_UP, [this](auto& e) {
|
||||
|
||||
|
@ -1130,7 +1130,7 @@ AmsHumidityTipPopup::AmsHumidityTipPopup(wxWindow* parent)
|
|||
auto close_bottom = close_top + close_img.GetBmpHeight();
|
||||
|
||||
auto mouse_pos = ClientToScreen(e.GetPosition());
|
||||
if (mouse_pos.x > close_left
|
||||
if (mouse_pos.x > close_left
|
||||
&& mouse_pos.y > close_top
|
||||
&& mouse_pos.x < close_right
|
||||
&& mouse_pos.y < close_bottom
|
||||
|
@ -1248,7 +1248,7 @@ AmsTutorialPopup::AmsTutorialPopup(wxWindow* parent)
|
|||
|
||||
tip_top = new wxStaticText(this, wxID_ANY, _L("Filament used in this print job"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
tip_top->SetForegroundColour(wxColour("#686868"));
|
||||
|
||||
|
||||
sizer_tip_top->Add(tip_top, 0, wxALL, 0);
|
||||
|
||||
|
||||
|
@ -1274,7 +1274,7 @@ AmsTutorialPopup::AmsTutorialPopup(wxWindow* parent)
|
|||
sizer_top->Add(sizer_top_tips, 0, wxALIGN_CENTER, 0);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
wxBoxSizer* sizer_middle = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
|
@ -1366,7 +1366,7 @@ AmsIntroducePopup::AmsIntroducePopup(wxWindow* parent)
|
|||
wxGetApp().UpdateDarkUIWin(this);
|
||||
}
|
||||
|
||||
void AmsIntroducePopup::set_mode(bool enable_ams)
|
||||
void AmsIntroducePopup::set_mode(bool enable_ams)
|
||||
{
|
||||
if (enable_ams) {
|
||||
m_staticText_top->SetLabelText(_L("Enable AMS"));
|
||||
|
@ -1503,7 +1503,7 @@ void AmsReplaceMaterialDialog::create()
|
|||
m_scrollview_sizer->Add( m_groups_sizer, 0, wxALIGN_CENTER, 0 );
|
||||
m_scrollview_groups->SetSizer(m_scrollview_sizer);
|
||||
m_scrollview_groups->Layout();
|
||||
|
||||
|
||||
|
||||
|
||||
auto m_button_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -1531,7 +1531,7 @@ void AmsReplaceMaterialDialog::create()
|
|||
m_main_sizer->Add(0,0,0, wxTOP, FromDIP(20));
|
||||
m_main_sizer->Add(m_button_sizer,0,wxALIGN_CENTER, FromDIP(16));
|
||||
m_main_sizer->Add(0,0,0, wxTOP, FromDIP(20));
|
||||
|
||||
|
||||
|
||||
CenterOnParent();
|
||||
SetSizer(m_main_sizer);
|
||||
|
@ -1612,7 +1612,7 @@ void AmsReplaceMaterialDialog::update_machine_obj(MachineObject* obj)
|
|||
if (is_in_tray || m_tray_used.size() <= 0) {
|
||||
m_groups_sizer->Add(create_backup_group(wxString::Format("%s%d", _L("Group"), group_index + 1), group_info, group_material, status_list), 0, wxALL, FromDIP(10));
|
||||
group_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (group_index > 0) {
|
||||
|
@ -1634,14 +1634,14 @@ void AmsReplaceMaterialDialog::update_machine_obj(MachineObject* obj)
|
|||
}
|
||||
else {
|
||||
label_txt->SetLabelText(_L("If there are two identical filaments in AMS, AMS filament backup will be enabled. \n(Currently supporting automatic supply of consumables with the same brand, material type, and color)"));
|
||||
}
|
||||
}
|
||||
|
||||
label_txt->SetMinSize(wxSize(FromDIP(380), -1));
|
||||
label_txt->SetMaxSize(wxSize(FromDIP(380), -1));
|
||||
label_txt->Wrap(FromDIP(380));
|
||||
|
||||
}
|
||||
|
||||
|
||||
m_scrollview_groups->Layout();
|
||||
Layout();
|
||||
Fit();
|
||||
|
@ -1736,7 +1736,7 @@ void AmsRMGroup::on_mouse_move(wxMouseEvent& evt)
|
|||
Refresh();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
startAngle += ev_angle;
|
||||
}
|
||||
|
||||
|
@ -1780,7 +1780,7 @@ wxPoint AmsRMGroup::CalculateEndpoint(const wxPoint& startPoint, int angle, int
|
|||
void AmsRMGroup::doRender(wxDC& dc)
|
||||
{
|
||||
wxSize size = GetSize();
|
||||
|
||||
|
||||
float center_mask_radius = FromDIP(52);
|
||||
float selected_radius = FromDIP(53);
|
||||
|
||||
|
@ -1808,7 +1808,7 @@ void AmsRMGroup::doRender(wxDC& dc)
|
|||
radius = size.x / 2;
|
||||
endAngle += ev_angle;
|
||||
|
||||
|
||||
|
||||
//draw body
|
||||
if (tray_color.Alpha() != 0) {
|
||||
dc.DrawEllipticArc(x - radius, y - radius, radius * 2, radius * 2, startAngle, endAngle);
|
||||
|
@ -1960,7 +1960,7 @@ void AmsHumidityLevelList::doRender(wxDC& dc)
|
|||
|
||||
|
||||
//level list
|
||||
|
||||
|
||||
for (int i = 0; i < hum_level_img_light.size(); i++) {
|
||||
if (wxGetApp().dark_mode()) {
|
||||
dc.DrawBitmap(hum_level_img_dark[i].bmp(), left, (GetSize().y - FromDIP(54)) / 2);
|
||||
|
@ -1968,7 +1968,7 @@ void AmsHumidityLevelList::doRender(wxDC& dc)
|
|||
else {
|
||||
dc.DrawBitmap(hum_level_img_light[i].bmp(), left, (GetSize().y - FromDIP(54)) / 2);
|
||||
}
|
||||
|
||||
|
||||
left += FromDIP(46) + FromDIP(54);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,26 @@ namespace GUI {
|
|||
#define NEW_HISTORY_DIALOG_INPUT_SIZE wxSize(FromDIP(250), FromDIP(24))
|
||||
#define HISTORY_WINDOW_ITEMS_COUNT 5
|
||||
|
||||
enum CaliColumnType : int {
|
||||
Cali_Name = 0,
|
||||
Cali_Filament,
|
||||
Cali_Nozzle,
|
||||
Cali_K_Value,
|
||||
Cali_Delete,
|
||||
Cali_Edit,
|
||||
Cali_Type_Count
|
||||
};
|
||||
|
||||
int get_colume_idx(CaliColumnType type, MachineObject* obj)
|
||||
{
|
||||
if ((!obj || !obj->is_multi_extruders())
|
||||
&& (type > CaliColumnType::Cali_Nozzle)) {
|
||||
return type - 1;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static wxString get_preset_name_by_filament_id(std::string filament_id)
|
||||
{
|
||||
auto preset_bundle = wxGetApp().preset_bundle;
|
||||
|
@ -87,6 +107,16 @@ HistoryWindow::HistoryWindow(wxWindow* parent, const std::vector<PACalibResult>&
|
|||
scroll_sizer->Add(mew_btn, 0, wxLEFT, FromDIP(20));
|
||||
scroll_sizer->AddSpacer(FromDIP(15));
|
||||
|
||||
m_extruder_switch_btn = new SwitchButton(scroll_window);
|
||||
m_extruder_switch_btn->SetBackgroundColour(wxColour(0, 174, 66));
|
||||
m_extruder_switch_btn->SetMinSize(wxSize(FromDIP(120), FromDIP(24)));
|
||||
m_extruder_switch_btn->SetMaxSize(wxSize(FromDIP(120), FromDIP(24)));
|
||||
m_extruder_switch_btn->SetLabels(_L("Left"), _L("Right"));
|
||||
m_extruder_switch_btn->Bind(wxEVT_TOGGLEBUTTON, &HistoryWindow::on_switch_extruder, this);
|
||||
m_extruder_switch_btn->SetValue(false);
|
||||
scroll_sizer->Add(m_extruder_switch_btn, 0, wxCENTER | wxALL, FromDIP(10));
|
||||
scroll_sizer->AddSpacer(10);
|
||||
|
||||
wxPanel* comboBox_panel = new wxPanel(scroll_window);
|
||||
comboBox_panel->SetBackgroundColour(wxColour(238, 238, 238));
|
||||
auto comboBox_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
@ -186,6 +216,11 @@ void HistoryWindow::on_device_connected(MachineObject* obj)
|
|||
}
|
||||
m_comboBox_nozzle_dia->SetSelection(selection);
|
||||
|
||||
if (obj->is_multi_extruders())
|
||||
m_extruder_switch_btn->Show();
|
||||
else
|
||||
m_extruder_switch_btn->Hide();
|
||||
|
||||
// trigger on_select nozzle
|
||||
wxCommandEvent evt(wxEVT_COMBOBOX);
|
||||
evt.SetEventObject(m_comboBox_nozzle_dia);
|
||||
|
@ -216,7 +251,12 @@ void HistoryWindow::update(MachineObject* obj)
|
|||
void HistoryWindow::on_select_nozzle(wxCommandEvent& evt)
|
||||
{
|
||||
reqeust_history_result(curr_obj);
|
||||
}
|
||||
|
||||
void HistoryWindow::on_switch_extruder(wxCommandEvent &evt)
|
||||
{
|
||||
evt.Skip();
|
||||
reqeust_history_result(curr_obj);
|
||||
}
|
||||
|
||||
void HistoryWindow::reqeust_history_result(MachineObject* obj)
|
||||
|
@ -228,9 +268,11 @@ void HistoryWindow::reqeust_history_result(MachineObject* obj)
|
|||
sync_history_data();
|
||||
|
||||
float nozzle_value = get_nozzle_value();
|
||||
int extruder_id = get_extruder_id();
|
||||
if (nozzle_value > 0) {
|
||||
PACalibExtruderInfo cali_info;
|
||||
cali_info.nozzle_diameter = nozzle_value;
|
||||
cali_info.extruder_id = extruder_id;
|
||||
CalibUtils::emit_get_PA_calib_infos(cali_info);
|
||||
m_tips->SetLabel(_L("Refreshing the historical Flow Dynamics Calibration records"));
|
||||
BOOST_LOG_TRIVIAL(info) << "request calib history";
|
||||
|
@ -261,15 +303,21 @@ void HistoryWindow::sync_history_data() {
|
|||
|
||||
auto title_name = new Label(m_history_data_panel, _L("Name"));
|
||||
title_name->SetFont(Label::Head_14);
|
||||
gbSizer->Add(title_name, { 0, 0 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||
gbSizer->Add(title_name, {0, get_colume_idx(CaliColumnType::Cali_Name, curr_obj) }, {1, 1}, wxBOTTOM, FromDIP(15));
|
||||
|
||||
auto title_preset_name = new Label(m_history_data_panel, _L("Filament"));
|
||||
title_preset_name->SetFont(Label::Head_14);
|
||||
gbSizer->Add(title_preset_name, { 0, 1 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||
gbSizer->Add(title_preset_name, { 0, get_colume_idx(CaliColumnType::Cali_Filament, curr_obj) }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||
|
||||
if (curr_obj && curr_obj->is_multi_extruders()) {
|
||||
auto nozzle_name = new Label(m_history_data_panel, _L("Nozzle"));
|
||||
nozzle_name->SetFont(Label::Head_14);
|
||||
gbSizer->Add(nozzle_name, {0, get_colume_idx(CaliColumnType::Cali_Nozzle, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
||||
}
|
||||
|
||||
auto title_k = new Label(m_history_data_panel, _L("Factor K"));
|
||||
title_k->SetFont(Label::Head_14);
|
||||
gbSizer->Add(title_k, { 0, 2 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||
gbSizer->Add(title_k, { 0, get_colume_idx(CaliColumnType::Cali_K_Value,curr_obj) }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||
|
||||
// Hide
|
||||
//auto title_n = new Label(m_history_data_panel, wxID_ANY, _L("N"));
|
||||
|
@ -278,7 +326,7 @@ void HistoryWindow::sync_history_data() {
|
|||
|
||||
auto title_action = new Label(m_history_data_panel, _L("Action"));
|
||||
title_action->SetFont(Label::Head_14);
|
||||
gbSizer->Add(title_action, { 0, 3 }, { 1, 1 });
|
||||
gbSizer->Add(title_action, {0, get_colume_idx(CaliColumnType::Cali_Delete, curr_obj)}, {1, 1});
|
||||
|
||||
auto to_lower_case = [](const std::string &str) {
|
||||
std::string lowerStr = str;
|
||||
|
@ -300,6 +348,9 @@ void HistoryWindow::sync_history_data() {
|
|||
wxString preset_name = get_preset_name_by_filament_id(result.filament_id);
|
||||
auto preset_name_value = new Label(m_history_data_panel, preset_name);
|
||||
|
||||
wxString nozzle_name = generate_nozzle_id(result.nozzle_volume_type);
|
||||
auto nozzle_name_label = new Label(m_history_data_panel, nozzle_name);
|
||||
|
||||
auto k_str = wxString::Format("%.3f", result.k_value);
|
||||
auto n_str = wxString::Format("%.3f", result.n_coef);
|
||||
auto k_value = new Label(m_history_data_panel, k_str);
|
||||
|
@ -354,12 +405,14 @@ void HistoryWindow::sync_history_data() {
|
|||
}
|
||||
});
|
||||
|
||||
gbSizer->Add(name_value, { i, 0 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||
gbSizer->Add(preset_name_value, { i, 1 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||
gbSizer->Add(k_value, { i, 2 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||
gbSizer->Add(name_value, {i, get_colume_idx(CaliColumnType::Cali_Name, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
||||
gbSizer->Add(preset_name_value, {i, get_colume_idx(CaliColumnType::Cali_Filament, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
||||
if (curr_obj && curr_obj->is_multi_extruders())
|
||||
gbSizer->Add(nozzle_name_label, {i, get_colume_idx(CaliColumnType::Cali_Nozzle, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
||||
gbSizer->Add(k_value, {i, get_colume_idx(CaliColumnType::Cali_K_Value, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
||||
//gbSizer->Add(n_value, { i, 3 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||
gbSizer->Add(delete_button, { i, 3 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||
gbSizer->Add(edit_button, { i, 4 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||
gbSizer->Add(delete_button, {i, get_colume_idx(CaliColumnType::Cali_Delete, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
||||
gbSizer->Add(edit_button, {i, get_colume_idx(CaliColumnType::Cali_Edit, curr_obj)}, {1, 1}, wxBOTTOM, FromDIP(15));
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -384,6 +437,25 @@ float HistoryWindow::get_nozzle_value()
|
|||
return nozzle_value;
|
||||
}
|
||||
|
||||
int HistoryWindow::get_extruder_id()
|
||||
{
|
||||
if (!curr_obj) {
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
if (!curr_obj->is_multi_extruders() || !m_extruder_switch_btn)
|
||||
return -1;
|
||||
|
||||
bool is_left = !m_extruder_switch_btn->GetValue();
|
||||
bool main_on_left = curr_obj->is_main_extruder_on_left();
|
||||
|
||||
if (is_left == main_on_left) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void HistoryWindow::on_click_new_button(wxCommandEvent& event)
|
||||
{
|
||||
if (curr_obj && curr_obj->get_printer_series() == PrinterSeries::SERIES_P1P && m_calib_results_history.size() >= 16) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "Widgets/ComboBox.hpp"
|
||||
#include "DeviceManager.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
class HistoryWindow : public DPIDialog {
|
||||
|
@ -15,6 +15,7 @@ public:
|
|||
~HistoryWindow();
|
||||
void on_dpi_changed(const wxRect& suggested_rect) {}
|
||||
void on_select_nozzle(wxCommandEvent& evt);
|
||||
void on_switch_extruder(wxCommandEvent &evt);
|
||||
void reqeust_history_result(MachineObject* obj);
|
||||
void sync_history_result(MachineObject* obj);
|
||||
void on_device_connected(MachineObject* obj);
|
||||
|
@ -24,11 +25,13 @@ protected:
|
|||
void sync_history_data();
|
||||
void enbale_action_buttons(bool enable);
|
||||
float get_nozzle_value();
|
||||
int get_extruder_id();
|
||||
|
||||
void on_click_new_button(wxCommandEvent &event);
|
||||
|
||||
wxPanel* m_history_data_panel;
|
||||
ComboBox* m_comboBox_nozzle_dia;
|
||||
SwitchButton* m_extruder_switch_btn;
|
||||
Label* m_tips;
|
||||
|
||||
wxTimer* m_refresh_timer { nullptr };
|
||||
|
|
|
@ -245,6 +245,33 @@ void split_string(std::string s, std::vector<std::string>& v) {
|
|||
v.push_back(t);
|
||||
}
|
||||
|
||||
wxString generate_nozzle_id(NozzleVolumeType nozzle_type)
|
||||
{
|
||||
std::string nozzle_id;
|
||||
switch (nozzle_type) {
|
||||
case NozzleVolumeType::nvtNormal: {
|
||||
nozzle_id = L("Normal");
|
||||
break;
|
||||
}
|
||||
case NozzleVolumeType::nvtBigTraffic: {
|
||||
nozzle_id = L("BigTraffic");
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
return nozzle_id;
|
||||
}
|
||||
|
||||
NozzleVolumeType convert_to_nozzle_type(const std::string &str)
|
||||
{
|
||||
NozzleVolumeType res = NozzleVolumeType::nvtNormal;
|
||||
if (str == "Normal")
|
||||
res = NozzleVolumeType::nvtNormal;
|
||||
else if (str == "BigTraffic")
|
||||
res = NozzleVolumeType::nvtBigTraffic;
|
||||
return res;
|
||||
}
|
||||
|
||||
PrinterArch get_printer_arch_by_str(std::string arch_str)
|
||||
{
|
||||
if (arch_str == "i3") {
|
||||
|
@ -2241,7 +2268,7 @@ int MachineObject::command_start_pa_calibration(const X1CCalibInfos &pa_data, in
|
|||
j["print"]["filaments"][i]["nozzle_temp"] = pa_data.calib_datas[i].nozzle_temp;
|
||||
j["print"]["filaments"][i]["ams_id"] = pa_data.calib_datas[i].ams_id;
|
||||
j["print"]["filaments"][i]["slot_id"] = pa_data.calib_datas[i].slot_id;
|
||||
j["print"]["filaments"][i]["nozzle_volume_type"] = int(pa_data.calib_datas[i].nozzle_volume_type);
|
||||
j["print"]["filaments"][i]["nozzle_id"] = generate_nozzle_id(pa_data.calib_datas[i].nozzle_volume_type).ToStdString();
|
||||
j["print"]["filaments"][i]["nozzle_diameter"] = pa_data.calib_datas[i].nozzle_diameter;
|
||||
j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(pa_data.calib_datas[i].max_volumetric_speed);
|
||||
|
||||
|
@ -2281,7 +2308,7 @@ int MachineObject::command_set_pa_calibration(const std::vector<PACalibResult> &
|
|||
j["print"]["filaments"][i]["cali_idx"] = pa_calib_values[i].cali_idx;
|
||||
j["print"]["filaments"][i]["tray_id"] = pa_calib_values[i].tray_id;
|
||||
j["print"]["filaments"][i]["extruder_id"] = pa_calib_values[i].extruder_id;
|
||||
j["print"]["filaments"][i]["nozzle_volume_type"] = int(pa_calib_values[i].nozzle_volume_type);
|
||||
j["print"]["filaments"][i]["nozzle_id"] = generate_nozzle_id(pa_calib_values[i].nozzle_volume_type).ToStdString();
|
||||
j["print"]["filaments"][i]["ams_id"] = pa_calib_values[i].ams_id;
|
||||
j["print"]["filaments"][i]["slot_id"] = pa_calib_values[i].slot_id;
|
||||
j["print"]["filaments"][i]["filament_id"] = pa_calib_values[i].filament_id;
|
||||
|
@ -2307,7 +2334,7 @@ int MachineObject::command_delete_pa_calibration(const PACalibIndexInfo& pa_cali
|
|||
j["print"]["command"] = "extrusion_cali_del";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["extruder_id"] = pa_calib.extruder_id;
|
||||
j["print"]["nozzle_volume_type"] = int(pa_calib.nozzle_volume_type);
|
||||
j["print"]["nozzle_id"] = generate_nozzle_id(pa_calib.nozzle_volume_type).ToStdString();
|
||||
j["print"]["filament_id"] = pa_calib.filament_id;
|
||||
j["print"]["cali_idx"] = pa_calib.cali_idx;
|
||||
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib.nozzle_diameter);
|
||||
|
@ -2325,7 +2352,7 @@ int MachineObject::command_get_pa_calibration_tab(const PACalibExtruderInfo &cal
|
|||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["filament_id"] = calib_info.filament_id;
|
||||
j["print"]["extruder_id"] = calib_info.extruder_id;
|
||||
j["print"]["nozzle_volume_type"] = int(calib_info.nozzle_volume_type);
|
||||
j["print"]["nozzle_id"] = generate_nozzle_id(calib_info.nozzle_volume_type).ToStdString();
|
||||
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(calib_info.nozzle_diameter);
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "extrusion_cali_get: " << j.dump();
|
||||
|
@ -4368,8 +4395,10 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
} else if (jj["command"].get<std::string>() == "ams_filament_setting" && !key_field_only) {
|
||||
if (jj.contains("result") && jj.contains("reason")) {
|
||||
if (jj["result"].get<std::string>() == "fail") {
|
||||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
if (jj.contains("err_code")) {
|
||||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4509,8 +4538,10 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
} else if (jj["command"].get<std::string>() == "extrusion_cali_set") {
|
||||
if (jj.contains("result") && jj.contains("reason")) {
|
||||
if (jj["result"].get<std::string>() == "fail") {
|
||||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
if (jj.contains("err_code")) {
|
||||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef CALI_DEBUG
|
||||
|
@ -4559,8 +4590,10 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
else if (jj["command"].get<std::string>() == "extrusion_cali_sel") {
|
||||
if (jj.contains("result") && jj.contains("reason")) {
|
||||
if (jj["result"].get<std::string>() == "fail") {
|
||||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
if (jj.contains("err_code")) {
|
||||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4615,7 +4648,6 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
}
|
||||
is_succeed = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4643,8 +4675,8 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
pa_calib_tab_info.extruder_id = jj["extruder_id"].get<int>();
|
||||
}
|
||||
|
||||
if (jj.contains("nozzle_volume_type")) {
|
||||
pa_calib_tab_info.nozzle_volume_type = NozzleVolumeType(jj["nozzle_volume_type"].get<int>());
|
||||
if (jj.contains("nozzle_id")) {
|
||||
pa_calib_tab_info.nozzle_volume_type = convert_to_nozzle_type(jj["nozzle_id"].get<std::string>());
|
||||
}
|
||||
|
||||
if (jj.contains("filaments") && jj["filaments"].is_array()) {
|
||||
|
@ -4696,7 +4728,6 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
if (jj.contains("err_code")) {
|
||||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
is_succeed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4736,8 +4767,8 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
pa_calib_result.extruder_id = -1;
|
||||
}
|
||||
|
||||
if (it->contains("nozzle_volume_type")) {
|
||||
pa_calib_result.nozzle_volume_type = NozzleVolumeType((*it)["nozzle_volume_type"].get<int>());
|
||||
if (it->contains("nozzle_id")) {
|
||||
pa_calib_result.nozzle_volume_type = convert_to_nozzle_type((*it)["nozzle_id"].get<std::string>());
|
||||
} else {
|
||||
pa_calib_result.nozzle_volume_type = NozzleVolumeType::nvtNormal;
|
||||
}
|
||||
|
|
|
@ -1174,6 +1174,8 @@ public:
|
|||
|
||||
// change the opacity
|
||||
void change_the_opacity(wxColour& colour);
|
||||
|
||||
wxString generate_nozzle_id(NozzleVolumeType nozzle_type);
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // slic3r_DeviceManager_hpp_
|
||||
|
|
Loading…
Reference in New Issue