FIX: incorrect display of AMS humidity

JIRA: [STUDIO-13742]
Change-Id: I25c26282c48faa05ab07dbb0cdbf5147bf475ccd
(cherry picked from commit 971afb8365c955c2562bb5c2d7a8effdc2b625ce)
This commit is contained in:
xin.zhang
2025-08-06 12:14:18 +08:00
committed by Noisyfox
parent b9601f666a
commit bdf413fb58
6 changed files with 52 additions and 39 deletions

View File

@@ -432,10 +432,9 @@ void DevFilaSystemParser::ParseV1_0(const json& jj, MachineObject* obj, DevFilaS
if (it->contains("humidity"))
{
std::string humidity = (*it)["humidity"].get<std::string>();
try
{
std::string humidity = (*it)["humidity"].get<std::string>();
curr_ams->m_humidity_level = atoi(humidity.c_str());
}
catch (...)
@@ -446,40 +445,15 @@ void DevFilaSystemParser::ParseV1_0(const json& jj, MachineObject* obj, DevFilaS
if (it->contains("humidity_raw"))
{
std::string humidity_raw = (*it)["humidity_raw"].get<std::string>();
try
{
std::string humidity_raw = (*it)["humidity_raw"].get<std::string>();
curr_ams->m_humidity_percent = atoi(humidity_raw.c_str());
}
catch (...)
{
;
}
if (curr_ams->GetHumidityPercent() != -1)
{
if (curr_ams->GetHumidityPercent() < 20)
{
curr_ams->m_humidity_level = 5;
}
else if (curr_ams->GetHumidityPercent() < 40)
{
curr_ams->m_humidity_level = 4;
}
else if (curr_ams->GetHumidityPercent() < 60)
{
curr_ams->m_humidity_level = 3;
}
else if (curr_ams->GetHumidityPercent() < 80)
{
curr_ams->m_humidity_level = 2;
}
else
{
curr_ams->m_humidity_level = 1;
}
}
}