Compare commits
2 Commits
3770680271
...
725b3ade9e
| Author | SHA1 | Date | |
|---|---|---|---|
| 725b3ade9e | |||
| 8cc3cb10b7 |
@ -26,7 +26,6 @@ int SensorScheduler::StartSchedule(uint16_t short_addr, int &next_duration, bool
|
||||
} else {
|
||||
id = iter->second;
|
||||
}
|
||||
|
||||
current_ts_ = GetLocalTs();
|
||||
CleanIdleOccupiedSet(current_ts_);
|
||||
|
||||
@ -36,11 +35,9 @@ int SensorScheduler::StartSchedule(uint16_t short_addr, int &next_duration, bool
|
||||
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_;
|
||||
ts_in_eigen_slice_ = false;
|
||||
|
||||
if (seconds_in_current_eigen_slice_ < 60 - 3) {
|
||||
ts_in_eigen_slice_ = true;
|
||||
}
|
||||
|
||||
if (ts_in_eigen_slice_) {
|
||||
nth_eigen_slice_ = (seconds_in_current_eigen_slice_ + 2) / eigen_value_send_duration_;
|
||||
if (nth_eigen_value_slice_ == 0) {
|
||||
|
||||
@ -131,6 +131,7 @@ Uart::Uart() : mUart(mIoSev), mStrand(mIoSev) {
|
||||
memset(send_data, 0, sizeof(send_data));
|
||||
last_short_addr = 0;
|
||||
last_time = 0;
|
||||
last_time_upgrade = 0;
|
||||
current_z = false;
|
||||
}
|
||||
|
||||
@ -348,11 +349,14 @@ 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_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);
|
||||
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;
|
||||
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)
|
||||
@ -385,7 +389,6 @@ int Uart::DealAskTask(uint16_t ushortAdd){
|
||||
scheduleTask.next_taskID = UPGRADE;
|
||||
TaskResp(scheduleTask);
|
||||
}
|
||||
|
||||
// if (next_task_id == kScheduleEigenValue) //1.特征值
|
||||
// {
|
||||
|
||||
@ -646,8 +649,9 @@ int Uart::DealFeatureValue(const char *pData,uint16_t ushortAdd){
|
||||
GetTimeNet(localtimestamp, 1);
|
||||
std::string nowTimetamp = std::string(localtimestamp);
|
||||
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){
|
||||
zlog_warn(zct, "DealFeatureValue short_addr_last = %02x%02x,timestamp_last = %ld,nowTime = %ld",UINT16_HIGH(ushortAdd), UINT16_LOW(ushortAdd),last_time,now_time);
|
||||
zlog_warn(zct, "DealFeatureValue2 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);
|
||||
if (iRet != 0)
|
||||
{
|
||||
@ -715,13 +719,13 @@ void Uart::DealRecvData(const char *pData) {
|
||||
GetTimeNet(localtimestamp, 1);
|
||||
std::string nowTimetamp = std::string(localtimestamp);
|
||||
long now_time = atol(nowTimetamp.c_str());
|
||||
if(ushortAdd == last_short_addr && (now_time - last_time) < 5){
|
||||
if(ushortAdd == last_short_addr && (now_time - last_time_upgrade) < 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);
|
||||
return ;
|
||||
}
|
||||
GetTimeNet(localtimestamp, 1);
|
||||
nowTimetamp = std::string(localtimestamp);
|
||||
last_time = atol(nowTimetamp.c_str());
|
||||
last_time_upgrade = atol(nowTimetamp.c_str());
|
||||
}
|
||||
|
||||
if (ushortAdd != last_short_addr){
|
||||
|
||||
@ -284,6 +284,7 @@ private:
|
||||
uint8_t send_data[100];
|
||||
uint16_t last_short_addr;
|
||||
long last_time;
|
||||
long last_time_upgrade;
|
||||
bool current_z;
|
||||
std::map<uint16_t, std::vector<uint8_t>> map_send_data;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user