not trigger send uplink when RSS changed

This commit is contained in:
Yunhorn 2024-05-12 15:14:14 +08:00
parent 8d0249df33
commit 354c1332e5
5 changed files with 12 additions and 9 deletions

View File

@ -210,7 +210,7 @@
#ifdef YUNHORN_STS_O7_ENABLED #ifdef YUNHORN_STS_O7_ENABLED
#define MajorVer 24U #define MajorVer 24U
#define MinorVer 05U #define MinorVer 05U
#define SubMinorVer 05U #define SubMinorVer 12U
#define FirmwareVersion 3U #define FirmwareVersion 3U
#define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U #define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U

View File

@ -238,7 +238,7 @@ void STS_Combined_Status_Processing(void)
event_start_time = mems_event_time.Seconds; event_start_time = mems_event_time.Seconds;
event_stop_time = 0; event_stop_time = 0;
APP_LOG(TS_OFF, VLEVEL_M, "\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);
} }
@ -250,7 +250,7 @@ void STS_Combined_Status_Processing(void)
event_start_time = 0; event_start_time = 0;
APP_LOG(TS_OFF, VLEVEL_M, "\r\n Event Stop at %6u Seconds \r\n", event_stop_time); APP_LOG(TS_OFF, VLEVEL_H, "\r\n Event Stop at %6u Seconds \r\n", event_stop_time);
} }
} }
@ -390,7 +390,7 @@ void STS_Combined_Status_Processing(void)
//if ((sts_rss_result_changed_flag)|| (sts_reed_hall_changed_flag) || (sts_tof_result_changed_flag) || (sts_water_leakage_changed_flag)) //if ((sts_rss_result_changed_flag)|| (sts_reed_hall_changed_flag) || (sts_tof_result_changed_flag) || (sts_water_leakage_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;
sts_tof_result_changed_flag =0; sts_tof_result_changed_flag =0;
#ifdef STS_M1 #ifdef STS_M1

View File

@ -291,7 +291,7 @@ 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); uint32_t detected_zone = (uint32_t)((float)(result.presence_distance - DEFAULT_START_M) / (float)DEFAULT_ZONE_LENGTH);
APP_LOG(TS_OFF, VLEVEL_L,"Motion in zone: %u, distance: %d, score: %d\n", (unsigned int)detected_zone, APP_LOG(TS_OFF, VLEVEL_H,"Motion in zone: %u, distance: %d, score: %d\n", (unsigned int)detected_zone,
(int)(result.presence_distance * 1000.0f), (int)(result.presence_distance * 1000.0f),
(int)(result.presence_score * 1000.0f)); (int)(result.presence_score * 1000.0f));
} }
@ -367,9 +367,10 @@ int sts_presence_rss_fall_rise_detection(void)
float average_score =0.0f; float average_score =0.0f;
uint8_t k=0; uint8_t k=0;
uint16_t motion_in_zone[10]={0x0}; uint16_t motion_in_zone[10]={0x0};
uint16_t detected_zone=0;
//for (k=0; k<5; k++) {motion_in_zone[k]=0;} //for (k=0; k<5; k++) {motion_in_zone[k]=0;}
#if 0 #if 1
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);
@ -387,6 +388,8 @@ int sts_presence_rss_fall_rise_detection(void)
average_result++; average_result++;
average_distance += result.presence_distance; average_distance += result.presence_distance;
average_score += result.presence_score; average_score += result.presence_score;
detected_zone = (uint16_t)((float)(result.presence_distance - DEFAULT_START_M) / (float)DEFAULT_ZONE_LENGTH);
motion_in_zone[detected_zone]++;
} }
if (sts_presence_fall_detection == 1) if (sts_presence_fall_detection == 1)
@ -429,7 +432,7 @@ int sts_presence_rss_fall_rise_detection(void)
} }
acc_detector_presence_configuration_destroy(&presence_configuration); acc_detector_presence_configuration_destroy(&presence_configuration);
// set to full lenght of iteration // set to full lenght of iteration
for (int i = 0; i < (iterations); 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);
if (!success) if (!success)
@ -446,7 +449,7 @@ int sts_presence_rss_fall_rise_detection(void)
average_result++; average_result++;
average_distance += result.presence_distance; average_distance += result.presence_distance;
average_score += result.presence_score; average_score += result.presence_score;
uint16_t detected_zone = (uint16_t)((float)(result.presence_distance - DEFAULT_START_M) / (float)DEFAULT_ZONE_LENGTH); detected_zone = (uint16_t)((float)(result.presence_distance - DEFAULT_START_M) / (float)DEFAULT_ZONE_LENGTH);
motion_in_zone[detected_zone]++; motion_in_zone[detected_zone]++;
} }

View File

@ -960,7 +960,7 @@ static void SendTxData(void)
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.over_stay_duration>>8)&0xff; //13 occupancy over time or not AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.over_stay_duration>>8)&0xff; //13 occupancy over time or not
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.over_stay_duration)&0xff; //13 occupancy over time or not AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.over_stay_duration)&0xff; //13 occupancy over time or not
#endif #endif
#if 0 #if 1
APP_LOG(TS_OFF, VLEVEL_L, APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| Color | Mode |\r\n######| %4s | %5s |\r\n",(char *)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[AppData.Buffer[1]]); "\r\n######| Color | Mode |\r\n######| %4s | %5s |\r\n",(char *)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[AppData.Buffer[1]]);
APP_LOG(TS_OFF, VLEVEL_L, APP_LOG(TS_OFF, VLEVEL_L,

Binary file not shown.