diff --git a/Cidn-SH b/Cidn-SH index 817ee23..c78224f 100644 Binary files a/Cidn-SH and b/Cidn-SH differ diff --git a/common/SH_global.h b/common/SH_global.h index 2c373c8..c67b7d6 100644 --- a/common/SH_global.h +++ b/common/SH_global.h @@ -20,7 +20,7 @@ enum enumZigBeeTransmitStatus { //#define NR5G_MODULE -//#define Q4G_MODULE +#define Q4G_MODULE //#define WIFI_MODULE //#define NR5G_MEIGE //#define G2UL_GATEWAY diff --git a/dbaccess/SH_SqlDB.cpp b/dbaccess/SH_SqlDB.cpp index 390295c..3d00d13 100644 --- a/dbaccess/SH_SqlDB.cpp +++ b/dbaccess/SH_SqlDB.cpp @@ -942,6 +942,11 @@ int SqliteDB::CalculateBattery() print_info("已经使用 = %f\n",atof(vecResSig[6].c_str())); float remainBattery = capacity - usageBattery * 0.2; + if (remainBattery < 10) + { + remainBattery = 10; + } + 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)); sprintf(whereCon," dataNodeNo = '%s' order by timeStamp desc limit 0,1 ",vecRes[i][0].c_str()); diff --git a/main.cpp b/main.cpp index 83241af..ba0492f 100644 --- a/main.cpp +++ b/main.cpp @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) // 设置线程属性之栈空间大小 boost::thread::attributes attrs; - attrs.set_stack_size(1024*1024*2); + attrs.set_stack_size(1024*1024); // 初始化平台配置文件 platform->PlatFormInit(); diff --git a/threadfunc/SH_ThreadFunc.cpp b/threadfunc/SH_ThreadFunc.cpp index 202181e..6609522 100644 --- a/threadfunc/SH_ThreadFunc.cpp +++ b/threadfunc/SH_ThreadFunc.cpp @@ -83,12 +83,18 @@ void CheckThread() #endif if (300 == time_check) { char buf[256] = {0}; + char buf2[256] = {0}; sprintf(buf, "{\"dataNodeGatewayNo\":\"%s\",\"cmd\":\"12\",\"status\":\"REQ\"}", GlobalConfig::MacAddr_G.c_str()); + sprintf(buf2, "{\"dataWatchNo\":\"%s\",\"cmd\":\"12\",\"status\":\"REQ\"}", + GlobalConfig::MacAddr_G.c_str()); std::string str = std::string(buf); + std::string str2 = std::string(buf2); time_check = 0; int iRet = data_publish(str.c_str(), GlobalConfig::Topic_G.mPubTiming.c_str()); iRet = data_publish(str.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str()); + iRet = data_publish(str2.c_str(), GlobalConfig::Topic_G.mPubTiming.c_str()); + iRet = data_publish(str2.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str()); if(iRet != 0 ) { LOG_ERROR("MQTT connect failed ,time check\n");