diff --git a/Core/Inc/yunhorn_sts_sensors.h b/Core/Inc/yunhorn_sts_sensors.h index 83f635c..39e6b28 100644 --- a/Core/Inc/yunhorn_sts_sensors.h +++ b/Core/Inc/yunhorn_sts_sensors.h @@ -192,7 +192,8 @@ enum sts_presence_fall_detection_type { STS_PRESENCE_NONE=0, STS_PRESENCE_FALL, STS_PRESENCE_RISING, - STS_PRESENCE_LAYDOWN + STS_PRESENCE_LAYDOWN, + STS_PRESENCE_UNCONCIOUS }; enum sts_sensor_result_t { diff --git a/Core/Src/yunhorn_sts_presence_rss.c b/Core/Src/yunhorn_sts_presence_rss.c index 9adaee3..22926d6 100644 --- a/Core/Src/yunhorn_sts_presence_rss.c +++ b/Core/Src/yunhorn_sts_presence_rss.c @@ -79,7 +79,7 @@ #define DEFAULT_MOTION_DATASET_LEN (128) //MOTION DATASET/PATTERN COLLECTION #define DEFAULT_MOTION_FEATURE_LEN (10) //MOTION FEATURE IDENDIFIED - +#define DEFAULT_UNCONCIOUS_THRESHOLD (250) extern volatile uint8_t sts_fall_detection_acc_threshold, sts_fall_detection_depth_threshold, sts_occupancy_overtime_threshold; volatile uint8_t sts_unconcious_state=0; @@ -597,10 +597,10 @@ void STS_YunhornCheckStandardDeviation(void) #ifdef LOG_RSS APP_LOG(TS_OFF, VLEVEL_L, "\r\n-------------Distance Average =%6u; Variance = %6u ; Standard =%6u \r\n", (int)(average_presence_distance*1000.0f), (int)(variance_presence_distance*1000.0f), (int)(standard_variance_presence_distance*1000.0f)); - - APP_LOG(TS_OFF, VLEVEL_L, "-------------Motion Average =%6u; Variance = %6u ; Standard =%6u \r\n", +#endif + APP_LOG(TS_OFF, VLEVEL_M, "-------------Motion Average =%6u; Variance = %6u ; Standard =%6u \r\n", (int)(average_presence_score*1000.0f), (int)(variance_presence_score*1000.0f), (int)(standard_variance_presence_score*1000.0f)); - +#ifdef LOG_RSS APP_LOG(TS_OFF, VLEVEL_L, "-------------ROC Dist Average =%6u; Variance = %6u ; Standard =%6u \r\n", (int)(average_roc_distance), (int)(variance_roc_distance), (int)(standard_variance_roc_distance)); @@ -643,7 +643,9 @@ void STS_YunhornCheckStandardDeviation(void) sts_motion_feature[motion_feature_count].fall_rising = sts_fall_rising_detected_result; 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 ) { APP_LOG(TS_OFF, VLEVEL_M, "\r\n\n\n >>>>>>>>>>>>>>>>> Suspecious Object FALL DOWN detected \r\n"); diff --git a/Core/Src/yunhorn_sts_process.c b/Core/Src/yunhorn_sts_process.c index 034baf4..3bd53b6 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -113,6 +113,7 @@ char sts_presence_fall_detection_message[5][20]={ "State_Fall_Down", "State_Rising_Up", "State_Laydown", + "State_Unconcious" }; #endif @@ -706,6 +707,10 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(void) sts_o7_sensorData.rss_presence_score = (uint16_t)(sts_presence_rss_score)&0xFFFF; // uint8_t sts_unconcious_state; // uint16_t sts_unconcious_threshold, sts_unconcious_threshold_duration; + + sts_o7_sensorData.unconcious_state=(sts_fall_rising_detected_result == STS_PRESENCE_UNCONCIOUS)? 1:0; + +#if 0 if (sts_presence_rss_score < sts_unconcious_threshold) { sts_o7_sensorData.unconcious_state = sts_presence_rss_score; @@ -713,6 +718,7 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(void) { sts_o7_sensorData.unconcious_state = 0; } +#endif } else { APP_LOG(TS_OFF, VLEVEL_M, "\r\n......STS_NO MOTION............\r\n"); sts_o7_sensorData.rss_presence_distance = 0x0; diff --git a/STM32CubeIDE/Release/STS_O7.bin b/STM32CubeIDE/Release/STS_O7.bin index 81d102f..1d5dbaf 100644 Binary files a/STM32CubeIDE/Release/STS_O7.bin and b/STM32CubeIDE/Release/STS_O7.bin differ