Compare commits

...
Author SHA1 Message Date
Ian Chua 4ebd8ed9cc refactor: generic N extruders 2026-09-25 19:51:18 +08:00
6 changed files with 411 additions and 199 deletions
+33 -17
View File
@@ -9,6 +9,8 @@
#include "libslic3r/libslic3r.h" #include "libslic3r/libslic3r.h"
#include "libslic3r/Utils.hpp" #include "libslic3r/Utils.hpp"
#include <slic3r/GUI/DeviceCore/DevDefs.h>
#include <slic3r/GUI/GUI_App.hpp>
namespace Slic3r namespace Slic3r
{ {
@@ -151,34 +153,48 @@ DevFirmwareVersionInfo DevNozzle::GetFirmwareInfo() const
int DevNozzle::GetLogicExtruderId() const int DevNozzle::GetLogicExtruderId() const
{ {
int total_ext_count = GetTotalExtruderCount(); int total_ext_count = GetTotalExtruderCount();
if (total_ext_count == 1) {
return LOGIC_UNIQUE_EXTRUDER_ID; if (GUI::wxGetApp().preset_bundle->is_bbl_vendor()) {
} else if (total_ext_count == 2) { if (total_ext_count == 1) {
if (AtLeftExtruder()) { return LOGIC_UNIQUE_EXTRUDER_ID;
return LOGIC_L_EXTRUDER_ID; } else if (total_ext_count == 2) {
} else if (AtRightExtruder()) { if (AtLeftExtruder()) {
return LOGIC_R_EXTRUDER_ID; return LOGIC_L_EXTRUDER_ID;
} else if (AtRightExtruder()) {
return LOGIC_R_EXTRUDER_ID;
}
} }
assert(0);
return LOGIC_UNIQUE_EXTRUDER_ID;
} }
assert(0); // For some reason, BBL's logical extruder ID is inverted:
return LOGIC_UNIQUE_EXTRUDER_ID; // physical extruder id = 0 (MAIN_EXTRUDER_ID) vs logical extruder id = 1 (LOGIC_R_EXTRUDER_ID)
// Likely because logical id reads from left to right (left = 0, right = 1)
// For generic N extruders, this inversion does not apply.
if (IsOnRack()) return INVALID_EXTRUDER_ID;
return m_nozzle_id;
} }
int DevNozzle::GetExtruderId() const int DevNozzle::GetExtruderId() const
{ {
int total_ext_count = GetTotalExtruderCount(); if (GUI::wxGetApp().preset_bundle->is_bbl_vendor()) {
if (total_ext_count == 1) { int total_ext_count = GetTotalExtruderCount();
return MAIN_EXTRUDER_ID; if (total_ext_count == 1) {
} else if (total_ext_count == 2) {
if (AtRightExtruder()) {
return MAIN_EXTRUDER_ID; return MAIN_EXTRUDER_ID;
} else if (AtLeftExtruder()) { } else if (total_ext_count == 2) {
return DEPUTY_EXTRUDER_ID; if (AtRightExtruder()) {
return MAIN_EXTRUDER_ID;
} else if (AtLeftExtruder()) {
return DEPUTY_EXTRUDER_ID;
}
} }
return MAIN_EXTRUDER_ID;
} }
return MAIN_EXTRUDER_ID; return m_nozzle_id;
} }
bool DevNozzle::AtLeftExtruder() const bool DevNozzle::AtLeftExtruder() const
+17 -12
View File
@@ -1199,19 +1199,24 @@ int MachineObject::get_bed_temperature_limit()
bool MachineObject::is_filament_installed() bool MachineObject::is_filament_installed()
{ {
if (m_extder_system->GetTotalExtderCount() > 0) { // if (m_extder_system->GetTotalExtderCount() > 0) {
// right//or single // // right//or single
auto ext = m_extder_system->m_extders[MAIN_EXTRUDER_ID]; // auto ext = m_extder_system->m_extders[MAIN_EXTRUDER_ID];
if (ext.m_ext_has_filament) { // if (ext.m_ext_has_filament) {
// return true;
// }
// }
// /*left*/
// if (m_extder_system->GetTotalExtderCount() > 1) {
// auto ext = m_extder_system->m_extders[DEPUTY_EXTRUDER_ID];
// if (ext.m_ext_has_filament) {
// return true;
// }
// }
for (auto& ext : m_extder_system->m_extders) {
if (ext.m_ext_has_filament)
return true; return true;
}
}
/*left*/
if (m_extder_system->GetTotalExtderCount() > 1) {
auto ext = m_extder_system->m_extders[DEPUTY_EXTRUDER_ID];
if (ext.m_ext_has_filament) {
return true;
}
} }
return false; return false;
} }
+344 -167
View File
@@ -1875,13 +1875,25 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent)
void StatusBasePanel::reset_temp_misc_control() void StatusBasePanel::reset_temp_misc_control()
{ {
// reset temp string // reset temp string
m_tempCtrl_nozzle->SetIconNormal(); if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle->SetLabel(TEMP_BLANK_STR); m_tempCtrl_nozzle->SetIconNormal();
m_tempCtrl_nozzle->GetTextCtrl()->SetValue(TEMP_BLANK_STR); m_tempCtrl_nozzle->SetLabel(TEMP_BLANK_STR);
m_tempCtrl_nozzle->GetTextCtrl()->SetValue(TEMP_BLANK_STR);
m_tempCtrl_nozzle_deputy->SetIconNormal(); m_tempCtrl_nozzle_deputy->SetIconNormal();
m_tempCtrl_nozzle_deputy->SetLabel(TEMP_BLANK_STR); m_tempCtrl_nozzle_deputy->SetLabel(TEMP_BLANK_STR);
m_tempCtrl_nozzle_deputy->GetTextCtrl()->SetValue(TEMP_BLANK_STR); m_tempCtrl_nozzle_deputy->GetTextCtrl()->SetValue(TEMP_BLANK_STR);
m_tempCtrl_nozzle->Enable(true);
m_tempCtrl_nozzle_deputy->Enable(true);
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles) {
tempCtrl->SetIconNormal();
tempCtrl->SetLabel(TEMP_BLANK_STR);
tempCtrl->GetTextCtrl()->SetValue(TEMP_BLANK_STR);
tempCtrl->Enable(true);
}
}
m_tempCtrl_bed->SetIconNormal(); m_tempCtrl_bed->SetIconNormal();
m_tempCtrl_bed->SetLabel(TEMP_BLANK_STR); m_tempCtrl_bed->SetLabel(TEMP_BLANK_STR);
@@ -1891,8 +1903,6 @@ void StatusBasePanel::reset_temp_misc_control()
m_tempCtrl_chamber->SetLabel(TEMP_BLANK_STR); m_tempCtrl_chamber->SetLabel(TEMP_BLANK_STR);
m_tempCtrl_chamber->GetTextCtrl()->SetValue(TEMP_BLANK_STR); m_tempCtrl_chamber->GetTextCtrl()->SetValue(TEMP_BLANK_STR);
m_tempCtrl_nozzle->Enable(true);
m_tempCtrl_nozzle_deputy->Enable(true);
m_tempCtrl_chamber->Enable(true); m_tempCtrl_chamber->Enable(true);
m_tempCtrl_bed->Enable(true); m_tempCtrl_bed->Enable(true);
@@ -2463,12 +2473,26 @@ void StatusPanel::wire_controls()
if (id == m_tempCtrl_bed->GetType()) { if (id == m_tempCtrl_bed->GetType()) {
on_set_bed_temp(); on_set_bed_temp();
} else if (id == m_tempCtrl_nozzle->GetType()) { } else if (id == m_tempCtrl_nozzle->GetType()) {
if (e.GetString() == wxString::Format("%d", MAIN_EXTRUDER_ID)) { // NOTE: this check assumes any future m_tempCtrl_nozzles population constructs those
on_set_nozzle_temp(MAIN_EXTRUDER_ID); // TempInput widgets with the same "type" id as m_tempCtrl_nozzle (as m_tempCtrl_nozzle_deputy
} else if (e.GetString() == wxString::Format("%d", DEPUTY_EXTRUDER_ID)) { // already does today), so their events route into this branch too.
on_set_nozzle_temp(DEPUTY_EXTRUDER_ID); if (wxGetApp().preset_bundle->is_bbl_vendor()) {
if (e.GetString() == wxString::Format("%d", MAIN_EXTRUDER_ID)) {
on_set_nozzle_temp(MAIN_EXTRUDER_ID);
} else if (e.GetString() == wxString::Format("%d", DEPUTY_EXTRUDER_ID)) {
on_set_nozzle_temp(DEPUTY_EXTRUDER_ID);
} else {
on_set_nozzle_temp(UNIQUE_EXTRUDER_ID);//there is only one nozzle
}
} else { } else {
on_set_nozzle_temp(UNIQUE_EXTRUDER_ID);//there is only one nozzle // N-extruder widgets all share TEMP_OF_NORMAL_TYPE, so e.GetString() can't
// disambiguate them; identify the one that fired by object identity instead.
for (size_t i = 0; i < m_tempCtrl_nozzles.size(); ++i) {
if (m_tempCtrl_nozzles[i] == e.GetEventObject()) {
on_set_nozzle_temp((int)i);
break;
}
}
} }
} else if (id == m_tempCtrl_chamber->GetType()) { } else if (id == m_tempCtrl_chamber->GetType()) {
if (!m_tempCtrl_chamber->IsOnChanging()) { if (!m_tempCtrl_chamber->IsOnChanging()) {
@@ -2493,10 +2517,17 @@ void StatusPanel::wire_controls()
m_setting_button->Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(StatusPanel::on_camera_enter), NULL, this); m_setting_button->Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(StatusPanel::on_camera_enter), NULL, this);
m_tempCtrl_bed->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_kill_focus), NULL, this); m_tempCtrl_bed->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_kill_focus), NULL, this);
m_tempCtrl_bed->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_set_focus), NULL, this); m_tempCtrl_bed->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_set_focus), NULL, this);
m_tempCtrl_nozzle->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this); if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this); m_tempCtrl_nozzle->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this); m_tempCtrl_nozzle->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this); m_tempCtrl_nozzle_deputy->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles) {
tempCtrl->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
tempCtrl->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
}
}
m_tempCtrl_chamber->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_cham_temp_kill_focus), NULL, this); m_tempCtrl_chamber->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_cham_temp_kill_focus), NULL, this);
m_tempCtrl_chamber->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_cham_temp_set_focus), NULL, this); m_tempCtrl_chamber->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_cham_temp_set_focus), NULL, this);
m_switch_lamp->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_lamp_switch), NULL, this); m_switch_lamp->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_lamp_switch), NULL, this);
@@ -2557,11 +2588,19 @@ StatusPanel::~StatusPanel()
m_setting_button->Disconnect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(StatusPanel::on_camera_enter), NULL, this); m_setting_button->Disconnect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(StatusPanel::on_camera_enter), NULL, this);
m_tempCtrl_bed->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_kill_focus), NULL, this); m_tempCtrl_bed->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_kill_focus), NULL, this);
m_tempCtrl_bed->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_set_focus), NULL, this); m_tempCtrl_bed->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_set_focus), NULL, this);
m_tempCtrl_nozzle->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this); if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle_deputy->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this); m_tempCtrl_nozzle->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles) {
tempCtrl->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
tempCtrl->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
}
}
m_switch_lamp->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_lamp_switch), NULL, this); m_switch_lamp->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_lamp_switch), NULL, this);
/*m_switch_nozzle_fan->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_nozzle_fan_switch), NULL, this); /*m_switch_nozzle_fan->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_nozzle_fan_switch), NULL, this);
@@ -3031,8 +3070,14 @@ void StatusPanel::show_printing_status(bool ctrl_area, bool temp_area)
} }
if (!temp_area) { if (!temp_area) {
m_tempCtrl_nozzle->Enable(false); if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle_deputy->Enable(false); m_tempCtrl_nozzle->Enable(false);
m_tempCtrl_nozzle_deputy->Enable(false);
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles)
tempCtrl->Enable(false);
}
m_tempCtrl_bed->Enable(false); m_tempCtrl_bed->Enable(false);
m_tempCtrl_chamber->Enable(false); m_tempCtrl_chamber->Enable(false);
m_switch_speed->Enable(false); m_switch_speed->Enable(false);
@@ -3043,8 +3088,14 @@ void StatusPanel::show_printing_status(bool ctrl_area, bool temp_area)
m_switch_cham_fan->Enable(false);*/ m_switch_cham_fan->Enable(false);*/
m_switch_fan->Enable(false); m_switch_fan->Enable(false);
} else { } else {
m_tempCtrl_nozzle->Enable(); if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle_deputy->Enable(); m_tempCtrl_nozzle->Enable();
m_tempCtrl_nozzle_deputy->Enable();
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles)
tempCtrl->Enable();
}
m_tempCtrl_bed->Enable(); m_tempCtrl_bed->Enable();
m_tempCtrl_chamber->Enable(); m_tempCtrl_chamber->Enable();
m_switch_speed->Enable(); m_switch_speed->Enable();
@@ -3073,11 +3124,18 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj)
m_tempCtrl_bed->SetMaxTemp(limit); m_tempCtrl_bed->SetMaxTemp(limit);
if (obj->nozzle_temp_range.size() >= 2) { if (obj->nozzle_temp_range.size() >= 2) {
m_tempCtrl_nozzle->SetMinTemp(obj->nozzle_temp_range[0]); if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle->SetMaxTemp(obj->nozzle_temp_range[1]); m_tempCtrl_nozzle->SetMinTemp(obj->nozzle_temp_range[0]);
m_tempCtrl_nozzle->SetMaxTemp(obj->nozzle_temp_range[1]);
m_tempCtrl_nozzle_deputy->SetMinTemp(obj->nozzle_temp_range[0]); m_tempCtrl_nozzle_deputy->SetMinTemp(obj->nozzle_temp_range[0]);
m_tempCtrl_nozzle_deputy->SetMaxTemp(obj->nozzle_temp_range[1]); m_tempCtrl_nozzle_deputy->SetMaxTemp(obj->nozzle_temp_range[1]);
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles) {
tempCtrl->SetMinTemp(obj->nozzle_temp_range[0]);
tempCtrl->SetMaxTemp(obj->nozzle_temp_range[1]);
}
}
} }
// update temprature if not input temp target // update temprature if not input temp target
@@ -3095,76 +3153,118 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj)
bool to_update_layout = false; bool to_update_layout = false;
int nozzle_num = obj->GetExtderSystem()->GetTotalExtderCount(); int nozzle_num = obj->GetExtderSystem()->GetTotalExtderCount();
if (nozzle_num == 1)
{
m_tempCtrl_nozzle->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent(MAIN_EXTRUDER_ID));
m_tempCtrl_nozzle->SetCurrType(TEMP_OF_NORMAL_TYPE);
m_tempCtrl_nozzle_deputy->SetCurrType(TEMP_OF_NORMAL_TYPE); if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle_deputy->SetLabel(TEMP_BLANK_STR); if (nozzle_num == 1)
{
m_tempCtrl_nozzle->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent(MAIN_EXTRUDER_ID));
m_tempCtrl_nozzle->SetCurrType(TEMP_OF_NORMAL_TYPE);
m_tempCtrl_nozzle_deputy->SetCurrType(TEMP_OF_NORMAL_TYPE);
m_tempCtrl_nozzle_deputy->SetLabel(TEMP_BLANK_STR);
m_tempCtrl_nozzle_deputy->Hide();
if (m_tempCtrl_nozzle->GetMinSize() != TEMP_CTRL_MIN_SIZE_ALIGN_ONE_ICON)
{
to_update_layout = true;
m_tempCtrl_nozzle->SetMinSize(TEMP_CTRL_MIN_SIZE_ALIGN_ONE_ICON);
}
}
else if (nozzle_num == 2)
{
m_tempCtrl_nozzle->SetCurrType(TEMP_OF_MAIN_NOZZLE_TYPE);
m_tempCtrl_nozzle->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent(MAIN_EXTRUDER_ID));
m_tempCtrl_nozzle->Show();
m_tempCtrl_nozzle_deputy->SetCurrType(TEMP_OF_DEPUTY_NOZZLE_TYPE);
m_tempCtrl_nozzle_deputy->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent(DEPUTY_EXTRUDER_ID));
m_tempCtrl_nozzle_deputy->Show();
if (m_tempCtrl_nozzle->GetMinSize() != TEMP_CTRL_MIN_SIZE_ALIGN_TWO_ICON)
{
to_update_layout = true;
m_tempCtrl_nozzle->SetMinSize(TEMP_CTRL_MIN_SIZE_ALIGN_TWO_ICON);
}
}
}
else
{
m_tempCtrl_nozzle->Hide();
m_tempCtrl_nozzle_deputy->Hide(); m_tempCtrl_nozzle_deputy->Hide();
if (m_tempCtrl_nozzle->GetMinSize() != TEMP_CTRL_MIN_SIZE_ALIGN_ONE_ICON) for (size_t i = 0; i < m_tempCtrl_nozzles.size(); ++i)
{ {
to_update_layout = true; m_tempCtrl_nozzles[i]->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent((int)i));
m_tempCtrl_nozzle->SetMinSize(TEMP_CTRL_MIN_SIZE_ALIGN_ONE_ICON); m_tempCtrl_nozzles[i]->SetCurrType(TEMP_OF_NORMAL_TYPE);
} m_tempCtrl_nozzles[i]->Show();
}
else if (nozzle_num == 2)
{
m_tempCtrl_nozzle->SetCurrType(TEMP_OF_MAIN_NOZZLE_TYPE);
m_tempCtrl_nozzle->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent(MAIN_EXTRUDER_ID));
m_tempCtrl_nozzle->Show();
m_tempCtrl_nozzle_deputy->SetCurrType(TEMP_OF_DEPUTY_NOZZLE_TYPE);
m_tempCtrl_nozzle_deputy->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent(DEPUTY_EXTRUDER_ID));
m_tempCtrl_nozzle_deputy->Show();
if (m_tempCtrl_nozzle->GetMinSize() != TEMP_CTRL_MIN_SIZE_ALIGN_TWO_ICON)
{
to_update_layout = true;
m_tempCtrl_nozzle->SetMinSize(TEMP_CTRL_MIN_SIZE_ALIGN_TWO_ICON);
} }
} }
if (m_temp_nozzle_timeout > 0) { if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_temp_nozzle_timeout--; if (m_temp_nozzle_timeout > 0) {
} else { m_temp_nozzle_timeout--;
if (!nozzle_temp_input) { } else {
auto main_extder = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID); if (!nozzle_temp_input) {
if (main_extder) auto main_extder = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID);
{ if (main_extder)
m_tempCtrl_nozzle->SetTagTemp(main_extder->GetTargetTemp());
m_tempCtrl_nozzle->SetCurrTemp((int)main_extder->GetCurrentTemp());
if (main_extder->GetTargetTemp() - main_extder->GetCurrentTemp() > TEMP_THRESHOLD_VAL)
{ {
m_tempCtrl_nozzle->SetIconActive(); m_tempCtrl_nozzle->SetTagTemp(main_extder->GetTargetTemp());
m_tempCtrl_nozzle->SetCurrTemp((int)main_extder->GetCurrentTemp());
if (main_extder->GetTargetTemp() - main_extder->GetCurrentTemp() > TEMP_THRESHOLD_VAL)
{
m_tempCtrl_nozzle->SetIconActive();
}
else
{
m_tempCtrl_nozzle->SetIconNormal();
}
} }
else }
}
if (m_temp_nozzle_deputy_timeout > 0) {
m_temp_nozzle_deputy_timeout--;
}
else {
if (!nozzle_temp_input && nozzle_num >= 2) {
auto deputy_extder = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID);
if (deputy_extder)
{ {
m_tempCtrl_nozzle->SetIconNormal(); m_tempCtrl_nozzle_deputy->SetTagTemp(deputy_extder->GetTargetTemp());
m_tempCtrl_nozzle_deputy->SetCurrTemp((int)deputy_extder->GetCurrentTemp());
if (deputy_extder->GetTargetTemp() - deputy_extder->GetCurrentTemp() > TEMP_THRESHOLD_VAL)
{
m_tempCtrl_nozzle_deputy->SetIconActive();
}
else
{
m_tempCtrl_nozzle_deputy->SetIconNormal();
}
} }
} }
} }
} }
if (m_temp_nozzle_deputy_timeout > 0) {
m_temp_nozzle_deputy_timeout--;
}
else { else {
if (!nozzle_temp_input && nozzle_num >= 2) { assert(m_temp_nozzle_timeouts.size() == m_tempCtrl_nozzles.size());
auto deputy_extder = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID); for (size_t i = 0; i < m_temp_nozzle_timeouts.size(); ++i) {
if (deputy_extder) if (m_temp_nozzle_timeouts[i] > 0) {
{ m_temp_nozzle_timeouts[i]--;
m_tempCtrl_nozzle_deputy->SetTagTemp(deputy_extder->GetTargetTemp()); } else {
m_tempCtrl_nozzle_deputy->SetCurrTemp((int)deputy_extder->GetCurrentTemp()); if (!nozzle_temp_input) {
if (deputy_extder->GetTargetTemp() - deputy_extder->GetCurrentTemp() > TEMP_THRESHOLD_VAL) auto extder = obj->GetExtderSystem()->GetExtderById(i);
{ if (extder)
m_tempCtrl_nozzle_deputy->SetIconActive(); {
} m_tempCtrl_nozzles[i]->SetTagTemp(extder->GetTargetTemp());
else m_tempCtrl_nozzles[i]->SetCurrTemp((int)extder->GetCurrentTemp());
{ if (extder->GetTargetTemp() - extder->GetCurrentTemp() > TEMP_THRESHOLD_VAL)
m_tempCtrl_nozzle_deputy->SetIconNormal(); {
m_tempCtrl_nozzles[i]->SetIconActive();
}
else
{
m_tempCtrl_nozzles[i]->SetIconNormal();
}
}
} }
} }
} }
@@ -3237,10 +3337,15 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
/*extder*/ /*extder*/
auto extder_system = obj->GetExtderSystem(); auto extder_system = obj->GetExtderSystem();
m_nozzle_num = extder_system->GetTotalExtderCount(); m_nozzle_num = extder_system->GetTotalExtderCount();
int select_index = m_nozzle_num - 1; // m_extruderImage/m_extruder_book only have dedicated pages for 1 and 2 nozzles (see
// create_extruder_control()); 3+ reuses the 2-nozzle page and style, which is a cosmetic
// fallback only (ExtruderImage::doRender's own "m_nozzle_num >= 2" branch already draws the
// same two-icon graphic for any count >= 2) -- this just avoids indexing past the vector's end.
int display_num = m_nozzle_num < (int)m_extruderImage.size() ? m_nozzle_num : (int)m_extruderImage.size();
int select_index = display_num - 1;
if (m_nozzle_num >= 2) { if (m_nozzle_num >= 2) {
m_extruder_book->SetSelection(m_nozzle_num); m_extruder_book->SetSelection(display_num);
/*style*/ /*style*/
m_nozzle_btn_panel->Show(); m_nozzle_btn_panel->Show();
@@ -3286,7 +3391,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
} }
} else { } else {
m_nozzle_btn_panel->Hide(); m_nozzle_btn_panel->Hide();
m_extruder_book->SetSelection(m_nozzle_num); m_extruder_book->SetSelection(display_num);
m_extruderImage[select_index]->setExtruderCount(m_nozzle_num); m_extruderImage[select_index]->setExtruderCount(m_nozzle_num);
if (extder_system->GetTotalExtderSize() > 0) if (extder_system->GetTotalExtderSize() > 0)
@@ -3473,34 +3578,50 @@ void StatusPanel::update_ams(MachineObject *obj)
// m_ams_control->SetExtruder(obj->is_filament_at_extruder(), obj->m_extder_data.extders[MAIN_NOZZLE_ID].snow.ams_id, obj->m_extder_data.extders[MAIN_NOZZLE_ID].snow.slot_id); // m_ams_control->SetExtruder(obj->is_filament_at_extruder(), obj->m_extder_data.extders[MAIN_NOZZLE_ID].snow.ams_id, obj->m_extder_data.extders[MAIN_NOZZLE_ID].snow.slot_id);
//} else { //} else {
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
/*right*/ /*right*/
if (obj->GetExtderSystem()->GetTotalExtderCount() > 0) { if (obj->GetExtderSystem()->GetTotalExtderCount() > 0) {
auto ext = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID); auto ext = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID);
if (ext->HasFilamentInExt()) { if (ext->HasFilamentInExt()) {
if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) { if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3); m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
} else { } else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2); m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
} }
} else { m_ams_control->SetExtruder(ext->HasFilamentInExt(), MAIN_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
} }
m_ams_control->SetExtruder(ext->HasFilamentInExt(), MAIN_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
}
/*left*/ /*left*/
if (obj->GetExtderSystem()->GetTotalExtderCount() > 1) { if (obj->GetExtderSystem()->GetTotalExtderCount() > 1) {
auto ext = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID); auto ext = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID);
if (ext->HasFilamentInExt()) { if (ext->HasFilamentInExt()) {
if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) { if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3); m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
} else { } else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2); m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
} }
} else { m_ams_control->SetExtruder(ext->HasFilamentInExt(), DEPUTY_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE); }
} else {
/*all extruders, in id order*/
for (const auto& ext : obj->GetExtderSystem()->GetExtruders()) {
if (ext.HasFilamentInExt()) {
if (ext.GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext.GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
} else {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
}
m_ams_control->SetExtruder(ext.HasFilamentInExt(), ext.GetExtId(), ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id);
} }
m_ams_control->SetExtruder(ext->HasFilamentInExt(), DEPUTY_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
} }
update_filament_loading_panel(obj); update_filament_loading_panel(obj);
@@ -4185,33 +4306,48 @@ void StatusPanel::on_set_nozzle_temp(int nozzle_id)
try { try {
long nozzle_temp; long nozzle_temp;
if (nozzle_id == MAIN_EXTRUDER_ID) { if (wxGetApp().preset_bundle->is_bbl_vendor()) {
wxString str = m_tempCtrl_nozzle->GetTextCtrl()->GetValue(); if (nozzle_id == MAIN_EXTRUDER_ID) {
if (str.ToLong(&nozzle_temp) && obj) { wxString str = m_tempCtrl_nozzle->GetTextCtrl()->GetValue();
set_hold_count(m_temp_nozzle_timeout); if (str.ToLong(&nozzle_temp) && obj) {
if (nozzle_temp > m_tempCtrl_nozzle->get_max_temp()) { set_hold_count(m_temp_nozzle_timeout);
nozzle_temp = m_tempCtrl_nozzle->get_max_temp(); if (nozzle_temp > m_tempCtrl_nozzle->get_max_temp()) {
m_tempCtrl_nozzle->SetTagTemp(wxString::Format("%d", nozzle_temp)); nozzle_temp = m_tempCtrl_nozzle->get_max_temp();
m_tempCtrl_nozzle->Warning(false); 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_EXTRUDER_ID, nozzle_temp);
}
} }
if (m_tempCtrl_nozzle->GetCurrType() == TempInputType::TEMP_OF_NORMAL_TYPE) { }
obj->command_set_nozzle(nozzle_temp);
} else { if (nozzle_id == DEPUTY_EXTRUDER_ID) {
obj->command_set_nozzle_new(MAIN_EXTRUDER_ID, nozzle_temp); 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_EXTRUDER_ID, nozzle_temp);
} }
} }
} }
else if (nozzle_id >= 0 && nozzle_id < (int)m_tempCtrl_nozzles.size()) {
if (nozzle_id == DEPUTY_EXTRUDER_ID) { assert(m_tempCtrl_nozzles.size() == m_temp_nozzle_timeouts.size());
wxString str = m_tempCtrl_nozzle_deputy->GetTextCtrl()->GetValue(); wxString str = m_tempCtrl_nozzles[nozzle_id]->GetTextCtrl()->GetValue();
if (str.ToLong(&nozzle_temp) && obj) { if (str.ToLong(&nozzle_temp) && obj) {
set_hold_count(m_temp_nozzle_deputy_timeout); set_hold_count(m_temp_nozzle_timeouts[nozzle_id]);
if (nozzle_temp > m_tempCtrl_nozzle_deputy->get_max_temp()) { if (nozzle_temp > m_tempCtrl_nozzles[nozzle_id]->get_max_temp()) {
nozzle_temp = m_tempCtrl_nozzle_deputy->get_max_temp(); nozzle_temp = m_tempCtrl_nozzles[nozzle_id]->get_max_temp();
m_tempCtrl_nozzle_deputy->SetTagTemp(wxString::Format("%d", nozzle_temp)); m_tempCtrl_nozzles[nozzle_id]->SetTagTemp(wxString::Format("%d", nozzle_temp));
m_tempCtrl_nozzle_deputy->Warning(false); m_tempCtrl_nozzles[nozzle_id]->Warning(false);
} }
obj->command_set_nozzle_new(DEPUTY_EXTRUDER_ID, nozzle_temp); obj->command_set_nozzle_new(nozzle_id, nozzle_temp);
} }
} }
} catch (...) { } catch (...) {
@@ -4295,26 +4431,44 @@ void StatusPanel::on_ams_load_curr()
return; return;
} }
// Filament Track Switch is calibrated: the load can go to either extruder, so ask the // Filament Track Switch is calibrated: the load can go to either/any extruder, so ask
// user which. Record each extruder's currently-loaded slot so the dialog can grey out a // the user which. Record each extruder's currently-loaded slot so the dialog can grey
// side that already holds this filament. // out a side that already holds this filament.
std::vector<std::pair<std::string, std::string>> extruderSlots(2, {"", ""}); // NOTE: FeedDirectionDialog/SetExtruderMapping (Widgets/AMSItem.{hpp,cpp}) take the real
if (auto ext = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID); ext.has_value()) // extruder count in the non-BBL path now, but that class's own internals haven't been
{ // audited for N > 2 -- this only fixes what's local to StatusPanel.cpp.
if (ext->HasFilamentInExt()) int extruder_count;
std::vector<std::pair<std::string, std::string>> extruderSlots;
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
extruder_count = 2;
extruderSlots.assign(2, {"", ""});
if (auto ext = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID); ext.has_value())
{ {
extruderSlots[MAIN_EXTRUDER_ID] = {ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id}; if (ext->HasFilamentInExt())
{
extruderSlots[MAIN_EXTRUDER_ID] = {ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id};
}
} }
} if (auto ext = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID); ext.has_value())
if (auto ext = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID); ext.has_value())
{
if (ext->HasFilamentInExt())
{ {
extruderSlots[DEPUTY_EXTRUDER_ID] = {ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id}; if (ext->HasFilamentInExt())
{
extruderSlots[DEPUTY_EXTRUDER_ID] = {ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id};
}
}
} else {
extruder_count = obj->GetExtderSystem()->GetTotalExtderCount();
extruderSlots.assign(extruder_count, {"", ""});
for (const auto& ext : obj->GetExtderSystem()->GetExtruders())
{
if (ext.HasFilamentInExt())
{
extruderSlots[ext.GetExtId()] = {ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id};
}
} }
} }
FeedDirectionDialog dialog(nullptr, 2, obj->printer_type); FeedDirectionDialog dialog(nullptr, extruder_count, obj->printer_type);
dialog.SetExtruderMapping(obj, curr_ams_id, curr_can_id, extruderSlots); dialog.SetExtruderMapping(obj, curr_ams_id, curr_can_id, extruderSlots);
auto rtn = dialog.ShowModal(); auto rtn = dialog.ShowModal();
@@ -4416,34 +4570,50 @@ void StatusPanel::on_ams_switch(SimpleEvent &event)
{ {
if(obj){ if(obj){
/*right*/ if (wxGetApp().preset_bundle->is_bbl_vendor()) {
if (obj->GetExtderSystem()->GetTotalExtderCount() > 0) { /*right*/
auto ext = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID); if (obj->GetExtderSystem()->GetTotalExtderCount() > 0) {
if (ext->HasFilamentInExt()) { auto ext = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID);
if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) { if (ext->HasFilamentInExt()) {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3); if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
} else { } else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2); m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
} }
} else { m_ams_control->SetExtruder(ext->HasFilamentInExt(), MAIN_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
} }
m_ams_control->SetExtruder(ext->HasFilamentInExt(), MAIN_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
}
/*left*/ /*left*/
if (obj->GetExtderSystem()->GetTotalExtderCount() > 1) { if (obj->GetExtderSystem()->GetTotalExtderCount() > 1) {
auto ext = obj->GetExtderSystem()->GetExtruders()[DEPUTY_EXTRUDER_ID]; auto ext = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID);
if (ext.HasFilamentInExt()) { if (ext->HasFilamentInExt()) {
if (ext.GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext.GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) { if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3); m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
} else { } else {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2); m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
} }
} else { m_ams_control->SetExtruder(ext->HasFilamentInExt(), DEPUTY_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE); }
} else {
/*all extruders, in id order*/
for (const auto& ext : obj->GetExtderSystem()->GetExtruders()) {
if (ext.HasFilamentInExt()) {
if (ext.GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext.GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
} else {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
}
m_ams_control->SetExtruder(ext.HasFilamentInExt(), ext.GetExtId(), ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id);
} }
m_ams_control->SetExtruder(ext.HasFilamentInExt(), DEPUTY_EXTRUDER_ID, ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id);
} }
} }
} }
@@ -5369,10 +5539,17 @@ void StatusPanel::msw_rescale()
m_bpButton_xy->Rescale(); m_bpButton_xy->Rescale();
auto size = TEMP_CTRL_MIN_SIZE_ALIGN_ONE_ICON; auto size = TEMP_CTRL_MIN_SIZE_ALIGN_ONE_ICON;
if (obj && obj->GetExtderSystem()->GetTotalExtderCount() >= 2) size = TEMP_CTRL_MIN_SIZE_ALIGN_TWO_ICON; if (obj && obj->GetExtderSystem()->GetTotalExtderCount() >= 2) size = TEMP_CTRL_MIN_SIZE_ALIGN_TWO_ICON;
m_tempCtrl_nozzle->SetMinSize(size); if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle->Rescale(); m_tempCtrl_nozzle->SetMinSize(size);
m_tempCtrl_nozzle_deputy->SetMinSize(size); m_tempCtrl_nozzle->Rescale();
m_tempCtrl_nozzle_deputy->Rescale(); m_tempCtrl_nozzle_deputy->SetMinSize(size);
m_tempCtrl_nozzle_deputy->Rescale();
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles) {
tempCtrl->SetMinSize(size);
tempCtrl->Rescale();
}
}
m_line_nozzle->SetSize(wxSize(-1, FromDIP(1))); m_line_nozzle->SetSize(wxSize(-1, FromDIP(1)));
m_tempCtrl_bed->SetMinSize(size); m_tempCtrl_bed->SetMinSize(size);
m_tempCtrl_bed->Rescale(); m_tempCtrl_bed->Rescale();
+4
View File
@@ -482,6 +482,10 @@ protected:
int m_temp_nozzle_timeout{ 0 }; int m_temp_nozzle_timeout{ 0 };
TempInput* m_tempCtrl_nozzle_deputy; TempInput* m_tempCtrl_nozzle_deputy;
int m_temp_nozzle_deputy_timeout{ 0 }; int m_temp_nozzle_deputy_timeout{ 0 };
std::vector<TempInput*> m_tempCtrl_nozzles;
std::vector<int> m_temp_nozzle_timeouts;
TempInput * m_tempCtrl_bed; TempInput * m_tempCtrl_bed;
int m_temp_bed_timeout {0}; int m_temp_bed_timeout {0};
TempInput * m_tempCtrl_chamber; TempInput * m_tempCtrl_chamber;
+10 -3
View File
@@ -837,14 +837,21 @@ void MultiNozzleStatusTable::UpdateRackInfo(std::weak_ptr<DevNozzleRack> rack)
bool has_right = false; bool has_right = false;
for (auto& elem : nozzles_in_extruder) { for (auto& elem : nozzles_in_extruder) {
auto& nozzle = elem.second; auto& nozzle = elem.second;
int extruder_id = nozzle.AtLeftExtruder() ? 0 : 1;
if (nozzle.AtRightExtruder()) int extruder_id{};
has_right = true; if (wxGetApp().preset_bundle->is_bbl_vendor()) {
extruder_id = nozzle.AtLeftExtruder() ? 0 : 1;
if (nozzle.AtRightExtruder())
has_right = true;
}
else
extruder_id = nozzle.GetExtruderId();
NozzleVolumeType volume_type = DevNozzle::ToNozzleVolumeType(nozzle.m_nozzle_flow); NozzleVolumeType volume_type = DevNozzle::ToNozzleVolumeType(nozzle.m_nozzle_flow);
m_badge->SetExtruderInfo(extruder_id, format_diameter_to_str(nozzle.GetNozzleDiameter()), volume_type); m_badge->SetExtruderInfo(extruder_id, format_diameter_to_str(nozzle.GetNozzleDiameter()), volume_type);
} }
// TODO: Update for N extruders
m_badge->SetExtruderValid(has_right); m_badge->SetExtruderValid(has_right);
} }
} }
+3
View File
@@ -170,6 +170,9 @@ void TempInput::SetFinish()
wxCommandEvent event(wxCUSTOMEVT_SET_TEMP_FINISH); wxCommandEvent event(wxCUSTOMEVT_SET_TEMP_FINISH);
event.SetInt(temp_type); event.SetInt(temp_type);
event.SetString(wxString::Format("%d", m_input_type)); event.SetString(wxString::Format("%d", m_input_type));
// N-extruder temp controls all share TEMP_OF_NORMAL_TYPE, so the string payload above can't
// tell them apart; carry widget identity so the listener can find which one fired.
event.SetEventObject(this);
wxPostEvent(this->GetParent(), event); wxPostEvent(this->GetParent(), event);
} }