Improve beacon state handling

This commit is contained in:
Willy-JL
2024-03-08 20:56:39 +00:00
parent 13fe7b3bfc
commit 435c35cee9
2 changed files with 6 additions and 3 deletions

View File

@@ -176,7 +176,10 @@ static void js_blebeacon_stop(struct mjs* mjs) {
blebeacon->saved_prev_active = true;
blebeacon->prev_active = furi_hal_bt_extra_beacon_is_active();
}
furi_hal_bt_extra_beacon_stop();
if(!furi_hal_bt_extra_beacon_stop()) {
ret_int_err(mjs, "Failed stopping beacon");
return;
}
mjs_return(mjs, MJS_UNDEFINED);
}
@@ -209,7 +212,7 @@ static void js_blebeacon_destroy(void* inst) {
JsBlebeaconInst* blebeacon = inst;
if(!blebeacon->keep_alive) {
if(furi_hal_bt_extra_beacon_is_active()) {
furi_hal_bt_extra_beacon_stop();
furi_check(furi_hal_bt_extra_beacon_stop());
}
if(blebeacon->saved_prev_cfg && blebeacon->prev_cfg_set) {
furi_check(furi_hal_bt_extra_beacon_set_config(&blebeacon->prev_cfg));