diff --git a/Core/Inc/main.h b/Core/Inc/main.h index b815869..70bac4b 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -78,7 +78,7 @@ void Error_Handler(void); #define LED1_ON HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_SET ) #define LED1_OFF HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET) - +#define LED1_TOGGLE HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin) #define MEMS_POWER_Pin GPIO_PIN_4 // PMU_ENABLE #define MEMS_POWER_GPIO_Port GPIOB // PMU_ENABLE diff --git a/Core/Src/sts_lamp_bar.c b/Core/Src/sts_lamp_bar.c index 1eed832..59952e7 100644 --- a/Core/Src/sts_lamp_bar.c +++ b/Core/Src/sts_lamp_bar.c @@ -421,12 +421,12 @@ void STS_Combined_Status_Processing(void) //STS_Lamp_Bar_Refresh(); #if 1 - //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_reed_hall_changed_flag)) { //sts_rss_result_changed_flag =0; - sts_reed_hall_changed_flag =0; - sts_tof_result_changed_flag =0; + //sts_reed_hall_changed_flag =0; + //sts_tof_result_changed_flag =0; #ifdef STS_M1 sts_water_leakage_changed_flag=0; #endif diff --git a/Core/Src/yunhorn_sts_presence_rss.c b/Core/Src/yunhorn_sts_presence_rss.c index 2c7d152..6f4fb98 100644 --- a/Core/Src/yunhorn_sts_presence_rss.c +++ b/Core/Src/yunhorn_sts_presence_rss.c @@ -473,10 +473,8 @@ int sts_presence_rss_fall_rise_detection(void) APP_LOG(TS_OFF, VLEVEL_H,"Fall Rise Detection, Motion Count = %u \r\n", (int)motion_count); sts_rss_result = (average_result > 1)? 1: 0; - if ((last_sts_rss_result ==STS_RESULT_NO_MOTION)&& (sts_rss_result==STS_RESULT_MOTION)) - { - OnSensor3StateChanged(); - } + if (sts_rss_result) {LED1_ON;} else {LED1_OFF;} + /* TODO XXXX 2024-06-06 * diff --git a/Core/Src/yunhorn_sts_process.c b/Core/Src/yunhorn_sts_process.c index f4d4403..9747b70 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -865,11 +865,12 @@ void OnSensor2StateChanged(void) void OnSensor3StateChanged(void) { SysTime_t sensor_event_time = SysTimeGetMcuTime(); +#if 0 if ((sensor_event_time.Seconds - last_sts_rss_time_stamp) < 3 ) //less than 3 seconds ... return for flipping filter { return ; } - +#endif if (sts_rss_result == STS_RESULT_MOTION) { sts_o7_sensorData.event_sensor3_start_time = sensor_event_time.Seconds; diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 9ce284c..850d092 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -35,8 +35,9 @@ #include "CayenneLpp.h" #include "sys_sensors.h" #include "flash_if.h" - +#ifdef CLOCK_SYNC #include "LmhpClockSync.h" +#endif /* USER CODE BEGIN Includes */ #include "tim.h" #include "sts_lamp_bar.h" @@ -594,10 +595,10 @@ void LoRaWAN_Init(void) UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_LoRaStopJoinEvent), UTIL_SEQ_RFU, StopJoin); // TODO XXX 2024-06-04 - +#ifdef CLOCK_SYNC LmHandlerPackageRegister( PACKAGE_ID_CLOCK_SYNC, NULL ); IsClockSynched = false; - +#endif /* Init Info table used by LmHandler*/ LoraInfo_Init(); @@ -649,7 +650,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, @@ -928,7 +929,7 @@ static void SendTxData(void) } AppData.BufferSize = (uint8_t)(sts_service_mask > STS_SERVICE_MASK_L1? 0:i)&0xff;; - +#ifdef CLOCK_SYNC if( IsClockSynched == false ) { status = LmhpClockSyncAppTimeReq( ); @@ -937,7 +938,7 @@ static void SendTxData(void) OnSysTimeUpdate(); } } - +#endif if ((JoinLedTimer.IsRunning) && (LmHandlerJoinStatus() == LORAMAC_HANDLER_SET)) { UTIL_TIMER_Stop(&JoinLedTimer); @@ -947,7 +948,6 @@ static void SendTxData(void) } status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false); - APP_LOG(TS_OFF, VLEVEL_M, "\r\n-----Send status =%d------------\r\n", status); if (LORAMAC_HANDLER_SUCCESS == status) { @@ -1212,8 +1212,9 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams) } heart_beat_timer = 1; UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); - HAL_Delay(5000); + HAL_Delay(3000); UTIL_TIMER_Start(&STSLampBarColorTimer); + UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer); /* USER CODE END OnJoinRequest_1 */ } @@ -1473,6 +1474,10 @@ static void OnYunhornSTSOORSSWakeUpTimerEvent(void *context) { sts_rss_result_changed_flag = 0; UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); + //if ((last_sts_rss_result ==STS_RESULT_NO_MOTION)&& (sts_rss_result==STS_RESULT_MOTION)) + { + OnSensor3StateChanged(); + } } }