mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-25 14:15:20 +00:00
FIX: update the display of AMSHumidity
jira: [STUDIO-10119] Change-Id: I7a1be57bd0dff13be149d6450b36fb54ffa9521d (cherry picked from commit c3a8690987005e0f53bbd5f9622a670e76bed93a)
This commit is contained in:
@@ -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<int>();
|
||||
}
|
||||
|
||||
if (it->contains("humidity")) {
|
||||
std::string humidity = (*it)["humidity"].get<std::string>();
|
||||
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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<ScalableBitmap> ams_humidity_no_num_dark_imgs;
|
||||
|
||||
ScalableBitmap ams_sun_img;
|
||||
ScalableBitmap ams_drying_img;
|
||||
|
||||
int m_humidity = { 0 };
|
||||
bool m_show_humidity = { false };
|
||||
|
||||
Reference in New Issue
Block a user