add millisecond sampling cmd/parse
This commit is contained in:
parent
ffe6fbf58d
commit
540e9e55a9
|
@ -41,7 +41,7 @@ void MX_USART2_UART_Init(void)
|
|||
|
||||
/* USER CODE END USART2_Init 1 */
|
||||
huart2.Instance = USART2;
|
||||
huart2.Init.BaudRate = 115200;
|
||||
huart2.Init.BaudRate = 460800;
|
||||
huart2.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
huart2.Init.StopBits = UART_STOPBITS_1;
|
||||
huart2.Init.Parity = UART_PARITY_NONE;
|
||||
|
|
|
@ -71,14 +71,14 @@
|
|||
|
||||
//acc_detector_presence_configuration_filter_parameters_t
|
||||
#define DEFAULT_INTER_FRAME_DEVIATION_TIME_CONST (0.5f) //default 0.5 unit(seconds) [6]
|
||||
#define DEFAULT_INTER_FRAME_FAST_CUTOFF (10.0f) //default 20.0 unit(hz) [8]
|
||||
#define DEFAULT_INTER_FRAME_SLOW_CUTOFF (0.01f) //(0.01f) 0.2 hz unit(hz) [9]
|
||||
#define DEFAULT_INTER_FRAME_FAST_CUTOFF (20.0f) //default 20.0 unit(hz) [8]
|
||||
#define DEFAULT_INTER_FRAME_SLOW_CUTOFF (0.20f) //(0.01f) 0.2 hz unit(hz) [9]
|
||||
#define DEFAULT_INTRA_FRAME_TIME_CONST (0) //default 0.0 unit(seconds)
|
||||
#define DEFAULT_INTRA_FRAME_WEIGHT (0) //default 0.6 for normal slow tracking 1.0 for fast tracking
|
||||
|
||||
// 2025 03 26 *** if detection toggles too often, increase the following, if too sluggish, decrease it instead
|
||||
//#define DEFAULT_OUTPUT_TIME_CONST (0.8f) //default 0.5 unit(seconds) [5]
|
||||
#define DEFAULT_OUTPUT_TIME_CONST (0.5f) //default 0.5 unit(seconds) [5]
|
||||
#define DEFAULT_OUTPUT_TIME_CONST (0.2f) //default 0.5 unit(seconds) [5]
|
||||
//#define DEFAULT_OUTPUT_TIME_CONST (0.4f) //default 0.5 unit(seconds) [5]
|
||||
|
||||
#define DEFAULT_NBR_REMOVED_PC (0) //default 0 int [10]
|
||||
|
@ -267,10 +267,10 @@ static void set_default_configuration_common(acc_detector_presence_configuration
|
|||
filter.inter_frame_slow_cutoff = DEFAULT_INTER_FRAME_SLOW_CUTOFF;
|
||||
|
||||
// no effect if intra-frame-weight set to 0
|
||||
filter.intra_frame_time_const = DEFAULT_INTRA_FRAME_TIME_CONST;
|
||||
// filter.intra_frame_time_const = DEFAULT_INTRA_FRAME_TIME_CONST;
|
||||
// for slow movement, people sit still, rest in sofa, seat, closestool, etc.
|
||||
// set the intra_frame_weight to 0.0
|
||||
filter.intra_frame_weight = DEFAULT_INTRA_FRAME_WEIGHT;
|
||||
// filter.intra_frame_weight = DEFAULT_INTRA_FRAME_WEIGHT;
|
||||
|
||||
// if detection toggles too often, increase the following, if too sluggish, decrease it instead
|
||||
filter.output_time_const = DEFAULT_OUTPUT_TIME_CONST; //0.0f;
|
||||
|
@ -285,8 +285,9 @@ static void set_default_configuration(acc_detector_presence_configuration_t pres
|
|||
acc_detector_presence_configuration_sensor_set(presence_configuration, DEFAULT_SENSOR_ID);
|
||||
acc_detector_presence_configuration_service_profile_set(presence_configuration, DEFAULT_PROFILE); // *** optional
|
||||
|
||||
uint16_t sweeps_per_frame = acc_detector_presence_configuration_sweeps_per_frame_get(presence_configuration);
|
||||
acc_detector_presence_configuration_sweeps_per_frame_set(presence_configuration, sweeps_per_frame);
|
||||
Sweeps_per_frame = acc_detector_presence_configuration_sweeps_per_frame_get(presence_configuration);
|
||||
acc_detector_presence_configuration_sweeps_per_frame_set(presence_configuration, Sweeps_per_frame);
|
||||
|
||||
acc_detector_presence_configuration_downsampling_factor_set(presence_configuration, 1);
|
||||
acc_detector_presence_configuration_hw_accelerated_average_samples_set(presence_configuration, DEFAULT_HWAAS);
|
||||
|
||||
|
@ -339,7 +340,10 @@ static void set_default_fall_rise_configuration(acc_detector_presence_configurat
|
|||
acc_detector_presence_configuration_detection_threshold_set(presence_configuration, DEFAULT_THRESHOLD);
|
||||
|
||||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//acc_service_sparse_configuration_sweeps_per_frame_set(sparse_configuration, sweeps_per_frame);
|
||||
|
||||
Sweeps_per_frame = acc_detector_presence_configuration_sweeps_per_frame_get(presence_configuration);
|
||||
acc_detector_presence_configuration_sweeps_per_frame_set(presence_configuration, Sweeps_per_frame);
|
||||
|
||||
acc_detector_presence_configuration_start_set(presence_configuration, DEFAULT_START_M);
|
||||
acc_detector_presence_configuration_length_set(presence_configuration, DEFAULT_LENGTH_M);
|
||||
acc_detector_presence_configuration_downsampling_factor_set(presence_configuration, DEFAULT_DOWNSAMPLING_FACTOR);
|
||||
|
@ -379,6 +383,9 @@ static void sts_rss_set_current_configuration_full(acc_detector_presence_configu
|
|||
acc_detector_presence_configuration_update_rate_set(presence_configuration, sts_presence_rss_config.default_update_rate_presence); //DEFAULT_UPDATE_RATE_2);
|
||||
acc_detector_presence_configuration_detection_threshold_set(presence_configuration, sts_presence_rss_config.default_threshold);//DEFAULT_DETECTION_THRESHOLD_2);
|
||||
|
||||
Sweeps_per_frame = acc_detector_presence_configuration_sweeps_per_frame_get(presence_configuration);
|
||||
acc_detector_presence_configuration_sweeps_per_frame_set(presence_configuration, Sweeps_per_frame);
|
||||
|
||||
acc_detector_presence_configuration_start_set(presence_configuration, sts_presence_rss_config.default_start_m);
|
||||
acc_detector_presence_configuration_length_set(presence_configuration, sts_presence_rss_config.default_length_m); //DEFAULT_LENGTH_M_2);
|
||||
|
||||
|
@ -418,7 +425,10 @@ static void sts_rss_set_configuration_background_evalution(acc_detector_presence
|
|||
acc_detector_presence_configuration_detection_threshold_set(presence_configuration, (float)300.0/1000.0);
|
||||
acc_detector_presence_configuration_receiver_gain_set(presence_configuration, (float)80/100.0);
|
||||
|
||||
set_default_configuration_common(presence_configuration);
|
||||
Sweeps_per_frame = acc_detector_presence_configuration_sweeps_per_frame_get(presence_configuration);
|
||||
acc_detector_presence_configuration_sweeps_per_frame_set(presence_configuration, Sweeps_per_frame);
|
||||
|
||||
//set_default_configuration_common(presence_configuration);
|
||||
}
|
||||
|
||||
|
||||
|
@ -440,7 +450,10 @@ static void sts_rss_set_current_configuration_simple(acc_detector_presence_confi
|
|||
acc_detector_presence_configuration_detection_threshold_set(presence_configuration, sts_presence_rss_config.default_threshold);//DEFAULT_DETECTION_THRESHOLD_2);
|
||||
acc_detector_presence_configuration_receiver_gain_set(presence_configuration, sts_presence_rss_config.default_receiver_gain);
|
||||
|
||||
set_default_configuration_common(presence_configuration);
|
||||
Sweeps_per_frame = acc_detector_presence_configuration_sweeps_per_frame_get(presence_configuration);
|
||||
acc_detector_presence_configuration_sweeps_per_frame_set(presence_configuration, Sweeps_per_frame);
|
||||
|
||||
//set_default_configuration_common(presence_configuration);
|
||||
}
|
||||
|
||||
static void print_current_configuration(acc_detector_presence_configuration_t presence_configuration)
|
||||
|
|
|
@ -1887,9 +1887,9 @@ static void OnYunhornSTSSamplingPeriodicityChanged(uint32_t periodicity)
|
|||
if (STS_LoRa_WAN_Joined !=0)
|
||||
{
|
||||
UTIL_TIMER_Stop(&YunhornSTSRSSWakeUpTimer);
|
||||
UTIL_TIMER_SetPeriod(&YunhornSTSRSSWakeUpTimer, SamplingPeriodicity);
|
||||
UTIL_TIMER_SetPeriod(&YunhornSTSRSSWakeUpTimer, SamplingPeriodicity); // millisecond interval
|
||||
UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
|
||||
APP_LOG(TS_OFF, VLEVEL_M,"**************** Sampling Timer Periodicity = %u (sec)\r\n", (SamplingPeriodicity/1000) );
|
||||
APP_LOG(TS_OFF, VLEVEL_M,"**************** Sampling Timer Periodicity = %u (millisec)\r\n", (SamplingPeriodicity) );
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -2342,14 +2342,17 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
|
|||
STS_SENSOR_Upload_Config_Invalid_Message();
|
||||
}
|
||||
break;
|
||||
case 'S': // SAMPLING INTERVAL OR DURATION
|
||||
case 'S': // SAMPLING INTERVAL OR DURATION S:second, L: 100 millisecond, U: 100 microsecond
|
||||
if ((((char)tlv_buf[CFG_CMD3] >= '0') && ((char)tlv_buf[CFG_CMD3] <='9')
|
||||
&& ((char)tlv_buf[CFG_CMD4] >='0') && ((char)tlv_buf[CFG_CMD4] <='9')) &&
|
||||
(((char)tlv_buf[CFG_CMD5] == 'M' || ((char)tlv_buf[CFG_CMD5] =='H') ||((char)tlv_buf[CFG_CMD5] =='S'))))
|
||||
(((char)tlv_buf[CFG_CMD5] == 'H' || ((char)tlv_buf[CFG_CMD5] =='M') ||((char)tlv_buf[CFG_CMD5] =='S') || ((char)tlv_buf[CFG_CMD5] =='L'))))
|
||||
{
|
||||
uint32_t heart_beat_or_sampling_periodicity_length = (tlv_buf[CFG_CMD3]-0x30)*10+ (tlv_buf[CFG_CMD4]-0x30);
|
||||
|
||||
if ((char)tlv_buf[CFG_CMD5] == 'M') {
|
||||
if ((char)tlv_buf[CFG_CMD5] == 'L') { // 100 millisecond
|
||||
heart_beat_or_sampling_periodicity_length *= 1;
|
||||
}
|
||||
else if ((char)tlv_buf[CFG_CMD5] == 'M') {
|
||||
heart_beat_or_sampling_periodicity_length *= 60;
|
||||
} else if ((char)tlv_buf[CFG_CMD5] == 'H') {
|
||||
heart_beat_or_sampling_periodicity_length *= 3600;
|
||||
|
@ -2364,7 +2367,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
|
|||
OnYunhornSTSHeartBeatPeriodicityChanged(HeartBeatPeriodicity);
|
||||
#endif
|
||||
#if defined(STS_O6)||defined(STS_O7)
|
||||
SamplingPeriodicity = heart_beat_or_sampling_periodicity_length*1000; //translate to 1000ms=1s
|
||||
SamplingPeriodicity = heart_beat_or_sampling_periodicity_length*100; //translate to 100ms
|
||||
OnYunhornSTSSamplingPeriodicityChanged(SamplingPeriodicity);
|
||||
#endif
|
||||
// 2024-07-31
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue