mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-23 00:35:53 +08:00
Clean up the code to remove warnings.
This commit is contained in:
27
Nextion.cpp
27
Nextion.cpp
@@ -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)
|
||||||
{
|
{
|
||||||
@@ -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,16 +132,17 @@ void CNextion::setIdleInt()
|
|||||||
sendCommand(command);
|
sendCommand(command);
|
||||||
sendCommandAction(21U);
|
sendCommandAction(21U);
|
||||||
|
|
||||||
FILE *deviceInfoFile;
|
|
||||||
double val;
|
|
||||||
// CPU temperature
|
// CPU temperature
|
||||||
deviceInfoFile = fopen ("/sys/class/thermal/thermal_zone0/temp", "r");
|
FILE* fp = ::fopen("/sys/class/thermal/thermal_zone0/temp", "rt");
|
||||||
if (deviceInfoFile != NULL) {
|
if (fp != NULL) {
|
||||||
fscanf (deviceInfoFile, "%lf", &val);
|
double val = 0.0;
|
||||||
fclose(deviceInfoFile);
|
int n = ::fscanf(fp, "%lf", &val);
|
||||||
val /= 1000;
|
::fclose(fp);
|
||||||
|
|
||||||
|
if (n == 1) {
|
||||||
|
val /= 1000.0;
|
||||||
if (m_displayTempInF) {
|
if (m_displayTempInF) {
|
||||||
val = (1.8 * val) + 32;
|
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);
|
||||||
@@ -150,6 +150,7 @@ void CNextion::setIdleInt()
|
|||||||
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
|
||||||
sendCommand(command);
|
sendCommand(command);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user