reduce unused code, and optimize rss process
This commit is contained in:
parent
dfba46119a
commit
320ca4da3c
|
@ -221,7 +221,7 @@ void STS_YunhornSTSEventP1_Process(void)
|
|||
|
||||
|
||||
/*
|
||||
* STS-P2 --- SEE ABOVE, RSS PRESENCE
|
||||
* STS-P2 --- RSS PRESENCE
|
||||
*/
|
||||
void STS_YunhornSTSEventP2_Process(void)
|
||||
{
|
||||
|
@ -229,34 +229,9 @@ void STS_YunhornSTSEventP2_Process(void)
|
|||
if ((sts_work_mode >= STS_RSS_MODE) && (sts_work_mode <= STS_TOF_RSS_MODE))
|
||||
{
|
||||
STS_RSS_Smart_Presence_Detection();
|
||||
STS_Reed_Hall_Presence_Detection();
|
||||
#if 0
|
||||
if (sts_rss_result == last_sts_rss_result) {
|
||||
sts_rss_result_changed_flag =0;
|
||||
} else {
|
||||
sts_rss_result_changed_flag =1;
|
||||
last_sts_rss_result = sts_rss_result;
|
||||
}
|
||||
#endif
|
||||
|
||||
sts_rss_result_changed_flag = (sts_rss_result == last_sts_rss_result)? 0:1;
|
||||
last_sts_rss_result = sts_rss_result;
|
||||
#if 0
|
||||
if (sts_reed_hall_result == last_sts_reed_hall_result)
|
||||
{
|
||||
sts_reed_hall_changed_flag = 0;
|
||||
|
||||
} else
|
||||
{
|
||||
sts_reed_hall_changed_flag = 1;
|
||||
}
|
||||
#endif
|
||||
sts_hall1_changed_flag = (sts_hall1_read == last_sts_hall1_result)? 0:1;
|
||||
last_sts_hall1_result = sts_hall1_read;
|
||||
sts_hall2_changed_flag = (sts_hall2_read == last_sts_hall2_result)? 0:1;
|
||||
last_sts_hall2_result = sts_hall2_read;
|
||||
sts_reed_hall_changed_flag = sts_hall1_changed_flag|sts_hall2_changed_flag;
|
||||
sts_reed_hall_result = last_sts_hall2_result|last_sts_hall1_result;
|
||||
sts_reed_hall_changed_flag = (sts_reed_hall_result == last_sts_reed_hall_result)? 0:1;
|
||||
|
||||
if (sts_service_mask > 0 ) {
|
||||
sts_rss_result_changed_flag =0;
|
||||
|
@ -265,8 +240,6 @@ void STS_YunhornSTSEventP2_Process(void)
|
|||
|
||||
STS_Combined_Status_Processing();
|
||||
|
||||
last_sts_rss_result = sts_rss_result;
|
||||
last_sts_reed_hall_result = sts_reed_hall_result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -290,7 +263,7 @@ void STS_Reed_Hall_Presence_Detection(void)
|
|||
|
||||
void STS_RSS_Smart_Presence_Detection(void)
|
||||
{
|
||||
STS_Lamp_Bar_Refresh();
|
||||
//STS_Lamp_Bar_Refresh();
|
||||
|
||||
//sts_presence_rss_presence_detection();
|
||||
|
||||
|
|
|
@ -632,26 +632,25 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
|||
{
|
||||
#ifdef STS_O7
|
||||
case HALL1_Pin:
|
||||
//sts_reed_hall_ext_int = 1;
|
||||
HAL_Delay(50); //de-bouncing
|
||||
sts_hall1_read = HALL1_STATE;
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\n\n Door Contact Read = %02X \r\n", HALL1_STATE);
|
||||
//UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
||||
/* Note: when "EventType == TX_ON_TIMER" this GPIO is not initialized */
|
||||
// if (EventType == TX_ON_EVENT)
|
||||
{
|
||||
|
||||
/* Note: when "EventType == TX_ON_TIMER" this GPIO is not initialized */
|
||||
// if (EventType == TX_ON_EVENT)
|
||||
{
|
||||
sensor_data_ready =1;
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||
}
|
||||
break;
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||
}
|
||||
break;
|
||||
|
||||
case HALL2_Pin:
|
||||
HAL_Delay(50); //de-bouncing
|
||||
sts_hall2_read = HALL2_STATE;
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\n\n SOS Button Read = %02X \r\n", HALL2_STATE);
|
||||
|
||||
sensor_data_ready =1;
|
||||
// UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||
break;
|
||||
|
@ -1326,7 +1325,7 @@ static void OnYunhornSTSOORSSWakeUpTimerEvent(void *context)
|
|||
{
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP2), CFG_SEQ_Prio_0);
|
||||
|
||||
if (STS_LoRa_WAN_Joined != 0)
|
||||
if ((STS_LoRa_WAN_Joined != 0)&&(sts_rss_result_changed_flag==1))
|
||||
{
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue