Compare commits

..

No commits in common. "725b3ade9e11c3e01b28758d3e84ee75654b5228" and "37706802717dee04d282c42a0b6961eab6a779ff" have entirely different histories.

4 changed files with 9 additions and 11 deletions

BIN
Cidn-SH

Binary file not shown.

View File

@ -26,6 +26,7 @@ int SensorScheduler::StartSchedule(uint16_t short_addr, int &next_duration, bool
} else { } else {
id = iter->second; id = iter->second;
} }
current_ts_ = GetLocalTs(); current_ts_ = GetLocalTs();
CleanIdleOccupiedSet(current_ts_); CleanIdleOccupiedSet(current_ts_);
@ -35,9 +36,11 @@ int SensorScheduler::StartSchedule(uint16_t short_addr, int &next_duration, bool
nth_eigen_value_slice_ = seconds_in_current_wave_slice_ / eigen_value_send_interval_; nth_eigen_value_slice_ = seconds_in_current_wave_slice_ / eigen_value_send_interval_;
seconds_in_current_eigen_slice_ = seconds_in_current_wave_slice_ % eigen_value_send_interval_; seconds_in_current_eigen_slice_ = seconds_in_current_wave_slice_ % eigen_value_send_interval_;
ts_in_eigen_slice_ = false; ts_in_eigen_slice_ = false;
if (seconds_in_current_eigen_slice_ < 60 - 3) { if (seconds_in_current_eigen_slice_ < 60 - 3) {
ts_in_eigen_slice_ = true; ts_in_eigen_slice_ = true;
} }
if (ts_in_eigen_slice_) { if (ts_in_eigen_slice_) {
nth_eigen_slice_ = (seconds_in_current_eigen_slice_ + 2) / eigen_value_send_duration_; nth_eigen_slice_ = (seconds_in_current_eigen_slice_ + 2) / eigen_value_send_duration_;
if (nth_eigen_value_slice_ == 0) { if (nth_eigen_value_slice_ == 0) {

View File

@ -131,7 +131,6 @@ Uart::Uart() : mUart(mIoSev), mStrand(mIoSev) {
memset(send_data, 0, sizeof(send_data)); memset(send_data, 0, sizeof(send_data));
last_short_addr = 0; last_short_addr = 0;
last_time = 0; last_time = 0;
last_time_upgrade = 0;
current_z = false; current_z = false;
} }
@ -349,14 +348,11 @@ int Uart::DealAskTask(uint16_t ushortAdd){
zlog_warn(zct, "device info not found %02x%02x ", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd)); zlog_warn(zct, "device info not found %02x%02x ", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
return 1; return 1;
} }
int next_task_id = 0; int next_duration = 0,next_task_id = 0;
int taskID; int taskID;
ScheduleTask scheduleTask; ScheduleTask scheduleTask;
bool z = false; 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);
uint16_t next_duration = scheduler::instance().GetNextDuration(ushortAdd,z,next_task_id);
zlog_info(zct, "next_duration = %d next_taskID = %d,z = %d", next_duration,next_task_id,z);
current_z = z; 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); 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 (taskID == kScheduleConfigSensor)
@ -389,6 +385,7 @@ int Uart::DealAskTask(uint16_t ushortAdd){
scheduleTask.next_taskID = UPGRADE; scheduleTask.next_taskID = UPGRADE;
TaskResp(scheduleTask); TaskResp(scheduleTask);
} }
// if (next_task_id == kScheduleEigenValue) //1.特征值 // if (next_task_id == kScheduleEigenValue) //1.特征值
// { // {
@ -649,9 +646,8 @@ int Uart::DealFeatureValue(const char *pData,uint16_t ushortAdd){
GetTimeNet(localtimestamp, 1); GetTimeNet(localtimestamp, 1);
std::string nowTimetamp = std::string(localtimestamp); std::string nowTimetamp = std::string(localtimestamp);
long now_time = atol(nowTimetamp.c_str()); long now_time = atol(nowTimetamp.c_str());
zlog_info(zct, "DealFeatureValue1 short_addr_last = %02x%02x,timestamp_last = %ld,nowTime = %ld",UINT16_HIGH(ushortAdd), UINT16_LOW(ushortAdd),last_time,now_time);
if(ushortAdd == last_short_addr && (now_time - last_time) < 5){ if(ushortAdd == last_short_addr && (now_time - last_time) < 5){
zlog_warn(zct, "DealFeatureValue2 short_addr_last = %02x%02x,timestamp_last = %ld,nowTime = %ld",UINT16_HIGH(ushortAdd), UINT16_LOW(ushortAdd),last_time,now_time); zlog_warn(zct, "DealFeatureValue short_addr_last = %02x%02x,timestamp_last = %ld,nowTime = %ld",UINT16_HIGH(ushortAdd), UINT16_LOW(ushortAdd),last_time,now_time);
int iRet = DealDataNodeFeature(pData, 0); int iRet = DealDataNodeFeature(pData, 0);
if (iRet != 0) if (iRet != 0)
{ {
@ -719,13 +715,13 @@ void Uart::DealRecvData(const char *pData) {
GetTimeNet(localtimestamp, 1); GetTimeNet(localtimestamp, 1);
std::string nowTimetamp = std::string(localtimestamp); std::string nowTimetamp = std::string(localtimestamp);
long now_time = atol(nowTimetamp.c_str()); long now_time = atol(nowTimetamp.c_str());
if(ushortAdd == last_short_addr && (now_time - last_time_upgrade) < 5){ if(ushortAdd == last_short_addr && (now_time - last_time) < 5){
zlog_warn(zct, "WAVE_COMPRESS | UPGRADE_ASK short_addr_last = %02x%02x,timestamp_last = %ld,nowTime = %ld",UINT16_HIGH(ushortAdd), UINT16_LOW(ushortAdd),last_time,now_time); zlog_warn(zct, "WAVE_COMPRESS | UPGRADE_ASK short_addr_last = %02x%02x,timestamp_last = %ld,nowTime = %ld",UINT16_HIGH(ushortAdd), UINT16_LOW(ushortAdd),last_time,now_time);
return ; return ;
} }
GetTimeNet(localtimestamp, 1); GetTimeNet(localtimestamp, 1);
nowTimetamp = std::string(localtimestamp); nowTimetamp = std::string(localtimestamp);
last_time_upgrade = atol(nowTimetamp.c_str()); last_time = atol(nowTimetamp.c_str());
} }
if (ushortAdd != last_short_addr){ if (ushortAdd != last_short_addr){

View File

@ -284,7 +284,6 @@ private:
uint8_t send_data[100]; uint8_t send_data[100];
uint16_t last_short_addr; uint16_t last_short_addr;
long last_time; long last_time;
long last_time_upgrade;
bool current_z; bool current_z;
std::map<uint16_t, std::vector<uint8_t>> map_send_data; std::map<uint16_t, std::vector<uint8_t>> map_send_data;