diff --git a/resources/images/ams_is_drying.svg b/resources/images/ams_is_drying.svg
new file mode 100644
index 000000000..a6c02f1a7
--- /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 6d776b607..0230efafe 100644
--- a/src/slic3r/GUI/DeviceManager.cpp
+++ b/src/slic3r/GUI/DeviceManager.cpp
@@ -4445,6 +4445,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 b9d9dbe08..91c14222d 100644
--- a/src/slic3r/GUI/DeviceManager.hpp
+++ b/src/slic3r/GUI/DeviceManager.hpp
@@ -362,6 +362,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 ed61bd8b7..b8fd455c0 100644
--- a/src/slic3r/GUI/Widgets/AMSItem.cpp
+++ b/src/slic3r/GUI/Widgets/AMSItem.cpp
@@ -48,12 +48,13 @@ bool AMSinfo::parse_ams_info(MachineObject *obj, Ams *ams, bool remain_flag, boo
if (ams->type == 1 || ams->type == 3){
this->ams_humidity = ams->humidity;
- this->humidity_raw = ams->humidity_raw;
}
else{
this->ams_humidity = -1;
- this->humidity_raw = -1;
}
+
+ this->humidity_raw = ams->humidity_raw;
+ this->left_dray_time = ams->left_dry_time;
this->ams_type = AMSModel(ams->type);
nozzle_id = ams->nozzle;
@@ -2762,13 +2763,15 @@ AMSHumidity::AMSHumidity() {}
AMSHumidity::AMSHumidity(wxWindow* parent, wxWindowID id, AMSinfo info, const wxPoint& pos, const wxSize& size)
: AMSHumidity()
{
+ create(parent, id, pos, wxDefaultSize);
+
for (int i = 1; i <= 5; i++) { ams_humidity_imgs.push_back(ScalableBitmap(this, "hum_level" + std::to_string(i) + "_light", 16));}
for (int i = 1; i <= 5; i++) { ams_humidity_dark_imgs.push_back(ScalableBitmap(this, "hum_level" + std::to_string(i) + "_dark", 16));}
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);
- create(parent, id, pos, wxDefaultSize);
+ ams_drying_img = ScalableBitmap(this, "ams_is_drying", 16);
Bind(wxEVT_PAINT, &AMSHumidity::paintEvent, this);
//wxWindow::SetBackgroundColour(AMS_CONTROL_DEF_HUMIDITY_BK_COLOUR);
@@ -2807,23 +2810,27 @@ void AMSHumidity::Update(AMSinfo amsinfo)
if (m_amsinfo != amsinfo)
{
m_amsinfo = amsinfo;
- if (m_amsinfo.humidity_raw != -1)
- {
- SetSize(AMS_HUMIDITY_SIZE);
- SetMinSize(AMS_HUMIDITY_SIZE);
- SetMaxSize(AMS_HUMIDITY_SIZE);
- }
- else
- {
- SetSize(AMS_HUMIDITY_NO_PERCENT_SIZE);
- SetMinSize(AMS_HUMIDITY_NO_PERCENT_SIZE);
- SetMaxSize(AMS_HUMIDITY_NO_PERCENT_SIZE);
- }
-
+ update_size();
Refresh();
}
}
+void AMSHumidity::update_size()
+{
+ wxSize size;
+ if (m_amsinfo.humidity_raw != -1) {
+ size = AMS_HUMIDITY_SIZE;
+ } else {
+ size = AMS_HUMIDITY_NO_PERCENT_SIZE;
+ }
+
+ if (!m_amsinfo.support_drying()) { size.x -= AMS_HUMIDITY_DRY_WIDTH; }
+
+ SetMaxSize(size);
+ SetMinSize(size);
+ SetSize(size);
+}
+
void AMSHumidity::paintEvent(wxPaintEvent& evt)
{
@@ -2919,20 +2926,25 @@ void AMSHumidity::doRender(wxDC& dc)
pot.x = pot.x + hum_img.GetBmpSize().x + FromDIP(3);
}
- //vertical line
- dc.SetPen(wxPen(wxColour(194, 194, 194)));
- dc.SetBrush(wxBrush(wxColour(194, 194, 194)));
- //dc.DrawLine(FromDIP(GetSize().x * 0.64), FromDIP(GetSize().y / 2 - 10), FromDIP(GetSize().x * 0.64), FromDIP(GetSize().y / 2 + 10));
- dc.DrawLine(pot.x, GetSize().y / 2 - FromDIP(10), pot.x, GetSize().y / 2 + FromDIP(10));
-
- //sun image
- /*pot.x = FromDIP(size.x * 0.69);
- pot.y = FromDIP((size.y - ams_sun_img.GetBmpHeight()) / 2);*/
- pot.x = pot.x + (ams_sun_img.GetBmpWidth() / 2);
- pot.y = (size.y - ams_sun_img.GetBmpHeight()) / 2;
- dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
- dc.DrawBitmap(ams_sun_img.bmp(), pot);
+ if (m_amsinfo.support_drying())
+ {
+ // 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));
+ if (m_amsinfo.left_dray_time > 0) {
+ pot.x = pot.x + (ams_drying_img.GetBmpWidth() / 2);
+ pot.y = (size.y - ams_drying_img.GetBmpHeight()) / 2;
+ dc.DrawBitmap(ams_drying_img.bmp(), pot);
+ } else {
+ pot.x = pot.x + (ams_sun_img.GetBmpWidth() / 2);
+ pot.y = (size.y - ams_sun_img.GetBmpHeight()) / 2;
+ dc.DrawBitmap(ams_sun_img.bmp(), pot);
+ }
+ }
}
else {
//to do ...
@@ -2945,6 +2957,7 @@ void AMSHumidity::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();
Layout();
Refresh();
diff --git a/src/slic3r/GUI/Widgets/AMSItem.hpp b/src/slic3r/GUI/Widgets/AMSItem.hpp
index 66c2ca73e..60135e42b 100644
--- a/src/slic3r/GUI/Widgets/AMSItem.hpp
+++ b/src/slic3r/GUI/Widgets/AMSItem.hpp
@@ -160,8 +160,11 @@ enum FilamentStepType {
#define AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE wxSize(FromDIP(18), FromDIP(36))
#define AMS_BODY_SIZE wxSize(FromDIP(36), FromDIP(55))
#define AMS_DOWN_ROAD_SIZE wxSize(FromDIP(568), FromDIP(10))
+
#define AMS_HUMIDITY_SIZE wxSize(FromDIP(93), FromDIP(26))
#define AMS_HUMIDITY_NO_PERCENT_SIZE wxSize(FromDIP(60), FromDIP(26))
+#define AMS_HUMIDITY_DRY_WIDTH FromDIP(35)
+
#define AMS_PANEL_SIZE wxSize(FromDIP(264), FromDIP(150))
#define GENERIC_AMS_SLOT_NUM 4
@@ -215,6 +218,7 @@ public:
int curreent_filamentstep;
int ams_humidity = 0;
int humidity_raw = -1;
+ int left_dray_time = 0;
AMSModel ams_type = AMSModel::GENERIC_AMS;
AMSModelOriginType ext_type = AMSModelOriginType::GENERIC_EXT;
@@ -229,6 +233,7 @@ public:
current_action == other.current_action &&
curreent_filamentstep == other.curreent_filamentstep &&
ams_humidity == other.ams_humidity &&
+ left_dray_time == other.left_dray_time &&
ams_type == other.ams_type &&
ext_type == other.ext_type)
{
@@ -250,6 +255,8 @@ public:
bool parse_ams_info(MachineObject* obj, Ams *ams, bool remain_flag = false, bool humidity_flag = false);
void parse_ext_info(MachineObject* obj, AmsTray tray);
+
+ bool support_drying() const { return (ams_type == AMSModel::N3S_AMS) || (ams_type == AMSModel::N3F_AMS); };
};
/*************************************************
@@ -719,7 +726,8 @@ public:
std::vector ams_humidity_no_num_imgs;
std::vector ams_humidity_no_num_dark_imgs;
- ScalableBitmap ams_sun_img;
+ ScalableBitmap ams_sun_img;
+ ScalableBitmap ams_drying_img;
int m_humidity = { 0 };
@@ -731,6 +739,9 @@ public:
void render(wxDC& dc);
void doRender(wxDC& dc);
void msw_rescale();
+
+private:
+ void update_size();
};