RM2_1 #2

Merged
sundp merged 208 commits from RM2_1 into master 2024-09-13 09:16:14 +08:00
2 changed files with 17 additions and 14 deletions
Showing only changes of commit 0e432db748 - Show all commits

View File

@ -58,7 +58,7 @@
#define DEFAULT_SENSOR_ID (1)
#define DEFAULT_START_M (0.8f) //(0.80f) //default 0.2 unit(meter) [1]
#define DEFAULT_LENGTH_M (3.5f) // (2.0f)) //default 1.0 unit(meter) [2]
#define DEFAULT_LENGTH_M (2.2f) // (2.0f)) //default 1.0 unit(meter) [2]
#define DEFAULT_ZONE_LENGTH (0.4f) //default 0.4 unit(meter)
#define DEFAULT_UPDATE_RATE_WAKEUP (2.0f) //default 80 unit(hz)
#define DEFAULT_UPDATE_RATE_TRACKING (10.0f) //default 80 unit(hz) [7]
@ -318,13 +318,13 @@ static void print_result(acc_detector_presence_result_t result)
//uint32_t detected_zone = (uint32_t)((float)(result.presence_distance - DEFAULT_START_M) / (float)DEFAULT_ZONE_LENGTH);
// 2024-08-05
uint32_t detected_zone = (uint32_t)((float)(result.presence_distance) / (float)DEFAULT_ZONE_LENGTH);
APP_LOG(TS_OFF, VLEVEL_H,"Motion in zone: %u, distance: %d, score: %d\n", (unsigned int)detected_zone,
APP_LOG(TS_OFF, VLEVEL_M,"Motion in zone: %u, distance: %d, score: %d\n", (unsigned int)detected_zone,
(int)(result.presence_distance * 1000.0f),
(int)(result.presence_score * 1000.0f));
}
else
{
APP_LOG(TS_OFF, VLEVEL_H,"No motion, score: %u\n", (int)(result.presence_score * 1000.0f));
APP_LOG(TS_OFF, VLEVEL_M,"No motion, score: %u\n", (int)(result.presence_score * 1000.0f));
}
}
@ -469,7 +469,7 @@ int sts_presence_rss_fall_rise_detection(void)
acc_detector_presence_destroy(&handle);
acc_rss_deactivate();
APP_LOG(TS_OFF, VLEVEL_H, "\r\n First Half --- Motion Count = %u \r\n", motion_count);
APP_LOG(TS_OFF, VLEVEL_M, "\r\n First Half --- Motion Count = %u \r\n", motion_count);
//acc_detector_presence_deactivate(handle);
}
@ -516,11 +516,11 @@ int sts_presence_rss_fall_rise_detection(void)
if (!result.data_saturated)
{
//APP_LOG(TS_OFF, VLEVEL_H,"\n%u ", i);
APP_LOG(TS_OFF, VLEVEL_H,"\n%u ", i);
//print_result(result);
if ((result.presence_detected) && (result.presence_score > DEFAULT_THRESHOLD))
{
//print_result(result);
print_result(result);
average_result++;
average_distance += result.presence_distance;
average_score += result.presence_score;
@ -603,7 +603,7 @@ int sts_presence_rss_fall_rise_detection(void)
* Fall Detection settings
*/
if (sts_fall_rising_detected_result)
if (sts_fall_rising_detected_result != STS_PRESENCE_NORMAL)
{
LED1_ON;
OnSensorRSS3BStateChanged();
@ -614,8 +614,11 @@ int sts_presence_rss_fall_rise_detection(void)
}
// RSS feature 3: No motion, or stay still , or unconscious process
uint8_t thiscnt= motion_detected_count;
if (motion_detected_count++ == 10) {
APP_LOG(TS_OFF, VLEVEL_M,"\r\n|Motion Detected Count =%u \r\n", 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);
if (motion_detected_count == 10) {
//for (uint8_t j=0; j<12; j++) motion_in_hs_zone[j][thiscnt]=0;
motion_detected_count=0;
}
@ -627,7 +630,7 @@ int sts_presence_rss_fall_rise_detection(void)
{
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\n|Motion Distance Zone| ##### |Height cm|\r\n");
uint8_t kk = (uint8_t)((uint16_t)(sts_sensor_install_height/1000)/(DEFAULT_ZONE_LENGTH));
uint8_t kk = (uint8_t)(((int)sts_sensor_install_height/1000)/(DEFAULT_ZONE_LENGTH));
APP_LOG(TS_OFF, VLEVEL_M,"\r\n|-----------Ceiling-------Sensor---V-----|\r\n");
for (uint8_t k=0; k <=kk; k++)
{

View File

@ -802,10 +802,10 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(STS_OO_SensorStatusDataTypeDef *senso
// uint8_t sts_unconscious_state;
// uint16_t sts_unconscious_threshold, sts_unconscious_threshold_duration;
}
//else {
// sensor_data->rss_presence_distance = 0x0;
// sensor_data->rss_presence_score = 0x0;
// }
else {
sensor_data->rss_presence_distance = 0x0;
sensor_data->rss_presence_score = 0x0;
}
// no_movement or unconscious duration
sensor_data->unconscious_state = ((sts_fall_rising_detected_result == STS_PRESENCE_UNCONSCIOUS) ||