fix bugs
This commit is contained in:
parent
4e19a5480f
commit
93cc7f69e7
@ -75,7 +75,7 @@ int Uart::UartRecv(int fd, char srcshow, char *buffer) {
|
||||
maxSize = 0;
|
||||
tcflush(fd, TCIOFLUSH);
|
||||
}
|
||||
zlog_info(zct, "0x8888 ===str_recv===,offSize = %d,ret = %d", offSize,ret);
|
||||
//zlog_info(zct, "0x9999 ===str_recv===,offSize = %d,ret = %d", offSize,ret);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -351,8 +351,6 @@ int Uart::DealAskTask(uint16_t ushortAdd){
|
||||
mssleep(50000);
|
||||
UpdateConfig(ushortAdd);
|
||||
}
|
||||
next_task_id = UPGRADE;
|
||||
next_duration = 20;
|
||||
if(next_task_id == kScheduleWaveForm){
|
||||
scheduleTask.cmd = REVIVE_DURATION;
|
||||
scheduleTask.shortAddr = ushortAdd;
|
||||
@ -363,13 +361,13 @@ int Uart::DealAskTask(uint16_t ushortAdd){
|
||||
scheduleTask.cmd = REVIVE_DURATION;
|
||||
scheduleTask.shortAddr = ushortAdd;
|
||||
scheduleTask.duration = next_duration;
|
||||
scheduleTask.next_taskID = next_task_id;
|
||||
scheduleTask.next_taskID = MEAS_EVAL;
|
||||
TaskResp(scheduleTask);
|
||||
}else if(next_task_id == UPGRADE){
|
||||
}else if(next_task_id == kScheduleUpgrade){
|
||||
scheduleTask.cmd = REVIVE_DURATION;
|
||||
scheduleTask.shortAddr = ushortAdd;
|
||||
scheduleTask.duration = next_duration;
|
||||
scheduleTask.next_taskID = next_task_id;
|
||||
scheduleTask.next_taskID = UPGRADE;
|
||||
TaskResp(scheduleTask);
|
||||
}
|
||||
|
||||
@ -434,6 +432,8 @@ int Uart::DealConfig(uint16_t ushortAdd){
|
||||
int Uart::DealWaveCompress(const char *pData,uint16_t ushortAdd){
|
||||
|
||||
zlog_info(zct, "DealWaveCompress ");
|
||||
ModifyDistAddr(ushortAdd);
|
||||
mssleep(50000);
|
||||
now_task = WAVE_CMD;
|
||||
WaveResp(ushortAdd);
|
||||
char buf[20] = {0x00};
|
||||
@ -874,19 +874,7 @@ void Uart::DealDataNodeInfo(const char *pData) {
|
||||
}
|
||||
}
|
||||
int upgrade = GET_BIT(chTemp, 7);
|
||||
zlog_info(zct, "upgrade = %d", upgrade);
|
||||
if (upgrade == 1)
|
||||
{
|
||||
sprintf(whereCon, "dataNodeNo='%s'", dataNodeInfo.ZigbeeLongAddr.c_str());
|
||||
std::string soft_version = sqlite_db_ctrl::instance().GetData(T_SENSOR_INFO(TNAME), " softVersion ", whereCon);
|
||||
if (dataNodeInfo.SoftVersion != soft_version) {
|
||||
DealUpgrade(ushortAdd,0);
|
||||
scheduler::instance().UpgradeResult(ushortAdd,0);
|
||||
}else{
|
||||
DealUpgrade(ushortAdd,3);
|
||||
scheduler::instance().UpgradeResult(ushortAdd,3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 54=》序号25 ACC采样时间
|
||||
memset(buf, 0, 32);
|
||||
@ -948,7 +936,8 @@ void Uart::DealDataNodeInfo(const char *pData) {
|
||||
memset(buf, 0, 32);
|
||||
sprintf(buf, "%d", chTemp);
|
||||
dataNodeInfo.VIntegralFilterFrequency = atoi(buf);
|
||||
|
||||
sprintf(whereCon, "dataNodeNo='%s'", dataNodeInfo.ZigbeeLongAddr.c_str());
|
||||
std::string soft_version = sqlite_db_ctrl::instance().GetData(T_SENSOR_INFO(TNAME), " softVersion ", whereCon);
|
||||
|
||||
sprintf(whereCon, "dataNodeNo='%s'", dataNodeInfo.ZigbeeLongAddr.c_str());
|
||||
if (sqlite_db_ctrl::instance().GetTableRows(T_SENSOR_INFO(TNAME), whereCon) > 0) {
|
||||
@ -987,7 +976,18 @@ void Uart::DealDataNodeInfo(const char *pData) {
|
||||
zlog_error(zct, "res = %d", res);
|
||||
}
|
||||
}
|
||||
|
||||
zlog_info(zct, "upgrade = %d", upgrade);
|
||||
if (upgrade == 1)
|
||||
{
|
||||
zlog_info(zct, "soft_version = %s,dataNodeInfo.SoftVersion = %s", soft_version.c_str(),dataNodeInfo.SoftVersion.c_str());
|
||||
if (dataNodeInfo.SoftVersion != soft_version) {
|
||||
DealUpgrade(ushortAdd,2);
|
||||
scheduler::instance().UpgradeResult(ushortAdd,0);
|
||||
}else{
|
||||
DealUpgrade(ushortAdd,3);
|
||||
scheduler::instance().UpgradeResult(ushortAdd,3);
|
||||
}
|
||||
}
|
||||
Json::Value jsonVal;
|
||||
jsonVal.clear();
|
||||
jsonVal["cmd"] = "26";
|
||||
|
||||
@ -460,9 +460,9 @@ int Uart::UpdateConfig(uint16_t ushortAdd) {
|
||||
WriteToUart((const char*)UpdateData, 100);
|
||||
int iRet = CheckZigbeeACK();
|
||||
if (iRet == 0) {
|
||||
zlog_info(zct, "updataconfig ACK send success,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
|
||||
zlog_info(zct, "updateconfig ACK send success,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
|
||||
} else {
|
||||
zlog_warn(zct, "updataconfig ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
|
||||
zlog_warn(zct, "updateconfig ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
|
||||
}
|
||||
|
||||
mssleep(50000);
|
||||
@ -643,9 +643,9 @@ int Uart::WaveResp(uint16_t shortAddr){
|
||||
WriteToUart((const char*)sendData, 8);
|
||||
int iRet = CheckZigbeeACK();
|
||||
if (iRet == 0) {
|
||||
zlog_info(zct, "SendReviveDuration ACK send success,shortAddr = %d", shortAddr);
|
||||
zlog_info(zct, "WaveResp ACK send success,shortAddr = %x", shortAddr);
|
||||
} else {
|
||||
zlog_warn(zct, "SendReviveDuration ACK send failed,shortAddr = %d", shortAddr);
|
||||
zlog_warn(zct, "WaveResp ACK send failed,shortAddr = %x", shortAddr);
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user