remove unused code

This commit is contained in:
Yunhorn 2024-05-14 12:52:10 +08:00
parent b3cd7d9c22
commit 8fa8d59a9c
5 changed files with 10 additions and 126 deletions

View File

@ -193,7 +193,8 @@ enum sts_presence_fall_detection_type {
STS_PRESENCE_FALL,
STS_PRESENCE_RISING,
STS_PRESENCE_LAYDOWN,
STS_PRESENCE_UNCONCIOUS
STS_PRESENCE_UNCONCIOUS,
STS_PRESENCE_STAYSTILL
};
enum sts_sensor_result_t {

View File

@ -615,7 +615,7 @@ void STS_YunhornCheckStandardDeviation(void)
#endif
if (standard_variance_presence_score <= DEFAULT_UNCONCIOUS_THRESHOLD) {
sts_fall_rising_detected_result = STS_PRESENCE_UNCONCIOUS;
sts_fall_rising_detected_result = STS_PRESENCE_STAYSTILL;
}
if ( sts_fall_rising_pattern_factor1 > (uint16_t)sts_fall_detection_acc_threshold)

View File

@ -109,12 +109,13 @@ volatile uint8_t last_sts_rss_result=0;
//extern volatile uint8_t last_sts_reed_hall_result;
extern volatile uint8_t last_lamp_bar_color;
extern volatile float sts_presence_rss_distance;
char sts_presence_fall_detection_message[5][20]={
char sts_presence_fall_detection_message[10][20]={
"State_Normal",
"State_Fall_Down",
"State_Rising_Up",
"State_Laydown",
"State_Unconcious"
"State_Unconcious",
"State_StayStill"
};
#endif
@ -522,6 +523,7 @@ void STS_PRESENCE_SENSOR_Init_Send_Data(void)
sts_o7_sensorData.dutycycletimelevel = 1;
sensor_data_ready = 0;
}
void STS_PRESENCE_SENSOR_Prepare_Send_Data(void)
{
sts_o7_sensorData.lamp_bar_color = sts_lamp_bar_color;
@ -540,23 +542,12 @@ 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;
} else
{
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;
sts_o7_sensorData.rss_presence_score = 0x0;
}
sts_o7_sensorData.unconcious_state=(sts_fall_rising_detected_result == STS_PRESENCE_UNCONCIOUS)? 1:0;
sts_o7_sensorData.fall_state = sts_fall_rising_detected_result;
if (sts_fall_rising_detected_result != STS_PRESENCE_NONE)
@ -571,7 +562,7 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(void)
if ((sts_occupancy_overtime_threshold != 0) && (event_start_time !=0))
{
uint32_t check_time_tmp = occupy_check_time.Seconds - event_start_time;
check_time_tmp = event_door_lock_start_time -event_door_lock_stop_time;
//APP_LOG(TS_OFF, VLEVEL_L, "\r\n Check time at %6u Seconds, time lag =%6u, Started at %6u \r\n", occupy_check_time.Seconds, check_time_tmp, event_start_time);
if (check_time_tmp > sts_occupancy_overtime_threshold*60)

View File

@ -796,114 +796,6 @@ static void OnRxData(LmHandlerAppData_t *appData, LmHandlerRxParams_t *params)
/* USER CODE END OnRxData_1 */
}
static uint8_t PrepareSendTxData(void)
{
uint8_t i = 0;
uint8_t batteryLevel = GetBatteryLevel();
uint16_t batteryLevelmV = SYS_GetBatteryLevel();
//SysTime_t occupy_check_time = SysTimeGetMcuTime();
STS_PRESENCE_SENSOR_Prepare_Send_Data();
sts_o7_sensorData.battery_Pct = (uint8_t)(99*batteryLevel/254);
switch (sts_work_mode) {
case STS_WIRED_MODE:
AppData.Buffer[i++] = sts_mtmcode1;
AppData.Buffer[i++] = sts_mtmcode2;
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor1_on_off); //01 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.battery_Pct); //02 Battery Level %
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV >>8); //03 Battery mV MSB
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV ); //04 Battery mV LSB
APP_LOG(TS_OFF, VLEVEL_L,"\r\n######| Mode S1-Open BAT % BAT mV |"
"\r\n######| %1d | %1d | %2d% | %4d mV|\r\n",
(char*)sts_work_mode_code[(uint8_t)sts_work_mode], AppData.Buffer[2], AppData.Buffer[3], batteryLevelmV);
break;
case STS_NETWORK_MODE:
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor2_on_off); //04 Sensor head #2 status
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor3_on_off); //05 Sensor head #3 status
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor4_on_off); //06 Sensor head #4 status
APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| Color | Mode | S1-Open | S2-Motion | S3-Open | S4 |"
"\r\n######|%10s | %15s | %1d | %1d | %1d | %1d |\r\n",
(char*)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[(uint8_t)AppData.Buffer[1]], AppData.Buffer[2],AppData.Buffer[3], AppData.Buffer[4],AppData.Buffer[5]);
break;
case STS_REEDSWITCH_MODE:
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.battery_Pct); //02 Battery Level %
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV >>8); //03 Battery mV MSB
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV ); //04 Battery mV LSB
APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| Color | Mode | S1-Open | VBAT in mV|"
"\r\n######|%10s | %15s | %1d | %2d% | %4d mV|\r\n",
(char*)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[(uint8_t)AppData.Buffer[1]], AppData.Buffer[2],AppData.Buffer[3], batteryLevelmV);
break;
case STS_RSS_MODE:
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor2_on_off); //03 Sensor head #2 status
//AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor3_on_off); // Sensor head #3 status
//AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor4_on_off); // Sensor head #4 status
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.rss_presence_distance>>8); //04 MSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.rss_presence_distance); //05 LSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.rss_presence_score >>8); //06 MSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.rss_presence_score); //07 LSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_occupancy_overtime_state); //08 occupancy over time or not
APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| Color | Mode | S2-Motion | |Distance(mm) | MotionScore|"
"\r\n######|%10s | %15s | %1d | %04d | %04d |\r\n",
(char*)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[(uint8_t)AppData.Buffer[1]], AppData.Buffer[2], (uint16_t)sts_o7_sensorData.rss_presence_distance,(uint16_t)sts_o7_sensorData.rss_presence_score);
break;
case STS_DUAL_MODE:
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor2_on_off); //04 Sensor head #2 status
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor3_on_off); //05 Sensor head #3 status
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor4_on_off); //06 Sensor head #4 status
//if (o7_data.state_sensor2_on_off != 0)
{
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.rss_presence_distance>>8); //07 MSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.rss_presence_distance); //08 LSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.rss_presence_score >>8); //09 MSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.rss_presence_score); //10 LSB score
}
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.unconcious_state); //11 unconcious state detected or not
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.fall_state); //12 fall detected or not
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.overtime); //13 occupancy over time or not
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.over_stay_duration>>8); //13 occupancy over time or not
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.over_stay_duration); //13 occupancy over time or not
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]]);
APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| S1-DoorOpen | S2-Motion | S3-No_Emergency | S4 |Distance(mm) | MotionScore| Unconcious | Over_Stay| Fall Detected|"
"\r\n######| %1d | %1d | %1d | %1d | %04d | %04d | %1d | %1d | %1d |\r\n",
AppData.Buffer[2], AppData.Buffer[3],AppData.Buffer[4], AppData.Buffer[5],
(uint16_t)sts_o7_sensorData.rss_presence_distance,(uint16_t)sts_o7_sensorData.rss_presence_score,
sts_o7_sensorData.unconcious_state, sts_o7_sensorData.unconcious_duration, sts_o7_sensorData.fall_state );
default:
break;
}
return i;
}
static void SendTxData(void)
{
/* USER CODE BEGIN SendTxData_1 */
@ -939,7 +831,7 @@ static void SendTxData(void)
//AppData.Buffer[i++] = AppLedStateOn;
//i = PrepareSendTxData();
//STS_PRESENCE_SENSOR_Prepare_Send_Data();
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.lamp_bar_color)&0xff; //01

Binary file not shown.