add feature and wave filter logic
This commit is contained in:
parent
974d54a09e
commit
bbbfdb6d63
@ -10,10 +10,13 @@
|
||||
#include <zlog.h>
|
||||
#include "short_addr_cfg.hpp"
|
||||
#include "update_cfg.hpp"
|
||||
#include "wave_feature_set.hpp"
|
||||
|
||||
extern zlog_category_t *zct;
|
||||
extern zlog_category_t *zbt;
|
||||
|
||||
uint8_t g_x, g_y, g_z;
|
||||
|
||||
int SensorScheduler::StartSchedule(int short_addr, int &next_duration) {
|
||||
int id = 0;
|
||||
auto iter = short_addr_map_.find(short_addr);
|
||||
@ -52,10 +55,17 @@ int SensorScheduler::StartSchedule(int short_addr, int &next_duration) {
|
||||
current_request_ = kScheduleConfigSensor;
|
||||
return kScheduleConfigSensor;
|
||||
} else {
|
||||
wave_feature_set_inst::instance().GetFeatureCfg(short_addr, g_x, g_y, g_z);
|
||||
if (g_x || g_y || g_z) {
|
||||
// 执行上送特征值任务
|
||||
zlog_warn(zct, "[%d:%x] send eigen value in eigen slice", id, short_addr);
|
||||
current_request_ = kScheduleEigenValue;
|
||||
return kScheduleEigenValue;
|
||||
} else {
|
||||
next_duration = GetNextDuration(short_addr);
|
||||
zlog_warn(zct, "[%d:%x] no need for eigen", id, short_addr);
|
||||
return kScheduleWrongTime;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
zlog_warn(zct, "[%d:%x] Invalid request, revive in %d eigen slice", id, short_addr, nth_eigen_slice_ + 1);
|
||||
@ -99,9 +109,16 @@ int SensorScheduler::StartSchedule(int short_addr, int &next_duration) {
|
||||
current_request_ = kScheduleConfigSensor;
|
||||
return kScheduleConfigSensor;
|
||||
}
|
||||
wave_feature_set_inst::instance().GetWaveCfg(short_addr, g_x, g_y, g_z);
|
||||
if (g_x || g_y || g_z) {
|
||||
zlog_warn(zct, "[%d:%x] it is wave time", id, short_addr);
|
||||
current_request_ = kScheduleWaveForm;
|
||||
return kScheduleWaveForm;
|
||||
} else {
|
||||
next_duration = GetNextDuration(short_addr);
|
||||
zlog_warn(zct, "[%d:%x] no need for wave", id, short_addr);
|
||||
return kScheduleWrongTime;
|
||||
}
|
||||
} else {
|
||||
if (slice_sensor_id_[nth_wave_slice-1] == 0) {
|
||||
zlog_warn(zct, "[%d:%x] in idle time", id, short_addr);
|
||||
@ -147,6 +164,8 @@ long SensorScheduler::CalcNextTimestamp(int id, uint16_t short_addr) {
|
||||
}
|
||||
int wave_slice = wave_slice_iter->second; // 从1开始
|
||||
long send_wave_ts = 0;
|
||||
wave_feature_set_inst::instance().GetWaveCfg(short_addr, g_x, g_y, g_z);
|
||||
if (g_x || g_y || g_z) {
|
||||
if (wave_slice > forward_wave_slice_num &&
|
||||
wave_slice <= forward_wave_slice_num + wave_slice_num_per_eigen_interval_) {
|
||||
// 发送波的时间窗也在本次特征值发送间隔中
|
||||
@ -158,6 +177,7 @@ long SensorScheduler::CalcNextTimestamp(int id, uint16_t short_addr) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long available_ts = 0;
|
||||
auto upgrade_iter = upgrade_.find(id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user