---- rss config for default, simple, full and fall detection

This commit is contained in:
Yunhorn 2024-08-15 18:40:24 +08:00
parent e797d0327f
commit 990e83f58e
4 changed files with 162 additions and 149 deletions

View File

@ -55,7 +55,8 @@
//volatile distance_measure_cfg_t distance_cfg={1.5, 2.0, 1, 63, 2, 10, 0.5, 1.3, 0.2}; //volatile distance_measure_cfg_t distance_cfg={1.5, 2.0, 1, 63, 2, 10, 0.5, 1.3, 0.2};
// SPARK FUN EXAMPLE // SPARK FUN EXAMPLE
// GOOD --- volatile distance_measure_cfg_t distance_cfg={0.4, 3.5, 4, 63, 0, 10, 0.5, 1.3, 0.2}; // GOOD --- volatile distance_measure_cfg_t distance_cfg={0.4, 3.5, 4, 63, 0, 10, 0.5, 1.3, 0.2};
volatile distance_measure_cfg_t distance_cfg={0.8, 3.5, 2, 63, 2, 10, 0.5, 1.3, 0.2}; // 2024-08-15 volatile distance_measure_cfg_t distance_cfg={0.8, 3.5, 2, 63, 2, 10, 0.5, 1.3, 0.2};
volatile distance_measure_cfg_t distance_cfg={0.8, 3.5, 4, 63, 2, 10, 0.5, 1.3, 0.2};
//volatile distance_measure_cfg_t distance_cfg={1.5, 3.3, 2, 63, 4, 10, 0.8182f, 0.4, 0.2}; //volatile distance_measure_cfg_t distance_cfg={1.5, 3.3, 2, 63, 4, 10, 0.8182f, 0.4, 0.2};
extern volatile uint16_t sts_distance_rss_distance, sts_sensor_install_height; extern volatile uint16_t sts_distance_rss_distance, sts_sensor_install_height;
@ -111,7 +112,7 @@ int sts_distance_rss_detector_distance(void)
} }
bool success = true; bool success = true;
const int iterations = 10; //5; const int iterations = 5; //5;
uint16_t number_of_peaks = 1; uint16_t number_of_peaks = 1;
acc_detector_distance_result_t result[number_of_peaks]; acc_detector_distance_result_t result[number_of_peaks];
acc_detector_distance_result_info_t result_info; acc_detector_distance_result_info_t result_info;

View File

@ -112,6 +112,7 @@ volatile uint8_t sts_unconscious_state=0;
volatile uint16_t sts_unconscious_threshold=1280, sts_unconscious_duration=0; volatile uint16_t sts_unconscious_threshold=1280, sts_unconscious_duration=0;
extern volatile uint8_t sts_rss_result, sts_rss_config_updated_flag, last_sts_rss_result; extern volatile uint8_t sts_rss_result, sts_rss_config_updated_flag, last_sts_rss_result;
extern volatile uint16_t sts_distance_rss_distance, sts_sensor_install_height; extern volatile uint16_t sts_distance_rss_distance, sts_sensor_install_height;
extern volatile uint8_t sts_work_mode;
volatile float sts_presence_rss_distance, sts_presence_rss_score; volatile float sts_presence_rss_distance, sts_presence_rss_score;
volatile STS_OO_RSS_SensorTuneDataTypeDef sts_presence_rss_config; volatile STS_OO_RSS_SensorTuneDataTypeDef sts_presence_rss_config;
@ -123,8 +124,8 @@ volatile uint8_t detected_hs_zone=0;;
volatile uint16_t motion_count=0, motion_feature_count=0; volatile uint16_t motion_count=0, motion_feature_count=0;
typedef struct typedef struct
{ {
uint16_t presence_score; // 1000* uint32_t presence_score; // 1000*
uint16_t presence_distance; // 1000*, in mm uint32_t presence_distance; // 1000*, in mm
} STS_presence_result_t; } STS_presence_result_t;
static STS_presence_result_t sts_motion_dataset[DEFAULT_MOTION_DATASET_LEN]; static STS_presence_result_t sts_motion_dataset[DEFAULT_MOTION_DATASET_LEN];
@ -132,7 +133,7 @@ static STS_PRESENCE_Motion_Featuer_t sts_motion_feature[DEFAULT_MOTION_FEATURE_L
volatile uint8_t sts_fall_rising_detected_result = STS_PRESENCE_NORMAL; volatile uint8_t sts_fall_rising_detected_result = STS_PRESENCE_NORMAL;
volatile uint8_t sts_fall_rising_detected_result_changed_flag =0; volatile uint8_t sts_fall_rising_detected_result_changed_flag =0;
volatile uint8_t last_sts_fall_rising_detected_result= STS_PRESENCE_NORMAL; volatile uint8_t last_sts_fall_rising_detected_result= STS_PRESENCE_NORMAL;
volatile float last_average_presence_distance; volatile uint16_t last_average_presence_distance=0;
volatile uint16_t sts_fall_rising_pattern_factor1=0, sts_fall_rising_pattern_factor2=0, sts_fall_rising_pattern_factor3=0; volatile uint16_t sts_fall_rising_pattern_factor1=0, sts_fall_rising_pattern_factor2=0, sts_fall_rising_pattern_factor3=0;
volatile uint16_t sts_roc_acc_standard_variance=0; volatile uint16_t sts_roc_acc_standard_variance=0;
extern volatile uint8_t sts_presence_fall_detection; extern volatile uint8_t sts_presence_fall_detection;
@ -348,24 +349,24 @@ int sts_presence_rss_fall_rise_detection(void)
{ {
case STS_RSS_CONFIG_DEFAULT: case STS_RSS_CONFIG_DEFAULT:
set_default_configuration(presence_configuration); set_default_configuration(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Default *** cfg applied\n"); APP_LOG(TS_OFF, VLEVEL_M,"\r\n##### YUNHORN STS *** Default *** cfg applied\n");
break; break;
case STS_RSS_CONFIG_SIMPLE: case STS_RSS_CONFIG_SIMPLE:
sts_rss_set_current_configuration_simple(presence_configuration); sts_rss_set_current_configuration_simple(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Simple *** cfg applied\n"); APP_LOG(TS_OFF, VLEVEL_M,"\r\n##### YUNHORN STS *** Simple *** cfg applied\n");
break; break;
case STS_RSS_CONFIG_FULL: case STS_RSS_CONFIG_FULL:
sts_rss_set_current_configuration_full(presence_configuration); sts_rss_set_current_configuration_full(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n######### YUNHORN STS *** FULL *** cfg applied\n"); APP_LOG(TS_OFF, VLEVEL_M,"\r\n######### YUNHORN STS *** FULL *** cfg applied\n");
break; break;
case STS_RSS_CONFIG_FALL_DETECTION: case STS_RSS_CONFIG_FALL_DETECTION:
set_default_fall_rise_configuration(presence_configuration); set_default_fall_rise_configuration(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n######### YUNHORN STS *** FALL DETECTION *** cfg applied\n"); APP_LOG(TS_OFF, VLEVEL_M,"\r\n######### YUNHORN STS *** FALL DETECTION *** cfg applied\n");
break; break;
default: default:
break; break;
} }
sts_rss_config_updated_flag = STS_RSS_CONFIG_DEFAULT; //update finished, set to 0 //sts_rss_config_updated_flag = STS_RSS_CONFIG_DEFAULT; //update finished, set to 0
acc_detector_presence_handle_t handle = acc_detector_presence_create(presence_configuration); acc_detector_presence_handle_t handle = acc_detector_presence_create(presence_configuration);
if (handle == NULL) if (handle == NULL)
@ -404,7 +405,8 @@ int sts_presence_rss_fall_rise_detection(void)
//past 10 times of detection with 5 zones from ground to ceiling //past 10 times of detection with 5 zones from ground to ceiling
//for (k=0; k<5; k++) {motion_in_zone[k]=0;} //for (k=0; k<5; k++) {motion_in_zone[k]=0;}
#if 1 if ((sts_work_mode == STS_DUAL_MODE)||(sts_work_mode == STS_RSS_MODE))
{
for (int i = 0; i < (iterations/2); i++) for (int i = 0; i < (iterations/2); i++)
{ {
success = acc_detector_presence_get_next(handle, &result); success = acc_detector_presence_get_next(handle, &result);
@ -452,12 +454,15 @@ int sts_presence_rss_fall_rise_detection(void)
APP_LOG(TS_OFF, VLEVEL_H, "\r\n First Half --- Motion Count = %u \r\n", motion_count); APP_LOG(TS_OFF, VLEVEL_H, "\r\n First Half --- Motion Count = %u \r\n", motion_count);
acc_detector_presence_deactivate(handle); acc_detector_presence_deactivate(handle);
}
else if ((sts_work_mode == STS_UNI_MODE))
{
#endif
// ******** Second Half detection of fall down and rise up // ******** Second Half detection of fall down and rise up
//if (sts_presence_fall_detection == TRUE) //if (sts_presence_fall_detection == TRUE)
//{ //{
// the following has been updated, no need to re-cofig
#if 0
set_default_fall_rise_configuration(presence_configuration); set_default_fall_rise_configuration(presence_configuration);
if (!acc_detector_presence_reconfigure(&handle, presence_configuration)) if (!acc_detector_presence_reconfigure(&handle, presence_configuration))
@ -468,7 +473,7 @@ int sts_presence_rss_fall_rise_detection(void)
acc_rss_deactivate(); acc_rss_deactivate();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
#endif
if (!acc_detector_presence_activate(handle)) if (!acc_detector_presence_activate(handle))
{ {
@ -533,6 +538,7 @@ int sts_presence_rss_fall_rise_detection(void)
if ((sts_presence_fall_detection == TRUE)&& (motion_count>10)) if ((sts_presence_fall_detection == TRUE)&& (motion_count>10))
STS_YunhornCheckStandardDeviation(); STS_YunhornCheckStandardDeviation();
}
// RSS feature 1: Motion, No-motion process // RSS feature 1: Motion, No-motion process
sts_rss_result = (average_result > 3)? 1: 0; sts_rss_result = (average_result > 3)? 1: 0;
@ -555,6 +561,7 @@ int sts_presence_rss_fall_rise_detection(void)
{ {
LED1_ON; LED1_ON;
OnSensorRSS3BStateChanged(); OnSensorRSS3BStateChanged();
sts_fall_rising_detected_result_changed_flag = sts_fall_rising_detected_result;
} else { } else {
LED1_OFF; LED1_OFF;
@ -641,7 +648,7 @@ void STS_YunhornCheckStandardDeviation(void)
uint32_t standard_variance_presence_distance = 0, standard_variance_presence_score=0; uint32_t standard_variance_presence_distance = 0, standard_variance_presence_score=0;
// ROC -- rate of change // ROC -- rate of change
uint32_t roc_distance[DEFAULT_MOTION_DATASET_LEN]={0}, sum_roc_distance=0, average_roc_distance=0, variance_roc_distance=0, standard_variance_roc_distance=0; uint32_t roc_distance[DEFAULT_MOTION_DATASET_LEN]={0}, sum_roc_distance=0, average_roc_distance=0, variance_roc_distance=0, standard_variance_roc_distance=0;
uint32_t roc_acc[DEFAULT_MOTION_DATASET_LEN]={0}, sum_roc_acc=0.0f, average_roc_acc=0.0f, variance_roc_acc=0.0f, standard_variance_roc_acc=0.0f;; uint32_t roc_acc[DEFAULT_MOTION_DATASET_LEN]={0}, sum_roc_acc=0, average_roc_acc=0, variance_roc_acc=0, standard_variance_roc_acc=0;
//act as speed of change at given time slot acc_integration_sleep_ms(1000 / DEFAULT_UPDATE_RATE_PRESENCE); //act as speed of change at given time slot acc_integration_sleep_ms(1000 / DEFAULT_UPDATE_RATE_PRESENCE);
uint8_t SAMPLE_DATASET_NUM = MIN(motion_count,DEFAULT_MOTION_DATASET_LEN ); uint8_t SAMPLE_DATASET_NUM = MIN(motion_count,DEFAULT_MOTION_DATASET_LEN );
APP_LOG(TS_OFF, VLEVEL_M, "\r\n Sample dataset for deviation process =%u \r\n",SAMPLE_DATASET_NUM); APP_LOG(TS_OFF, VLEVEL_M, "\r\n Sample dataset for deviation process =%u \r\n",SAMPLE_DATASET_NUM);
@ -659,18 +666,18 @@ void STS_YunhornCheckStandardDeviation(void)
average_presence_distance = ((uint32_t)sum_presence_distance/(uint32_t)(SAMPLE_DATASET_NUM)); average_presence_distance = ((uint32_t)sum_presence_distance/(uint32_t)(SAMPLE_DATASET_NUM));
average_presence_score = ((uint32_t)sum_presence_score/(uint32_t)(SAMPLE_DATASET_NUM)); average_presence_score = ((uint32_t)sum_presence_score/(uint32_t)(SAMPLE_DATASET_NUM));
// 1) VARIANCE // 1) VARIANCE^2
for (j = 0; j < SAMPLE_DATASET_NUM; j++) for (j = 0; j < SAMPLE_DATASET_NUM; j++)
{ {
variance_presence_distance += (uint32_t)pow(sts_motion_dataset[j].presence_distance - average_presence_distance,2)/(SAMPLE_DATASET_NUM-1); sum_presence_distance += (uint32_t)pow(sts_motion_dataset[j].presence_distance - average_presence_distance,2);
variance_presence_score += (uint32_t)pow(sts_motion_dataset[j].presence_score - average_presence_score,2)/(SAMPLE_DATASET_NUM-1); sum_presence_score += (uint32_t)pow(sts_motion_dataset[j].presence_score - average_presence_score,2);
} }
//variance_presence_distance /= (uint32_t)(SAMPLE_DATASET_NUM-1); variance_presence_distance =sum_presence_distance/(uint32_t)(SAMPLE_DATASET_NUM-1);
//variance_presence_score /= (uint32_t)(SAMPLE_DATASET_NUM-1); variance_presence_score =sum_presence_score/(uint32_t)(SAMPLE_DATASET_NUM-1);
//STANDARD VARIANCE sigma //STANDARD VARIANCE sigma
standard_variance_presence_distance = (uint32_t)sqrt(variance_presence_distance); standard_variance_presence_distance = (uint32_t)sqrt(sum_presence_distance/SAMPLE_DATASET_NUM);
standard_variance_presence_score = (uint32_t)sqrt(variance_presence_score); standard_variance_presence_score = (uint32_t)sqrt(sum_presence_score/SAMPLE_DATASET_NUM);
APP_LOG(TS_OFF, VLEVEL_M, "\r\n Standard Variance_Presence_Distance=%u \r\n Standard Variance Presence Score=%u\r\n", APP_LOG(TS_OFF, VLEVEL_M, "\r\n Standard Variance_Presence_Distance=%u \r\n Standard Variance Presence Score=%u\r\n",
standard_variance_presence_distance, standard_variance_presence_score); standard_variance_presence_distance, standard_variance_presence_score);
@ -686,13 +693,13 @@ void STS_YunhornCheckStandardDeviation(void)
for (j = 0; j < (SAMPLE_DATASET_NUM-1); j++) for (j = 0; j < (SAMPLE_DATASET_NUM-1); j++)
{ {
variance_roc_distance += (uint32_t)(pow(roc_distance[j] - average_roc_distance,2)/SAMPLE_DATASET_NUM); sum_roc_distance += (uint32_t)(pow(roc_distance[j] - average_roc_distance,2));
} }
// average // average
//variance_roc_distance /= (uint32_t)(SAMPLE_DATASET_NUM); variance_roc_distance =sum_roc_distance/(uint32_t)(SAMPLE_DATASET_NUM-2);
//???? //????
standard_variance_roc_distance = (uint32_t)sqrt((uint32_t)variance_roc_distance); standard_variance_roc_distance = (uint32_t)sqrt((uint32_t)variance_roc_distance)/(SAMPLE_DATASET_NUM-1);
// ROC Acceleration // ROC Acceleration
@ -703,16 +710,16 @@ void STS_YunhornCheckStandardDeviation(void)
sum_roc_acc += ((uint32_t)roc_acc[i]); sum_roc_acc += ((uint32_t)roc_acc[i]);
} }
average_roc_acc = (uint32_t)sum_roc_acc/(SAMPLE_DATASET_NUM-2); average_roc_acc = (uint32_t)sum_roc_acc/(SAMPLE_DATASET_NUM-3);
for (j = 0; j < (SAMPLE_DATASET_NUM-2); j++) for (j = 0; j < (SAMPLE_DATASET_NUM-3); j++)
{ {
variance_roc_acc += (uint32_t)pow((uint32_t)((uint32_t)roc_acc[j] - (uint32_t)average_roc_acc),2)/(SAMPLE_DATASET_NUM-1); sum_roc_acc += (uint32_t)pow((uint32_t)((uint32_t)roc_acc[j] - (uint32_t)average_roc_acc),2);
} }
//variance_roc_acc /= (uint32_t)(SAMPLE_DATASET_NUM-1); variance_roc_acc = sum_roc_acc/(uint32_t)(SAMPLE_DATASET_NUM-4);
standard_variance_roc_acc = (uint32_t)sqrt((uint32_t)variance_roc_acc); standard_variance_roc_acc = (uint32_t)sqrt((uint32_t)sum_roc_acc)/(SAMPLE_DATASET_NUM-3);
//Normallize to m/s --- * DEFAULT_MOTION_DATASET_LEN for One single second //Normallize to m/s --- * DEFAULT_MOTION_DATASET_LEN for One single second
#if 0 #if 0
@ -726,33 +733,38 @@ void STS_YunhornCheckStandardDeviation(void)
#endif #endif
// print result // print result
//#ifdef LOG_RSS //#ifdef LOG_RSS
APP_LOG(TS_OFF, VLEVEL_M, "\r\n---Sensor Install Height=%6u-----\r\n-------------Distance Average =%6u; Standard_Variance =%6u \r\n", APP_LOG(TS_OFF, VLEVEL_M, "\r\n---Sensor Install Height=%4u (mm)-----\r\n-------------Distance Average =%6u (mm); Standard_Variance =%04u (mm)\r\n",
(int)sts_sensor_install_height, (int)(average_presence_distance), (int)(standard_variance_presence_distance)); (int)sts_sensor_install_height, (int)(average_presence_distance), (int)(standard_variance_presence_distance));
//#endif //#endif
//#ifdef LOG_RSS //#ifdef LOG_RSS
APP_LOG(TS_OFF, VLEVEL_M, "\r\n\n-------------Motion Average =%6u; Standard_Variance =%6u \r\n", APP_LOG(TS_OFF, VLEVEL_M, "\r\n\n-------------Motion Average (score)=%04u; Standard_Variance (score)=%04u \r\n",
(int)(average_presence_score), (int)(standard_variance_presence_score)); (int)(average_presence_score), (int)(standard_variance_presence_score));
//#endif //#endif
//#ifdef LOG_RSS //#ifdef LOG_RSS
APP_LOG(TS_OFF, VLEVEL_M, "\r\n-------------ROC Dist Average =%6u; Standard_Variance =%6u \r\n", APP_LOG(TS_OFF, VLEVEL_M, "\r\n-------------ROC Dist Average (mm/s) =%6u; Standard_Variance =%6u (mm/s)\r\n",
(int)(average_roc_distance), (int)(standard_variance_roc_distance)); (int)(average_roc_distance), (int)(standard_variance_roc_distance));
APP_LOG(TS_OFF, VLEVEL_M, "\r\n-------------ROC ACC Average =%6u; Standard_Variance =%6u \r\n", APP_LOG(TS_OFF, VLEVEL_M, "\r\n-------------ROC ACC Average =%6u (mm/s2); Standard_Variance =%6u (mm/s2)\r\n",
(int)(average_roc_acc), (int)(standard_variance_roc_acc)); (int)(average_roc_acc), (int)(standard_variance_roc_acc));
//sts_fall_rising_pattern_factor1 = (int)(standard_variance_roc_distance); //sts_fall_rising_pattern_factor1 = (int)(standard_variance_roc_distance);
sts_fall_rising_pattern_factor1 = (int)(average_roc_distance); sts_fall_rising_pattern_factor1 = (int)(average_roc_distance);
sts_fall_rising_pattern_factor2 = (int)(fabs(average_presence_distance - last_average_presence_distance)); if (last_average_presence_distance >0)
sts_fall_rising_pattern_factor2 = (uint16_t)(abs((uint16_t)average_presence_distance - (uint16_t)last_average_presence_distance));
//sts_fall_rising_pattern_factor2 = (uint16_t)(abs((uint16_t)average_presence_distance - (uint16_t)sts_sensor_install_height));
//APP_LOG(TS_OFF, VLEVEL_M, "\r\n*************** factor2=%6u ---- average_distance=%6u ----install height=%6u\r\n", sts_fall_rising_pattern_factor2,average_presence_distance,sts_sensor_install_height )
sts_fall_rising_pattern_factor3 = (int)(standard_variance_presence_score); sts_fall_rising_pattern_factor3 = (int)(standard_variance_presence_score);
APP_LOG(TS_OFF, VLEVEL_L,"\r\nAvg-Dist =%6u, Last_AVG-Dist =%6u \r\n", (int)(average_presence_distance), (int)(last_average_presence_distance)); APP_LOG(TS_OFF, VLEVEL_L,"\r\nAvg-Dist =%6u (mm), Last_AVG-Dist =%6u (mm)\r\n", (int)(average_presence_distance), (int)(last_average_presence_distance));
APP_LOG(TS_OFF, VLEVEL_L,"\r\nStandard Variance Presence_score=%u \r\n", (int)(standard_variance_presence_score)); APP_LOG(TS_OFF, VLEVEL_L,"\r\nStandard Variance Presence_score =%u (score)\r\n", (int)(standard_variance_presence_score));
APP_LOG(TS_OFF, VLEVEL_M, "\r\nThreshold 1: Acc = %6u ---- Measure 1 = %6u ---- \r\n", APP_LOG(TS_OFF, VLEVEL_M, "\r\nThreshold 1: Acc = %6u (mm/s) ---- Measure 1 = %6u (mm/s)---- \r\n",
(int)(sts_fall_detection_acc_threshold), (int)(sts_fall_rising_pattern_factor1/10)); (int)(sts_fall_detection_acc_threshold), (int)(sts_fall_rising_pattern_factor1));
APP_LOG(TS_OFF, VLEVEL_M, "\r\nThreshold 2: Dis = %6u cm --- Measure 2 = %6u cm ---- \r\n", APP_LOG(TS_OFF, VLEVEL_M, "\r\nThreshold 2: Dis = %6u (cm) --- Measure 2 = %6u (cm) ---- \r\n",
(int)(sts_fall_detection_depth_threshold), (int)(sts_fall_rising_pattern_factor2/10)); (int)(sts_fall_detection_depth_threshold), (int)(sts_fall_rising_pattern_factor2/10));
APP_LOG(TS_OFF, VLEVEL_M, "\r\nMeasure 3 = %6u (score) ---- \r\n", (int)(sts_fall_rising_pattern_factor3));
//#endif //#endif
// ******************************************* // *******************************************
@ -779,7 +791,7 @@ void STS_YunhornCheckStandardDeviation(void)
// Considering factor #2 --- fall down depth, say > 30 cm 40 cm in given factor 1 time unit // Considering factor #2 --- fall down depth, say > 30 cm 40 cm in given factor 1 time unit
// //
if ((sts_fall_rising_pattern_factor2 > sts_fall_detection_depth_threshold ) && (average_presence_distance > 1000*DEFAULT_START_M)) if ((sts_fall_rising_pattern_factor2 > (sts_fall_detection_depth_threshold*10) ) && (average_presence_distance > 1000*DEFAULT_START_M))
{ {
sts_fall_rising_detected_result = STS_PRESENCE_FALL; sts_fall_rising_detected_result = STS_PRESENCE_FALL;
//last_sts_fall_rising_detected_result = sts_fall_rising_detected_result; //last_sts_fall_rising_detected_result = sts_fall_rising_detected_result;

View File

@ -273,7 +273,7 @@ void STS_YunhornSTSEventP2_Process(void)
//STS_Lamp_Bar_Refresh(); //TODO XXX eliminate refresh every second.... try //STS_Lamp_Bar_Refresh(); //TODO XXX eliminate refresh every second.... try
if ((sts_work_mode >= STS_RSS_MODE) && (sts_work_mode <= STS_TOF_RSS_MODE)) if ((sts_work_mode >= STS_RSS_MODE) && (sts_work_mode <= STS_TOF_RSS_MODE))
{ {
if (sts_presence_fall_detection == TRUE) { if (sts_presence_fall_detection == FALSE) { // otherwise, has been set to full/simple/etc.
sts_rss_config_updated_flag = STS_RSS_CONFIG_FALL_DETECTION; sts_rss_config_updated_flag = STS_RSS_CONFIG_FALL_DETECTION;
} }
sts_presence_rss_fall_rise_detection(); sts_presence_rss_fall_rise_detection();
@ -283,7 +283,7 @@ void STS_YunhornSTSEventP2_Process(void)
last_sts_rss_result = sts_rss_result; last_sts_rss_result = sts_rss_result;
//sts_fall_rising_detected_result_changed_flag = (sts_fall_rising_detected_result == last_sts_fall_rising_detected_result)?0:1; //sts_fall_rising_detected_result_changed_flag = (sts_fall_rising_detected_result == last_sts_fall_rising_detected_result)?0:1;
sts_fall_rising_detected_result_changed_flag = (sts_fall_rising_detected_result != last_sts_fall_rising_detected_result)?1:0; //sts_fall_rising_detected_result_changed_flag = (sts_fall_rising_detected_result != last_sts_fall_rising_detected_result)?1:0;
last_sts_fall_rising_detected_result = sts_fall_rising_detected_result; last_sts_fall_rising_detected_result = sts_fall_rising_detected_result;
@ -657,7 +657,7 @@ void STS_Combined_Status_Processing(void)
} }
if ((sts_rss_result_changed_flag))//|| (sts_reed_hall_changed_flag)||(sts_fall_rising_detected_result_changed_flag)) if ((sts_rss_result_changed_flag)|| (sts_reed_hall_changed_flag)||(sts_fall_rising_detected_result_changed_flag))
{ {
//sts_rss_result_changed_flag =0; //sts_rss_result_changed_flag =0;
//sts_reed_hall_changed_flag =0; //sts_reed_hall_changed_flag =0;

View File

@ -2527,7 +2527,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
UTIL_MEM_set_8((void*)outbuf, 0x0, sizeof(outbuf)); UTIL_MEM_set_8((void*)outbuf, 0x0, sizeof(outbuf));
UTIL_MEM_cpy_8((void*)outbuf,(void*)tlv_buf, tlv_buf_size); UTIL_MEM_cpy_8((void*)outbuf,(void*)tlv_buf, tlv_buf_size);
i = tlv_buf_size; i = tlv_buf_size;
APP_LOG(TS_OFF, VLEVEL_L, "###### RSS Full CFG=%s\r\n",(char *)outbuf); APP_LOG(TS_OFF, VLEVEL_M, "###### RSS Full CFG=%s\r\n",(char *)outbuf);
// Step 2: Save valid config to NVM // Step 2: Save valid config to NVM
sts_cfg_nvm.mtmcode1 = sts_mtmcode1; sts_cfg_nvm.mtmcode1 = sts_mtmcode1;