Merge branch 'dg102' of http://192.168.0.10:3000/pandx/WLG into dg102
This commit is contained in:
commit
ad4d2cff9b
69
doc/wave_filter.jsonc
Normal file
69
doc/wave_filter.jsonc
Normal file
@ -0,0 +1,69 @@
|
||||
下面信息对于特征值与波形保持一致,只在命令号上做区别
|
||||
// 更新全部配置的内容
|
||||
{
|
||||
"partial": false, // 如果提交全部的话,此项为false,提交部分的话,此项为true
|
||||
"global": [1, 1, 1],
|
||||
"3259": [0, 1, 0],
|
||||
"4123": [1, 1, 0],
|
||||
"4326": [1, 1, 0]
|
||||
}
|
||||
|
||||
// 更新部分配置的内容
|
||||
{
|
||||
"partial": true, // 如果提交全部的话,此项为false,提交部分的话,此项为true
|
||||
"4326": [1, 1, 0]
|
||||
}
|
||||
|
||||
// 获取特征值配置内容
|
||||
// 请求
|
||||
{
|
||||
"cmd": "63",
|
||||
"sub_cmd": 0 // 0:获取,1:设置
|
||||
}
|
||||
|
||||
// 响应
|
||||
{
|
||||
"cmd": "63",
|
||||
"success": true,
|
||||
"sub_cmd": 0, // 0:获取,1:设置
|
||||
"cmdBody": {
|
||||
"global": [1, 1, 1],
|
||||
"3259": [0, 1, 0],
|
||||
"4123": [1, 1, 0],
|
||||
"4326": [1, 1, 0]
|
||||
}
|
||||
}
|
||||
|
||||
// 请求
|
||||
|
||||
// 设置特征值配置内容-全部
|
||||
{
|
||||
"cmd": "63",
|
||||
"sub_cmd": 1, // 0:获取,1:设置
|
||||
"cmdBody": {
|
||||
"partial": false,
|
||||
"global": [1, 1, 1],
|
||||
"3259": [0, 1, 0],
|
||||
"4123": [1, 1, 0],
|
||||
"4326": [1, 1, 0]
|
||||
}
|
||||
}
|
||||
|
||||
// 设置部分
|
||||
{
|
||||
"cmd": "63",
|
||||
"sub_cmd": 1, // 0:获取,1:设置
|
||||
"cmdBody": {
|
||||
"partial": true, // 当设置部分时,只能提交一条记录
|
||||
"4326": [1, 1, 0]
|
||||
}
|
||||
}
|
||||
|
||||
// 响应
|
||||
{
|
||||
"cmd": "63",
|
||||
"sub_cmd": 1, // 0:获取,1:设置
|
||||
"success": true
|
||||
}
|
||||
|
||||
波形的设置使用命令号:"64",其它格式与特征值保持一致
|
||||
@ -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);
|
||||
@ -650,11 +670,15 @@ void SensorScheduler::ClearScheduleCfg(int short_addr) {
|
||||
ShortAddrCfg::ClearCfg();
|
||||
UpdateCfg::ClearCfg();
|
||||
UpgradeCfg::ClearCfg();
|
||||
wave_feature_set_inst::instance().RemoveAllFeatureCfg();
|
||||
wave_feature_set_inst::instance().RemoveAllWaveCfg();
|
||||
} else {
|
||||
UpdateConfigResult(short_addr, 0);
|
||||
UpgradeResult(short_addr, kUpgradeSuccess);
|
||||
short_addr_map_.erase(short_addr);
|
||||
ShortAddrCfg::WriteCfg(short_addr_map_);
|
||||
wave_feature_set_inst::instance().RemoveFeatureCfg(short_addr);
|
||||
wave_feature_set_inst::instance().RemoveWaveCfg(short_addr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user