diff --git a/API_log/SH_log.cpp b/API_log/SH_log.cpp index 05bb876..d26b3a1 100644 --- a/API_log/SH_log.cpp +++ b/API_log/SH_log.cpp @@ -81,7 +81,14 @@ void log_write(const char *level, const char* format, ...) char cmd[256] = { 0 }; sprintf(cmd, "cp %s %s_bak", gLogParam.m_log_full_name, gLogParam.m_log_full_name); - system(cmd); + + int iRet = system(cmd); + if (iRet == -1) + { + perror("system() error"); + } + + print_brown("iRet = %d,cmd = %s\n",iRet,cmd); remove(gLogParam.m_log_full_name); fp = fopen(gLogParam.m_log_full_name, "a"); if(fp == NULL) { diff --git a/Cidn-SH b/Cidn-SH index 1737861..eb6b18a 100644 Binary files a/Cidn-SH and b/Cidn-SH differ diff --git a/dbaccess/SH_SqlDB.cpp b/dbaccess/SH_SqlDB.cpp index 3916038..7b01612 100644 --- a/dbaccess/SH_SqlDB.cpp +++ b/dbaccess/SH_SqlDB.cpp @@ -1461,7 +1461,7 @@ int SqliteDB::CalculateData() sprintf(whereCon," and channelID = '%s-X'",vecRet[i][1].c_str()); strsql = string(sql3) + string(whereCon); CountWaveX3 = GetTableRows(tableName,strsql.c_str()); - if ((CountWaveX > 0 && (CountWaveX / planCount > rate)) && (CountWaveX2 > 0 && (CountWaveX2 / planCount > rate)) && (CountWaveX3 > 0 && (CountWaveX3 / planCount > rate))) + if ((CountWaveX > 0 && (CountWaveX / planCount > (rate/100))) && (CountWaveX2 > 0 && (CountWaveX2 / planCount > (rate/100))) && (CountWaveX3 > 0 && (CountWaveX3 / planCount > (rate/100)))) { rateX = 1; }else{ @@ -1481,7 +1481,7 @@ int SqliteDB::CalculateData() strsql = string(sql3) + string(whereCon); CountWaveY3 = GetTableRows(tableName,strsql.c_str()); - if ((CountWaveY > 0 && (CountWaveY / planCount > rate)) && (CountWaveY2 > 0 && (CountWaveY2 / planCount > rate)) && (CountWaveY3 > 0 && (CountWaveY3 / planCount > rate))) + if ((CountWaveY > 0 && (CountWaveY / planCount > (rate/100))) && (CountWaveY2 > 0 && (CountWaveY2 / planCount > (rate/100))) && (CountWaveY3 > 0 && (CountWaveY3 / planCount > (rate/100)))) { rateY = 1; }else{ @@ -1501,7 +1501,7 @@ int SqliteDB::CalculateData() strsql = string(sql3) + string(whereCon); CountWaveZ3 = GetTableRows(tableName,strsql.c_str()); - if ((CountWaveZ > 0 && (CountWaveZ / planCount > rate)) && (CountWaveZ2 > 0 && (CountWaveZ2 / planCount > rate)) && (CountWaveZ3 > 0 && (CountWaveZ3 / planCount > rate))) + if ((CountWaveZ > 0 && (CountWaveZ / planCount > (rate/100))) && (CountWaveZ2 > 0 && (CountWaveZ2 / planCount > (rate/100))) && (CountWaveZ3 > 0 && (CountWaveZ3 / planCount > (rate/100)))) { rateZ = 1; }else{ @@ -1519,6 +1519,7 @@ int SqliteDB::CalculateData() int zigbeepowerEnable = readIntValue( "config", "zigbeepowerEnable",(char*)GlobalConfig::Config_G.c_str()); if(zigbeepowerEnable){ + LOG_INFO("rateX = %d,rateY = %d,rateZ = %d,zigbeepower = %s \n",rateX,rateY,rateZ,vecRet[i][5].c_str()); if (rateX != -1 && rateY != -1 && rateZ != -1 && vecRet[i][5] == "3") { char updateSql[50] = {0x00}; @@ -1526,7 +1527,7 @@ int SqliteDB::CalculateData() memset(whereCon,0x00,sizeof(whereCon)); sprintf(whereCon," dataNodeNo = '%s'",vecRet[i][0].c_str()); UpdateTableData(T_SENSOR_INFO(TNAME), updateSql, whereCon); - LOG_INFO("update ZigbeePower 2"); + LOG_INFO("2 update ZigbeePower "); } if ((rateX == -1 || rateY == -1 || rateZ == -1 ) && vecRet[i][5] == "2") @@ -1536,7 +1537,7 @@ int SqliteDB::CalculateData() memset(whereCon,0x00,sizeof(whereCon)); sprintf(whereCon," dataNodeNo = '%s'",vecRet[i][0].c_str()); UpdateTableData(T_SENSOR_INFO(TNAME), updateSql, whereCon); - LOG_INFO("update ZigbeePower 3"); + LOG_INFO("3 update ZigbeePower "); } } featureInterVal = atoi(vecRet[i][3].c_str()); diff --git a/main.cpp b/main.cpp index ea499e0..1a649e7 100644 --- a/main.cpp +++ b/main.cpp @@ -29,7 +29,7 @@ int main(int argc, char *argv[]) { printf(" Firmware compile time:%s %s,version %s\n", __DATE__, __TIME__,GlobalConfig::Version.c_str()); // 初始化日志记录,日志缓存区,记录数,未使用,后期,命令启动 - log_init(SOFTWARE_RUN_LOG, 1380, 160 * 1024 * 2); + log_init(SOFTWARE_RUN_LOG, 1380, 1000 * 1024); LOG_INFO("####CIDNSOFT start####\n"); // 查看版本信息 diff --git a/uart/SH_Uart.cpp b/uart/SH_Uart.cpp index 2ed06d0..bfdaa53 100644 --- a/uart/SH_Uart.cpp +++ b/uart/SH_Uart.cpp @@ -2026,6 +2026,7 @@ void Uart::DealDataNodeInfo(const char *pData) g_mapCompress.insert(std::make_pair(dataNodeInfo.ZigbeeShortAddr,tempchannel)); print_info("new Node,size = %d\n",g_mapCompress.size()); } + LOG_INFO("DealDataNodeInfo %s \n",dataNodeInfo.ZigbeeShortAddr.c_str()); } void Uart::RecordBattery(string & strLongAddr,DataRecvStatic& dataStatic,string& nowTimetamp) @@ -2336,8 +2337,8 @@ void Uart::DealDataNodeFeature(const char *pData, int flag) print_info("dataStatic.TemTop : %f dataStatic.TemBot : %f dataStatic.Dip :%d dataStatic.Voltage : %d\n", dataStatic.TemTop\ , dataStatic.TemBot, dataStatic.Dip, dataStatic.Voltage); - sprintf(updateSql, "temTop='%f',temBot='%f',dip='%d',voltage='%d',timeStamp='%s',StaticIndex = %d, nodeResend = %d,zigbeeSignal = '',zigbeeSignalNode = '',statisticType = '',timing = '' ",\ - dataStatic.TemTop, dataStatic.TemBot, dataStatic.Dip, dataStatic.Voltage, nowTimetamp.c_str(),staticIndex,nodeResend); + sprintf(updateSql, "temTop='%f',temBot='%f',dip='%d',voltage='%d',timeStamp='%s',StaticIndex = %d, nodeResend = %d,zigbeeSignal = '',zigbeeSignalNode = '',statisticType = '%d',timing = '%d' ",\ + dataStatic.TemTop, dataStatic.TemBot, dataStatic.Dip, dataStatic.Voltage, nowTimetamp.c_str(),staticIndex,nodeResend,flag,timing); sprintf(whereCon, "channelID='%s' ", (strMeasurementID + "-S").c_str()); if ( /*0 == sql_ctl->GetTableRows(T_DATASTATIC_INFO(TNAME), whereCon)*/ (Count * 3 < SAVE_COUNT && lTime < OneWeek ) || strTime.size() == 0 ) { print_info("insert static data to sql\n");