NEW:support multiple extruder new control
jira:[device page] Change-Id: Idf68a3385172cbaa123cedb4e2b814c15cc09f07
This commit is contained in:
parent
666e49e299
commit
7700b911a6
|
@ -1633,6 +1633,20 @@ bool MachineObject::is_studio_cmd(int sequence_id)
|
|||
return false;
|
||||
}
|
||||
|
||||
int MachineObject::command_select_extruder(int id)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << "select_extruder";
|
||||
|
||||
nozzle_selected_count = HOLD_COUNT_MAX;
|
||||
|
||||
json j;
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["command"] = "select_extruder";
|
||||
j["print"]["extruder_index"] = id;
|
||||
|
||||
return this->publish_json(j.dump(), 1);
|
||||
}
|
||||
|
||||
int MachineObject::command_get_version(bool with_retry)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << "command_get_version";
|
||||
|
@ -1924,6 +1938,21 @@ int MachineObject::command_set_nozzle(int temp)
|
|||
return this->publish_gcode(gcode_str);
|
||||
}
|
||||
|
||||
int MachineObject::command_set_nozzle_new(int nozzle_id, int temp)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << "set_nozzle_temp";
|
||||
|
||||
nozzle_selected_count = HOLD_COUNT_MAX;
|
||||
|
||||
json j;
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["command"] = "set_nozzle_temp";
|
||||
j["print"]["extruder_index"] = nozzle_id;
|
||||
j["print"]["target_temp"] = temp;
|
||||
|
||||
return this->publish_json(j.dump(), 1);
|
||||
}
|
||||
|
||||
int MachineObject::command_set_chamber(int temp)
|
||||
{
|
||||
json j;
|
||||
|
@ -3306,6 +3335,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (jj.contains("command")) {
|
||||
if (jj["command"].get<std::string>() == "ams_change_filament") {
|
||||
if (jj.contains("errno")) {
|
||||
|
@ -5685,8 +5715,14 @@ void MachineObject::parse_new_info(json print)
|
|||
|
||||
m_extder_data = ExtderData();
|
||||
m_extder_data.total_extder_count = get_flag_bits(extruder["state"].get<int>(), 0, 3);
|
||||
m_extder_data.current_extder_id = get_flag_bits(extruder["state"].get<int>(), 4, 3);
|
||||
m_extder_data.target_extder_id = get_flag_bits(extruder["state"].get<int>(), 8, 3);
|
||||
|
||||
if (nozzle_selected_count > 0) {
|
||||
nozzle_selected_count--;
|
||||
} else {
|
||||
m_extder_data.current_extder_id = get_flag_bits(extruder["state"].get<int>(), 4, 3);
|
||||
m_extder_data.target_extder_id = get_flag_bits(extruder["state"].get<int>(), 8, 3);
|
||||
m_extder_data.state = (ExtruderSwitchState) get_flag_bits(extruder["state"].get<int>(), 12, 2);
|
||||
}
|
||||
|
||||
for (auto it = extruder["info"].begin(); it != extruder["info"].end(); it++) {
|
||||
|
||||
|
|
|
@ -136,6 +136,13 @@ enum ManualPaCaliMethod {
|
|||
PA_PATTERN,
|
||||
};
|
||||
|
||||
enum ExtruderSwitchState {
|
||||
ES_IDLE = 0,
|
||||
ES_BUSY,
|
||||
ES_SWITCHING,
|
||||
ES_SWITCHING_FAILED
|
||||
};
|
||||
|
||||
enum AirDuctType {
|
||||
AIR_FAN_TYPE,
|
||||
AIR_DOOR_TYPE
|
||||
|
@ -211,6 +218,7 @@ struct ExtderData
|
|||
int current_extder_id{0};
|
||||
int target_extder_id{0};
|
||||
int total_extder_count {0};
|
||||
int state;
|
||||
std::vector<Extder> extders;
|
||||
};
|
||||
|
||||
|
@ -567,6 +575,7 @@ public:
|
|||
std::string dev_id;
|
||||
bool local_use_ssl_for_mqtt { true };
|
||||
bool local_use_ssl_for_ftp { true };
|
||||
bool m_busy_for_select_extruder {false};
|
||||
int subscribe_counter{3};
|
||||
std::string dev_connection_type; /* lan | cloud */
|
||||
std::string connection_type() { return dev_connection_type; }
|
||||
|
@ -898,6 +907,7 @@ public:
|
|||
int xcam_prompt_sound_hold_count = 0;
|
||||
int xcam_filament_tangle_detect_count = 0;
|
||||
int ams_print_option_count = 0;
|
||||
int nozzle_selected_count = 0;
|
||||
|
||||
//supported features
|
||||
bool is_support_chamber_edit{false};
|
||||
|
@ -992,6 +1002,7 @@ public:
|
|||
std::string parse_version();
|
||||
void parse_version_func();
|
||||
bool is_studio_cmd(int seq);
|
||||
|
||||
/* command commands */
|
||||
int command_get_version(bool with_retry = true);
|
||||
int command_request_push_all(bool request_now = false);
|
||||
|
@ -1000,7 +1011,7 @@ public:
|
|||
int command_set_printer_nozzle(std::string nozzle_type, float diameter);
|
||||
int command_set_printer_nozzle2(int id, std::string nozzle_type, float diameter, int flow);
|
||||
int command_get_access_code();
|
||||
|
||||
int command_select_extruder(int id);
|
||||
|
||||
/* command upgrade */
|
||||
int command_upgrade_confirm();
|
||||
|
@ -1023,6 +1034,7 @@ public:
|
|||
int command_task_resume();
|
||||
int command_set_bed(int temp);
|
||||
int command_set_nozzle(int temp);
|
||||
int command_set_nozzle_new(int nozzle_id, int temp);
|
||||
int command_set_chamber(int temp);
|
||||
// ams controls
|
||||
int command_ams_switch(int tray_index, int old_temp = 210, int new_temp = 210);
|
||||
|
|
|
@ -1378,7 +1378,7 @@ wxBoxSizer *StatusBasePanel::create_temp_control(wxWindow *parent)
|
|||
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxWindowID nozzle_id = wxWindow::NewControlId();
|
||||
m_tempCtrl_nozzle = new TempInput(parent, nozzle_id, TEMP_BLANK_STR, TempInputType::TEMP_OF_MAIN_NOZZLE_TYPE, TEMP_BLANK_STR, wxString("monitor_nozzle_temp"), wxString("monitor_nozzle_temp_active"),
|
||||
m_tempCtrl_nozzle = new TempInput(parent, nozzle_id, TEMP_BLANK_STR, TempInputType::TEMP_OF_NORMAL_TYPE, TEMP_BLANK_STR, wxString("monitor_nozzle_temp"), wxString("monitor_nozzle_temp_active"),
|
||||
wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER);
|
||||
m_tempCtrl_nozzle->SetMinSize(TEMP_CTRL_MIN_SIZE_OF_SINGLE_NOZZLE);
|
||||
m_tempCtrl_nozzle->SetMinTemp(nozzle_temp_range[0]);
|
||||
|
@ -1393,7 +1393,7 @@ wxBoxSizer *StatusBasePanel::create_temp_control(wxWindow *parent)
|
|||
m_tempCtrl_nozzle->SetBorderColor(tempinput_border_colour);
|
||||
|
||||
sizer->Add(m_tempCtrl_nozzle, 0, wxEXPAND | wxALL, 1);
|
||||
m_tempCtrl_nozzle_deputy = new TempInput(parent, nozzle_id, TEMP_BLANK_STR, TempInputType::TEMP_OF_DEPUTY_NOZZLE_TYPE, TEMP_BLANK_STR, wxString("monitor_nozzle_temp"), wxString("monitor_nozzle_temp_active"),
|
||||
m_tempCtrl_nozzle_deputy = new TempInput(parent, nozzle_id, TEMP_BLANK_STR, TempInputType::TEMP_OF_NORMAL_TYPE, TEMP_BLANK_STR, wxString("monitor_nozzle_temp"), wxString("monitor_nozzle_temp_active"),
|
||||
wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER);
|
||||
m_tempCtrl_nozzle_deputy->SetMinSize(TEMP_CTRL_MIN_SIZE_OF_SINGLE_NOZZLE);
|
||||
m_tempCtrl_nozzle_deputy->SetMinTemp(nozzle_temp_range[0]);
|
||||
|
@ -1404,7 +1404,7 @@ wxBoxSizer *StatusBasePanel::create_temp_control(wxWindow *parent)
|
|||
m_tempCtrl_nozzle_deputy->SetBorderColor(tempinput_border_colour);
|
||||
|
||||
sizer->Add(m_tempCtrl_nozzle_deputy, 0, wxEXPAND | wxALL, 1);
|
||||
//m_tempCtrl_nozzle_deputy->Hide();
|
||||
m_tempCtrl_nozzle_deputy->Hide();
|
||||
|
||||
m_line_nozzle = new StaticLine(parent);
|
||||
m_line_nozzle->SetLineColour(STATIC_BOX_LINE_COL);
|
||||
|
@ -1781,7 +1781,7 @@ wxBoxSizer *StatusBasePanel::create_extruder_control(wxWindow *parent)
|
|||
StateColor e_ctrl_bg(std::pair<wxColour, int>(BUTTON_PRESS_COL, StateColor::Pressed), std::pair<wxColour, int>(BUTTON_NORMAL1_COL, StateColor::Normal));
|
||||
StateColor e_ctrl_bd(std::pair<wxColour, int>(BUTTON_HOVER_COL, StateColor::Hovered), std::pair<wxColour, int>(BUTTON_NORMAL1_COL, StateColor::Normal));
|
||||
|
||||
m_left_right_btn_panel = new SwitchBoard(panel, _L("Left"), _L("Right"), wxSize(FromDIP(126), FromDIP(26)));
|
||||
m_nozzle_btn_panel = new SwitchBoard(panel, _L("Left"), _L("Right"), wxSize(FromDIP(126), FromDIP(26)));
|
||||
|
||||
m_bpButton_e_10 = new Button(panel, "", "monitor_extruder_up", 0, FromDIP(22));
|
||||
m_bpButton_e_10->SetBorderWidth(2);
|
||||
|
@ -1825,7 +1825,7 @@ wxBoxSizer *StatusBasePanel::create_extruder_control(wxWindow *parent)
|
|||
m_extruder_label->SetForegroundColour(TEXT_LIGHT_FONT_COL);
|
||||
|
||||
bSizer_e_ctrl->Add(0, 0, 0, wxTOP, FromDIP(15));
|
||||
bSizer_e_ctrl->Add(m_left_right_btn_panel, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
bSizer_e_ctrl->Add(m_nozzle_btn_panel, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
bSizer_e_ctrl->Add(0, 0, 0, wxTOP, FromDIP(15));
|
||||
bSizer_e_ctrl->Add(m_bpButton_e_10, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
bSizer_e_ctrl->Add(0, 0, 0, wxTOP, FromDIP(7));
|
||||
|
@ -2011,7 +2011,11 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co
|
|||
if (id == m_tempCtrl_bed->GetType()) {
|
||||
on_set_bed_temp();
|
||||
} else if (id == m_tempCtrl_nozzle->GetType()) {
|
||||
on_set_nozzle_temp();
|
||||
if (e.GetString() == wxString::Format("%d", MAIN_NOZZLE_ID)) {
|
||||
on_set_nozzle_temp(MAIN_NOZZLE_ID);
|
||||
} else if (e.GetString() == wxString::Format("%d", DEPUTY_NOZZLE_ID)) {
|
||||
on_set_nozzle_temp(DEPUTY_NOZZLE_ID);
|
||||
}
|
||||
} else if (id == m_tempCtrl_chamber->GetType()) {
|
||||
on_set_chamber_temp();
|
||||
}
|
||||
|
@ -2050,6 +2054,8 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co
|
|||
m_bpButton_z_down_10->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_axis_ctrl_z_down_10), NULL, this);
|
||||
m_bpButton_e_10->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_axis_ctrl_e_up_10), NULL, this);
|
||||
m_bpButton_e_down_10->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_axis_ctrl_e_down_10), NULL, this);
|
||||
m_nozzle_btn_panel->Connect(wxCUSTOMEVT_SELECT_NOZZLE_POS, wxCommandEventHandler(StatusPanel::on_nozzle_selected), NULL, this);
|
||||
|
||||
//m_button_unload->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_unload), NULL, this);
|
||||
Bind(EVT_AMS_EXTRUSION_CALI, &StatusPanel::on_filament_extrusion_cali, this);
|
||||
Bind(EVT_AMS_LOAD, &StatusPanel::on_ams_load, this);
|
||||
|
@ -2113,12 +2119,13 @@ StatusPanel::~StatusPanel()
|
|||
m_bpButton_z_down_10->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_axis_ctrl_z_down_10), NULL, this);
|
||||
m_bpButton_e_10->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_axis_ctrl_e_up_10), NULL, this);
|
||||
m_bpButton_e_down_10->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_axis_ctrl_e_down_10), NULL, this);
|
||||
m_nozzle_btn_panel->Disconnect(wxCUSTOMEVT_SELECT_NOZZLE_POS, wxCommandEventHandler(StatusPanel::on_nozzle_selected), NULL, this);
|
||||
m_switch_speed->Disconnect(wxEVT_LEFT_DOWN, wxCommandEventHandler(StatusPanel::on_switch_speed), NULL, this);
|
||||
m_calibration_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_calibration), NULL, this);
|
||||
m_options_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_print_options), NULL, this);
|
||||
m_parts_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_parts_options), NULL, this);
|
||||
//m_button_unload->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_unload), NULL, this);
|
||||
|
||||
//
|
||||
// remove warning dialogs
|
||||
if (m_print_error_dlg != nullptr)
|
||||
delete m_print_error_dlg;
|
||||
|
@ -2678,8 +2685,14 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj)
|
|||
m_tempCtrl_bed->SetIconNormal();
|
||||
}
|
||||
|
||||
m_tempCtrl_nozzle->SetCurrTemp((int) obj->m_extder_data.extders[0].temp);
|
||||
if(nozzle_num == 2 && obj->m_extder_data.extders.size() > 1) m_tempCtrl_nozzle_deputy->SetCurrTemp((int)obj->m_extder_data.extders[0].temp);
|
||||
m_tempCtrl_nozzle->SetCurrTemp((int) obj->m_extder_data.extders[MAIN_NOZZLE_ID].temp);
|
||||
if (nozzle_num == 2 && obj->m_extder_data.extders.size() > 1) {
|
||||
m_tempCtrl_nozzle->SetCurrType(TEMP_OF_MAIN_NOZZLE_TYPE);
|
||||
m_tempCtrl_nozzle_deputy->SetCurrType(TEMP_OF_DEPUTY_NOZZLE_TYPE);
|
||||
m_tempCtrl_nozzle_deputy->Show();
|
||||
m_tempCtrl_nozzle_deputy->SetCurrTemp((int)obj->m_extder_data.extders[DEPUTY_NOZZLE_ID].temp);
|
||||
}
|
||||
|
||||
if (obj->nozzle_max_temperature > -1) {
|
||||
if (m_tempCtrl_nozzle) m_tempCtrl_nozzle->SetMaxTemp(obj->nozzle_max_temperature);
|
||||
if (m_tempCtrl_nozzle_deputy && nozzle_num >= 2) m_tempCtrl_nozzle_deputy->SetMaxTemp(obj->nozzle_max_temperature);
|
||||
|
@ -2692,14 +2705,14 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj)
|
|||
if (m_temp_nozzle_timeout > 0) {
|
||||
m_temp_nozzle_timeout--;
|
||||
} else {
|
||||
if (!nozzle_temp_input) { m_tempCtrl_nozzle->SetTagTemp((int) obj->m_extder_data.extders[0].target_temp); }
|
||||
if (!nozzle_temp_input) { m_tempCtrl_nozzle->SetTagTemp((int) obj->m_extder_data.extders[MAIN_NOZZLE_ID].target_temp); }
|
||||
}
|
||||
|
||||
if (m_temp_nozzle_deputy_timeout > 0) {
|
||||
m_temp_nozzle_deputy_timeout--;
|
||||
}
|
||||
else {
|
||||
if (!nozzle_temp_input && nozzle_num >= 2) { m_tempCtrl_nozzle_deputy->SetTagTemp((int)obj->m_extder_data.extders[0].target_temp); }
|
||||
if (!nozzle_temp_input && nozzle_num >= 2) { m_tempCtrl_nozzle_deputy->SetTagTemp((int)obj->m_extder_data.extders[DEPUTY_NOZZLE_ID].target_temp); }
|
||||
}
|
||||
|
||||
if ((obj->m_extder_data.extders[0].target_temp - obj->m_extder_data.extders[0].temp) >= TEMP_THRESHOLD_VAL) {
|
||||
|
@ -2746,11 +2759,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
|
|||
m_extruder_book->SetSelection(m_nozzle_num);
|
||||
|
||||
/*style*/
|
||||
if (m_nozzle_num == 2) {
|
||||
m_left_right_btn_panel->Show();
|
||||
} else {
|
||||
m_left_right_btn_panel->Hide();
|
||||
}
|
||||
m_nozzle_btn_panel->Show();
|
||||
|
||||
m_extruderImage[select_index]->setExtruderCount(m_nozzle_num);
|
||||
m_extruderImage[select_index]->update(ExtruderState::FILLED_LOAD, ExtruderState::FILLED_UNLOAD);
|
||||
|
@ -2758,16 +2767,17 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
|
|||
/*current*/
|
||||
if (obj->m_extder_data.current_extder_id == 0xf) {
|
||||
m_extruderImage[select_index]->setExtruderUsed("");
|
||||
m_left_right_btn_panel->updateState("");
|
||||
m_nozzle_btn_panel->updateState("");
|
||||
} else if (obj->m_extder_data.current_extder_id == MAIN_NOZZLE_ID) {
|
||||
m_extruderImage[select_index]->setExtruderUsed("right");
|
||||
m_left_right_btn_panel->updateState("right");
|
||||
m_nozzle_btn_panel->updateState("right");
|
||||
} else if (obj->m_extder_data.current_extder_id == DEPUTY_NOZZLE_ID) {
|
||||
m_extruderImage[select_index]->setExtruderUsed("left");
|
||||
m_left_right_btn_panel->updateState("left");
|
||||
m_nozzle_btn_panel->updateState("left");
|
||||
}
|
||||
Layout();
|
||||
} else {
|
||||
m_nozzle_btn_panel->Hide();
|
||||
m_extruder_book->SetSelection(m_nozzle_num);
|
||||
m_extruderImage[select_index]->setExtruderCount(m_nozzle_num);
|
||||
}
|
||||
|
@ -3855,33 +3865,41 @@ void StatusPanel::on_set_bed_temp()
|
|||
}
|
||||
}
|
||||
|
||||
void StatusPanel::on_set_nozzle_temp()
|
||||
void StatusPanel::on_set_nozzle_temp(int nozzle_id)
|
||||
{
|
||||
if (!obj) {return;}
|
||||
|
||||
wxString str = m_tempCtrl_nozzle->GetTextCtrl()->GetValue();
|
||||
wxString str_deputy;
|
||||
int nozzle_num = obj->m_extder_data.total_extder_count;
|
||||
if (nozzle_num >= 2) str_deputy = m_tempCtrl_nozzle_deputy->GetTextCtrl()->GetValue();
|
||||
try {
|
||||
long nozzle_temp;
|
||||
if (str.ToLong(&nozzle_temp) && obj) {
|
||||
set_hold_count(m_temp_nozzle_timeout);
|
||||
if (nozzle_temp > m_tempCtrl_nozzle->get_max_temp()) {
|
||||
nozzle_temp = m_tempCtrl_nozzle->get_max_temp();
|
||||
m_tempCtrl_nozzle->SetTagTemp(wxString::Format("%d", nozzle_temp));
|
||||
m_tempCtrl_nozzle->Warning(false);
|
||||
|
||||
if (nozzle_id == MAIN_NOZZLE_ID) {
|
||||
wxString str = m_tempCtrl_nozzle->GetTextCtrl()->GetValue();
|
||||
if (str.ToLong(&nozzle_temp) && obj) {
|
||||
set_hold_count(m_temp_nozzle_timeout);
|
||||
if (nozzle_temp > m_tempCtrl_nozzle->get_max_temp()) {
|
||||
nozzle_temp = m_tempCtrl_nozzle->get_max_temp();
|
||||
m_tempCtrl_nozzle->SetTagTemp(wxString::Format("%d", nozzle_temp));
|
||||
m_tempCtrl_nozzle->Warning(false);
|
||||
}
|
||||
if (m_tempCtrl_nozzle->GetCurrType() == TempInputType::TEMP_OF_NORMAL_TYPE) {
|
||||
obj->command_set_nozzle(nozzle_temp);
|
||||
} else {
|
||||
obj->command_set_nozzle_new(MAIN_NOZZLE_ID, nozzle_temp);
|
||||
}
|
||||
}
|
||||
obj->command_set_nozzle(nozzle_temp);
|
||||
}
|
||||
if (nozzle_num >= 2 && str_deputy.ToLong(&nozzle_temp) && obj) {
|
||||
//set_hold_count(m_temp_nozzle_deputy_timeout);
|
||||
if (nozzle_temp > m_tempCtrl_nozzle_deputy->get_max_temp()) {
|
||||
nozzle_temp = m_tempCtrl_nozzle_deputy->get_max_temp();
|
||||
m_tempCtrl_nozzle_deputy->SetTagTemp(wxString::Format("%d", nozzle_temp));
|
||||
m_tempCtrl_nozzle_deputy->Warning(false);
|
||||
|
||||
if (nozzle_id == DEPUTY_NOZZLE_ID) {
|
||||
wxString str = m_tempCtrl_nozzle_deputy->GetTextCtrl()->GetValue();
|
||||
if (str.ToLong(&nozzle_temp) && obj) {
|
||||
// set_hold_count(m_temp_nozzle_deputy_timeout);
|
||||
if (nozzle_temp > m_tempCtrl_nozzle_deputy->get_max_temp()) {
|
||||
nozzle_temp = m_tempCtrl_nozzle_deputy->get_max_temp();
|
||||
m_tempCtrl_nozzle_deputy->SetTagTemp(wxString::Format("%d", nozzle_temp));
|
||||
m_tempCtrl_nozzle_deputy->Warning(false);
|
||||
}
|
||||
obj->command_set_nozzle_new(DEPUTY_NOZZLE_ID, nozzle_temp);
|
||||
}
|
||||
obj->command_set_nozzle(nozzle_temp);
|
||||
}
|
||||
} catch (...) {
|
||||
;
|
||||
|
@ -4597,6 +4615,14 @@ void StatusPanel::on_xyz_abs(wxCommandEvent &event)
|
|||
}
|
||||
|
||||
|
||||
void StatusPanel::on_nozzle_selected(wxCommandEvent &event)
|
||||
{
|
||||
if (obj) {
|
||||
obj->m_extder_data.current_extder_id = event.GetInt();
|
||||
auto nozzle_id = event.GetInt();obj->command_select_extruder(nozzle_id);
|
||||
}
|
||||
}
|
||||
|
||||
void StatusPanel::on_show_print_options(wxCommandEvent& event)
|
||||
{
|
||||
if (obj) {
|
||||
|
|
|
@ -404,7 +404,7 @@ protected:
|
|||
Button * m_button_clean;
|
||||
wxSimplebook* m_extruder_book;
|
||||
std::vector<ExtruderImage *> m_extruderImage;
|
||||
SwitchBoard * m_left_right_btn_panel;
|
||||
SwitchBoard * m_nozzle_btn_panel;
|
||||
|
||||
wxStaticText * m_text_tasklist_caption;
|
||||
|
||||
|
@ -417,9 +417,9 @@ protected:
|
|||
wxBoxSizer * m_misc_ctrl_sizer;
|
||||
StaticBox* m_fan_panel;
|
||||
StaticLine * m_line_nozzle;
|
||||
TempInput* m_tempCtrl_nozzle;
|
||||
TempInput* m_tempCtrl_nozzle;
|
||||
int m_temp_nozzle_timeout{ 0 };
|
||||
TempInput* m_tempCtrl_nozzle_deputy;
|
||||
TempInput* m_tempCtrl_nozzle_deputy;
|
||||
int m_temp_nozzle_deputy_timeout{ 0 };
|
||||
TempInput * m_tempCtrl_bed;
|
||||
int m_temp_bed_timeout {0};
|
||||
|
@ -498,6 +498,7 @@ protected:
|
|||
virtual void on_axis_ctrl_z_down_10(wxCommandEvent &event) { event.Skip(); }
|
||||
virtual void on_axis_ctrl_e_up_10(wxCommandEvent &event) { event.Skip(); }
|
||||
virtual void on_axis_ctrl_e_down_10(wxCommandEvent &event) { event.Skip(); }
|
||||
virtual void on_nozzle_selected(wxCommandEvent &event) { event.Skip(); }
|
||||
|
||||
public:
|
||||
StatusBasePanel(wxWindow * parent,
|
||||
|
@ -620,6 +621,8 @@ protected:
|
|||
void on_axis_ctrl_e_down_10(wxCommandEvent &event);
|
||||
void axis_ctrl_e_hint(bool up_down);
|
||||
|
||||
void on_nozzle_selected(wxCommandEvent &event);
|
||||
|
||||
void on_start_unload(wxCommandEvent &event);
|
||||
/* temp control */
|
||||
void on_bed_temp_kill_focus(wxFocusEvent &event);
|
||||
|
@ -627,7 +630,7 @@ protected:
|
|||
void on_set_bed_temp();
|
||||
void on_nozzle_temp_kill_focus(wxFocusEvent &event);
|
||||
void on_nozzle_temp_set_focus(wxFocusEvent &event);
|
||||
void on_set_nozzle_temp();
|
||||
void on_set_nozzle_temp(int nozzle_id);
|
||||
void on_set_chamber_temp();
|
||||
|
||||
/* extruder apis */
|
||||
|
@ -663,6 +666,7 @@ protected:
|
|||
void on_auto_leveling(wxCommandEvent &event);
|
||||
void on_xyz_abs(wxCommandEvent &event);
|
||||
|
||||
|
||||
void on_show_parts_options(wxCommandEvent& event);
|
||||
/* print options */
|
||||
void on_show_print_options(wxCommandEvent &event);
|
||||
|
|
|
@ -843,7 +843,7 @@ std::string GenerateRandomString(int length)
|
|||
return randomString;
|
||||
}
|
||||
|
||||
bool WebViewPanel::SaveBase64ToLocal(std::string Base64Buf, std::string FileName, std::string FileTail, wxString &download_path, wxString &download_file)
|
||||
void WebViewPanel::OpenMakerlab3mf(std::string Base64Buf, std::string FileName)
|
||||
{
|
||||
int nSize = wxBase64DecodedSize(Base64Buf.length());
|
||||
char *DstBuf = new char[nSize + 1];
|
||||
|
@ -1730,7 +1730,7 @@ void WebViewPanel::SwitchWebContent(std::string modelname, int refresh)
|
|||
|
||||
wxString strlang = wxGetApp().current_language_code_safe();
|
||||
|
||||
if (modelname.compare("makersupply") == 0)
|
||||
if (modelname.compare("makerlab") == 0)
|
||||
{
|
||||
std::string strRegion = wxGetApp().app_config->get_country_code();
|
||||
wxString MakerSupplyUrl;
|
||||
|
@ -1739,18 +1739,20 @@ void WebViewPanel::SwitchWebContent(std::string modelname, int refresh)
|
|||
else
|
||||
MakerSupplyUrl = "https://store.bambulab.com/collections/makers-supply?from=bambustudio";
|
||||
|
||||
wxLaunchDefaultBrowser(MakerSupplyUrl);
|
||||
}
|
||||
else if (modelname.compare("makerlab") == 0)
|
||||
{
|
||||
wxString FinalUrl;
|
||||
|
||||
if (!m_MakerLabFirst)
|
||||
{
|
||||
UpdateMakerlabStatus();
|
||||
if (m_MakerLab_LastUrl != "")
|
||||
FinalUrl = m_MakerLab_LastUrl;
|
||||
else
|
||||
{
|
||||
SetMakerlabUrl("");
|
||||
|
||||
FinalUrl = m_MakerLab_LastUrl;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_MakerLab_LastUrl != "") m_browserML->LoadURL(m_MakerLab_LastUrl);
|
||||
if (m_MakerLab_LastUrl != "")
|
||||
FinalUrl = m_MakerLab_LastUrl;
|
||||
}
|
||||
|
||||
m_MakerLabFirst = true;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include <wx/dcgraph.h>
|
||||
#include <wx/dcmemory.h>
|
||||
|
||||
wxDEFINE_EVENT(wxCUSTOMEVT_SELECT_NOZZLE_POS, wxCommandEvent);
|
||||
|
||||
SwitchButton::SwitchButton(wxWindow* parent, wxWindowID id)
|
||||
: wxBitmapToggleButton(parent, id, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxBU_EXACTFIT)
|
||||
, m_on(this, "toggle_on", 16)
|
||||
|
@ -223,8 +225,12 @@ void SwitchBoard::render(wxDC &dc)
|
|||
|
||||
void SwitchBoard::doRender(wxDC &dc)
|
||||
{
|
||||
wxColour disable_color = wxColour(0xCECECE);
|
||||
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.SetBrush(wxBrush(0xeeeeee));
|
||||
|
||||
if (is_enable) {dc.SetBrush(wxBrush(0xeeeeee));
|
||||
} else {dc.SetBrush(disable_color);}
|
||||
dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 8);
|
||||
|
||||
/*left*/
|
||||
|
@ -245,7 +251,8 @@ void SwitchBoard::doRender(wxDC &dc)
|
|||
|
||||
/*right*/
|
||||
if (switch_right) {
|
||||
dc.SetBrush(wxBrush(wxColour(0, 174, 66)));
|
||||
if (is_enable) {dc.SetBrush(wxBrush(wxColour(0, 174, 66)));
|
||||
} else {dc.SetBrush(disable_color);}
|
||||
dc.DrawRoundedRectangle(GetSize().x / 2, 0, GetSize().x / 2, GetSize().y, 8);
|
||||
}
|
||||
|
||||
|
@ -262,15 +269,25 @@ void SwitchBoard::doRender(wxDC &dc)
|
|||
|
||||
void SwitchBoard::on_left_down(wxMouseEvent &evt)
|
||||
{
|
||||
if (!is_enable) {
|
||||
return;
|
||||
}
|
||||
int index = -1;
|
||||
auto pos = ClientToScreen(evt.GetPosition());
|
||||
auto rect = ClientToScreen(wxPoint(0, 0));
|
||||
|
||||
if (pos.x > 0 && pos.x < rect.x + GetSize().x / 2) {
|
||||
switch_left = true;
|
||||
switch_right = false;
|
||||
index = 1;
|
||||
} else {
|
||||
switch_left = false;
|
||||
switch_right = true;
|
||||
index = 0;
|
||||
}
|
||||
Refresh();
|
||||
|
||||
wxCommandEvent event(wxCUSTOMEVT_SELECT_NOZZLE_POS);
|
||||
event.SetInt(index);
|
||||
wxPostEvent(this, event);
|
||||
}
|
|
@ -8,6 +8,8 @@
|
|||
#include "Label.hpp"
|
||||
#include "Button.hpp"
|
||||
|
||||
wxDECLARE_EVENT(wxCUSTOMEVT_SELECT_NOZZLE_POS, wxCommandEvent);
|
||||
|
||||
class SwitchButton : public wxBitmapToggleButton
|
||||
{
|
||||
public:
|
||||
|
@ -53,12 +55,16 @@ public:
|
|||
|
||||
bool switch_left{false};
|
||||
bool switch_right{false};
|
||||
bool is_enable {true};
|
||||
|
||||
public:
|
||||
void paintEvent(wxPaintEvent &evt);
|
||||
void render(wxDC &dc);
|
||||
void doRender(wxDC &dc);
|
||||
void on_left_down(wxMouseEvent &evt);
|
||||
void Enable(){is_enable = true;Refresh();};
|
||||
void Disable(){is_enable = false;Refresh();};
|
||||
bool IsEnabled(){return is_enable;};
|
||||
};
|
||||
|
||||
#endif // !slic3r_GUI_SwitchButton_hpp_
|
||||
|
|
|
@ -58,7 +58,7 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString
|
|||
if (m_read_only) return;
|
||||
// enter input mode
|
||||
auto temp = text_ctrl->GetValue();
|
||||
if (temp.length() > 0 && temp[0] == (0x5f)) {
|
||||
if (temp.length() > 0 && temp[0] == (0x5f)) {
|
||||
text_ctrl->SetValue(wxEmptyString);
|
||||
}
|
||||
if (wdialog != nullptr) { wdialog->Dismiss(); }
|
||||
|
@ -111,7 +111,7 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString
|
|||
});
|
||||
text_ctrl->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable context menu
|
||||
text_ctrl->Bind(wxEVT_LEFT_DOWN, [this](auto &e) {
|
||||
if (m_read_only) {
|
||||
if (m_read_only) {
|
||||
return;
|
||||
} else {
|
||||
e.Skip();
|
||||
|
@ -145,6 +145,7 @@ void TempInput::SetFinish()
|
|||
{
|
||||
wxCommandEvent event(wxCUSTOMEVT_SET_TEMP_FINISH);
|
||||
event.SetInt(temp_type);
|
||||
event.SetString(wxString::Format("%d", m_input_type));
|
||||
wxPostEvent(this->GetParent(), event);
|
||||
}
|
||||
|
||||
|
@ -173,8 +174,8 @@ void TempInput::SetTagTemp(int temp)
|
|||
}
|
||||
}
|
||||
|
||||
void TempInput::SetTagTemp(wxString temp)
|
||||
{
|
||||
void TempInput::SetTagTemp(wxString temp)
|
||||
{
|
||||
if (text_ctrl->GetValue() != temp) {
|
||||
text_ctrl->SetValue(temp);
|
||||
messureSize();
|
||||
|
@ -182,18 +183,20 @@ void TempInput::SetTagTemp(wxString temp)
|
|||
}
|
||||
}
|
||||
|
||||
void TempInput::SetCurrTemp(int temp)
|
||||
{
|
||||
void TempInput::SetCurrTemp(int temp)
|
||||
{
|
||||
auto tp = wxString::Format("%d", temp);
|
||||
if (GetLabel() != tp) {
|
||||
SetLabel(tp);
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void TempInput::SetCurrTemp(wxString temp)
|
||||
void TempInput::SetCurrTemp(wxString temp)
|
||||
{
|
||||
if (GetLabel() != temp) {
|
||||
SetLabel(temp);
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,10 +225,10 @@ void TempInput::Warning(bool warn, WarningType type)
|
|||
wxBoxSizer *sizer_text;
|
||||
sizer_text = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
|
||||
|
||||
warning_text = new wxStaticText(body, wxID_ANY,
|
||||
wxEmptyString,
|
||||
|
||||
warning_text = new wxStaticText(body, wxID_ANY,
|
||||
wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxALIGN_CENTER_HORIZONTAL);
|
||||
warning_text->SetFont(::Label::Body_12);
|
||||
|
@ -457,19 +460,19 @@ void TempInput::render(wxDC &dc)
|
|||
auto text = wxWindow::GetLabel();
|
||||
dc.SetFont(::Label::Head_14);
|
||||
labelSize = dc.GetMultiLineTextExtent(wxWindow::GetLabel());
|
||||
|
||||
|
||||
if (!IsEnabled()) {
|
||||
dc.SetTextForeground(wxColour(0xAC, 0xAC, 0xAC));
|
||||
dc.SetTextBackground(background_color.colorForStates((int) StateColor::Disabled));
|
||||
}
|
||||
}
|
||||
else {
|
||||
dc.SetTextForeground(wxColour(0x32, 0x3A, 0x3D));
|
||||
dc.SetTextBackground(background_color.colorForStates((int) states));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*if (!text.IsEmpty()) {
|
||||
|
||||
|
||||
}*/
|
||||
wxSize textSize = text_ctrl->GetSize();
|
||||
if (align_right) {
|
||||
|
|
|
@ -71,12 +71,12 @@ public:
|
|||
const wxSize & size = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
|
||||
|
||||
wxPopupTransientWindow *wdialog{nullptr};
|
||||
int temp_type;
|
||||
bool actice = false;
|
||||
|
||||
|
||||
|
||||
wxString erasePending(wxString &str);
|
||||
|
||||
void SetTagTemp(int temp);
|
||||
|
@ -85,7 +85,8 @@ public:
|
|||
void SetCurrTemp(int temp);
|
||||
void SetCurrTemp(wxString temp);
|
||||
void SetCurrType(TempInputType type);
|
||||
|
||||
TempInputType GetCurrType(){return m_input_type;};
|
||||
|
||||
bool AllisNum(std::string str);
|
||||
void SetFinish();
|
||||
void Warning(bool warn, WarningType type = WARNING_UNKNOWN);
|
||||
|
|
Loading…
Reference in New Issue