revised with debug messages
This commit is contained in:
parent
7868e6d0bf
commit
4dbde9dcfe
|
@ -47,12 +47,12 @@ extern "C" {
|
|||
/**
|
||||
* @brief Verbose level for all trace logs
|
||||
*/
|
||||
#define VERBOSE_LEVEL VLEVEL_OFF
|
||||
#define VERBOSE_LEVEL VLEVEL_M
|
||||
|
||||
/**
|
||||
* @brief Enable trace logs
|
||||
*/
|
||||
#define APP_LOG_ENABLED 0
|
||||
#define APP_LOG_ENABLED 1
|
||||
|
||||
/**
|
||||
* @brief Activate monitoring (probes) of some internal RF signals for debug purpose
|
||||
|
@ -75,7 +75,7 @@ extern "C" {
|
|||
* @brief Enable/Disable MCU Debugger pins (dbg serial wires)
|
||||
* @note by HW serial wires are ON by default, need to put them OFF to save power
|
||||
*/
|
||||
#define DEBUGGER_ENABLED 0
|
||||
#define DEBUGGER_ENABLED 1
|
||||
|
||||
/**
|
||||
* @brief Disable Low Power mode
|
||||
|
|
|
@ -266,22 +266,7 @@ void STS_Combined_Status_Processing(void)
|
|||
} else if ((sts_rss_result == STS_RESULT_MOTION) || (sts_reed_hall_1_result == STS_Status_Door_Close )||(sts_reed_hall_2_result == STS_Status_SOS_Pushdown ))
|
||||
{
|
||||
sts_status_color = STS_RED;
|
||||
#if 0
|
||||
switch(sts_fall_rising_detected_result) {
|
||||
case STS_PRESENCE_LAYDOWN:
|
||||
sts_lamp_bar_color = STS_YELLOW;
|
||||
sts_status_color = STS_YELLOW;
|
||||
break;
|
||||
case STS_PRESENCE_FALL: //RED_BLUE FLASH
|
||||
sts_lamp_bar_color = STS_RED_BLUE;
|
||||
sts_status_color = STS_RED_BLUE;
|
||||
break;
|
||||
case STS_PRESENCE_RISING: //NORMAL OCCUPANCY STATUS
|
||||
sts_lamp_bar_color = STS_RED;
|
||||
sts_status_color = STS_RED;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (sts_reed_hall_2_result == STS_Status_SOS_Pushdown )
|
||||
{
|
||||
sts_status_color = STS_RED_BLUE;
|
||||
|
@ -383,17 +368,6 @@ void STS_Combined_Status_Processing(void)
|
|||
break;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (sts_status_color == STS_RED_BLUE)
|
||||
{
|
||||
//STS_Lamp_Bar_Set_STS_RGB_Color(sts_lamp_bar_color, luminance_level);
|
||||
STS_Lamp_Bar_Set_STS_RGB_Color(STS_RED, luminance_level);
|
||||
HAL_Delay(100);
|
||||
STS_Lamp_Bar_Set_STS_RGB_Color(STS_BLUE, luminance_level);
|
||||
HAL_Delay(100);
|
||||
STS_Lamp_Bar_Set_STS_RGB_Color(STS_RED_BLUE, luminance_level);
|
||||
}
|
||||
#endif
|
||||
if ((sts_work_mode == STS_WIRED_MODE) || (sts_service_mask > STS_SERVICE_MASK_L0))
|
||||
{
|
||||
sts_status_color = STS_DARK;
|
||||
|
@ -404,7 +378,7 @@ void STS_Combined_Status_Processing(void)
|
|||
else
|
||||
{
|
||||
|
||||
//if ((last_lamp_bar_color != sts_status_color))
|
||||
if ((last_lamp_bar_color != sts_status_color))
|
||||
{
|
||||
sts_lamp_bar_color = ((sts_service_mask == STS_SERVICE_MASK_L0)? sts_status_color:STS_DARK);
|
||||
|
||||
|
@ -430,7 +404,7 @@ void STS_Combined_Status_Processing(void)
|
|||
#ifdef STS_M1
|
||||
sts_water_leakage_changed_flag=0;
|
||||
#endif
|
||||
sensor_data_ready = 1;
|
||||
//sensor_data_ready = 1;
|
||||
//STS_PRESENCE_SENSOR_Prepare_Send_Data();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -302,7 +302,11 @@ static void print_result(acc_detector_presence_result_t result)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* OUTPUT: sts_rss_result = STS_PRESENCE_MOTION, STS_PRESENCE_NO_MOTION
|
||||
* sts_rss_result
|
||||
*/
|
||||
int sts_presence_rss_fall_rise_detection(void)
|
||||
{
|
||||
const acc_hal_t *hal = acc_hal_integration_get_implementation();
|
||||
|
|
|
@ -90,14 +90,14 @@ volatile STS_R0_SensorDataTypeDef r4_data;
|
|||
#endif
|
||||
#if defined(STS_O7)||defined(STS_O6)
|
||||
extern volatile STS_OO_RSS_SensorTuneDataTypeDef sts_presence_rss_config;
|
||||
|
||||
volatile uint32_t cnt=0;
|
||||
extern volatile distance_measure_cfg_t distance_cfg;
|
||||
volatile uint8_t sts_work_mode = STS_DUAL_MODE;
|
||||
extern uint8_t luminance_level;
|
||||
extern volatile uint8_t sts_status_color;
|
||||
extern volatile uint8_t sts_lamp_bar_color; //puColor
|
||||
extern volatile uint8_t sts_cloud_netcolor; //netColor
|
||||
|
||||
extern volatile bool p2_work_finished;
|
||||
volatile uint8_t sts_tof_result_changed_flag = 0;
|
||||
|
||||
volatile uint8_t sts_rss_result_changed_flag = 0;
|
||||
|
@ -230,22 +230,27 @@ void STS_YunhornSTSEventP1_Process(void)
|
|||
STS_Combined_Status_Processing();
|
||||
}
|
||||
|
||||
extern volatile uint32_t wcnt;
|
||||
|
||||
/*
|
||||
* STS-P2 --- RSS PRESENCE
|
||||
*/
|
||||
void STS_YunhornSTSEventP2_Process(void)
|
||||
{
|
||||
|
||||
p2_work_finished=false;
|
||||
//STS_Lamp_Bar_Refresh(); //TODO XXX eliminate refresh every second.... try
|
||||
if ((sts_work_mode >= STS_RSS_MODE) && (sts_work_mode <= STS_TOF_RSS_MODE))
|
||||
{
|
||||
//STS_RSS_Smart_Presence_Detection();
|
||||
APP_LOG(TS_OFF,VLEVEL_M, "\r\n****************P2--id=%d Call rss_fall_rise_detection %d\r\n", (wcnt-1), cnt++)
|
||||
sts_presence_rss_fall_rise_detection();
|
||||
|
||||
|
||||
sts_rss_result_changed_flag = (sts_rss_result == last_sts_rss_result)? 0:1;
|
||||
last_sts_rss_result = sts_rss_result;
|
||||
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "rss_result=%d \r\nrss_result_changed_flag=%1d \r\nRSS_MOTION_RESULT=%s \r\n",
|
||||
sts_rss_result, sts_rss_result_changed_flag,(STS_RESULT_NO_MOTION == sts_rss_result)?"NO_MOTION":"MOTION");
|
||||
|
||||
sts_fall_rising_detected_result_changed_flag = (sts_fall_rising_detected_result == last_sts_fall_rising_detected_result)?0:1;
|
||||
last_sts_fall_rising_detected_result = sts_fall_rising_detected_result;
|
||||
|
||||
|
@ -256,9 +261,8 @@ void STS_YunhornSTSEventP2_Process(void)
|
|||
}
|
||||
|
||||
STS_Combined_Status_Processing();
|
||||
|
||||
}
|
||||
|
||||
p2_work_finished=true;
|
||||
}
|
||||
|
||||
void STS_Reed_Hall_Presence_Detection(void)
|
||||
|
@ -278,20 +282,6 @@ void STS_Reed_Hall_Presence_Detection(void)
|
|||
|
||||
}
|
||||
|
||||
void STS_RSS_Smart_Presence_Detection(void)
|
||||
{
|
||||
//STS_Lamp_Bar_Refresh();
|
||||
|
||||
//sts_presence_rss_presence_detection();
|
||||
|
||||
sts_presence_rss_fall_rise_detection();
|
||||
|
||||
// if (sts_presence_fall_detection) {
|
||||
// STS_YunhornSTSFallDetection();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* STS P3 process, Lamp Bar Scoller
|
||||
*/
|
||||
|
|
|
@ -72,6 +72,8 @@ volatile uint8_t STS_LoRa_WAN_Joined = 0;
|
|||
volatile uint8_t mems_int1_detected = 0;
|
||||
volatile uint8_t upload_message_timer=0;
|
||||
volatile uint8_t heart_beat_timer =0;
|
||||
volatile uint32_t wcnt=0;
|
||||
volatile bool p2_work_finished=true;
|
||||
uint8_t outbuf[128]={0x0};
|
||||
volatile static bool r_b=true;
|
||||
volatile sts_cfg_nvm_t sts_cfg_nvm = {
|
||||
|
@ -650,7 +652,7 @@ void LoRaWAN_Init(void)
|
|||
UTIL_TIMER_Create(&YunhornSTSRSSWakeUpTimer,
|
||||
YUNHORN_STS_RSS_WAKEUP_CHECK_TIME,
|
||||
UTIL_TIMER_PERIODIC, OnYunhornSTSOORSSWakeUpTimerEvent, NULL);
|
||||
//UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
|
||||
UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
|
||||
|
||||
UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer,
|
||||
YUNHORN_STS_HEART_BEAT_CHECK_TIME,
|
||||
|
@ -1214,7 +1216,7 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams)
|
|||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||
HAL_Delay(3000);
|
||||
UTIL_TIMER_Start(&STSLampBarColorTimer);
|
||||
UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
|
||||
//UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
|
||||
/* USER CODE END OnJoinRequest_1 */
|
||||
}
|
||||
|
||||
|
@ -1468,8 +1470,13 @@ static void OnRestoreContextRequest(void *nvm, uint32_t nvm_size)
|
|||
*/
|
||||
static void OnYunhornSTSOORSSWakeUpTimerEvent(void *context)
|
||||
{
|
||||
if (p2_work_finished)
|
||||
{
|
||||
APP_LOG(TS_OFF,VLEVEL_M, "****************Wakeup Timer-- Call P2 %d\r\n", wcnt++)
|
||||
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP2), CFG_SEQ_Prio_0);
|
||||
|
||||
|
||||
if ((STS_LoRa_WAN_Joined != 0)&&(sts_rss_result_changed_flag==1))
|
||||
{
|
||||
sts_rss_result_changed_flag = 0;
|
||||
|
@ -1481,6 +1488,10 @@ static void OnYunhornSTSOORSSWakeUpTimerEvent(void *context)
|
|||
}
|
||||
}
|
||||
|
||||
//UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Yunhorn STS Sensor Heart Beat Timer callback function
|
||||
* @param context ptr of STS Sampling Check context
|
||||
|
|
Loading…
Reference in New Issue