[FL-3264] Various stop mode fixes (#2584)
* BleGlue: log hci_cmd_resp invocation * BleGlue: increase BleHciDriver stack size * ble hid app: increase stack * ble: comment unnecessary hci reset * BleGlue: stricter checks in communication with core2, cleanup code * Furi: enter insomnia when executing from RAM --------- Co-authored-by: gornekich <n.gorbadey@gmail.com>
This commit is contained in:
parent
de02a0a25a
commit
f68c3b2a65
@ -68,7 +68,7 @@ static const APPD_GpioConfig_t aGpioConfigList[GPIO_CFG_NBR_OF_FEATURES] = {
|
|||||||
{GPIOA, LL_GPIO_PIN_0, 0, 0}, /* END_OF_CONNECTION_EVENT - Set on Entry / Reset on Exit */
|
{GPIOA, LL_GPIO_PIN_0, 0, 0}, /* END_OF_CONNECTION_EVENT - Set on Entry / Reset on Exit */
|
||||||
{GPIOA, LL_GPIO_PIN_0, 0, 0}, /* TIMER_SERVER_CALLBACK - Toggle on Entry */
|
{GPIOA, LL_GPIO_PIN_0, 0, 0}, /* TIMER_SERVER_CALLBACK - Toggle on Entry */
|
||||||
{GPIOA, LL_GPIO_PIN_4, 1, 0}, /* PES_ACTIVITY - Set on Entry / Reset on Exit */
|
{GPIOA, LL_GPIO_PIN_4, 1, 0}, /* PES_ACTIVITY - Set on Entry / Reset on Exit */
|
||||||
{GPIOB, LL_GPIO_PIN_2, 1, 0}, /* MB_BLE_SEND_EVT - Set on Entry / Reset on Exit */
|
{GPIOC, LL_GPIO_PIN_0, 1, 0}, /* MB_BLE_SEND_EVT - Set on Entry / Reset on Exit */
|
||||||
/* From v1.3.0 */
|
/* From v1.3.0 */
|
||||||
{GPIOA, LL_GPIO_PIN_0, 0, 0}, /* BLE_NO_DELAY - Set on Entry / Reset on Exit */
|
{GPIOA, LL_GPIO_PIN_0, 0, 0}, /* BLE_NO_DELAY - Set on Entry / Reset on Exit */
|
||||||
{GPIOA, LL_GPIO_PIN_0, 0, 0}, /* BLE_STACK_STORE_NVM_CB - Set on Entry / Reset on Exit */
|
{GPIOA, LL_GPIO_PIN_0, 0, 0}, /* BLE_STACK_STORE_NVM_CB - Set on Entry / Reset on Exit */
|
||||||
|
@ -137,38 +137,33 @@ static int32_t ble_app_hci_thread(void* arg) {
|
|||||||
// Called by WPAN lib
|
// Called by WPAN lib
|
||||||
void hci_notify_asynch_evt(void* pdata) {
|
void hci_notify_asynch_evt(void* pdata) {
|
||||||
UNUSED(pdata);
|
UNUSED(pdata);
|
||||||
if(ble_app) {
|
furi_check(ble_app);
|
||||||
FuriThreadId thread_id = furi_thread_get_id(ble_app->thread);
|
FuriThreadId thread_id = furi_thread_get_id(ble_app->thread);
|
||||||
furi_assert(thread_id);
|
furi_assert(thread_id);
|
||||||
furi_thread_flags_set(thread_id, BLE_APP_FLAG_HCI_EVENT);
|
furi_thread_flags_set(thread_id, BLE_APP_FLAG_HCI_EVENT);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hci_cmd_resp_release(uint32_t flag) {
|
void hci_cmd_resp_release(uint32_t flag) {
|
||||||
UNUSED(flag);
|
UNUSED(flag);
|
||||||
if(ble_app) {
|
furi_check(ble_app);
|
||||||
furi_semaphore_release(ble_app->hci_sem);
|
furi_check(furi_semaphore_release(ble_app->hci_sem) == FuriStatusOk);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hci_cmd_resp_wait(uint32_t timeout) {
|
void hci_cmd_resp_wait(uint32_t timeout) {
|
||||||
UNUSED(timeout);
|
furi_check(ble_app);
|
||||||
if(ble_app) {
|
furi_check(furi_semaphore_acquire(ble_app->hci_sem, timeout) == FuriStatusOk);
|
||||||
furi_semaphore_acquire(ble_app->hci_sem, FuriWaitForever);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ble_app_hci_event_handler(void* pPayload) {
|
static void ble_app_hci_event_handler(void* pPayload) {
|
||||||
SVCCTL_UserEvtFlowStatus_t svctl_return_status;
|
SVCCTL_UserEvtFlowStatus_t svctl_return_status;
|
||||||
tHCI_UserEvtRxParam* pParam = (tHCI_UserEvtRxParam*)pPayload;
|
tHCI_UserEvtRxParam* pParam = (tHCI_UserEvtRxParam*)pPayload;
|
||||||
|
|
||||||
if(ble_app) {
|
furi_check(ble_app);
|
||||||
svctl_return_status = SVCCTL_UserEvtRx((void*)&(pParam->pckt->evtserial));
|
svctl_return_status = SVCCTL_UserEvtRx((void*)&(pParam->pckt->evtserial));
|
||||||
if(svctl_return_status != SVCCTL_UserEvtFlowDisable) {
|
if(svctl_return_status != SVCCTL_UserEvtFlowDisable) {
|
||||||
pParam->status = HCI_TL_UserEventFlow_Enable;
|
pParam->status = HCI_TL_UserEventFlow_Enable;
|
||||||
} else {
|
} else {
|
||||||
pParam->status = HCI_TL_UserEventFlow_Disable;
|
pParam->status = HCI_TL_UserEventFlow_Disable;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,8 +289,6 @@ static void gap_init_svc(Gap* gap) {
|
|||||||
tBleStatus status;
|
tBleStatus status;
|
||||||
uint32_t srd_bd_addr[2];
|
uint32_t srd_bd_addr[2];
|
||||||
|
|
||||||
// HCI Reset to synchronise BLE Stack
|
|
||||||
hci_reset();
|
|
||||||
// Configure mac address
|
// Configure mac address
|
||||||
aci_hal_write_config_data(
|
aci_hal_write_config_data(
|
||||||
CONFIG_DATA_PUBADDR_OFFSET, CONFIG_DATA_PUBADDR_LEN, gap->config->mac_address);
|
CONFIG_DATA_PUBADDR_OFFSET, CONFIG_DATA_PUBADDR_LEN, gap->config->mac_address);
|
||||||
|
@ -29,6 +29,8 @@ int main() {
|
|||||||
FuriThread* main_thread = furi_thread_alloc_ex("Init", 4096, init_task, NULL);
|
FuriThread* main_thread = furi_thread_alloc_ex("Init", 4096, init_task, NULL);
|
||||||
|
|
||||||
#ifdef FURI_RAM_EXEC
|
#ifdef FURI_RAM_EXEC
|
||||||
|
// Prevent entering sleep mode when executed from RAM
|
||||||
|
furi_hal_power_insomnia_enter();
|
||||||
furi_thread_start(main_thread);
|
furi_thread_start(main_thread);
|
||||||
#else
|
#else
|
||||||
furi_hal_light_sequence("RGB");
|
furi_hal_light_sequence("RGB");
|
||||||
@ -44,6 +46,7 @@ int main() {
|
|||||||
furi_hal_power_reset();
|
furi_hal_power_reset();
|
||||||
} else if(boot_mode == FuriHalRtcBootModeUpdate) {
|
} else if(boot_mode == FuriHalRtcBootModeUpdate) {
|
||||||
furi_hal_light_sequence("rgb BR");
|
furi_hal_light_sequence("rgb BR");
|
||||||
|
// Do update
|
||||||
flipper_boot_update_exec();
|
flipper_boot_update_exec();
|
||||||
// if things go nice, we shouldn't reach this point.
|
// if things go nice, we shouldn't reach this point.
|
||||||
// But if we do, abandon to avoid bootloops
|
// But if we do, abandon to avoid bootloops
|
||||||
|
Loading…
Reference in New Issue
Block a user