L8A #78

Closed
sundp wants to merge 28 commits from L8A into master
6 changed files with 37 additions and 21 deletions
Showing only changes of commit 9ecfa78e6b - Show all commits

View File

@ -73,7 +73,7 @@ void MX_LoRaWAN_Init(void)
/* USER CODE END MX_LoRaWAN_Init_2 */
LoRaWAN_Init();
/* USER CODE BEGIN MX_LoRaWAN_Init_3 */
STS_SENSOR_Function_Test_Process();
//STS_SENSOR_Function_Test_Process();
//STS_ClockSync_process();
//STS_SENSOR_Warm_Up();
/* USER CODE END MX_LoRaWAN_Init_3 */

View File

@ -83,7 +83,7 @@ uint32_t check_time=0;
volatile bool motionDetected =false;
uint32_t lastMotionTime =0;
const uint32_t ledOnDuration = 10000;
static uint8_t sts_warm_up_message_counter=0;
/* USER CODE END EV */
@ -114,7 +114,7 @@ typedef enum TxEventType_e
/**
* LEDs period value of the timer in ms
*/
#define LED_PERIOD_TIME 800
#define LED_PERIOD_TIME 500
/**
* Join switch period value of the timer in ms
@ -281,7 +281,7 @@ static void OnJoinTimerLedEvent(void *context);
* @brief STS Wake Up Scan timer callback function
* @param context ptr of VL53LX TOF People Counting Process context
*/
static void OnYunhornSTSWakeUpScanTimerEvent(void *context);
//static void OnYunhornSTSWakeUpScanTimerEvent(void *context);
/**
@ -301,7 +301,7 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context);
* @param context ptr of STS RSS WakeUp context
*/
static void OnYunhornSTSOORSSWakeUpTimerEvent(void *context);
// static void OnYunhornSTSOORSSWakeUpTimerEvent(void *context);
/**
* @brief Yunhorn STS Heart beat timer callback function
@ -1245,7 +1245,7 @@ static void SendTxData(void)
if (fhmos_data.state_fall_released == 1)
{
fhmos_data.state_fall_released == 0;
fhmos_data.state_fall_released = 0;
AppData.Buffer[i++] = (uint8_t) 0xff&(fhmos_data.time_stamp_fall_confirmed>>24);
AppData.Buffer[i++] = (uint8_t) 0xff&(fhmos_data.time_stamp_fall_confirmed>>16);
@ -1360,11 +1360,16 @@ static void OnTxTimerEvent(void *context)
APP_LOG(TS_OFF, VLEVEL_M, "\nSET TASK P4\r\n");
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0);
#endif
if (sts_warm_up_message_counter ++ < 10)
{
UTIL_TIMER_Stop(&TxTimer);
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
UTIL_TIMER_Start(&TxTimer);
}
/*Wait for next tx slot*/
UTIL_TIMER_Start(&TxTimer);
/* USER CODE BEGIN OnTxTimerEvent_2 */
/* USER CODE END OnTxTimerEvent_2 */
@ -1438,15 +1443,12 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams)
}
AppData.Port = 1;
AppData.BufferSize = 16;
// UTIL_MEM_cpy_8(AppData.Buffer, (uint8_t*)"YUNHORN168", 10);
UTIL_MEM_cpy_8((uint8_t*)AppData.Buffer, (uint8_t *)YUNHORN_STS_PRD_STRING, sizeof(YUNHORN_STS_PRD_STRING));
AppData.BufferSize = sizeof(YUNHORN_STS_PRD_STRING);
AppData.BufferSize = sizeof(YUNHORN_STS_PRD_STRING)-1;
LmHandlerParams.IsTxConfirmed = true;
LmHandlerErrorStatus_t status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
if (status ==LORAMAC_HANDLER_SUCCESS ) LmHandlerParams.IsTxConfirmed = false;
// STS_SENSOR_Function_Test_Process();
}
else
{
@ -1457,6 +1459,7 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams)
}
UTIL_TIMER_Start(&TxTimer);
// UTIL_TIMER_Start(&YunhornSTSWakeUpScanTimer);
/* USER CODE END OnJoinRequest_1 */
}
@ -1746,7 +1749,7 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
* @brief Yunhorn STS Occupancy RSS WakeUP timer callback function
* @param context ptr of STS RSS WakeUp context
*/
#if 0
static void OnYunhornSTSOORSSWakeUpTimerEvent(void *context)
{
#ifdef STS_O6
@ -1754,7 +1757,7 @@ static void OnYunhornSTSOORSSWakeUpTimerEvent(void *context)
#endif
}
#endif
/**
* @brief Yunhorn STS Heart beat timer callback function
* @param context ptr of context
@ -1842,6 +1845,7 @@ void OnYunhornSTSHeartBeatPeriodicityChanged(uint32_t periodicity)
}
/* USER CODE BEGIN PrFD_YunhornSTSWakeUpScanTimerEvents */
#if 0
static void OnYunhornSTSWakeUpScanTimerEvent(void *context)
{
#if defined(STS_P2)||defined(STS_T6)||defined(L8)
@ -1853,6 +1857,7 @@ static void OnYunhornSTSWakeUpScanTimerEvent(void *context)
#endif
}
#endif
void STSWakeupScanTimerStop(void)
{
@ -1868,10 +1873,16 @@ void STS_SENSOR_Warm_Up(void)
//UTIL_MEM_cpy_8((uint8_t*)AppData.Buffer, (uint8_t *)YUNHORN_STS_PRD_STRING, sizeof(YUNHORN_STS_PRD_STRING));
AppData.BufferSize = sizeof(AppData.Buffer);
LmHandlerErrorStatus_t status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
HAL_Delay(3000);
status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
HAL_Delay(3000);
status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
if (LORAMAC_HANDLER_SUCCESS ==status )
{
HAL_Delay(3000);
status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
}
if (LORAMAC_HANDLER_SUCCESS ==status )
{
HAL_Delay(3000);
status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
}
}
void STS_ClockSync_process(void)
{

View File

@ -85,8 +85,13 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = {
sts_mtmcode2,
sts_version,
sts_hardware_ver,
#if defined(STS_L8)
0x0A, //Regular TxPeriodicity interval
'S', //Uplink data interval unit, for heart-beat uplink
#else
0x05, //Regular TxPeriodicity interval
'M', //Uplink data interval unit, for heart-beat uplink
#endif
#if defined(STS_P2)||defined(L8)||defined(STS_O6T)||defined(STS_T6)
0x01, //Heart-beat interval or Sampling interval
'S', //Sampling sensor interval unit, for real-time sensing of MEMS

View File

@ -159,11 +159,11 @@ void MX_TOF_Init(void)
//STS_TOF_VL53LX_PeopleCounting_Process();
#ifdef L8
MX_53L8A1_ThresholdDetection_Init();
MX_53L8A1_ThresholdDetection_Process();
STS_FHMOS_sensor_config_init();
//MX_53L8A1_ThresholdDetection_Process();
//STS_FHMOS_sensor_config_init();
//sts_high_threshold = sts_cfg_nvm.sensor_install_height_in_10cm ;
//sts_low_threshold = sts_cfg_nvm.sensor_install_height_in_10cm -1400;
STS_TOF_L8_Reconfig();
//STS_TOF_L8_Reconfig();
#elif defined(STS_R1D)
XWL55_WLE5_53L0X_Init();