优化了信号数据筛选,优化了固件升级超时逻辑
This commit is contained in:
parent
9d3c22b10a
commit
9dd61e77cd
@ -23,8 +23,8 @@ enum enumZigBeeTransmitStatus {
|
||||
//#define Q4G_MODULE
|
||||
//#define WIFI_MODULE
|
||||
//#define NR5G_MEIGE
|
||||
#define G2UL_GATEWAY
|
||||
//#define IMX6UL_GATEWAY
|
||||
//#define G2UL_GATEWAY
|
||||
#define IMX6UL_GATEWAY
|
||||
|
||||
class GlobalConfig
|
||||
{
|
||||
|
@ -184,24 +184,5 @@ typedef enum {
|
||||
}T_GATEWAY_INFO_Index;
|
||||
const static char* T_GATEWAY_INFO[] = { "t_gateway_info","gatewayMAC","sensorVersion","gatewayLocation","zigbeePanID","zigbeeChannel","communicationType","signal","localIP","systemVersion","programVersion","webVersion","serverIP","serverPort","status","gateWayUpdate","MAC2"};
|
||||
|
||||
typedef enum {
|
||||
T_BATTERY_INFO_TNAME = 0,
|
||||
T_BATTERY_INFO_GATEWAYMAC,
|
||||
T_GATEWAY_INFO_SENSORVER,
|
||||
T_GATEWAY_INFO_GATEWAYLOCATION,
|
||||
T_GATEWAY_INFO_ZIGBEEPANID,
|
||||
T_GATEWAY_INFO_ZIGBEECHANNEL,
|
||||
T_GATEWAY_INFO_COMMUNICATIONTYPE,
|
||||
T_GATEWAY_INFO_SIGNAL,
|
||||
T_GATEWAY_INFO_LOCALIP,
|
||||
T_GATEWAY_INFO_SYSTEMVERSION,
|
||||
T_GATEWAY_INFO_PROGRAMVERSION,
|
||||
T_GATEWAY_INFO_WEBVERSION,
|
||||
T_GATEWAY_INFO_SERVERIP,
|
||||
T_GATEWAY_INFO_SERVERPORT,
|
||||
T_GATEWAY_INFO_STATUS,
|
||||
T_GATEWAY_INFO_GATEWAYUPDATE,
|
||||
T_GATEWAY_INFO_MAC2,
|
||||
}T_GATEWAY_INFO_Index;
|
||||
const static char* T_GATEWAY_INFO[] = {};
|
||||
|
||||
#endif
|
||||
|
@ -1277,7 +1277,7 @@ std::string JsonData::JsonCmd_Cgi_26(Param_26 ¶m)
|
||||
|
||||
char looseValue[10]={0x00};
|
||||
readStringValue("config", "loose",looseValue,(char*)GlobalConfig::Config_G.c_str());
|
||||
print_debug("loose = %f \n",atof(looseValue));
|
||||
//print_debug("loose = %f \n",atof(looseValue));
|
||||
Json::Value jsArray;
|
||||
array_t arrRes;
|
||||
arrRes = sql_ctl->GetDataMultiLineTransaction(T_SENSOR_INFO(TNAME), "*", NULL);
|
||||
@ -1363,10 +1363,10 @@ std::string JsonData::JsonCmd_Cgi_26(Param_26 ¶m)
|
||||
char szTableName[50]={0x00},selectCon[128]={0x00};
|
||||
sprintf(szTableName,"t_dataStatic_%s",arrRes[j][0].c_str());
|
||||
memset(selectCon,0x00,sizeof(selectCon));
|
||||
sprintf(selectCon, "zigbeeSignal <> '' ORDER BY timeStamp desc LIMIT 0,1");
|
||||
sprintf(selectCon, "zigbeeSignal <> '' and zigbeeSignal <> '0' ORDER BY timeStamp desc LIMIT 0,1");
|
||||
string strZigbeeSignal = sql_ctl->GetData(szTableName, "zigbeeSignal", selectCon);
|
||||
memset(selectCon,0x00,sizeof(selectCon));
|
||||
sprintf(selectCon, "zigbeeSignalNode <> '' ORDER BY timeStamp desc LIMIT 0,1");
|
||||
sprintf(selectCon, "zigbeeSignalNode <> '' and zigbeeSignalNode <> '0' ORDER BY timeStamp desc LIMIT 0,1");
|
||||
string strZigbeeSignalNode = sql_ctl->GetData(szTableName, "zigbeeSignalNode", selectCon);
|
||||
if(strZigbeeSignal == "")
|
||||
jsSensorData["RSSI"] = "0," + arrRes[j][40];
|
||||
|
@ -1131,13 +1131,12 @@ void Uart::UpdateWirelessNode(unsigned short shortAdd)
|
||||
break;
|
||||
usleep(10000);
|
||||
time += 1;
|
||||
}while(time < 250);
|
||||
if(time >= 250){
|
||||
// resendCount++;
|
||||
// if(resendCount < 3){
|
||||
// LOG_INFO(" RESEND gpio_read failed shortAdd %x %x,error index %d\n",UINT16_HIGH(shortAdd),UINT16_LOW(shortAdd),j);
|
||||
// goto RESEND;
|
||||
// }
|
||||
}while(time < 150);
|
||||
if(time >= 150){
|
||||
resendCount++;
|
||||
if(resendCount < 5){
|
||||
LOG_INFO(" RESEND gpio_read failed shortAdd %x %x,error index %d\n",UINT16_HIGH(shortAdd),UINT16_LOW(shortAdd),j);
|
||||
}else{
|
||||
LOG_INFO("gpio_read failed shortAdd %x %x,error index %d\n",UINT16_HIGH(shortAdd),UINT16_LOW(shortAdd),j);
|
||||
print_red("gpio_read failed \n");
|
||||
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS;
|
||||
@ -1145,6 +1144,7 @@ void Uart::UpdateWirelessNode(unsigned short shortAdd)
|
||||
bUpdate = false;
|
||||
goto endUpdate;
|
||||
}
|
||||
}
|
||||
gpio_set(GlobalConfig::GPIO_G.zigAckreset,0);
|
||||
usleep(2000);
|
||||
// if(gpio_read(GlobalConfig::GPIO_G.zigAckrep) == 48)
|
||||
@ -1187,10 +1187,10 @@ void Uart::UpdateWirelessNode(unsigned short shortAdd)
|
||||
gpio_set(GlobalConfig::GPIO_G.zigAckreset,1);
|
||||
break;
|
||||
}
|
||||
usleep(100);
|
||||
usleep(10000);
|
||||
time += 1;
|
||||
}while(time < 2500);
|
||||
if(time >= 2500){
|
||||
}while(time < 150);
|
||||
if(time >= 150){
|
||||
LOG_INFO("gpio_read failed shortAdd %x %x\n",UINT16_HIGH(shortAdd),UINT16_LOW(shortAdd));
|
||||
print_info("gpio_read failed \n");
|
||||
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS;
|
||||
@ -1203,6 +1203,7 @@ void Uart::UpdateWirelessNode(unsigned short shortAdd)
|
||||
print_info("Update END!!! file Size = %d\n",thisSize);
|
||||
}
|
||||
endUpdate:
|
||||
resendCount = 0;
|
||||
free(buffer);
|
||||
tcflush(fd,TCIFLUSH);
|
||||
boost::this_thread::sleep(boost::posix_time::seconds(1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user