Clean up the code to remove warnings.

This commit is contained in:
Jonathan Naylor
2018-09-06 17:10:58 +01:00
parent 8ee9f2f7af
commit 131d87c830
2 changed files with 19 additions and 18 deletions

View File

@@ -61,6 +61,8 @@ m_berCount1(0U),
m_berCount2(0U), m_berCount2(0U),
m_txFrequency(txFrequency), m_txFrequency(txFrequency),
m_rxFrequency(rxFrequency), m_rxFrequency(rxFrequency),
m_fl_txFrequency(0.0F),
m_fl_rxFrequency(0.0F),
m_displayTempInF(displayTempInF), m_displayTempInF(displayTempInF),
m_location(location) m_location(location)
{ {
@@ -84,7 +86,7 @@ bool CNextion::open()
return false; return false;
} }
info[0]=0; info[0] = 0;
m_network = new CNetworkInfo; m_network = new CNetworkInfo;
m_network->getNetworkInterface(info); m_network->getNetworkInterface(info);
m_ipaddress = (char*)info; m_ipaddress = (char*)info;
@@ -92,11 +94,8 @@ bool CNextion::open()
sendCommand("bkcmd=0"); sendCommand("bkcmd=0");
sendCommandAction(0U); sendCommandAction(0U);
m_fl_txFrequency = m_txFrequency; m_fl_txFrequency = float(m_txFrequency) / 1000000.0F;
m_fl_txFrequency/=1000000U; m_fl_rxFrequency = float(m_rxFrequency) / 1000000.0F;
m_fl_rxFrequency = m_rxFrequency;
m_fl_rxFrequency/=1000000U;
setIdle(); setIdle();
@@ -133,22 +132,24 @@ void CNextion::setIdleInt()
sendCommand(command); sendCommand(command);
sendCommandAction(21U); sendCommandAction(21U);
FILE *deviceInfoFile; // CPU temperature
double val; FILE* fp = ::fopen("/sys/class/thermal/thermal_zone0/temp", "rt");
//CPU temperature if (fp != NULL) {
deviceInfoFile = fopen ("/sys/class/thermal/thermal_zone0/temp", "r"); double val = 0.0;
if (deviceInfoFile != NULL) { int n = ::fscanf(fp, "%lf", &val);
fscanf (deviceInfoFile, "%lf", &val); ::fclose(fp);
fclose(deviceInfoFile);
val /= 1000; if (n == 1) {
if( m_displayTempInF){ val /= 1000.0;
val = (1.8 * val) + 32; if (m_displayTempInF) {
val = (1.8 * val) + 32.0;
::sprintf(command, "t20.txt=\"%2.1f %cF\"", val, 176); ::sprintf(command, "t20.txt=\"%2.1f %cF\"", val, 176);
} else { } else {
::sprintf(command, "t20.txt=\"%2.1f %cC\"", val, 176); ::sprintf(command, "t20.txt=\"%2.1f %cC\"", val, 176);
} }
sendCommand(command); sendCommand(command);
sendCommandAction(22U); sendCommandAction(22U);
}
} }
::sprintf(command, "t31.txt=\"%s\"", m_location.c_str()); // location ::sprintf(command, "t31.txt=\"%s\"", m_location.c_str()); // location

View File

@@ -99,8 +99,8 @@ private:
unsigned int m_berCount2; unsigned int m_berCount2;
unsigned int m_txFrequency; unsigned int m_txFrequency;
unsigned int m_rxFrequency; unsigned int m_rxFrequency;
float m_fl_txFrequency=0; float m_fl_txFrequency;
float m_fl_rxFrequency=0; float m_fl_rxFrequency;
bool m_displayTempInF; bool m_displayTempInF;
std::string m_location; std::string m_location;