add code
This commit is contained in:
parent
517ea957f0
commit
4e19a5480f
@ -46,7 +46,7 @@ int Uart::UartRecv(int fd, char srcshow, char *buffer) {
|
||||
ret = read_data(fd, buff, BUF_LENGTH, 10);
|
||||
if (ret <= 0) {
|
||||
timeoutflag++;
|
||||
if (timeoutflag > 300) {
|
||||
if (timeoutflag > 200) {
|
||||
DealReviveDuration(wave_shortAddr);
|
||||
zlog_warn(zct, "===============0x9999 timeout= %d offSize = %d===============shortAddr = %02x%02x", timeoutflag, offSize,UINT16_HIGH(wave_shortAddr),UINT16_LOW(wave_shortAddr));
|
||||
zlog_warn(zct, "0x9999 timeout %d===============Size = %d", timeoutflag, offSize);
|
||||
@ -351,6 +351,8 @@ 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,6 +365,12 @@ int Uart::DealAskTask(uint16_t ushortAdd){
|
||||
scheduleTask.duration = next_duration;
|
||||
scheduleTask.next_taskID = next_task_id;
|
||||
TaskResp(scheduleTask);
|
||||
}else if(next_task_id == UPGRADE){
|
||||
scheduleTask.cmd = REVIVE_DURATION;
|
||||
scheduleTask.shortAddr = ushortAdd;
|
||||
scheduleTask.duration = next_duration;
|
||||
scheduleTask.next_taskID = next_task_id;
|
||||
TaskResp(scheduleTask);
|
||||
}
|
||||
|
||||
// if (next_task_id == kScheduleEigenValue) //1.特征值
|
||||
@ -562,9 +570,9 @@ void Uart::DealRecvData(const char *pData) {
|
||||
case DEVICE_INF2:
|
||||
DealDataNodeName(pData);
|
||||
break;
|
||||
case ASK_TASK:
|
||||
DealAskTask(ushortAdd);
|
||||
break;
|
||||
// case ASK_TASK:
|
||||
// DealAskTask(ushortAdd);
|
||||
// break;
|
||||
case DEVICE_EXCEPTION:
|
||||
DealException(pData);
|
||||
break;
|
||||
@ -604,6 +612,7 @@ void Uart::DealRecvData(const char *pData) {
|
||||
break;
|
||||
case UPGRADE_ASK:
|
||||
taskID = scheduler::instance().StartSchedule(ushortAdd,next_duration, next_task_id);
|
||||
taskID = kScheduleUpgrade;
|
||||
if (taskID == kScheduleUpgrade){
|
||||
UpdateWirelessNode(ushortAdd);
|
||||
}else if(taskID == kScheduleResultNone){
|
||||
@ -1228,9 +1237,9 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
|
||||
memcpy(RecvBuf, (char *)&UartRecvBuf[i], 100);
|
||||
DealDataNodeWave(RecvBuf, command);
|
||||
mPackgeIndex = (unsigned int)UartRecvBuf[i + 6];
|
||||
} else if (now_task != WAVE_CMD && (command == ASK_TASK || command == DEVICE_INF || command == MEAS_EVAL || command == CONFIG || command == UPGRADE || command == DEVICE_INF2 || command == SIGNAL_STRENGTH || command == DEVICE_EXCEPTION)) {
|
||||
} else if (now_task != WAVE_CMD && (command == ASK_TASK || command == DEVICE_INF || command == MEAS_EVAL || command == CONFIG || command == UPGRADE || command == DEVICE_INF2 || command == SIGNAL_STRENGTH || command == DEVICE_EXCEPTION || command == UPGRADE_ASK)) {
|
||||
char RecvBuf[100] = {0x00};
|
||||
if (command == ASK_TASK )
|
||||
if (command == ASK_TASK || command == UPGRADE_ASK)
|
||||
{
|
||||
memcpy(RecvBuf, &UartRecvBuf[i], 8);
|
||||
if (!CheckCrc(RecvBuf, 7)) {
|
||||
|
||||
@ -145,7 +145,6 @@ void Uart::WritePanId2Zigbee(unsigned short pad) {
|
||||
zlog_info(zct, "WritePanId2Zigbee : %d", pad);
|
||||
unsigned short pad1 = pad, tmp;
|
||||
tmp = GlobalConfig::Zigbee_G.MyAddr;
|
||||
zlog_info(zct, "MyAddr : %d", GlobalConfig::Zigbee_G.MyAddr);
|
||||
swap((char *)&pad1);
|
||||
GlobalConfig::Zigbee_G.PanID = pad1;
|
||||
modify_info(tmp, (char *)&GlobalConfig::Zigbee_G);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user