ENH: set 4 status of monitor extruder icon

Change-Id: I2739c7079268409975a9bd6ed1efb6cf47868438
This commit is contained in:
tao.jin 2022-10-27 13:11:52 +08:00 committed by Lane.Wei
parent cd1210b0ca
commit 7b3621bb0c
12 changed files with 40 additions and 69 deletions

View file

@ -1443,6 +1443,7 @@ int MachineObject::command_axis_control(std::string axis, double unit, double va
}
else if (axis.compare("E") == 0) {
sprintf(cmd, "M83 \nG0 %s%0.1f F%d\n", axis.c_str(), value * unit, speed);
extruder_axis_status = (value >= 0.0f)? LOAD : UNLOAD;
}
else {
return -1;
@ -1634,6 +1635,7 @@ void MachineObject::reset()
print_status = "";
last_mc_print_stage = -1;
m_new_ver_list_exist = false;
extruder_axis_status = LOAD;
subtask_ = nullptr;

View file

@ -310,6 +310,13 @@ public:
UpgradingFinished = 3
};
enum ExtruderAxisStatus {
LOAD = 0,
UNLOAD =1,
STATUS_NUMS = 2
};
enum ExtruderAxisStatus extruder_axis_status = LOAD;
class ModuleVersionInfo
{
public:

View file

@ -179,8 +179,10 @@ void StatusBasePanel::init_bitmaps()
m_thumbnail_placeholder = ScalableBitmap(this, "monitor_placeholder", 120);
m_thumbnail_sdcard = ScalableBitmap(this, "monitor_sdcard_thumbnail", 120);
//m_bitmap_camera = create_scaled_bitmap("monitor_camera", nullptr, 18);
m_bitmap_extruder = *cache.load_png("monitor_extruder", FromDIP(28), FromDIP(70), false, false);
m_bitmap_extruder_load = *cache.load_png("monitor_extruder_load", FromDIP(28), FromDIP(70), false, false);
m_bitmap_extruder_empty_load = *cache.load_png("monitor_extruder_empty_load", FromDIP(28), FromDIP(70), false, false);
m_bitmap_extruder_filled_load = *cache.load_png("monitor_extruder_filled_load", FromDIP(28), FromDIP(70), false, false);
m_bitmap_extruder_empty_unload = *cache.load_png("monitor_extruder_empty_unload", FromDIP(28), FromDIP(70), false, false);
m_bitmap_extruder_filled_unload = *cache.load_png("monitor_extruder_filled_unload", FromDIP(28), FromDIP(70), false, false);
m_bitmap_sdcard_state_on = create_scaled_bitmap("sdcard_state_on", nullptr, 20);
m_bitmap_sdcard_state_off = create_scaled_bitmap("sdcard_state_off", nullptr, 20);
}
@ -916,7 +918,7 @@ wxBoxSizer *StatusBasePanel::create_extruder_control(wxWindow *parent)
bSizer_e_ctrl->Add(m_bpButton_e_10, 0, wxALIGN_CENTER_HORIZONTAL, 0);
bSizer_e_ctrl->Add(0, FromDIP(7), 0, 0, 0);
m_bitmap_extruder_img = new wxStaticBitmap(panel, wxID_ANY, m_bitmap_extruder, wxDefaultPosition, wxDefaultSize, 0);
m_bitmap_extruder_img = new wxStaticBitmap(panel, wxID_ANY, m_bitmap_extruder_empty_load, wxDefaultPosition, wxDefaultSize, 0);
m_bitmap_extruder_img->SetMinSize(EXTRUDER_IMAGE_SIZE);
bSizer_e_ctrl->Add(m_bitmap_extruder_img, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP | wxBOTTOM, FromDIP(5));
@ -1311,13 +1313,6 @@ void StatusPanel::update(MachineObject *obj)
update_temp_ctrl(obj);
update_misc_ctrl(obj);
if (obj && obj->is_filament_at_extruder()) {
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder_load);
}
else {
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder);
}
// BBS hide tasklist info
// update_tasklist(obj);
update_ams(obj);
@ -1550,6 +1545,9 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
}
}
// update extruder icon
update_extruder_status(obj);
// nozzle fan
if (m_switch_nozzle_fan_timeout > 0)
m_switch_nozzle_fan_timeout--;
@ -1582,6 +1580,23 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
}
}
void StatusPanel::update_extruder_status(MachineObject* obj)
{
if (!obj) return;
if (obj->is_filament_at_extruder()) {
if (obj->extruder_axis_status == MachineObject::ExtruderAxisStatus::LOAD)
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder_filled_load);
else
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder_filled_unload);
}
else {
if (obj->extruder_axis_status == MachineObject::ExtruderAxisStatus::LOAD)
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder_empty_load);
else
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder_empty_unload);
}
}
void StatusPanel::update_ams(MachineObject *obj)
{
// update obj in sub dlg
@ -2619,7 +2634,7 @@ void StatusPanel::msw_rescale()
m_bpButton_xy->SetMinSize(AXIS_MIN_SIZE);
m_bpButton_xy->SetSize(AXIS_MIN_SIZE);
m_temp_extruder_line->SetSize(wxSize(FromDIP(1), -1));
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder);
update_extruder_status(obj);
m_bitmap_extruder_img->SetMinSize(EXTRUDER_IMAGE_SIZE);
for (Button *btn : m_buttons) { btn->Rescale(); }

View file

@ -80,8 +80,10 @@ protected:
ScalableBitmap m_bitmap_fan_off;
ScalableBitmap m_bitmap_use_time;
ScalableBitmap m_bitmap_use_weight;
wxBitmap m_bitmap_extruder;
wxBitmap m_bitmap_extruder_load;
wxBitmap m_bitmap_extruder_empty_load;
wxBitmap m_bitmap_extruder_filled_load;
wxBitmap m_bitmap_extruder_empty_unload;
wxBitmap m_bitmap_extruder_filled_unload;
CameraRecordingStatus m_state_recording{CameraRecordingStatus::RECORDING_NONE};
CameraTimelapseStatus m_state_timelapse{CameraTimelapseStatus::TIMELAPSE_NONE};
@ -340,6 +342,7 @@ protected:
void update_temp_ctrl(MachineObject *obj);
void update_misc_ctrl(MachineObject *obj);
void update_ams(MachineObject* obj);
void update_extruder_status(MachineObject* obj);
void update_cali(MachineObject* obj);
void reset_printing_values();