All BLE Quiet tests pass!
This commit is contained in:
parent
f367b5ae5b
commit
4cdf1a0ede
2 changed files with 27 additions and 26 deletions
|
@ -343,50 +343,49 @@ SystemKResult_T BLE_Quiet(uint32_t duration_ms)
|
||||||
// Already quiet; reset timer with new duration if duration_ms > 0.
|
// Already quiet; reset timer with new duration if duration_ms > 0.
|
||||||
if (duration_ms > 0)
|
if (duration_ms > 0)
|
||||||
{
|
{
|
||||||
// Stop and delete existing timer if it exists.
|
// Stop the timer and change the period if it is already running.
|
||||||
if (BLEUnquietTimer != NULL)
|
if (BLEUnquietTimer != NULL)
|
||||||
{
|
{
|
||||||
xTimerStop(BLEUnquietTimer, 0);
|
xTimerStop(BLEUnquietTimer, 0);
|
||||||
xTimerDelete(BLEUnquietTimer, 0);
|
xTimerChangePeriod(BLEUnquietTimer, pdMS_TO_TICKS(duration_ms), 0);
|
||||||
BLEUnquietTimer = NULL;
|
xTimerStart(BLEUnquietTimer, 0);
|
||||||
}
|
|
||||||
|
|
||||||
// Create and start new timer with the new duration.
|
|
||||||
BLEUnquietTimer = xTimerCreateStatic(
|
|
||||||
"BLEUnquietTimer",
|
|
||||||
pdMS_TO_TICKS(duration_ms),
|
|
||||||
pdFALSE,
|
|
||||||
(void *)0,
|
|
||||||
Unquiet_Timer_Callback,
|
|
||||||
&xBLEUnquietTimerBuffer);
|
|
||||||
|
|
||||||
if (BLEUnquietTimer == NULL)
|
|
||||||
{
|
|
||||||
KLOG_ERROR(TAG, "Couldn't create the BLEUnquietTimer!");
|
|
||||||
result = SYSTEMK_RESULT_FAILED_TO_CREATE_RTOS_TIMER;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (xTimerStart(BLEUnquietTimer, 0) != pdPASS)
|
// There should already be a timer, but just in case...
|
||||||
|
BLEUnquietTimer = xTimerCreateStatic(
|
||||||
|
"BLEUnquietTimer",
|
||||||
|
pdMS_TO_TICKS(duration_ms),
|
||||||
|
pdFALSE,
|
||||||
|
(void *)0,
|
||||||
|
Unquiet_Timer_Callback,
|
||||||
|
&xBLEUnquietTimerBuffer);
|
||||||
|
|
||||||
|
if (BLEUnquietTimer == NULL)
|
||||||
{
|
{
|
||||||
KLOG_ERROR(TAG, "Couldn't start the BLEUnquietTimer!");
|
KLOG_ERROR(TAG, "Couldn't create the BLEUnquietTimer!");
|
||||||
result = SYSTEMK_RESULT_FAILED_TO_START_RTOS_TIMER;
|
result = SYSTEMK_RESULT_FAILED_TO_CREATE_RTOS_TIMER;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (xTimerStart(BLEUnquietTimer, 0) != pdPASS)
|
||||||
|
{
|
||||||
|
KLOG_ERROR(TAG, "Couldn't start the BLEUnquietTimer!");
|
||||||
|
result = SYSTEMK_RESULT_FAILED_TO_START_RTOS_TIMER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If duration_ms is 0, stop and delete the timer to stay quiet indefinitely.
|
// If duration_ms is 0, stop the timer to stay quiet indefinitely.
|
||||||
if (BLEUnquietTimer != NULL)
|
if (BLEUnquietTimer != NULL)
|
||||||
{
|
{
|
||||||
xTimerStop(BLEUnquietTimer, 0);
|
xTimerStop(BLEUnquietTimer, 0);
|
||||||
xTimerDelete(BLEUnquietTimer, 0);
|
|
||||||
BLEUnquietTimer = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = SYSTEMK_RESULT_SUCCESS;
|
result = SYSTEMK_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (Host_And_Controller_Synced == true)
|
else if (Host_And_Controller_Synced == true)
|
||||||
{
|
{
|
||||||
Is_Quiet = true;
|
Is_Quiet = true;
|
||||||
|
@ -433,6 +432,8 @@ SystemKResult_T BLE_Unquiet(void)
|
||||||
{
|
{
|
||||||
SystemKResult_T result = SYSTEMK_RESULT_NOT_READY;
|
SystemKResult_T result = SYSTEMK_RESULT_NOT_READY;
|
||||||
|
|
||||||
|
KLOG_INFO(TAG, "BLE_Unquiet()");
|
||||||
|
|
||||||
if (Is_Quiet == false)
|
if (Is_Quiet == false)
|
||||||
{
|
{
|
||||||
// Already unquiet; no action needed.
|
// Already unquiet; no action needed.
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 88c81dc405ef5d10fcf67d80d349bc1a7924e6f9
|
Subproject commit e0e7fdf1aef151390c1e82d95e89e39038206bca
|
Loading…
Add table
Add a link
Reference in a new issue