mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-29 13:52:07 +00:00
FIX: incorrect display of AMS humidity
JIRA: [STUDIO-13742] Change-Id: I25c26282c48faa05ab07dbb0cdbf5147bf475ccd (cherry picked from commit 971afb8365c955c2562bb5c2d7a8effdc2b625ce)
This commit is contained in:
@@ -288,7 +288,7 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
|
||||
wxPoint popup_pos(img_pos.x - m_Humidity_tip_popup.GetSize().GetWidth() + FromDIP(150), img_pos.y - FromDIP(80));
|
||||
m_Humidity_tip_popup.Position(popup_pos, wxSize(0, 0));
|
||||
|
||||
int humidity_value = info->humidity_level;
|
||||
int humidity_value = info->humidity_display_idx;
|
||||
if (humidity_value > 0 && humidity_value <= 5) { m_Humidity_tip_popup.set_humidity_level(humidity_value); }
|
||||
m_Humidity_tip_popup.Popup();
|
||||
}
|
||||
@@ -1001,7 +1001,7 @@ void AMSControl::UpdateAms(const std::string &series_name,
|
||||
{
|
||||
uiAmsHumidityInfo humidity_info;
|
||||
humidity_info.ams_id = the_info.ams_id;
|
||||
humidity_info.humidity_level = the_info.ams_humidity;
|
||||
humidity_info.humidity_display_idx = the_info.get_humidity_display_idx();
|
||||
humidity_info.humidity_percent = the_info.humidity_raw;
|
||||
humidity_info.left_dry_time = the_info.left_dray_time;
|
||||
humidity_info.current_temperature = the_info.current_temperature;
|
||||
|
||||
@@ -197,6 +197,43 @@ Caninfo AMSinfo::get_caninfo(const std::string& can_id, bool& found) const
|
||||
return Caninfo();
|
||||
};
|
||||
|
||||
int AMSinfo::get_humidity_display_idx() const
|
||||
{
|
||||
if (ams_type == AMSModel::GENERIC_AMS)
|
||||
{
|
||||
if (ams_humidity > 0 && ams_humidity < 6)
|
||||
{
|
||||
return ams_humidity;
|
||||
}
|
||||
}
|
||||
else if (ams_type == AMSModel::N3F_AMS || ams_type == AMSModel::N3S_AMS)
|
||||
{
|
||||
if (humidity_raw < 20)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
else if (humidity_raw < 40)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
else if (humidity_raw < 60)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
else if (humidity_raw < 80)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
assert(false && "Invalid AMS type for humidity display");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
Description:AMSExtText
|
||||
**************************************************/
|
||||
@@ -2822,7 +2859,7 @@ AMSHumidity::AMSHumidity(wxWindow* parent, wxWindowID id, AMSinfo info, const wx
|
||||
uiAmsHumidityInfo *info = new uiAmsHumidityInfo;
|
||||
info->ams_id = m_amsinfo.ams_id;
|
||||
info->ams_type = m_amsinfo.ams_type;
|
||||
info->humidity_level = m_amsinfo.ams_humidity;
|
||||
info->humidity_display_idx = m_amsinfo.get_humidity_display_idx();
|
||||
info->humidity_percent = m_amsinfo.humidity_raw;
|
||||
info->left_dry_time = m_amsinfo.left_dray_time;
|
||||
info->current_temperature = m_amsinfo.current_temperature;
|
||||
@@ -2916,9 +2953,9 @@ void AMSHumidity::doRender(wxDC& dc)
|
||||
{
|
||||
ScalableBitmap hum_img;
|
||||
if (!wxGetApp().dark_mode()) {
|
||||
hum_img = ams_humidity_imgs[m_amsinfo.ams_humidity - 1];
|
||||
hum_img = ams_humidity_imgs[m_amsinfo.get_humidity_display_idx() - 1];
|
||||
} else {
|
||||
hum_img = ams_humidity_dark_imgs[m_amsinfo.ams_humidity - 1];
|
||||
hum_img = ams_humidity_dark_imgs[m_amsinfo.get_humidity_display_idx() - 1];
|
||||
}
|
||||
|
||||
pot = wxPoint((size.x - hum_img.GetBmpWidth()) / 2, ((size.y - hum_img.GetBmpSize().y) / 2));
|
||||
@@ -2930,9 +2967,9 @@ void AMSHumidity::doRender(wxDC& dc)
|
||||
// hum image
|
||||
ScalableBitmap hum_img;
|
||||
if (!wxGetApp().dark_mode()) {
|
||||
hum_img = ams_humidity_no_num_imgs[m_amsinfo.ams_humidity - 1];
|
||||
hum_img = ams_humidity_no_num_imgs[m_amsinfo.get_humidity_display_idx() - 1];
|
||||
} else {
|
||||
hum_img = ams_humidity_no_num_dark_imgs[m_amsinfo.ams_humidity - 1];
|
||||
hum_img = ams_humidity_no_num_dark_imgs[m_amsinfo.get_humidity_display_idx() - 1];
|
||||
}
|
||||
|
||||
pot = wxPoint(FromDIP(5), ((size.y - hum_img.GetBmpSize().y) / 2));
|
||||
|
||||
@@ -262,6 +262,8 @@ public:
|
||||
|
||||
bool support_drying() const { return (ams_type == AMSModel::N3S_AMS) || (ams_type == AMSModel::N3F_AMS); };
|
||||
Caninfo get_caninfo(const std::string& can_id, bool& found) const;
|
||||
|
||||
int get_humidity_display_idx() const;
|
||||
};
|
||||
|
||||
/*************************************************
|
||||
|
||||
Reference in New Issue
Block a user