Commit 058fb127 authored by Yuelong Yu's avatar Yuelong Yu
Browse files

temperatures on analog boards are displayed correctly

parent 6a35db6f
......@@ -133,12 +133,12 @@ namespace AGIPDMC_ns
// temperature sensor(near voltage regulator ADC "U")
// big endian data, for high byte, only last 4 bits are used
short shEntry1 =m_vshMatrix[ nIdxBegin + nOffSet+i];
shEntry1 = (((shEntry1 & 0xff00) >> 8)| ((shEntry1 & 0xff) << 8)) & 0xfff;
//shEntry1 = (((shEntry1 & 0xff00) >> 8)| ((shEntry1 & 0xff) << 8)) & 0xfff;
//branch b
//temperature sensor(near voltage regulator ADC "U_plus_I")
short shEntry2 =m_vshMatrix[ nIdxBegin + nOffSet+(i+1) ];
shEntry2 = (((shEntry2 & 0xff00) & 0xf) | ((shEntry2 & 0xff) << 8)) & 0xfff;
//shEntry2 = (((shEntry2 & 0xff00) & 0xf) | ((shEntry2 & 0xff) << 8)) & 0xfff;
dResult = CalculateTemperatures(NormalizeResistor(shEntry1,shEntry2));
if(isnan(dResult))
......
......@@ -139,22 +139,22 @@ namespace AGIPDMC_ns
if(m_vstTemperature[nIdx].dBoardTemperature1 == UNKNOWN_VALUE)
strMsg = "X;";
else
strMsg = to_string(m_vstTemperature[nIdx].dBoardTemperature1) + string(";");
strMsg = FormatTemperature(m_vstTemperature[nIdx].dBoardTemperature1) + string(";");
if(m_vstTemperature[nIdx].dBoardTemperature2 == UNKNOWN_VALUE)
strMsg += "X;";
else
strMsg += to_string(m_vstTemperature[nIdx].dBoardTemperature2) + string(";");
strMsg += FormatTemperature(m_vstTemperature[nIdx].dBoardTemperature2) + string(";");
if(m_vstTemperature[nIdx].dBoardTemperature3 == UNKNOWN_VALUE)
strMsg += "X;";
else
strMsg += to_string(m_vstTemperature[nIdx].dBoardTemperature3) + string(";");
strMsg += FormatTemperature(m_vstTemperature[nIdx].dBoardTemperature3) + string(";");
if(m_vstTemperature[nIdx].dLTCCTemperature == UNKNOWN_VALUE)
strMsg += "X;";
else
strMsg += to_string(m_vstTemperature[nIdx].dLTCCTemperature) + string(";");
strMsg += FormatTemperature(m_vstTemperature[nIdx].dLTCCTemperature) + string(";");
return CORBA::string_dup(strMsg.c_str());
}
......@@ -185,7 +185,7 @@ namespace AGIPDMC_ns
void UpdateDataThread::UpdateTemperatures()
{
cout<<__func__<<endl;
//cout<<__func__<<endl;
m_vstTemperature.clear();
m_uptrMC->CalculateAllTemperatures();
......@@ -279,6 +279,13 @@ namespace AGIPDMC_ns
{
m_objAGIPDMC->SetState(Tango::FAULT);
}
}
}
}
string UpdateDataThread::FormatTemperature(double dTemperature)
{
char buffer [10];
sprintf(buffer,"%.2f",dTemperature);
return string(buffer);
}
}
......@@ -29,6 +29,7 @@ namespace AGIPDMC_ns
int GetMatrixCounter(vector<short>& vshData);
void DoWork();
void UpdateMatrix();
string FormatTemperature(double dTemperature);
/// member variables
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment