Skip to content

Commit 9841d54

Browse files
committed
disable whenConnected for MICROBIT1 (too little free memory)
1 parent a37c24f commit 9841d54

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

libs/bluetooth/bluetooth.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ typedef enum {
127127
BLE_AMS_INITED = 1<<17, //< Apple Media Service enabled
128128
BLE_ANCS_OR_AMS_INITED = BLE_ANCS_INITED|BLE_AMS_INITED, //< Apple Notifications or Media Service enabled
129129
#endif
130-
130+
#ifndef SAVE_ON_FLASH
131131
BLE_ADVERTISE_WHEN_CONNECTED = 1<<18, // Do we keep advertising when we're connected?
132+
#endif
132133
BLE_IS_ADVERTISING_MULTIPLE = 1<<19, // We have multiple different advertising packets
133134
BLE_ADVERTISING_MULTIPLE_SHIFT = 20,//GET_BIT_NUMBER(BLE_ADVERTISING_MULTIPLE_ONE),
134135
BLE_ADVERTISING_MULTIPLE_ONE = 1 << BLE_ADVERTISING_MULTIPLE_SHIFT,

libs/bluetooth/jswrap_bluetooth.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ void jswrap_ble_setAdvertising(JsVar *data, JsVar *options) {
873873
if (jsvGetBoolAndUnLock(v)) bleStatus &= ~BLE_IS_NOT_SCANNABLE;
874874
else bleStatus |= BLE_IS_NOT_SCANNABLE;
875875
}
876-
876+
#ifndef SAVE_ON_FLASH
877877
v = jsvObjectGetChild(options, "whenConnected", 0);
878878
if (v) {
879879
if (jsvGetBoolAndUnLock(v)) {
@@ -882,6 +882,7 @@ void jswrap_ble_setAdvertising(JsVar *data, JsVar *options) {
882882
isAdvertising = true;
883883
} else bleStatus &= ~BLE_ADVERTISE_WHEN_CONNECTED;
884884
}
885+
#endif
885886

886887
v = jsvObjectGetChild(options, "name", 0);
887888
if (v) {

targets/nrf5x/bluetooth.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,8 +1067,10 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context) {
10671067
bleStatus &= ~BLE_IS_SENDING_HID;
10681068
#endif
10691069
jsble_advertising_stop(); // we're not advertising now we're connected
1070+
#ifndef SAVE_ON_FLASH
10701071
if (!(bleStatus & BLE_IS_SLEEPING) && (bleStatus & BLE_ADVERTISE_WHEN_CONNECTED))
10711072
jsble_queue_pending(BLEP_ADVERTISING_START, 0); // start advertising again
1073+
#endif
10721074

10731075
if (!jsiIsConsoleDeviceForced() && (bleStatus & BLE_NUS_INITED)) {
10741076
jsiClearInputLine(false); // clear the input line on connect

0 commit comments

Comments
 (0)