remove unused code
This commit is contained in:
parent
bfb86a6241
commit
b3cd7d9c22
|
@ -81,6 +81,7 @@ extern volatile float sts_presence_rss_distance;
|
||||||
extern volatile uint8_t sensor_data_ready;
|
extern volatile uint8_t sensor_data_ready;
|
||||||
extern SysTime_t mems_event_time;
|
extern SysTime_t mems_event_time;
|
||||||
extern volatile uint32_t event_start_time, event_stop_time;
|
extern volatile uint32_t event_start_time, event_stop_time;
|
||||||
|
extern volatile uint32_t event_door_lock_start_time, event_door_lock_stop_time;
|
||||||
uint8_t luminance_level = DEFAULT_LUMINANCE_LEVEL;
|
uint8_t luminance_level = DEFAULT_LUMINANCE_LEVEL;
|
||||||
|
|
||||||
|
|
||||||
|
@ -238,6 +239,7 @@ void STS_Combined_Status_Processing(void)
|
||||||
if (event_start_time == 0) {
|
if (event_start_time == 0) {
|
||||||
|
|
||||||
event_start_time = mems_event_time.Seconds;
|
event_start_time = mems_event_time.Seconds;
|
||||||
|
event_door_lock_start_time = event_start_time;
|
||||||
event_stop_time = 0;
|
event_stop_time = 0;
|
||||||
|
|
||||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n Event Started at %6u Seconds \r\n", event_start_time);
|
APP_LOG(TS_OFF, VLEVEL_H, "\r\n Event Started at %6u Seconds \r\n", event_start_time);
|
||||||
|
@ -249,7 +251,7 @@ void STS_Combined_Status_Processing(void)
|
||||||
if (event_stop_time ==0)
|
if (event_stop_time ==0)
|
||||||
{
|
{
|
||||||
event_stop_time = mems_event_time.Seconds;
|
event_stop_time = mems_event_time.Seconds;
|
||||||
|
event_door_lock_stop_time = event_stop_time;
|
||||||
event_start_time = 0;
|
event_start_time = 0;
|
||||||
|
|
||||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n Event Stop at %6u Seconds, Duration = %6u Seconds\r\n", event_stop_time, (event_stop_time-event_start_time));
|
APP_LOG(TS_OFF, VLEVEL_H, "\r\n Event Stop at %6u Seconds, Duration = %6u Seconds\r\n", event_stop_time, (event_stop_time-event_start_time));
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
//#define DEFAULT_UPDATE_RATE_PRESENCE (80.0F) //(65.0f) //default 80 unit(hz)
|
//#define DEFAULT_UPDATE_RATE_PRESENCE (80.0F) //(65.0f) //default 80 unit(hz)
|
||||||
|
|
||||||
#define DEFAULT_HWAAS (63) //default 10 unit(hz)
|
#define DEFAULT_HWAAS (63) //default 10 unit(hz)
|
||||||
#define DEFAULT_THRESHOLD (1.5f) //default 1.5 level float [3]
|
#define DEFAULT_THRESHOLD (1.2f) //default 1.5 level float [3]
|
||||||
|
|
||||||
//acc_detector_presence_configuration_filter_parameters_t
|
//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_DEVIATION_TIME_CONST (0.5f) //default 0.5 unit(seconds) [6]
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
#define DEFAULT_NBR_REMOVED_PC (0) //default 0 int [10]
|
#define DEFAULT_NBR_REMOVED_PC (0) //default 0 int [10]
|
||||||
|
|
||||||
#define DEFAULT_DOWNSAMPLING_FACTOR (2) //default 1
|
#define DEFAULT_DOWNSAMPLING_FACTOR (2) //default 1
|
||||||
#define DEFAULT_RECEIVER_GAIN (0.40f) //default 0.9 gain mdB [4]
|
#define DEFAULT_RECEIVER_GAIN (0.65f) //default 0.9 gain mdB [4]
|
||||||
//#define DEFAULT_RECEIVER_GAIN (0.65f) //default 0.9 gain mdB [4]
|
//#define DEFAULT_RECEIVER_GAIN (0.65f) //default 0.9 gain mdB [4]
|
||||||
|
|
||||||
#define DEFAULT_MOTION_DATASET_LEN (128) //MOTION DATASET/PATTERN COLLECTION
|
#define DEFAULT_MOTION_DATASET_LEN (128) //MOTION DATASET/PATTERN COLLECTION
|
||||||
|
@ -175,14 +175,11 @@ static void set_default_configuration(acc_detector_presence_configuration_t pres
|
||||||
acc_detector_presence_configuration_downsampling_factor_set(presence_configuration, DEFAULT_DOWNSAMPLING_FACTOR);
|
acc_detector_presence_configuration_downsampling_factor_set(presence_configuration, DEFAULT_DOWNSAMPLING_FACTOR);
|
||||||
acc_detector_presence_configuration_receiver_gain_set(presence_configuration, DEFAULT_RECEIVER_GAIN);
|
acc_detector_presence_configuration_receiver_gain_set(presence_configuration, DEFAULT_RECEIVER_GAIN);
|
||||||
|
|
||||||
acc_detector_presence_configuration_filter_parameters_t filter = acc_detector_presence_configuration_filter_parameters_get(
|
acc_detector_presence_configuration_filter_parameters_t filter = acc_detector_presence_configuration_filter_parameters_get(presence_configuration);
|
||||||
presence_configuration);
|
|
||||||
filter.inter_frame_deviation_time_const = DEFAULT_INTER_FRAME_DEVIATION_TIME_CONST;
|
filter.inter_frame_deviation_time_const = DEFAULT_INTER_FRAME_DEVIATION_TIME_CONST;
|
||||||
|
|
||||||
// will be disabled if this value > 1/2 of update rate, default update rate 65, so must < 30
|
// will be disabled if this value > 1/2 of update rate, default update rate 65, so must < 30
|
||||||
//
|
|
||||||
filter.inter_frame_fast_cutoff = DEFAULT_INTER_FRAME_FAST_CUTOFF;
|
filter.inter_frame_fast_cutoff = DEFAULT_INTER_FRAME_FAST_CUTOFF;
|
||||||
|
|
||||||
filter.inter_frame_slow_cutoff = DEFAULT_INTER_FRAME_SLOW_CUTOFF;
|
filter.inter_frame_slow_cutoff = DEFAULT_INTER_FRAME_SLOW_CUTOFF;
|
||||||
|
|
||||||
// no effect if intra-frame-weight set to 0
|
// no effect if intra-frame-weight set to 0
|
||||||
|
@ -191,7 +188,7 @@ static void set_default_configuration(acc_detector_presence_configuration_t pres
|
||||||
// set the intra_frame_weight to 0.0
|
// 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;
|
filter.output_time_const = DEFAULT_OUTPUT_TIME_CONST; //0.0f;
|
||||||
acc_detector_presence_configuration_filter_parameters_set(presence_configuration, &filter);
|
acc_detector_presence_configuration_filter_parameters_set(presence_configuration, &filter);
|
||||||
acc_detector_presence_configuration_nbr_removed_pc_set(presence_configuration, DEFAULT_NBR_REMOVED_PC);
|
acc_detector_presence_configuration_nbr_removed_pc_set(presence_configuration, DEFAULT_NBR_REMOVED_PC);
|
||||||
|
@ -219,8 +216,7 @@ static void set_default_fall_rise_configuration(acc_detector_presence_configurat
|
||||||
acc_detector_presence_configuration_downsampling_factor_set(presence_configuration, DEFAULT_DOWNSAMPLING_FACTOR);
|
acc_detector_presence_configuration_downsampling_factor_set(presence_configuration, DEFAULT_DOWNSAMPLING_FACTOR);
|
||||||
acc_detector_presence_configuration_receiver_gain_set(presence_configuration, DEFAULT_RECEIVER_GAIN);
|
acc_detector_presence_configuration_receiver_gain_set(presence_configuration, DEFAULT_RECEIVER_GAIN);
|
||||||
|
|
||||||
acc_detector_presence_configuration_filter_parameters_t filter = acc_detector_presence_configuration_filter_parameters_get(
|
acc_detector_presence_configuration_filter_parameters_t filter = acc_detector_presence_configuration_filter_parameters_get(presence_configuration);
|
||||||
presence_configuration);
|
|
||||||
// if intra-frame-weight set to 1.0, then the following inter-frame parameters have no effect
|
// if intra-frame-weight set to 1.0, then the following inter-frame parameters have no effect
|
||||||
filter.inter_frame_deviation_time_const = DEFAULT_INTER_FRAME_DEVIATION_TIME_CONST;
|
filter.inter_frame_deviation_time_const = DEFAULT_INTER_FRAME_DEVIATION_TIME_CONST;
|
||||||
filter.inter_frame_fast_cutoff = 10.0f; //DEFAULT_INTER_FRAME_FAST_CUTOFF;
|
filter.inter_frame_fast_cutoff = 10.0f; //DEFAULT_INTER_FRAME_FAST_CUTOFF;
|
||||||
|
@ -443,7 +439,7 @@ int sts_presence_rss_fall_rise_detection(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
print_result(result);
|
print_result(result);
|
||||||
//if (!result.data_saturated)
|
if (!result.data_saturated)
|
||||||
{
|
{
|
||||||
if (result.presence_detected)
|
if (result.presence_detected)
|
||||||
{
|
{
|
||||||
|
@ -473,7 +469,7 @@ int sts_presence_rss_fall_rise_detection(void)
|
||||||
//APP_LOG(TS_OFF, VLEVEL_L,"Second Half, Fall Rise Detection, Motion Count = %u \r\n", (int)motion_count);
|
//APP_LOG(TS_OFF, VLEVEL_L,"Second Half, Fall Rise Detection, Motion Count = %u \r\n", (int)motion_count);
|
||||||
APP_LOG(TS_OFF, VLEVEL_H,"Fall Rise Detection, Motion Count = %u \r\n", (int)motion_count);
|
APP_LOG(TS_OFF, VLEVEL_H,"Fall Rise Detection, Motion Count = %u \r\n", (int)motion_count);
|
||||||
|
|
||||||
sts_rss_result = (average_result > 3)? 1: 0;
|
sts_rss_result = (average_result > 1)? 1: 0;
|
||||||
|
|
||||||
APP_LOG(TS_OFF, VLEVEL_H,"Average Motion Result = %u OUTPUT RSS RESULT=%u \r\n", (int)average_result, sts_rss_result);
|
APP_LOG(TS_OFF, VLEVEL_H,"Average Motion Result = %u OUTPUT RSS RESULT=%u \r\n", (int)average_result, sts_rss_result);
|
||||||
for (k=0; k<10; k++) {
|
for (k=0; k<10; k++) {
|
||||||
|
@ -618,6 +614,10 @@ void STS_YunhornCheckStandardDeviation(void)
|
||||||
(int)(sts_fall_detection_depth_threshold), (int)(sts_fall_rising_pattern_factor2));
|
(int)(sts_fall_detection_depth_threshold), (int)(sts_fall_rising_pattern_factor2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (standard_variance_presence_score <= DEFAULT_UNCONCIOUS_THRESHOLD) {
|
||||||
|
sts_fall_rising_detected_result = STS_PRESENCE_UNCONCIOUS;
|
||||||
|
}
|
||||||
|
|
||||||
if ( sts_fall_rising_pattern_factor1 > (uint16_t)sts_fall_detection_acc_threshold)
|
if ( sts_fall_rising_pattern_factor1 > (uint16_t)sts_fall_detection_acc_threshold)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -627,7 +627,7 @@ void STS_YunhornCheckStandardDeviation(void)
|
||||||
if ((sts_fall_rising_pattern_factor2 > sts_fall_detection_depth_threshold ) && (average_presence_distance > DEFAULT_START_M))
|
if ((sts_fall_rising_pattern_factor2 > sts_fall_detection_depth_threshold ) && (average_presence_distance > 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
motion_feature_count ++;
|
motion_feature_count ++;
|
||||||
|
@ -643,9 +643,7 @@ void STS_YunhornCheckStandardDeviation(void)
|
||||||
sts_motion_feature[motion_feature_count].fall_rising = sts_fall_rising_detected_result;
|
sts_motion_feature[motion_feature_count].fall_rising = sts_fall_rising_detected_result;
|
||||||
sts_roc_acc_standard_variance = (uint8_t) standard_variance_roc_acc;
|
sts_roc_acc_standard_variance = (uint8_t) standard_variance_roc_acc;
|
||||||
|
|
||||||
if (standard_variance_presence_score <= DEFAULT_UNCONCIOUS_THRESHOLD) {
|
|
||||||
sts_fall_rising_detected_result = STS_PRESENCE_UNCONCIOUS;
|
|
||||||
}
|
|
||||||
if ( sts_fall_rising_detected_result == STS_PRESENCE_FALL )
|
if ( sts_fall_rising_detected_result == STS_PRESENCE_FALL )
|
||||||
{
|
{
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\n\n\n >>>>>>>>>>>>>>>>> Suspecious Object FALL DOWN detected \r\n");
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\n\n\n >>>>>>>>>>>>>>>>> Suspecious Object FALL DOWN detected \r\n");
|
||||||
|
@ -655,7 +653,8 @@ void STS_YunhornCheckStandardDeviation(void)
|
||||||
// last_average_presence_distance = average_presence_distance;
|
// last_average_presence_distance = average_presence_distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((last_sts_fall_rising_detected_result == STS_PRESENCE_FALL))
|
}
|
||||||
|
if ((last_sts_fall_rising_detected_result == STS_PRESENCE_FALL))
|
||||||
{
|
{
|
||||||
if ((average_presence_distance < (sts_motion_feature[motion_feature_count].p_dist_avg + sts_motion_feature[motion_feature_count].p_dist_standard)))
|
if ((average_presence_distance < (sts_motion_feature[motion_feature_count].p_dist_avg + sts_motion_feature[motion_feature_count].p_dist_standard)))
|
||||||
{
|
{
|
||||||
|
@ -676,7 +675,7 @@ void STS_YunhornCheckStandardDeviation(void)
|
||||||
sts_fall_rising_detected_result = STS_PRESENCE_NONE;
|
sts_fall_rising_detected_result = STS_PRESENCE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
last_sts_fall_rising_detected_result = sts_fall_rising_detected_result;
|
||||||
last_average_presence_distance = average_presence_distance;
|
last_average_presence_distance = average_presence_distance;
|
||||||
#if 0
|
#if 0
|
||||||
if (sts_fall_rising_detected_result != STS_PRESENCE_NONE)
|
if (sts_fall_rising_detected_result != STS_PRESENCE_NONE)
|
||||||
|
|
|
@ -44,7 +44,7 @@ volatile uint8_t sensor_data_ready;
|
||||||
|
|
||||||
extern volatile uint8_t sts_reed_hall_result;
|
extern volatile uint8_t sts_reed_hall_result;
|
||||||
volatile uint8_t last_sts_reed_hall_result;
|
volatile uint8_t last_sts_reed_hall_result;
|
||||||
volatile uint32_t event_start_time, event_stop_time;
|
|
||||||
volatile uint8_t sts_soap_level_state;
|
volatile uint8_t sts_soap_level_state;
|
||||||
volatile STS_OO_SensorStatusDataTypeDef sts_o7_sensorData;
|
volatile STS_OO_SensorStatusDataTypeDef sts_o7_sensorData;
|
||||||
volatile STS_PRESENCE_SENSOR_Event_Status_t sts_o7_event_status;
|
volatile STS_PRESENCE_SENSOR_Event_Status_t sts_o7_event_status;
|
||||||
|
@ -56,6 +56,7 @@ volatile uint8_t sts_reed_hall_1_changed=0, sts_reed_hall_2_changed=0;
|
||||||
volatile uint8_t sts_rss_config_updated_flag = 0;
|
volatile uint8_t sts_rss_config_updated_flag = 0;
|
||||||
extern volatile uint8_t mems_int1_detected, link_wakeup, link_sleep;
|
extern volatile uint8_t mems_int1_detected, link_wakeup, link_sleep;
|
||||||
volatile uint32_t event_start_time=0, event_stop_time=0;
|
volatile uint32_t event_start_time=0, event_stop_time=0;
|
||||||
|
volatile uint32_t event_door_lock_start_time=0,event_door_lock_stop_time=0;
|
||||||
extern volatile uint8_t sts_occupancy_overtime_state;
|
extern volatile uint8_t sts_occupancy_overtime_state;
|
||||||
extern volatile STS_OO_RSS_SensorTuneDataTypeDef sts_presence_rss_config;
|
extern volatile STS_OO_RSS_SensorTuneDataTypeDef sts_presence_rss_config;
|
||||||
extern volatile sts_cfg_nvm_t sts_cfg_nvm;
|
extern volatile sts_cfg_nvm_t sts_cfg_nvm;
|
||||||
|
@ -427,112 +428,6 @@ void STS_YunhornSTSEventPIORS485_Process(void)
|
||||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\n P_IO_RS485 Process\r\n");
|
APP_LOG(TS_OFF, VLEVEL_L, "\r\n P_IO_RS485 Process\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
void STS_Combined_Status_Processing(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
switch (sts_work_mode)
|
|
||||||
{
|
|
||||||
case STS_NETWORK_MODE:
|
|
||||||
sts_status_color = sts_cloud_netcolor;
|
|
||||||
break;
|
|
||||||
case STS_WIRED_MODE: // NO LAMP BAR FOR THOSE WATER LEAKAGE SENSOR OR SOAP CAPACITY SENSORS
|
|
||||||
sts_status_color = STS_DARK;
|
|
||||||
sts_water_leakage_result = sts_reed_hall_result; // == STS_Status_Door_Open )?1U:0U; //STS_RESULT_WATER_LEAKAGE_YES:STS_RESULT_WATER_LEAKAGE_NO;
|
|
||||||
sts_water_leakage_changed_flag = 1;
|
|
||||||
break;
|
|
||||||
case STS_REEDSWITCH_MODE:
|
|
||||||
|
|
||||||
sts_status_color = (sts_reed_hall_result == STS_Status_Door_Open )? STS_GREEN: STS_RED;
|
|
||||||
|
|
||||||
break;
|
|
||||||
case STS_RSS_MODE:
|
|
||||||
if (sts_rss_result == STS_RESULT_NO_MOTION){
|
|
||||||
sts_status_color = STS_GREEN;
|
|
||||||
} else if ((sts_rss_result == STS_RESULT_MOTION))
|
|
||||||
{
|
|
||||||
sts_status_color = STS_RED;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case STS_DUAL_MODE:
|
|
||||||
if ((sts_rss_result == STS_RESULT_NO_MOTION) && (sts_reed_hall_result == STS_Status_Door_Open ))
|
|
||||||
{
|
|
||||||
sts_status_color = STS_GREEN;
|
|
||||||
|
|
||||||
} else if ((sts_rss_result == STS_RESULT_MOTION) || (sts_reed_hall_result == STS_Status_Door_Close ))
|
|
||||||
{
|
|
||||||
sts_status_color = STS_RED;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case STS_DUAL_RSS_MODE:
|
|
||||||
if ((sts_rss_result == STS_RESULT_NO_MOTION) && (sts_rss_2nd_result == STS_RESULT_NO_MOTION))
|
|
||||||
{
|
|
||||||
sts_status_color = STS_GREEN;
|
|
||||||
} else if ((sts_rss_result == STS_RESULT_MOTION) || (sts_rss_2nd_result == STS_RESULT_MOTION))
|
|
||||||
{
|
|
||||||
sts_status_color = STS_RED;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case STS_TOF_RSS_MODE:
|
|
||||||
if ((sts_rss_result == STS_RESULT_NO_MOTION) && (sts_tof_result == STS_RESULT_NO_PRESENCE)){
|
|
||||||
sts_status_color = STS_GREEN;
|
|
||||||
|
|
||||||
} else if ((sts_rss_result == STS_RESULT_MOTION) || (sts_tof_result == STS_RESULT_PRESENCE))
|
|
||||||
{
|
|
||||||
sts_status_color = STS_RED;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
// TO-DO LIST ***********************************************************
|
|
||||||
case STS_TOF_DISTANCE_MODE:
|
|
||||||
if ((sts_tof_result == STS_RESULT_NO_PRESENCE)) {
|
|
||||||
sts_status_color = STS_GREEN;
|
|
||||||
} else if ((sts_tof_result == STS_RESULT_PRESENCE)) {
|
|
||||||
sts_status_color = STS_RED;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case STS_TOF_PRESENCE_MODE:
|
|
||||||
if ((sts_tof_result == STS_RESULT_NO_PRESENCE)) {
|
|
||||||
sts_status_color = STS_GREEN;
|
|
||||||
} else if ((sts_tof_result == STS_RESULT_PRESENCE)) {
|
|
||||||
sts_status_color = STS_RED;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case STS_TOF_IN_OUT_MODE:
|
|
||||||
if ((sts_tof_result == STS_RESULT_NO_PRESENCE)) {
|
|
||||||
sts_status_color = STS_GREEN;
|
|
||||||
} else if ((sts_tof_result == STS_RESULT_PRESENCE)) {
|
|
||||||
sts_status_color = STS_RED;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// TO-DO LIST ***********************************************************
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (sts_work_mode != STS_WIRED_MODE)
|
|
||||||
{
|
|
||||||
if ((last_lamp_bar_color != sts_status_color))
|
|
||||||
{
|
|
||||||
sts_lamp_bar_color = ((sts_service_mask == STS_SERVICE_MASK_L0)? STS_DARK: sts_status_color);
|
|
||||||
|
|
||||||
STS_Lamp_Bar_Set_STS_RGB_Color(sts_lamp_bar_color, luminance_level);
|
|
||||||
if ((sts_service_mask == STS_SERVICE_MASK_L0) || (sts_lamp_bar_color == STS_DARK))
|
|
||||||
{
|
|
||||||
STS_WS2812B_Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
last_lamp_bar_color = sts_lamp_bar_color;
|
|
||||||
}
|
|
||||||
} else STS_Lamp_Bar_Set_Dark();
|
|
||||||
|
|
||||||
if ((sts_rss_result_changed_flag + sts_reed_hall_changed_flag + sts_tof_result_changed_flag +sts_water_leakage_changed_flag))
|
|
||||||
sensor_data_ready = 1U;
|
|
||||||
STS_PRESENCE_SENSOR_Prepare_Send_Data();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void STS_PRESENCE_SENSOR_WakeUp_Process_Sampling(void)
|
void STS_PRESENCE_SENSOR_WakeUp_Process_Sampling(void)
|
||||||
{
|
{
|
||||||
|
@ -551,69 +446,7 @@ void STS_PRESENCE_SENSOR_After_Wake_Up()
|
||||||
|
|
||||||
void STS_FallDetection_LampBarProcess(void)
|
void STS_FallDetection_LampBarProcess(void)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
char buf[32]={0x0};
|
|
||||||
uint8_t i=0;
|
|
||||||
switch (sts_fall_rising_detected_result)
|
|
||||||
{
|
|
||||||
case STS_PRESENCE_LAYDOWN:
|
|
||||||
sts_lamp_bar_color = STS_YELLOW;
|
|
||||||
sts_status_color = STS_YELLOW;
|
|
||||||
sts_rss_result = STS_RESULT_MOTION;
|
|
||||||
STS_Lamp_Bar_Set_STS_RGB_Color(sts_lamp_bar_color, luminance_level);
|
|
||||||
#if 0
|
|
||||||
buf[i++] = (uint8_t)sts_lamp_bar_color;
|
|
||||||
buf[i++] = (uint8_t)sts_work_mode;
|
|
||||||
buf[i++] = (uint8_t)sts_fall_rising_detected_result;
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
case STS_PRESENCE_FALL:
|
|
||||||
sts_lamp_bar_color = STS_BLUE; //STS_RED_BLUE;
|
|
||||||
sts_status_color = STS_BLUE; //STS_RED_BLUE;
|
|
||||||
sts_rss_result = STS_RESULT_MOTION;
|
|
||||||
STS_Lamp_Bar_Set_STS_RGB_Color(sts_lamp_bar_color, luminance_level);
|
|
||||||
#if 0
|
|
||||||
buf[i++] = (uint8_t)sts_lamp_bar_color;
|
|
||||||
buf[i++] = (uint8_t)sts_work_mode;
|
|
||||||
buf[i++] = (uint8_t)sts_fall_rising_detected_result;
|
|
||||||
|
|
||||||
buf[i++] = (uint8_t)(sts_fall_rising_pattern_factor1/10 + 0x30)&0xFF;
|
|
||||||
buf[i++] = (uint8_t)(sts_fall_rising_pattern_factor1%10 + 0x30)&0xFF;
|
|
||||||
buf[i++] = (uint8_t)(sts_roc_acc_standard_variance/10 + 0x30)&0xFF;
|
|
||||||
buf[i++] = (uint8_t)(sts_roc_acc_standard_variance%10 + 0x30)&0xFF;
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case STS_PRESENCE_RISING:
|
|
||||||
sts_lamp_bar_color = STS_RED; // normal occupancy status
|
|
||||||
sts_status_color = STS_RED; // normal occupancy status
|
|
||||||
sts_rss_result = STS_RESULT_MOTION;
|
|
||||||
STS_Lamp_Bar_Set_STS_RGB_Color(sts_lamp_bar_color, luminance_level);
|
|
||||||
#if 0
|
|
||||||
buf[i++] = (uint8_t)sts_lamp_bar_color;
|
|
||||||
buf[i++] = (uint8_t)sts_work_mode;
|
|
||||||
buf[i++] = (uint8_t)sts_fall_rising_detected_result;
|
|
||||||
|
|
||||||
// TESTING ONLY TO BE REMOVED
|
|
||||||
buf[i++] = (uint8_t)(sts_fall_rising_pattern_factor1/10 + 0x30)&0xFF;
|
|
||||||
buf[i++] = (uint8_t)(sts_fall_rising_pattern_factor1%10 + 0x30)&0xFF;
|
|
||||||
buf[i++] = (uint8_t)(sts_roc_acc_standard_variance/10 + 0x30)&0xFF;
|
|
||||||
buf[i++] = (uint8_t)(sts_roc_acc_standard_variance%10 + 0x30)&0xFF;
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\n <<<<<<<<<<<<<< Fall Rise state=%25s, send buf size = %d \r\n",
|
|
||||||
sts_presence_fall_detection_message[sts_fall_rising_detected_result], i )
|
|
||||||
|
|
||||||
STS_SENSOR_Upload_Message((LORAWAN_USER_APP_PORT+2), i, (char*)buf);
|
|
||||||
|
|
||||||
sts_fall_rising_detected_result = STS_PRESENCE_NONE;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void STS_YunhornSTSFallDetection(void)
|
void STS_YunhornSTSFallDetection(void)
|
||||||
|
@ -727,7 +560,8 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(void)
|
||||||
|
|
||||||
sts_o7_sensorData.fall_state = sts_fall_rising_detected_result;
|
sts_o7_sensorData.fall_state = sts_fall_rising_detected_result;
|
||||||
if (sts_fall_rising_detected_result != STS_PRESENCE_NONE)
|
if (sts_fall_rising_detected_result != STS_PRESENCE_NONE)
|
||||||
{ APP_LOG(TS_OFF, VLEVEL_M, "\r\n......FALL DETECTION............\r\n");
|
{
|
||||||
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\n......FALL RISING DETECTION RESULT: %25s............\r\n",sts_presence_fall_detection_message[sts_fall_rising_detected_result] );
|
||||||
sts_o7_sensorData.fall_speed = (uint8_t)sts_fall_rising_pattern_factor1;
|
sts_o7_sensorData.fall_speed = (uint8_t)sts_fall_rising_pattern_factor1;
|
||||||
sts_o7_sensorData.fall_gravity = (uint8_t)sts_roc_acc_standard_variance;
|
sts_o7_sensorData.fall_gravity = (uint8_t)sts_roc_acc_standard_variance;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue