diff --git a/resources/images/ams_is_drying.svg b/resources/images/ams_is_drying.svg new file mode 100644 index 0000000000..a6c02f1a79 --- /dev/null +++ b/resources/images/ams_is_drying.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 601ee3b30d..7a5aa5ea4e 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -4056,6 +4056,11 @@ int MachineObject::parse_json(std::string payload, bool key_field_only) } if (!curr_ams) continue; + if (it->contains("dry_time") && (*it)["dry_time"].is_number()) + { + curr_ams->left_dry_time = (*it)["dry_time"].get(); + } + if (it->contains("humidity")) { std::string humidity = (*it)["humidity"].get(); diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 0d857d4783..5e845d5f1c 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -273,6 +273,7 @@ public: type = type_id; } std::string id; + int left_dry_time = 0; int humidity = 5; int humidity_raw = -1;// the percentage, -1 means invalid. eg. 100 means 100% bool startup_read_opt{true}; diff --git a/src/slic3r/GUI/Widgets/AMSItem.cpp b/src/slic3r/GUI/Widgets/AMSItem.cpp index 5b80a8439b..7da276db6b 100644 --- a/src/slic3r/GUI/Widgets/AMSItem.cpp +++ b/src/slic3r/GUI/Widgets/AMSItem.cpp @@ -49,6 +49,7 @@ bool AMSinfo::parse_ams_info(MachineObject *obj, Ams *ams, bool remain_flag, boo } this->humidity_raw = ams->humidity_raw; + this->left_dray_time = ams->left_dry_time; this->ams_type = AMSModel(ams->type); cans.clear(); @@ -1410,6 +1411,7 @@ AMSRoad::AMSRoad(wxWindow *parent, wxWindowID id, Caninfo info, int canindex, in for (int i = 1; i <= 5; i++) { ams_humidity_no_num_imgs.push_back(ScalableBitmap(this, "hum_level" + std::to_string(i) + "_no_num_light", 16)); } for (int i = 1; i <= 5; i++) { ams_humidity_no_num_dark_imgs.push_back(ScalableBitmap(this, "hum_level" + std::to_string(i) + "_no_num_dark", 16)); } ams_sun_img = ScalableBitmap(this, "ams_drying", 16); + ams_drying_img = ScalableBitmap(this, "ams_is_drying", 16); if (m_rode_mode != AMSRoadMode::AMS_ROAD_MODE_VIRTUAL_TRAY) { create(parent, id, pos, size); } @@ -1636,6 +1638,27 @@ void AMSRoad::doRender(wxDC &dc) dc.DrawBitmap(hum_img.bmp(), pot); pot.x = pot.x + hum_img.GetBmpSize().x + FromDIP(3); } + + if (m_amsinfo.support_drying()) + { + pot.x += FromDIP(2);// spacing + + // vertical line + dc.SetPen(wxPen(wxColour(194, 194, 194))); + dc.SetBrush(wxBrush(wxColour(194, 194, 194))); + dc.DrawLine(pot.x, GetSize().y / 2 - FromDIP(10), pot.x, GetSize().y / 2 + FromDIP(10)); + + // sun image + dc.SetPen(wxPen(*wxTRANSPARENT_PEN)); + pot.x += ((size.GetWidth() - pot.x) - ams_drying_img.GetBmpWidth()) / 2;// spacing + if (m_amsinfo.left_dray_time > 0) { + pot.y = (size.y - ams_drying_img.GetBmpHeight()) / 2; + dc.DrawBitmap(ams_drying_img.bmp(), pot); + } else { + pot.y = (size.y - ams_sun_img.GetBmpHeight()) / 2; + dc.DrawBitmap(ams_sun_img.bmp(), pot); + } + } } else { //to do ... @@ -1703,6 +1726,7 @@ void AMSRoad::msw_rescale() for (auto &img : ams_humidity_no_num_imgs) { img.msw_rescale(); } for (auto &img : ams_humidity_no_num_dark_imgs) { img.msw_rescale(); } ams_sun_img.msw_rescale(); + ams_drying_img.msw_rescale(); } diff --git a/src/slic3r/GUI/Widgets/AMSItem.hpp b/src/slic3r/GUI/Widgets/AMSItem.hpp index 149b6d7f61..3b8960be24 100644 --- a/src/slic3r/GUI/Widgets/AMSItem.hpp +++ b/src/slic3r/GUI/Widgets/AMSItem.hpp @@ -137,6 +137,9 @@ enum FilamentStepType { #define AMS_EXTRUDER_SIZE wxSize(FromDIP(86), FromDIP(72)) #define AMS_EXTRUDER_BITMAP_SIZE wxSize(FromDIP(36), FromDIP(55)) +#define AMS_HUMIDITY_DRY_WIDTH FromDIP(35) + + struct Caninfo { std::string can_id; @@ -161,9 +164,12 @@ public: int curreent_filamentstep; int ams_humidity = 0; int humidity_raw = -1; + int left_dray_time = 0; AMSModel ams_type = AMSModel::GENERIC_AMS; bool parse_ams_info(MachineObject* obj, Ams *ams, bool remain_flag = false, bool humidity_flag = false); + + bool support_drying() const { return (ams_type == AMSModel::N3S_AMS) || (ams_type == AMSModel::N3F_AMS); }; }; /************************************************* @@ -400,6 +406,7 @@ public: std::vector ams_humidity_no_num_dark_imgs; ScalableBitmap ams_sun_img; + ScalableBitmap ams_drying_img; int m_humidity = { 0 }; bool m_show_humidity = { false };