|
|
@ -83,7 +83,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_DOWNSAMPLING_FACTOR (2) //default 1
|
|
|
|
#define DEFAULT_DOWNSAMPLING_FACTOR (2) //default 1
|
|
|
|
//#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.40f) //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
|
|
|
|
#define DEFAULT_MOTION_FEATURE_LEN (10) //MOTION FEATURE IDENDIFIED
|
|
|
|
#define DEFAULT_MOTION_FEATURE_LEN (10) //MOTION FEATURE IDENDIFIED
|
|
|
@ -462,7 +462,8 @@ int sts_presence_rss_fall_rise_detection(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//acc_integration_sleep_ms(1000 / DEFAULT_UPDATE_RATE_PRESENCE); // 15ms, DEFAULT_UPDATE_RATE);
|
|
|
|
//acc_integration_sleep_ms(1000 / DEFAULT_UPDATE_RATE_PRESENCE); // 15ms, DEFAULT_UPDATE_RATE);
|
|
|
|
acc_integration_sleep_ms(2);
|
|
|
|
acc_integration_sleep_ms(10); // --- around 1500 ms in total
|
|
|
|
|
|
|
|
//acc_integration_sleep_ms(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
deactivated = acc_detector_presence_deactivate(handle);
|
|
|
|
deactivated = acc_detector_presence_deactivate(handle);
|
|
|
@ -516,11 +517,11 @@ int sts_presence_rss_fall_rise_detection(void)
|
|
|
|
|
|
|
|
|
|
|
|
if (!result.data_saturated)
|
|
|
|
if (!result.data_saturated)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_H,"\n%u ", i);
|
|
|
|
//APP_LOG(TS_OFF, VLEVEL_L,"\n%u ", i);
|
|
|
|
//print_result(result);
|
|
|
|
//print_result(result);
|
|
|
|
if ((result.presence_detected) && (result.presence_score > DEFAULT_THRESHOLD))
|
|
|
|
if ((result.presence_detected) && (result.presence_score > DEFAULT_THRESHOLD))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
print_result(result);
|
|
|
|
//print_result(result);
|
|
|
|
average_result++;
|
|
|
|
average_result++;
|
|
|
|
average_distance += result.presence_distance;
|
|
|
|
average_distance += result.presence_distance;
|
|
|
|
average_score += result.presence_score;
|
|
|
|
average_score += result.presence_score;
|
|
|
@ -549,15 +550,15 @@ int sts_presence_rss_fall_rise_detection(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ~12 ms per RSS scan
|
|
|
|
// ~12 ms per RSS scan
|
|
|
|
// acc_integration_sleep_ms(1000 / DEFAULT_UPDATE_RATE_PRESENCE); // 15 ms, DEFAULT_UPDATE_RATE);
|
|
|
|
// acc_integration_sleep_ms(1000 / DEFAULT_UPDATE_RATE_PRESENCE); // 15 ms, DEFAULT_UPDATE_RATE);
|
|
|
|
//acc_integration_sleep_ms(10); --- around 1500 ms in total
|
|
|
|
acc_integration_sleep_ms(10); //--- around 1500 ms in total
|
|
|
|
acc_integration_sleep_ms(2); //--- around 1000ms in total
|
|
|
|
//acc_integration_sleep_ms(2); //--- around 1000ms in total
|
|
|
|
}
|
|
|
|
}
|
|
|
|
deactivated = acc_detector_presence_deactivate(handle);
|
|
|
|
deactivated = acc_detector_presence_deactivate(handle);
|
|
|
|
acc_detector_presence_destroy(&handle);
|
|
|
|
acc_detector_presence_destroy(&handle);
|
|
|
|
acc_rss_deactivate();
|
|
|
|
acc_rss_deactivate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\n Second Half --- Motion Count Sum to = %u \r\n", motion_count);
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_H, "\r\n Second Half --- Motion Count Sum to = %u \r\n", 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_L,"Second Half, Fall Rise Detection, Motion Count = %u \r\n", (int)motion_count);
|
|
|
|
|
|
|
|
|
|
|
@ -578,11 +579,11 @@ int sts_presence_rss_fall_rise_detection(void)
|
|
|
|
|
|
|
|
|
|
|
|
sts_presence_rss_distance = average_distance;
|
|
|
|
sts_presence_rss_distance = average_distance;
|
|
|
|
sts_presence_rss_score = average_score;
|
|
|
|
sts_presence_rss_score = average_score;
|
|
|
|
sts_rss_result = (average_result > (DEFAULT_UPDATE_RATE_PRESENCE/5))? 1: 0;
|
|
|
|
sts_rss_result = (average_result > (DEFAULT_UPDATE_RATE_PRESENCE/20))? 1: 0;
|
|
|
|
|
|
|
|
|
|
|
|
//if (average_result) //if (average_score !=0) //if (sts_rss_result)
|
|
|
|
if (sts_rss_result) //if (average_score !=0) //if (sts_rss_result)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_L,"\r\n######## Motion: %u Distance=%u mm, Score=%u Average_result=%u out of %u \r\n",
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_M,"\r\n######## Motion: %u Distance=%u mm, Score=%u Average_result=%u out of %u \r\n",
|
|
|
|
(uint8_t)sts_rss_result,(int) sts_presence_rss_distance, (int)(sts_presence_rss_score), (int)average_result, (int)iterations);
|
|
|
|
(uint8_t)sts_rss_result,(int) sts_presence_rss_distance, (int)(sts_presence_rss_score), (int)average_result, (int)iterations);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -614,9 +615,9 @@ int sts_presence_rss_fall_rise_detection(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RSS feature 3: No motion, or stay still , or unconscious process
|
|
|
|
// RSS feature 3: No motion, or stay still , or unconscious process
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_M,"\r\n|Motion Detected Count =%u \r\n", motion_detected_count);
|
|
|
|
// APP_LOG(TS_OFF, VLEVEL_M,"\r\n|Motion Detected Count =%u \r\n", motion_detected_count);
|
|
|
|
uint8_t thiscnt= motion_detected_count++;
|
|
|
|
uint8_t thiscnt= motion_detected_count++;
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_M,"\r\n|Motion Detected Count =%u and thiscnt=%u \r\n", motion_detected_count, thiscnt);
|
|
|
|
// APP_LOG(TS_OFF, VLEVEL_M,"\r\n|Motion Detected Count =%u and thiscnt=%u \r\n", motion_detected_count, thiscnt);
|
|
|
|
if (motion_detected_count == 10) {
|
|
|
|
if (motion_detected_count == 10) {
|
|
|
|
//for (uint8_t j=0; j<12; j++) motion_in_hs_zone[j][thiscnt]=0;
|
|
|
|
//for (uint8_t j=0; j<12; j++) motion_in_hs_zone[j][thiscnt]=0;
|
|
|
|
motion_detected_count=0;
|
|
|
|
motion_detected_count=0;
|
|
|
@ -625,7 +626,7 @@ int sts_presence_rss_fall_rise_detection(void)
|
|
|
|
OnSensorRSS3CStateChanged();
|
|
|
|
OnSensorRSS3CStateChanged();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#ifdef LOG_RSS
|
|
|
|
#ifdef LOG_RSS
|
|
|
|
if (sts_work_mode == STS_UNI_MODE)
|
|
|
|
if (sts_work_mode == STS_UNI_MODE)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_M,"\r\nSensor at Ceiling Height: %u cm\r\n",(uint16_t)sts_sensor_install_height/10);
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_M,"\r\nSensor at Ceiling Height: %u cm\r\n",(uint16_t)sts_sensor_install_height/10);
|
|
|
@ -644,7 +645,7 @@ int sts_presence_rss_fall_rise_detection(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_M,"\r\n|-----------Floor Ground-----------^-----|\r\n");
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_M,"\r\n|-----------Floor Ground-----------^-----|\r\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (deactivated && success)
|
|
|
|
if (deactivated && success)
|
|
|
|