From 4d24232105f8c2bcc61da2dd81a545ddd82af540 Mon Sep 17 00:00:00 2001 From: Philip Gladstone Date: Fri, 7 Jan 2022 20:59:38 -0500 Subject: [PATCH] Notify seems to work now. --- components/modules/ble.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/modules/ble.c b/components/modules/ble.c index 4d4d0918..2d325119 100644 --- a/components/modules/ble.c +++ b/components/modules/ble.c @@ -392,6 +392,7 @@ lble_task_cb(task_param_t param, task_prio_t prio) { lua_pop(L, 1); // Throw away the null write pointer } lua_pop(L, 1); // THrow away the value + message.errcode = 0; } cleanup: @@ -533,7 +534,7 @@ lble_build_gatt_svcs(lua_State *L, struct ble_gatt_svc_def **resultp, const uint handles[0]++; lua_pushinteger(L, handles[0]); - lua_setfield(L, -2, "notify"); + lua_setfield(L, -3, "notify"); chr->val_handle = &handles[handles[0]]; } lua_pop(L, 1); @@ -939,7 +940,7 @@ static int lble_notify(lua_State *L) { } int handle = luaL_checkinteger(L, 1); - luaL_argcheck(L, handle <= 0 || handle > notify_handles[0], 1, "handle out of range"); + luaL_argcheck(L, handle > 0 && handle <= notify_handles[0], 1, "handle out of range"); ble_gatts_chr_updated(notify_handles[handle]);