优化日志记录 3.2.2

This commit is contained in:
CHINAMI-TV221UM\Administrator 2024-08-23 19:40:57 +08:00
parent 408d0c7c42
commit 1c85208ab9
5 changed files with 16 additions and 7 deletions

1
common/u2g.h Normal file
View File

@ -0,0 +1 @@
void utf2gbk(char *utf,char* gbk);

View File

@ -942,7 +942,7 @@ int SqliteDB::CalculateBattery()
print_info("已经使用 = %f\n",atof(vecResSig[6].c_str())); print_info("已经使用 = %f\n",atof(vecResSig[6].c_str()));
float remainBattery = capacity - usageBattery * 0.2; float remainBattery = capacity - usageBattery * 0.2;
LOG_INFO("dataNodeNo = %s,已经使用 = %f,剩余电量 = %f\n",vecRes[i][0].c_str(),atof(vecResSig[6].c_str()),remainBattery); LOG_INFO("dataNodeNo = %s,batteryUsage = %f,batteryRemain = %f\n",vecRes[i][0].c_str(),atof(vecResSig[6].c_str()),remainBattery);
memset(whereCon,0x00,sizeof(whereCon)); memset(whereCon,0x00,sizeof(whereCon));
sprintf(whereCon," dataNodeNo = '%s' order by timeStamp desc limit 0,1 ",vecRes[i][0].c_str()); sprintf(whereCon," dataNodeNo = '%s' order by timeStamp desc limit 0,1 ",vecRes[i][0].c_str());
string strtimeStamp = sql_ctl->GetData(T_BATTERY_INFO(TNAME)," timeStamp ",whereCon); string strtimeStamp = sql_ctl->GetData(T_BATTERY_INFO(TNAME)," timeStamp ",whereCon);

View File

@ -12,7 +12,7 @@ int GlobalConfig::LinkCount = 0;
int GlobalConfig::net0Status = 1; int GlobalConfig::net0Status = 1;
std::string GlobalConfig::Version = "3.2.1"; std::string GlobalConfig::Version = "3.2.2";
std::string GlobalConfig::MacAddr_G = ""; std::string GlobalConfig::MacAddr_G = "";
std::string GlobalConfig::MacAddr_G2 = ""; std::string GlobalConfig::MacAddr_G2 = "";
std::string GlobalConfig::IpAddr_G = ""; std::string GlobalConfig::IpAddr_G = "";

View File

@ -29,7 +29,7 @@ Dial dial;
void CheckThread() void CheckThread()
{ {
print_info("ENTER CHECK THREAD \n"); print_info("ENTER CHECK THREAD \n");
std::string runinfo = "系统循环检测模块启动"; std::string runinfo = "ENTER CHECK THREAD ";
LOG_INFO(runinfo.c_str()); LOG_INFO(runinfo.c_str());
int heart_count = 0; int heart_count = 0;
@ -306,7 +306,7 @@ void CheckThread()
char localtimestamp[32] = { 0 }; char localtimestamp[32] = { 0 };
GetTimeNet(localtimestamp, 1); GetTimeNet(localtimestamp, 1);
char whereCon[1024] = {0}; char whereCon[1024] = {0};
sprintf(whereCon," timestamp < '%ld' ",atol(localtimestamp) - 15638400); //删除半年前的数据 sprintf(whereCon," timestamp < '%ld' ",atol(localtimestamp) - 5097600); //删除2个月前的数据
sql_ctl->DeleteTableData(" t_battery_history ",whereCon); sql_ctl->DeleteTableData(" t_battery_history ",whereCon);
/*staticData = 0; /*staticData = 0;
Json::Value jsHeart; Json::Value jsHeart;

View File

@ -1964,7 +1964,14 @@ void Uart::DealDataNodeFeature(const char *pData, int flag)
char buf[20] = {0x00}; char buf[20] = {0x00};
int nodeResend = 0; int nodeResend = 0;
sprintf(buf, "%02x%02x", pRecvData->ShortAddr[0], pRecvData->ShortAddr[1]); sprintf(buf, "%02x%02x", pRecvData->ShortAddr[0], pRecvData->ShortAddr[1]);
LOG_INFO("DealDataNodeFeature %02x%02x,isWave \n",pRecvData->ShortAddr[0], pRecvData->ShortAddr[1],flag); if (flag == 1)
{
LOG_INFO("DealDataNodeFeature %02x%02x, %d\n",pRecvData->ShortAddr[0], pRecvData->ShortAddr[1],flag);
}else{
LOG_INFO("DealDataNodeFeature %02x%02x\n",pRecvData->ShortAddr[0], pRecvData->ShortAddr[1]);
}
if (bSendTimeStamp)//波形处理中 if (bSendTimeStamp)//波形处理中
return; return;
std::string strShortAddr = std::string(buf); std::string strShortAddr = std::string(buf);
@ -2216,7 +2223,8 @@ void Uart::DealDataNodeFeature(const char *pData, int flag)
char selectCon[128] = { 0 }; char selectCon[128] = { 0 };
sprintf(selectCon, "channelID='%s' and sendMsg = '1' ORDER BY timeStamp ASC LIMIT 0,1",(strMeasurementID + "-S").c_str()); sprintf(selectCon, "channelID='%s' and sendMsg = '1' ORDER BY timeStamp ASC LIMIT 0,1",(strMeasurementID + "-S").c_str());
std::string strTime = sql_ctl->GetData(szTableName, "timeStamp", selectCon); std::string strTime = sql_ctl->GetData(szTableName, "timeStamp", selectCon);
int Count = sql_ctl->GetTableRows(szTableName, NULL); sprintf(whereCon,"channelID='%s' and sendMsg = '1'",(strMeasurementID + "-S").c_str());
int Count = sql_ctl->GetTableRows(szTableName, whereCon);
if(Count == -1){ if(Count == -1){
sql_ctl->CreatedataStatictable(szTableName); sql_ctl->CreatedataStatictable(szTableName);
} }
@ -3434,7 +3442,7 @@ void Uart::DealDataNodeFeature(const char *pData, int flag)
bZigbeeSinal = false; bZigbeeSinal = false;
} }
LOG_INFO("DealDataNodeFeature end %02x%02x,isWave \n",pRecvData->ShortAddr[0], pRecvData->ShortAddr[1],flag); LOG_INFO("DealDataNodeFeature end %02x%02x\n",pRecvData->ShortAddr[0], pRecvData->ShortAddr[1]);
} }
void Uart::DealDataNodeWave(const char *pData) void Uart::DealDataNodeWave(const char *pData)