Compare commits
5 Commits
040584f1eb
...
3a2b5a9253
Author | SHA1 | Date |
---|---|---|
|
3a2b5a9253 | |
|
406f7a204c | |
|
5a2a231dea | |
|
78bc3c4a6d | |
|
2ccbb7479f |
|
@ -595,8 +595,10 @@ TimerTime_t LmHandlerGetDutyCycleWaitTime( void )
|
||||||
return DutyCycleWaitTime;
|
return DutyCycleWaitTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LmHandlerJoin( ActivationType_t mode, bool forceRejoin )
|
LmHandlerErrorStatus_t LmHandlerJoin( ActivationType_t mode, bool forceRejoin )
|
||||||
{
|
{
|
||||||
|
LmHandlerErrorStatus_t lmhStatus = LORAMAC_HANDLER_ERROR;
|
||||||
|
LoRaMacStatus_t status;
|
||||||
MlmeReq_t mlmeReq;
|
MlmeReq_t mlmeReq;
|
||||||
|
|
||||||
mlmeReq.Type = MLME_JOIN;
|
mlmeReq.Type = MLME_JOIN;
|
||||||
|
@ -611,7 +613,12 @@ void LmHandlerJoin( ActivationType_t mode, bool forceRejoin )
|
||||||
LoRaMacStart();
|
LoRaMacStart();
|
||||||
#if (defined( LORAMAC_VERSION ) && ( LORAMAC_VERSION == 0x01000300 ))
|
#if (defined( LORAMAC_VERSION ) && ( LORAMAC_VERSION == 0x01000300 ))
|
||||||
/* Starts the OTAA join procedure */
|
/* Starts the OTAA join procedure */
|
||||||
LoRaMacMlmeRequest( &mlmeReq );
|
status = LoRaMacMlmeRequest( &mlmeReq );
|
||||||
|
|
||||||
|
if( status == LORAMAC_STATUS_OK )
|
||||||
|
{
|
||||||
|
lmhStatus = LORAMAC_STATUS_OK;
|
||||||
|
}
|
||||||
#endif /* LORAMAC_VERSION */
|
#endif /* LORAMAC_VERSION */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -661,7 +668,7 @@ void LmHandlerJoin( ActivationType_t mode, bool forceRejoin )
|
||||||
{
|
{
|
||||||
LmHandlerCallbacks->OnJoinRequest( &JoinParams );
|
LmHandlerCallbacks->OnJoinRequest( &JoinParams );
|
||||||
}
|
}
|
||||||
LmHandlerRequestClass( LmHandlerParams.DefaultClass );
|
lmhStatus = LmHandlerRequestClass( LmHandlerParams.DefaultClass );
|
||||||
#endif /* LORAMAC_VERSION */
|
#endif /* LORAMAC_VERSION */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,10 +676,17 @@ void LmHandlerJoin( ActivationType_t mode, bool forceRejoin )
|
||||||
if( ( CtxRestoreDone == false ) || ( forceRejoin == true ) )
|
if( ( CtxRestoreDone == false ) || ( forceRejoin == true ) )
|
||||||
{
|
{
|
||||||
/* Starts the join procedure */
|
/* Starts the join procedure */
|
||||||
LoRaMacMlmeRequest( &mlmeReq );
|
status = LoRaMacMlmeRequest( &mlmeReq );
|
||||||
|
|
||||||
|
if( status == LORAMAC_STATUS_OK )
|
||||||
|
{
|
||||||
|
lmhStatus = LORAMAC_STATUS_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DutyCycleWaitTime = mlmeReq.ReqReturn.DutyCycleWaitTime;
|
DutyCycleWaitTime = mlmeReq.ReqReturn.DutyCycleWaitTime;
|
||||||
#endif /* LORAMAC_VERSION */
|
#endif /* LORAMAC_VERSION */
|
||||||
|
|
||||||
|
return lmhStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
LmHandlerFlagStatus_t LmHandlerJoinStatus( void )
|
LmHandlerFlagStatus_t LmHandlerJoinStatus( void )
|
||||||
|
|
|
@ -363,8 +363,12 @@ TimerTime_t LmHandlerGetDutyCycleWaitTime( void );
|
||||||
*
|
*
|
||||||
* \param [in] mode Activation mode (OTAA or ABP)
|
* \param [in] mode Activation mode (OTAA or ABP)
|
||||||
* \param [in] forceRejoin Flag to force the rejoin even if LoRaWAN context can be restored
|
* \param [in] forceRejoin Flag to force the rejoin even if LoRaWAN context can be restored
|
||||||
|
*
|
||||||
|
* \retval status Returns \ref LORAMAC_HANDLER_SUCCESS if request has been
|
||||||
|
* processed else if device not yet joined a network \ref LORAMAC_HANDLER_NO_NETWORK_JOINED
|
||||||
|
* else \ref LORAMAC_HANDLER_ERROR
|
||||||
*/
|
*/
|
||||||
void LmHandlerJoin( ActivationType_t mode, bool forceRejoin );
|
LmHandlerErrorStatus_t LmHandlerJoin( ActivationType_t mode, bool forceRejoin );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Check whether the Device is joined to the network
|
* Check whether the Device is joined to the network
|
||||||
|
@ -394,7 +398,7 @@ LmHandlerErrorStatus_t LmHandlerPingSlotReq( uint8_t periodicity );
|
||||||
*
|
*
|
||||||
* \retval status Returns \ref LORAMAC_HANDLER_SUCCESS if request has been
|
* \retval status Returns \ref LORAMAC_HANDLER_SUCCESS if request has been
|
||||||
* processed else if device not yet joined a network \ref LORAMAC_HANDLER_NO_NETWORK_JOINED
|
* processed else if device not yet joined a network \ref LORAMAC_HANDLER_NO_NETWORK_JOINED
|
||||||
else \ref LORAMAC_HANDLER_ERROR
|
* else \ref LORAMAC_HANDLER_ERROR
|
||||||
*/
|
*/
|
||||||
LmHandlerErrorStatus_t LmHandlerRequestClass( DeviceClass_t newClass );
|
LmHandlerErrorStatus_t LmHandlerRequestClass( DeviceClass_t newClass );
|
||||||
|
|
||||||
|
|
|
@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
{
|
{
|
||||||
sfx_u8 status = SFX_ERR_NONE;
|
sfx_u8 status = SFX_ERR_NONE;
|
||||||
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
||||||
|
sfx_s8 lbt_threshold_cal;
|
||||||
/* Starts Rx Windows to sense if channel is occupied or clear*
|
/* Starts Rx Windows to sense if channel is occupied or clear*
|
||||||
* If the channel is clear during the minimum carrier sense
|
* If the channel is clear during the minimum carrier sense
|
||||||
* value (cs_min), under the limit of the cs_threshold,
|
* value (cs_min), under the limit of the cs_threshold,
|
||||||
|
@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
|
|
||||||
HAL_Delay(Radio.GetWakeupTime());
|
HAL_Delay(Radio.GetWakeupTime());
|
||||||
|
|
||||||
|
lbt_threshold_cal = E2P_Read_RssiCal();
|
||||||
|
cs_threshold += lbt_threshold_cal;
|
||||||
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
||||||
|
|
||||||
while (RxCarrierSenseGetStatus() == 0)
|
while (RxCarrierSenseGetStatus() == 0)
|
||||||
|
|
|
@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
{
|
{
|
||||||
sfx_u8 status = SFX_ERR_NONE;
|
sfx_u8 status = SFX_ERR_NONE;
|
||||||
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
||||||
|
sfx_s8 lbt_threshold_cal;
|
||||||
/* Starts Rx Windows to sense if channel is occupied or clear*
|
/* Starts Rx Windows to sense if channel is occupied or clear*
|
||||||
* If the channel is clear during the minimum carrier sense
|
* If the channel is clear during the minimum carrier sense
|
||||||
* value (cs_min), under the limit of the cs_threshold,
|
* value (cs_min), under the limit of the cs_threshold,
|
||||||
|
@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
|
|
||||||
HAL_Delay(Radio.GetWakeupTime());
|
HAL_Delay(Radio.GetWakeupTime());
|
||||||
|
|
||||||
|
lbt_threshold_cal = E2P_Read_RssiCal();
|
||||||
|
cs_threshold += lbt_threshold_cal;
|
||||||
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
||||||
|
|
||||||
while (RxCarrierSenseGetStatus() == 0)
|
while (RxCarrierSenseGetStatus() == 0)
|
||||||
|
|
|
@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
{
|
{
|
||||||
sfx_u8 status = SFX_ERR_NONE;
|
sfx_u8 status = SFX_ERR_NONE;
|
||||||
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
||||||
|
sfx_s8 lbt_threshold_cal;
|
||||||
/* Starts Rx Windows to sense if channel is occupied or clear*
|
/* Starts Rx Windows to sense if channel is occupied or clear*
|
||||||
* If the channel is clear during the minimum carrier sense
|
* If the channel is clear during the minimum carrier sense
|
||||||
* value (cs_min), under the limit of the cs_threshold,
|
* value (cs_min), under the limit of the cs_threshold,
|
||||||
|
@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
|
|
||||||
HAL_Delay(Radio.GetWakeupTime());
|
HAL_Delay(Radio.GetWakeupTime());
|
||||||
|
|
||||||
|
lbt_threshold_cal = E2P_Read_RssiCal();
|
||||||
|
cs_threshold += lbt_threshold_cal;
|
||||||
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
||||||
|
|
||||||
while (RxCarrierSenseGetStatus() == 0)
|
while (RxCarrierSenseGetStatus() == 0)
|
||||||
|
|
|
@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
{
|
{
|
||||||
sfx_u8 status = SFX_ERR_NONE;
|
sfx_u8 status = SFX_ERR_NONE;
|
||||||
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
||||||
|
sfx_s8 lbt_threshold_cal;
|
||||||
/* Starts Rx Windows to sense if channel is occupied or clear*
|
/* Starts Rx Windows to sense if channel is occupied or clear*
|
||||||
* If the channel is clear during the minimum carrier sense
|
* If the channel is clear during the minimum carrier sense
|
||||||
* value (cs_min), under the limit of the cs_threshold,
|
* value (cs_min), under the limit of the cs_threshold,
|
||||||
|
@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
|
|
||||||
HAL_Delay(Radio.GetWakeupTime());
|
HAL_Delay(Radio.GetWakeupTime());
|
||||||
|
|
||||||
|
lbt_threshold_cal = E2P_Read_RssiCal();
|
||||||
|
cs_threshold += lbt_threshold_cal;
|
||||||
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
||||||
|
|
||||||
while (RxCarrierSenseGetStatus() == 0)
|
while (RxCarrierSenseGetStatus() == 0)
|
||||||
|
|
|
@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
{
|
{
|
||||||
sfx_u8 status = SFX_ERR_NONE;
|
sfx_u8 status = SFX_ERR_NONE;
|
||||||
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
||||||
|
sfx_s8 lbt_threshold_cal;
|
||||||
/* Starts Rx Windows to sense if channel is occupied or clear*
|
/* Starts Rx Windows to sense if channel is occupied or clear*
|
||||||
* If the channel is clear during the minimum carrier sense
|
* If the channel is clear during the minimum carrier sense
|
||||||
* value (cs_min), under the limit of the cs_threshold,
|
* value (cs_min), under the limit of the cs_threshold,
|
||||||
|
@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
|
|
||||||
HAL_Delay(Radio.GetWakeupTime());
|
HAL_Delay(Radio.GetWakeupTime());
|
||||||
|
|
||||||
|
lbt_threshold_cal = E2P_Read_RssiCal();
|
||||||
|
cs_threshold += lbt_threshold_cal;
|
||||||
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
||||||
|
|
||||||
while (RxCarrierSenseGetStatus() == 0)
|
while (RxCarrierSenseGetStatus() == 0)
|
||||||
|
|
|
@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
{
|
{
|
||||||
sfx_u8 status = SFX_ERR_NONE;
|
sfx_u8 status = SFX_ERR_NONE;
|
||||||
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
||||||
|
sfx_s8 lbt_threshold_cal;
|
||||||
/* Starts Rx Windows to sense if channel is occupied or clear*
|
/* Starts Rx Windows to sense if channel is occupied or clear*
|
||||||
* If the channel is clear during the minimum carrier sense
|
* If the channel is clear during the minimum carrier sense
|
||||||
* value (cs_min), under the limit of the cs_threshold,
|
* value (cs_min), under the limit of the cs_threshold,
|
||||||
|
@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
|
|
||||||
HAL_Delay(Radio.GetWakeupTime());
|
HAL_Delay(Radio.GetWakeupTime());
|
||||||
|
|
||||||
|
lbt_threshold_cal = E2P_Read_RssiCal();
|
||||||
|
cs_threshold += lbt_threshold_cal;
|
||||||
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
||||||
|
|
||||||
while (RxCarrierSenseGetStatus() == 0)
|
while (RxCarrierSenseGetStatus() == 0)
|
||||||
|
|
|
@ -485,6 +485,7 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
{
|
{
|
||||||
sfx_u8 status = SFX_ERR_NONE;
|
sfx_u8 status = SFX_ERR_NONE;
|
||||||
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
sfx_rx_state_enum_t cs_state = DL_TIMEOUT;
|
||||||
|
sfx_s8 lbt_threshold_cal;
|
||||||
/* Starts Rx Windows to sense if channel is occupied or clear*
|
/* Starts Rx Windows to sense if channel is occupied or clear*
|
||||||
* If the channel is clear during the minimum carrier sense
|
* If the channel is clear during the minimum carrier sense
|
||||||
* value (cs_min), under the limit of the cs_threshold,
|
* value (cs_min), under the limit of the cs_threshold,
|
||||||
|
@ -502,6 +503,8 @@ sfx_u8 RF_API_wait_for_clear_channel(sfx_u8 cs_min, sfx_s8 cs_threshold, sfx_rx_
|
||||||
|
|
||||||
HAL_Delay(Radio.GetWakeupTime());
|
HAL_Delay(Radio.GetWakeupTime());
|
||||||
|
|
||||||
|
lbt_threshold_cal = E2P_Read_RssiCal();
|
||||||
|
cs_threshold += lbt_threshold_cal;
|
||||||
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
APP_LOG(TS_ON, VLEVEL_M, "CS start cs_min=%dms, cs_threshold=%dBm\n\r", cs_min, cs_threshold);
|
||||||
|
|
||||||
while (RxCarrierSenseGetStatus() == 0)
|
while (RxCarrierSenseGetStatus() == 0)
|
||||||
|
|
Loading…
Reference in New Issue