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