FIX:the extruder status display fault while has filament
jira: [STUDIO-9154] Change-Id: Iadaa5479eb9770c795f2ebc45c8e5305c2c5640b
This commit is contained in:
parent
6587ac01b8
commit
27c99677ed
|
@ -232,6 +232,11 @@ void ExtruderImage::setExtruderUsed(std::string loc)
|
||||||
current_nozzle_loc = loc;
|
current_nozzle_loc = loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExtruderImage::update(ExtruderState single_state)
|
||||||
|
{
|
||||||
|
m_single_ext_state = single_state;
|
||||||
|
}
|
||||||
|
|
||||||
void ExtruderImage::update(ExtruderState right_state, ExtruderState left_state) {
|
void ExtruderImage::update(ExtruderState right_state, ExtruderState left_state) {
|
||||||
m_left_ext_state = left_state;
|
m_left_ext_state = left_state;
|
||||||
m_right_ext_state = right_state;
|
m_right_ext_state = right_state;
|
||||||
|
@ -330,16 +335,21 @@ void ExtruderImage::doRender(wxDC& dc)
|
||||||
dc.DrawBitmap(right_nozzle_bmp->bmp(), pot.x, pot.y + right_pipe_bmp->GetBmpSize().y);
|
dc.DrawBitmap(right_nozzle_bmp->bmp(), pot.x, pot.y + right_pipe_bmp->GetBmpSize().y);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
|
ScalableBitmap* nozzle_bmp = nullptr;
|
||||||
switch (m_single_ext_state)
|
switch (m_single_ext_state)
|
||||||
{
|
{
|
||||||
case Slic3r::GUI::FILLED_LOAD: m_extruder_single_nozzle_filled_load; break;
|
case Slic3r::GUI::FILLED_LOAD: nozzle_bmp = m_extruder_single_nozzle_filled_load; break;
|
||||||
case Slic3r::GUI::FILLED_UNLOAD: m_extruder_single_nozzle_filled_unload; break;
|
case Slic3r::GUI::FILLED_UNLOAD: nozzle_bmp = m_extruder_single_nozzle_filled_unload; break;
|
||||||
case Slic3r::GUI::EMPTY_LOAD: m_extruder_single_nozzle_empty_load; break;
|
case Slic3r::GUI::EMPTY_LOAD: nozzle_bmp = m_extruder_single_nozzle_empty_load; break;
|
||||||
case Slic3r::GUI::EMPTY_UNLOAD: m_extruder_single_nozzle_empty_unload; break;
|
case Slic3r::GUI::EMPTY_UNLOAD: nozzle_bmp = m_extruder_single_nozzle_empty_unload; break;
|
||||||
default:
|
default: break;
|
||||||
break;
|
}
|
||||||
|
|
||||||
|
if (nozzle_bmp)
|
||||||
|
{
|
||||||
|
dc.DrawBitmap(nozzle_bmp->bmp(), pot.x - nozzle_bmp->GetBmpWidth() / 2, (size.y - nozzle_bmp->GetBmpHeight()) / 2);
|
||||||
}
|
}
|
||||||
dc.DrawBitmap(m_extruder_single_nozzle_empty_load->bmp(), pot.x - m_extruder_single_nozzle_empty_load->GetBmpWidth() / 2, (size.y - m_extruder_single_nozzle_empty_load->GetBmpHeight()) / 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2923,6 +2933,12 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj)
|
||||||
|
|
||||||
void StatusPanel::update_misc_ctrl(MachineObject *obj)
|
void StatusPanel::update_misc_ctrl(MachineObject *obj)
|
||||||
{
|
{
|
||||||
|
auto get_extder_shown_state = [](bool ext_has_filament) -> ExtruderState
|
||||||
|
{
|
||||||
|
// no data to distinguish ExtruderState::UNLOAD or LOAD, use LOAD png as default
|
||||||
|
return ext_has_filament ? ExtruderState::FILLED_LOAD : ExtruderState::EMPTY_LOAD;
|
||||||
|
};
|
||||||
|
|
||||||
if (!obj) return;
|
if (!obj) return;
|
||||||
|
|
||||||
/*extder*/
|
/*extder*/
|
||||||
|
@ -2936,7 +2952,15 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
|
||||||
m_nozzle_btn_panel->Show();
|
m_nozzle_btn_panel->Show();
|
||||||
|
|
||||||
m_extruderImage[select_index]->setExtruderCount(m_nozzle_num);
|
m_extruderImage[select_index]->setExtruderCount(m_nozzle_num);
|
||||||
m_extruderImage[select_index]->update(ExtruderState::FILLED_LOAD, ExtruderState::FILLED_UNLOAD);
|
|
||||||
|
assert(obj->m_extder_data.extders.size() > 1);
|
||||||
|
if (obj->m_extder_data.extders.size() > 1)
|
||||||
|
{
|
||||||
|
const Extder& left_extder = obj->m_extder_data.extders[0];
|
||||||
|
const Extder& right_extder = obj->m_extder_data.extders[1];
|
||||||
|
m_extruderImage[select_index]->update(get_extder_shown_state(left_extder.ext_has_filament),
|
||||||
|
get_extder_shown_state(right_extder.ext_has_filament));
|
||||||
|
}
|
||||||
|
|
||||||
/*current*/
|
/*current*/
|
||||||
if (obj->flag_update_nozzle) {
|
if (obj->flag_update_nozzle) {
|
||||||
|
@ -2955,6 +2979,14 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
|
||||||
m_nozzle_btn_panel->Hide();
|
m_nozzle_btn_panel->Hide();
|
||||||
m_extruder_book->SetSelection(m_nozzle_num);
|
m_extruder_book->SetSelection(m_nozzle_num);
|
||||||
m_extruderImage[select_index]->setExtruderCount(m_nozzle_num);
|
m_extruderImage[select_index]->setExtruderCount(m_nozzle_num);
|
||||||
|
|
||||||
|
assert(!obj->m_extder_data.extders.empty());
|
||||||
|
if (!obj->m_extder_data.extders.empty())
|
||||||
|
{
|
||||||
|
const Extder& extder = obj->m_extder_data.extders[0];
|
||||||
|
ExtruderState shown_state = get_extder_shown_state(extder.ext_has_filament);
|
||||||
|
m_extruderImage[select_index]->update(shown_state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*switch extder*/
|
/*switch extder*/
|
||||||
|
|
|
@ -117,7 +117,9 @@ class ExtruderImage : public wxWindow
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void update(int nozzle_num, int nozzle_id);
|
void update(int nozzle_num, int nozzle_id);
|
||||||
|
void update(ExtruderState single_state);
|
||||||
void update(ExtruderState right_state, ExtruderState left_state);
|
void update(ExtruderState right_state, ExtruderState left_state);
|
||||||
|
|
||||||
void msw_rescale();
|
void msw_rescale();
|
||||||
void setExtruderCount(int nozzle_num);
|
void setExtruderCount(int nozzle_num);
|
||||||
void setExtruderUsed(std::string loc);
|
void setExtruderUsed(std::string loc);
|
||||||
|
|
Loading…
Reference in New Issue