FIxes for BLE_Quiet on PSoC6.
This commit is contained in:
parent
bb915121e8
commit
88c81dc405
2 changed files with 16 additions and 9 deletions
|
@ -39,6 +39,8 @@ typedef enum
|
||||||
SYSTEMK_RESULT_QUEUE_IS_FULL,
|
SYSTEMK_RESULT_QUEUE_IS_FULL,
|
||||||
SYSTEMK_RESULT_NOT_READY,
|
SYSTEMK_RESULT_NOT_READY,
|
||||||
SYSTEMK_RESULT_FAILED_TO_CREATE_RTOS_TASK,
|
SYSTEMK_RESULT_FAILED_TO_CREATE_RTOS_TASK,
|
||||||
|
SYSTEMK_RESULT_FAILED_TO_CREATE_RTOS_TIMER,
|
||||||
|
SYSTEMK_RESULT_FAILED_TO_START_RTOS_TIMER,
|
||||||
SYSTEMK_RESULT_FILE_NOT_FOUND,
|
SYSTEMK_RESULT_FILE_NOT_FOUND,
|
||||||
SYSTEMK_RESULT_KEY_NOT_FOUND,
|
SYSTEMK_RESULT_KEY_NOT_FOUND,
|
||||||
SYSTEMK_RESULT_READ_FAILED,
|
SYSTEMK_RESULT_READ_FAILED,
|
||||||
|
|
|
@ -107,11 +107,21 @@ static void Configuring_Do(StateMachineContext_T *context)
|
||||||
portBASE_TYPE xStatus;
|
portBASE_TYPE xStatus;
|
||||||
static KEvent_T Event;
|
static KEvent_T Event;
|
||||||
|
|
||||||
// For the first hundred milliseconds, keep updating the Hello packet, since on some platforms (PSoC6), one call is not enough.
|
// Update the Hello packet every 250ms for the first second, since on some platforms (PSoC6), the BLE is not initialized before
|
||||||
// TODO: Fix the Hello packet hack on PSoC6.
|
// the `Configuring_Do` gets going.
|
||||||
if ((xTaskGetTickCount() - context->Time_At_State_Entry_In_Ticks) < (100 / portTICK_PERIOD_MS))
|
// TODO: Fix the Hello packet hack needed for PSoC6. Maybe we need a `BLE_Initialized` event?
|
||||||
{
|
{
|
||||||
BLE_UpdateHelloPacket();
|
TickType_t now = xTaskGetTickCount();
|
||||||
|
if ((now - context->Time_At_State_Entry_In_Ticks) < (1000 / portTICK_PERIOD_MS))
|
||||||
|
{
|
||||||
|
static TickType_t Time_At_Last_Hello_Update = 0;
|
||||||
|
|
||||||
|
if ((now - Time_At_Last_Hello_Update) > (250 / portTICK_PERIOD_MS))
|
||||||
|
{
|
||||||
|
BLE_UpdateHelloPacket();
|
||||||
|
Time_At_Last_Hello_Update = now;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xStatus = Receive_KEvent(&Event);
|
xStatus = Receive_KEvent(&Event);
|
||||||
|
@ -414,11 +424,6 @@ void HandleBLEConfigurationPacket(const BLE_ParametersPacket_T *const packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Once configuration has begun, stop advertising the HELLO packet to free up bandwidth.
|
|
||||||
BLE_StopAdvertising();
|
|
||||||
}
|
|
||||||
|
|
||||||
BLE_FreePacketBuffer((BLE_GenericPacketType_T *)packet);
|
BLE_FreePacketBuffer((BLE_GenericPacketType_T *)packet);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue