fix bugs,version 5.2
This commit is contained in:
parent
9b20a86c78
commit
86822f2e95
@ -18,7 +18,7 @@ enum enumZigBeeTransmitStatus {
|
|||||||
|
|
||||||
|
|
||||||
//#define NR5G_MODULE
|
//#define NR5G_MODULE
|
||||||
//#define Q4G_MODULE
|
#define Q4G_MODULE
|
||||||
//#define WIFI_MODULE
|
//#define WIFI_MODULE
|
||||||
//#define NR5G_MEIGE
|
//#define NR5G_MEIGE
|
||||||
|
|
||||||
|
|||||||
@ -825,7 +825,7 @@ int SqliteDB::CalculateBattery() {
|
|||||||
memset(selectSql, 0x00, sizeof(selectSql));
|
memset(selectSql, 0x00, sizeof(selectSql));
|
||||||
char updateSql[1024] = {0};
|
char updateSql[1024] = {0};
|
||||||
int res = 0;
|
int res = 0;
|
||||||
sprintf(selectSql, " dataNodeNo,StaticTime,WaveTime,featureInterVal,waveInterVal,samplingRate,batteryPower ");
|
sprintf(selectSql, " MeasurementID,StaticTime,WaveTime,featureInterVal,waveInterVal,samplingRate,batteryPower ");
|
||||||
array_t vecRes = GetDataMultiLine(T_SENSOR_INFO(TNAME), selectSql, NULL);
|
array_t vecRes = GetDataMultiLine(T_SENSOR_INFO(TNAME), selectSql, NULL);
|
||||||
zlog_info(zct, "Size = %d", vecRes.size());
|
zlog_info(zct, "Size = %d", vecRes.size());
|
||||||
if (vecRes.size() > 0) {
|
if (vecRes.size() > 0) {
|
||||||
@ -848,11 +848,12 @@ int SqliteDB::CalculateBattery() {
|
|||||||
startCapacity = capacity;
|
startCapacity = capacity;
|
||||||
|
|
||||||
sprintf(updateSql, "batteryPower = '%f,%f' ", startCapacity, startCapacity);
|
sprintf(updateSql, "batteryPower = '%f,%f' ", startCapacity, startCapacity);
|
||||||
|
memset(whereCon, 0x00, sizeof(whereCon));
|
||||||
|
sprintf(whereCon, "MeasurementID = '%s' ", vecRes[i][0].c_str());
|
||||||
res = UpdateTableData(T_SENSOR_INFO(TNAME), updateSql, whereCon);
|
res = UpdateTableData(T_SENSOR_INFO(TNAME), updateSql, whereCon);
|
||||||
if(res !=0 ){
|
if(res !=0 ){
|
||||||
zlog_error(zct, "res = %d", res);
|
zlog_error(zct, "res = %d", res);
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
memset(whereCon, 0x00, sizeof(whereCon));
|
memset(whereCon, 0x00, sizeof(whereCon));
|
||||||
sprintf(whereCon, " dataNodeNo = '%s' order by timeStamp asc limit 0,1 ", vecRes[i][0].c_str());
|
sprintf(whereCon, " dataNodeNo = '%s' order by timeStamp asc limit 0,1 ", vecRes[i][0].c_str());
|
||||||
@ -930,7 +931,7 @@ int SqliteDB::CalculateBattery() {
|
|||||||
res = UpdateTableData(T_BATTERY_INFO(TNAME), updateSql, whereCon);
|
res = UpdateTableData(T_BATTERY_INFO(TNAME), updateSql, whereCon);
|
||||||
if(res !=0 ){
|
if(res !=0 ){
|
||||||
zlog_error(zct, "res = %d", res);
|
zlog_error(zct, "res = %d", res);
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
memset(whereCon, 0x00, sizeof(whereCon));
|
memset(whereCon, 0x00, sizeof(whereCon));
|
||||||
memset(updateSql, 0x00, sizeof(updateSql));
|
memset(updateSql, 0x00, sizeof(updateSql));
|
||||||
@ -940,15 +941,15 @@ int SqliteDB::CalculateBattery() {
|
|||||||
res = ExeSql(insertSql);
|
res = ExeSql(insertSql);
|
||||||
if(res !=0 ){
|
if(res !=0 ){
|
||||||
zlog_error(zct, "res = %d", res);
|
zlog_error(zct, "res = %d", res);
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
sprintf(deleteSql, "delete from t_battery_info where timeStamp < '%s' and dataNodeNo = '%s'", strtimeStamp.c_str(), vecRes[i][0].c_str());
|
sprintf(deleteSql, "delete from t_battery_info where timeStamp < '%s' and dataNodeNo = '%s'", strtimeStamp.c_str(), vecRes[i][0].c_str());
|
||||||
res = ExeSql(deleteSql);
|
res = ExeSql(deleteSql);
|
||||||
if(res !=0 ){
|
if(res !=0 ){
|
||||||
zlog_error(zct, "res = %d", res);
|
zlog_error(zct, "res = %d", res);
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
sprintf(whereCon, "dataNodeNo = '%s' ", vecRes[i][0].c_str());
|
sprintf(whereCon, "MeasurementID = '%s' ", vecRes[i][0].c_str());
|
||||||
if (startCapacity > 0) {
|
if (startCapacity > 0) {
|
||||||
sprintf(updateSql, "batteryPower = '%f,%f' ", startCapacity, remainBattery);
|
sprintf(updateSql, "batteryPower = '%f,%f' ", startCapacity, remainBattery);
|
||||||
} else {
|
} else {
|
||||||
@ -960,7 +961,7 @@ int SqliteDB::CalculateBattery() {
|
|||||||
res = data_publish(strData.c_str(), GlobalConfig::Topic_G.mPubConfig.c_str());
|
res = data_publish(strData.c_str(), GlobalConfig::Topic_G.mPubConfig.c_str());
|
||||||
if(res !=0 ){
|
if(res !=0 ){
|
||||||
zlog_error(zct, "data_publish res = %d", res);
|
zlog_error(zct, "data_publish res = %d", res);
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ void CheckThread() {
|
|||||||
int commSignal = 0;
|
int commSignal = 0;
|
||||||
int loose_check = 0;
|
int loose_check = 0;
|
||||||
int mqttresend = 0;
|
int mqttresend = 0;
|
||||||
|
int checkNet0 = 0;
|
||||||
while (GlobalConfig::QuitFlag_G) {
|
while (GlobalConfig::QuitFlag_G) {
|
||||||
GlobalConfig::threadStatus = 1;
|
GlobalConfig::threadStatus = 1;
|
||||||
sleep(1);
|
sleep(1);
|
||||||
@ -103,6 +103,14 @@ void CheckThread() {
|
|||||||
jd.JsonCmd_07();
|
jd.JsonCmd_07();
|
||||||
HardStatus = 0;
|
HardStatus = 0;
|
||||||
}
|
}
|
||||||
|
if(checkNet0 == 5){
|
||||||
|
checkNet0 = 0;
|
||||||
|
int iStatus = get_netlink_status("eth0");
|
||||||
|
if(iStatus == 1 && GlobalConfig::net0Status == 0){
|
||||||
|
system("ifconfig eth0:1 192.168.188.188 netmask 255.255.255.0");
|
||||||
|
}
|
||||||
|
GlobalConfig::net0Status = iStatus;
|
||||||
|
}
|
||||||
if (mqttresend == 7200) {
|
if (mqttresend == 7200) {
|
||||||
mqttresend = 0;
|
mqttresend = 0;
|
||||||
zlog_info(zct, "mqttresend check");
|
zlog_info(zct, "mqttresend check");
|
||||||
@ -239,6 +247,7 @@ void CheckThread() {
|
|||||||
logClean++;
|
logClean++;
|
||||||
loose_check++;
|
loose_check++;
|
||||||
mqttresend++;
|
mqttresend++;
|
||||||
|
checkNet0 ++;
|
||||||
#ifdef WIFI_MODULE
|
#ifdef WIFI_MODULE
|
||||||
wifi_reconnect_count++;
|
wifi_reconnect_count++;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user