优化了信号数据筛选,优化了固件升级超时逻辑

This commit is contained in:
CHINAMI-TV221UM\Administrator 2024-07-18 09:41:33 +08:00
parent 9d3c22b10a
commit 9dd61e77cd
4 changed files with 23 additions and 41 deletions

View File

@ -23,8 +23,8 @@ enum enumZigBeeTransmitStatus {
//#define Q4G_MODULE //#define Q4G_MODULE
//#define WIFI_MODULE //#define WIFI_MODULE
//#define NR5G_MEIGE //#define NR5G_MEIGE
#define G2UL_GATEWAY //#define G2UL_GATEWAY
//#define IMX6UL_GATEWAY #define IMX6UL_GATEWAY
class GlobalConfig class GlobalConfig
{ {

View File

@ -184,24 +184,5 @@ typedef enum {
}T_GATEWAY_INFO_Index; }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"}; 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 #endif

View File

@ -1277,7 +1277,7 @@ std::string JsonData::JsonCmd_Cgi_26(Param_26 &param)
char looseValue[10]={0x00}; char looseValue[10]={0x00};
readStringValue("config", "loose",looseValue,(char*)GlobalConfig::Config_G.c_str()); 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; Json::Value jsArray;
array_t arrRes; array_t arrRes;
arrRes = sql_ctl->GetDataMultiLineTransaction(T_SENSOR_INFO(TNAME), "*", NULL); arrRes = sql_ctl->GetDataMultiLineTransaction(T_SENSOR_INFO(TNAME), "*", NULL);
@ -1363,10 +1363,10 @@ std::string JsonData::JsonCmd_Cgi_26(Param_26 &param)
char szTableName[50]={0x00},selectCon[128]={0x00}; char szTableName[50]={0x00},selectCon[128]={0x00};
sprintf(szTableName,"t_dataStatic_%s",arrRes[j][0].c_str()); sprintf(szTableName,"t_dataStatic_%s",arrRes[j][0].c_str());
memset(selectCon,0x00,sizeof(selectCon)); 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); string strZigbeeSignal = sql_ctl->GetData(szTableName, "zigbeeSignal", selectCon);
memset(selectCon,0x00,sizeof(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); string strZigbeeSignalNode = sql_ctl->GetData(szTableName, "zigbeeSignalNode", selectCon);
if(strZigbeeSignal == "") if(strZigbeeSignal == "")
jsSensorData["RSSI"] = "0," + arrRes[j][40]; jsSensorData["RSSI"] = "0," + arrRes[j][40];

View File

@ -1131,19 +1131,19 @@ void Uart::UpdateWirelessNode(unsigned short shortAdd)
break; break;
usleep(10000); usleep(10000);
time += 1; time += 1;
}while(time < 250); }while(time < 150);
if(time >= 250){ if(time >= 150){
// resendCount++; resendCount++;
// if(resendCount < 3){ if(resendCount < 5){
// LOG_INFO(" RESEND gpio_read failed shortAdd %x %x,error index %d\n",UINT16_HIGH(shortAdd),UINT16_LOW(shortAdd),j); LOG_INFO(" RESEND gpio_read failed shortAdd %x %x,error index %d\n",UINT16_HIGH(shortAdd),UINT16_LOW(shortAdd),j);
// goto RESEND; }else{
// } LOG_INFO("gpio_read failed shortAdd %x %x,error index %d\n",UINT16_HIGH(shortAdd),UINT16_LOW(shortAdd),j);
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");
print_red("gpio_read failed \n"); GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS;
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS; GlobalConfig::EnterZigBeeWaveTransmittingCnt_G = 0;
GlobalConfig::EnterZigBeeWaveTransmittingCnt_G = 0; bUpdate = false;
bUpdate = false; goto endUpdate;
goto endUpdate; }
} }
gpio_set(GlobalConfig::GPIO_G.zigAckreset,0); gpio_set(GlobalConfig::GPIO_G.zigAckreset,0);
usleep(2000); usleep(2000);
@ -1187,10 +1187,10 @@ void Uart::UpdateWirelessNode(unsigned short shortAdd)
gpio_set(GlobalConfig::GPIO_G.zigAckreset,1); gpio_set(GlobalConfig::GPIO_G.zigAckreset,1);
break; break;
} }
usleep(100); usleep(10000);
time += 1; time += 1;
}while(time < 2500); }while(time < 150);
if(time >= 2500){ if(time >= 150){
LOG_INFO("gpio_read failed shortAdd %x %x\n",UINT16_HIGH(shortAdd),UINT16_LOW(shortAdd)); LOG_INFO("gpio_read failed shortAdd %x %x\n",UINT16_HIGH(shortAdd),UINT16_LOW(shortAdd));
print_info("gpio_read failed \n"); print_info("gpio_read failed \n");
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS; 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); print_info("Update END!!! file Size = %d\n",thisSize);
} }
endUpdate: endUpdate:
resendCount = 0;
free(buffer); free(buffer);
tcflush(fd,TCIFLUSH); tcflush(fd,TCIFLUSH);
boost::this_thread::sleep(boost::posix_time::seconds(1)); boost::this_thread::sleep(boost::posix_time::seconds(1));