diff --git a/uart/uart.cpp b/uart/uart.cpp index 1545df2..88f5d3c 100644 --- a/uart/uart.cpp +++ b/uart/uart.cpp @@ -374,23 +374,25 @@ int Uart::DealAskTask(uint16_t ushortAdd){ zlog_warn(zct, "device info not found %02x%02x ", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd)); return 1; } - int next_duration = 0,next_task_id = 0; + int next_duration_,next_task_id = 0; int taskID; ScheduleTask scheduleTask; bool z = false; - taskID = scheduler::instance().StartSchedule(ushortAdd,next_duration,z, next_task_id); + //taskID = scheduler::instance().StartSchedule(ushortAdd,next_duration,z, next_task_id); current_z = z; - zlog_info(zct, "taskID = %d next_duration = %d next_task_id = %d,current_z = %d", taskID, next_duration, next_task_id,current_z); - if (taskID == kScheduleConfigSensor) + if (scheduler::instance().StartSchedule(ushortAdd,next_duration_,z, next_task_id) == kScheduleConfigSensor) { scheduleTask.cmd = CONFIG; - scheduleTask.duration = next_duration; + scheduleTask.duration = next_duration_; scheduleTask.next_taskID = next_task_id; scheduleTask.shortAddr = ushortAdd; TaskResp(scheduleTask); mssleep(50000); UpdateConfig(ushortAdd); } + uint16_t next_duration = scheduler::instance().GetNextDuration(ushortAdd,z,next_task_id); + zlog_info(zct, "taskID = %d next_duration = %d next_task_id = %d,current_z = %d", taskID, next_duration, next_task_id,current_z); + if(next_task_id == kScheduleWaveForm){ scheduleTask.cmd = REVIVE_DURATION; scheduleTask.shortAddr = ushortAdd; @@ -645,14 +647,14 @@ int Uart::DealFeatureValue(const char *pData,uint16_t ushortAdd){ { return -1; } - // char logInfo[100] = {0x00}; - // std::vector& data_vec = map_send_data[ushortAdd]; - // const uint8_t* send_data = data_vec.data(); - // WriteToUart((const char*)send_data, 100); - // mssleep(50000); - // WriteToUart((const char*)send_data, 100); - // mssleep(50000); - // WriteToUart((const char*)send_data, 100); + char logInfo[100] = {0x00}; + std::vector& data_vec = map_send_data[ushortAdd]; + const uint8_t* send_data = data_vec.data(); + WriteToUart((const char*)send_data, 100); + mssleep(50000); + WriteToUart((const char*)send_data, 100); + mssleep(50000); + WriteToUart((const char*)send_data, 100); }else { DealAskTask(ushortAdd); DealDataNodeFeature(pData, 0);