diff --git a/libs/banglejs/jswrap_bangle.c b/libs/banglejs/jswrap_bangle.c index 4b60ef0357..a7eefa3280 100644 --- a/libs/banglejs/jswrap_bangle.c +++ b/libs/banglejs/jswrap_bangle.c @@ -3956,7 +3956,7 @@ NO_INLINE void jswrap_banglejs_init() { h = (int)(unsigned char)jsvGetCharInString(img, 1); char addrStr[20]; #ifndef EMULATED - JsVar *addr = jswrap_ble_getAddress(); // Write MAC address in bottom right + JsVar *addr = jswrap_ble_getAddress(false); // Write MAC address in bottom right #else JsVar *addr = jsvNewFromString("Emulated"); #endif @@ -3977,7 +3977,7 @@ NO_INLINE void jswrap_banglejs_init() { else y += h-15; char addrStr[20]; #ifndef EMULATED - JsVar *addr = jswrap_ble_getAddress(); // Write MAC address in bottom right + JsVar *addr = jswrap_ble_getAddress(false); // Write MAC address in bottom right #else JsVar *addr = jsvNewFromString("Emulated"); #endif diff --git a/libs/bluetooth/jswrap_bluetooth.c b/libs/bluetooth/jswrap_bluetooth.c index 5cfed8c07e..c72b2256a1 100644 --- a/libs/bluetooth/jswrap_bluetooth.c +++ b/libs/bluetooth/jswrap_bluetooth.c @@ -213,7 +213,7 @@ void jswrap_ble_init() { #if defined(USE_NFC) && defined(NFC_DEFAULT_URL) // By default Puck.js's NFC will send you to the PuckJS website // address is included so Web Bluetooth can connect to the correct one - JsVar *addr = jswrap_ble_getAddress(); + JsVar *addr = jswrap_ble_getAddress(false); JsVar *uri = jsvVarPrintf(NFC_DEFAULT_URL"?a=%v", addr); jsvUnLock(addr); jswrap_nfc_URL(uri); @@ -708,7 +708,7 @@ void jswrap_ble_eraseBonds() { "name" : "getAddress", "generate" : "jswrap_ble_getAddress", "params" : [ - ["current", "JsVar", "If true, return the current address rather than the default"] + ["current", "bool", "If true, return the current address rather than the default"] ], "return" : ["JsVar", "MAC address - a string of the form 'aa:bb:cc:dd:ee:ff'" ] } @@ -717,8 +717,8 @@ Get this device's default or current Bluetooth MAC address. For Puck.js, the last 5 characters of this (e.g. `ee:ff`) are used in the device's advertised Bluetooth name. */ -JsVar *jswrap_ble_getAddress(JsVar *current) { - if (jsvGetBool(current)) { +JsVar *jswrap_ble_getAddress(bool current) { + if (current) { JsVar *addr = jsvObjectGetChildIfExists(execInfo.hiddenRoot, BLE_NAME_MAC_ADDRESS); if (addr) return addr; } diff --git a/libs/bluetooth/jswrap_bluetooth.h b/libs/bluetooth/jswrap_bluetooth.h index b92f611031..876b072d92 100644 --- a/libs/bluetooth/jswrap_bluetooth.h +++ b/libs/bluetooth/jswrap_bluetooth.h @@ -92,7 +92,7 @@ void jswrap_ble_sleep(); void jswrap_ble_wake(); void jswrap_ble_restart(JsVar *callback); void jswrap_ble_eraseBonds(); -JsVar *jswrap_ble_getAddress(); +JsVar *jswrap_ble_getAddress(bool current); void jswrap_ble_setAddress(JsVar *address); JsVar *jswrap_ble_resolveAddress(JsVar *address); diff --git a/libs/pixljs/jswrap_pixljs.c b/libs/pixljs/jswrap_pixljs.c index e4650aa3dc..0baec5ca74 100644 --- a/libs/pixljs/jswrap_pixljs.c +++ b/libs/pixljs/jswrap_pixljs.c @@ -444,7 +444,7 @@ void jswrap_pixljs_init() { } jswrap_graphics_drawCString(&gfx,28,39,JS_VERSION); // Write MAC address in bottom right - JsVar *addr = jswrap_ble_getAddress(); + JsVar *addr = jswrap_ble_getAddress(false); char buf[20]; jsvGetString(addr, buf, sizeof(buf)); jsvUnLock(addr);