Skip to content
Snippets Groups Projects
Commit b6368279 authored by schneider's avatar schneider
Browse files

Merge branch 'rahix/fix-broken-shutdown' into 'master'

Make sleep work again when BLE is disabled

Closes #231

See merge request !466
parents a35e4ac9 01fb427e
No related branches found
No related tags found
1 merge request!466Make sleep work again when BLE is disabled
Pipeline #5188 passed
......@@ -269,17 +269,26 @@ void RSV11_IRQHandler(void)
notify();
}
/*************************************************************************************************/
bool ble_shall_start(void)
bool ble_is_enabled(void)
{
bool ble_enabled = config_get_boolean_with_default("ble_enable", false);
/*
* 0 = unknown, check config
* 1 = disabled
* 2 = enabled
*/
static int ble_state = 0;
if (ble_enabled) {
LOG_INFO("ble", "BLE is enabled.");
} else {
LOG_INFO("ble", "BLE is disabled.");
if (ble_state == 0) {
if (config_get_boolean_with_default("ble_enable", false)) {
ble_state = 2;
LOG_INFO("ble", "BLE is enabled.");
} else {
ble_state = 1;
LOG_INFO("ble", "BLE is disabled.");
}
}
return ble_enabled;
return ble_state == 2;
}
/*************************************************************************************************/
static void scheduleTimer(void)
......
......@@ -156,7 +156,7 @@ int main(void)
}
/* BLE */
if (ble_shall_start()) {
if (ble_is_enabled()) {
if (xTaskCreate(
vBleTask,
(const char *)"BLE",
......
......@@ -93,7 +93,7 @@ int pmic_read_amux(enum pmic_amux_signal sig, float *result);
/* ---------- BLE ---------------------------------------------------------- */
void vBleTask(void *pvParameters);
bool ble_shall_start(void);
bool ble_is_enabled(void);
void ble_uart_write(uint8_t *pValue, uint8_t len);
/* ---------- Hardware (Peripheral) Locks ---------------------------------- */
......
......@@ -190,7 +190,9 @@ void sleep_deepsleep(void)
core1_stop();
MAX77650_getINT_GLBL();
gpio_low_power();
BbDrvDisable();
if (ble_is_enabled()) {
BbDrvDisable();
}
turnOffClocks();
old_clkcn = MXC_GCR->clkcn;
switchToHIRC();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment