From 4109e3053f49f04c68f621b8ebde78a2da92228f Mon Sep 17 00:00:00 2001 From: Philip Gladstone Date: Fri, 5 Nov 2021 23:50:48 +0000 Subject: [PATCH] Prevent ble.shutdown() as it corrupts something... --- components/modules/ble.c | 4 ++++ docs/modules/ble.md | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/modules/ble.c b/components/modules/ble.c index fa29cf97..8bb16df7 100644 --- a/components/modules/ble.c +++ b/components/modules/ble.c @@ -995,6 +995,10 @@ static int lble_init(lua_State *L) { } static int lble_shutdown(lua_State *L) { + // It seems that shutting down the stack corrupts some critical data structures + // so, for now, don't allow it. + luaL_error(L, "Shutting down the BLE stack is currently not possible"); + inited = SHUTTING; ble_gap_adv_stop(); diff --git a/docs/modules/ble.md b/docs/modules/ble.md index 24082a8a..7b7d8535 100644 --- a/docs/modules/ble.md +++ b/docs/modules/ble.md @@ -57,7 +57,8 @@ ble.advertise("foo") ## ble.shutdown() -Shuts down the BlueTooth controller and returns it to the state where another `init` ought to work (but currently doesn't). +Shuts down the BlueTooth controller and returns it to the state where another `init` ought to work (but currently doesn't). And, at the moment, shutting +it down doesn't work either -- it appears to corrupt some deep data structures. #### Syntax `ble.shutdown()`