-
Yes, not sure I am following you, but I think MIT app is more capable of doing lots of custom things. And BangleJs needs it’s very own app to interact with. Basic use case of app where you can push latest news, announcement and update. Very own way to send notifications to BangleJs.
Web Ble App Store works grate for installing and updating apps but it is not practical to do everyday “smartwatch” stuff from mobile browser as a use needs a lot user actions to perform a simple task. A dedicated app would make more sense to me.
-
Thank @Gordon for your response. It is very unfortunate that mBit v2 still not so powerful to run Esprunio and TF both. I am sure there must me some performances optimisation there to fit in.
-
This conversation brings me an idea. What if we create a small Android app made in MIT App Inventor for BangleJS?
But yes there is a caveat is MIT app inventor apps does not supports background services or task out of the box for web the app will be in background no notifications will be sent to BangleJs. But this can be fixed via adding some extension. Few are paid but those are more then hack.
-
Nice hack @ThePlayShed. Just wondering , how far you can put your controller from the train before BLE disconnect.
I was playing similar things with MiP robot. Unfortunately it disconnects from few meter(~4-5 meters) away from the controller. But get good range when using mobile phone or laptop.
-
New Updates:
I am so excited to have MbitV2 in my hand so could not resist to try and run existing tensorflow micro_speech model on microbit.
I started to look an existing Espruino approach from this post to generate espruino compatible tflite model. I encountered so many issues while convert existing model(hello world/sin wave), creating new model(speach), and even building espruino for mBitV2.
1 - Convert existing hello_world model
This code is no longer working with the new notebook.
import base64; print("var model=atob(\""+base64.b64encode(tflite_model)+"\");")
but this works
import base64; print(base64.b64encode(tflite_model))
After fixing the base64 stuff, i tried to run the same example in emulator but it neither gives any error nor expected outcome.
Original example vs Updated example
2- "Prompt not detected - upload failed" errorI am getting upload error when trying to upload this code direct to RAM.
Is this related to Low RAM or Flash??? How can I fix this?
Connected to Espruino MICROBIT2 >Execution Interrupted New interpreter error: Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Execution Interrupted Prompt not detected - upload failed. Trying to recover...
Microbit is flashed this hex
>process.env ={ VERSION: "2v08", GIT_COMMIT: "9a1dd6eb", BOARD: "MICROBIT2", FLASH: 524288, STORAGE: 40960, RAM: 65536, SERIAL: "d80c74c5-75c326d4", CONSOLE: "Bluetooth", MODULES: "Flash,Storage,hea" ... "opixel,tensorflow", EXPTR: 536882360 } >
3- Build error.
To get more space on Microbit I tried to remove 'NEOPIXEL' module from the board file and build
make clean && BOARD=MICROBIT2 make
.But I got errors right after elf file is created
here is the truncated log
...... ... ... /mnt/c/Users/ABHINAV.000/Documents/esp/Espruino/targetlibs/nrf5x_12/components/drivers_nrf/hal/nrf_gpio.h:648:22: warning: inlining failed in call to 'nrf_gpio_pin_write': call is unlikely and code size would grow [-Winline] __STATIC_INLINE void nrf_gpio_pin_write(uint32_t pin_number, uint32_t value) ^ targets/nrf5x/jshardware.c:740:9: note: called from here nrf_gpio_pin_write(MB_LED_COL2, i&1); ^ /mnt/c/Users/ABHINAV.000/Documents/esp/Espruino/targetlibs/nrf5x_12/components/drivers_nrf/hal/nrf_gpiote.h:322:22: warning: inlining failed in call to 'nrf_gpiote_event_clear': call is unlikely and code size would grow [-Winline] __STATIC_INLINE void nrf_gpiote_event_clear(nrf_gpiote_events_t event) ^ targetlibs/nrf5x_12/components/drivers_nrf/gpiote/nrf_drv_gpiote.c:251:5: note: called from here nrf_gpiote_event_clear(NRF_GPIOTE_EVENTS_PORT); ^ targets/nrf5x/jshardware.c: In function 'dly.isra.0': /mnt/c/Users/ABHINAV.000/Documents/esp/Espruino/targetlibs/nrf5x_12/components/drivers_nrf/delay/nrf_delay.h:162:22: warning: inlining failed in call to 'nrf_delay_us': call is unlikely and code size would grow [-Winline] __STATIC_INLINE void nrf_delay_us(uint32_t number_of_us) ^ targets/nrf5x/jshardware.c:961:3: note: called from here nrf_delay_us((uint32_t)microsec); ^ src/jsutils.c: In function 'jsAssertFail': /mnt/c/Users/ABHINAV.000/Documents/esp/Espruino/targetlibs/nrf5x_12/components/toolchain/cmsis/include/core_cm4.h:1790:22: warning: inlining failed in call to 'NVIC_SystemReset': call is unlikely and code size would grow [-Winline] __STATIC_INLINE void NVIC_SystemReset(void) ^ src/jsutils.c:374:3: note: called from here NVIC_SystemReset(); ^ /mnt/c/Users/ABHINAV.000/Documents/esp/Espruino/targetlibs/nrf5x_12/components/toolchain/cmsis/include/core_cm4.h:1790:22: warning: inlining failed in call to 'NVIC_SystemReset': call is unlikely and code size would grow [-Winline] __STATIC_INLINE void NVIC_SystemReset(void) ^ src/jsutils.c:374:3: note: called from here NVIC_SystemReset(); ^ python scripts/check_elf_size.py MICROBIT2 espruino_2v08.93_microbit2.elf Testing espruino_2v08.93_microbit2.elf for MICROBIT2 STORAGE: 442368 -> 483328 FS DATA: 465824 -> 465840 (16 bytes) CODE: 126976 -> 465840 (338612 bytes) ========================== CODE AND STORAGE OVERLAP by 23472 bytes ========================== make/common/NRF5X.make:440: recipe for target 'espruino_2v08.93_microbit2.app_hex' failed make: *** [espruino_2v08.93_microbit2.app_hex] Error 1
-
I recently got my Microbit V2 that is very much supported by Espruino. I noticed that Tensor Flow is already activated in microbit v2 board file. Thai means it supports TF by default.
Since mBit v2 has inbuild microphone I wonder how easy or complex is to implement/run well known TF-Lite Yes-No demo or Edge Impulse Voice Activated Microbit demo.
Edge impulse internally using tensor flow lib which looks same as in Espruino TF
PS: You can also export the trained models to compatible Arduino or C++ library.
By the way this link is broken here Espruino GitHub and the this is the correct URL
-
-
that make sense... thanks @Gordon !!
-
I was trying to extend BangleJS locale module to localize time and observed that time() function is not giving the expected result.
>let l = require("locale"); ={ name: "en_GB", currencySym: "\xA3", translate: function (a) { ... }, date: function (a,c) { ... }, time: function (a,c) { ... }, dow: function (a,c) { ... }, month: function (a,c) { ... }, number: function (a) { ... }, currency: function (a) { ... }, distance: function (a) { ... }, speed: function (a) { ... }, temp: function (a) { ... }, meridian: function (a) { ... } } >l.time(new Date()); ="am:52.46 am" >
from this https://github.com/espruino/Espruino/blob/master/libs/js/banglejs/locale.js#L9 it looks like this is a bug.
and it should be
time : (d,short) => { // Date to "4:15.28 pm" or "15:42"(short) var h = d.getHours(), m = d.getMinutes() if (short) return (" "+h).substr(-2)+":"+("0"+m).substr(-2); else { var r = "am"; if (h==0) { h=12; } else if (h>=12) { if (h>12) h-=12; r = "pm"; } return (" "+h).substr(-2)+":"+("0"+m).substr(-2)+"."+("0"+d.getSeconds()).substr(-2)+" "+r; } },
-
-
-
-
Hi,
I have 4 diffetent types of image data. 3 of them are in SVG format and one is in bitmap. I have converted SVG->BangleJS using this, and Bitmap->BangleJS using this
1- Bitmap
var img = require("heatshrink").decompress(atob("oNDyBC/AH4A/AH4A/AH4A/AH4A/AGlVnltzpD/AG887gBLJv4Avtu9P5oBDqs8Kv4AFqtcon8sudf9oBHPf4ABst9Jsp/VQf5/CvhNnQP7/hJ76BZrtcP/6Djst8QLK1ZADtdKbQvTFrNdnh/0rjTbQaavtAD9Vnh/dK6aB/P75hTQcp/xpp/UMKo5NtudEKJNBP+EcM7bhhf/9E/hjfDp4xBY6tlvp9xP8aDTNOYAVPqJdXQP4AVtudP86DPPP7XVLMJ//QMJP/AGNVnh//AH4ABPo9NjhJ/AHdt3o31rt8PP4A9P4M87hD/P/6B/P/6B/P/6B/P/6B/AHp/JALZl/QP6D/MpKB7pscP/6DXQM9dviB/Qa6BnP/JjRD57dBPr9lvp/7cqZP9Qf6D/Qf6D/ONqD/P/6D/P/6D/P/6D/P/5hdQf5//Qf5//Qf5//Frdlvh//P9dVngtRpscP/5/pFaIBDtu9P/5/lPqqxdP/59jP/5NjPrdtzp//P79Nnh9ZrtcPvZ/lPrKZBPvp/9on8Pv5/lQK57/P9InpP/5XZrt8Pv4ATtuda9dlvojFsudO/4AJP9YA/ACttzp//AH4ABP/4A/AAdtzp9Bst8Iv4A/AH4A/AH4A5"));
2- SVG - Int Array
var polyImg = [ {fill: "#3d9ae2", points: new Uint8Array(E.toArrayBuffer(atob("PQg9CzsNOA82DzMOMA0vCi4ILwUxAjMBNgA5ATsCPQU9CA==")))}, {fill: "#3d9ae2", points: new Uint8Array(E.toArrayBuffer(atob("")))}, {fill: "#3d9ae2", points: new Uint8Array(E.toArrayBuffer(atob("KxMsECsOIQQeAxsEDxEOEw8WEhcUFh4LJhMoFCsT")))}, {fill: "#3d9ae2", points: new Uint8Array(E.toArrayBuffer(atob("")))}, {fill: "#3d9ae2", points: new Uint8Array(E.toArrayBuffer(atob("OhwuHC4VKBwoICkhKiI6IjwhPR88HToc")))}, {fill: "#3d9ae2", points: new Uint8Array(E.toArrayBuffer(atob("")))}, {fill: "#3d9ae2", points: new Uint8Array(E.toArrayBuffer(atob("ATwEPQY8GSkUJAE3ADoBPA==")))}, {fill: "#3d9ae2", points: new Uint8Array(E.toArrayBuffer(atob("")))}, {fill: "#3d9ae2", points: new Uint8Array(E.toArrayBuffer(atob("Hx4cHRoeGCEaIyMtGDMWNRY4GTobOSoxLC4rKw==")))}, {fill: "#3d9ae2", points: new Uint8Array(E.toArrayBuffer(atob("")))} ];
2- SVG Float32 array
var polyImgF = [ {fill: "#3d9ae2", points: new Float32Array(E.toArrayBuffer(atob("NlB1Qlon8kAf4XJC8VYoQWL1a0ISz09BkLhhQiAfaUFbgVdCG09wQVCwS0LAkmZBUNJBQsrjSkFvfjtCg/AhQX+yOUJaJ/JAgiE8QgSfk0AfDUNCDl4JQO9JTULSfxA/W4FXQoYf7D0sUmNCrUQ5PzQwbULyCh1AN4RzQvlroEA2UHVCWifyQA==")))}, {fill: "#3d9ae2", points: new Float32Array(E.toArrayBuffer(atob("")))}, {fill: "#3d9ae2", points: new Float32Array(E.toArrayBuffer(atob("jgQrQm9BlUEUSC9C1qp+QfEKK0LgRVhBBNgFQnD0hkCjIPJBMbQ+QFCP20FAHYdAgDxvQWO4hUFbWV5B6o6bQeJ4b0Hf1q5B+JKNQXJIt0FzxaBBK86uQVKl80GZ3DdBlYAWQiNKlUFfayFCtrudQY4EK0JvQZVB")))}, {fill: "#3d9ae2", points: new Float32Array(E.toArrayBuffer(atob("")))}, {fill: "#3d9ae2", points: new Float32Array(E.toArrayBuffer(atob("2IloQn5a3kF/sjlCflreQX+yOUIGQatBwyUgQn5a3kHEJSBCWjkAQp40IkIgwwVCAqooQvu5CEJDj2hC+rkIQmOZcUL09ARCNVB1QmXc90Evi3FCJMjlQdiJaEJ+Wt5B")))}, {fill: "#3d9ae2", points: new Float32Array(E.toArrayBuffer(atob("")))}, {fill: "#3d9ae2", points: new Float32Array(E.toArrayBuffer(atob("yv+HPxp7cULMbHNA1b11QnKCxkB9gXFCnTnJQf20JUL9GKBBNiURQq90hz+J9VxCrpSBOyXhZ0LK/4c/GntxQg==")))}, {fill: "#3d9ae2", points: new Float32Array(E.toArrayBuffer(atob("")))}, {fill: "#3d9ae2", points: new Float32Array(E.toArrayBuffer(atob("Bo/1Qd7K8kFFp99Bak3qQZ5kzEGZ0/JB4O/DQZRZBEJVbcxB0PYNQjWJC0IHRDNCPnC8QWhqS0LN3K5BPDVUQgvbskEgQWBCzsHFQZIuZ0IrhdpBnpllQuWBKEIXfUVCD+kwQv3yOELUECxCBqsqQg==")))}, {fill: "#3d9ae2", points: new Float32Array(E.toArrayBuffer(atob("")))} ];
3- Regular Array
var polyImg = [ {fill: "#3d9ae2", points: [61.328,7.567,60.72,10.521,58.99,12.988,56.43,14.57,53.876,15.019,50.922,14.411,48.455,12.681,46.873,10.121,46.424,7.567,47.033,4.613,48.763,2.146,51.322,0.564,53.876,0.115,56.83,0.724,59.297,2.454,60.879,5.013,61.328,7.567]}, {fill: "#3d9ae2", points: []}, {fill: "#3d9ae2", points: [42.754,18.657,43.82,15.917,42.761,13.517,33.461,4.217,30.266,2.98,27.445,4.222,14.952,16.715,13.897,19.445,14.967,21.855,17.697,22.91,20.096,21.851,30.456,11.491,37.626,18.661,40.355,19.717,42.754,18.657]}, {fill: "#3d9ae2", points: []}, {fill: "#3d9ae2", points: [58.135,27.794,46.424,27.794,46.424,21.407,40.037,27.794,40.037,32.056,40.551,33.441,42.166,34.182,58.14,34.182,60.4,33.239,61.328,30.983,60.386,28.723,58.135,27.794]}, {fill: "#3d9ae2", points: []}, {fill: "#3d9ae2", points: [1.062,60.37,3.804,61.435,6.203,60.376,25.153,41.427,20.012,36.286,1.058,55.24,0.004,57.97,1.062,60.37]}, {fill: "#3d9ae2", points: []}, {fill: "#3d9ae2", points: [30.695,30.349,27.957,29.288,25.549,30.353,24.492,33.087,25.553,35.491,34.884,44.816,23.555,50.854,21.858,53.052,22.357,56.064,24.72,57.795,27.315,57.4,42.127,49.372,44.228,46.237,43.016,42.667]}, {fill: "#3d9ae2", points: []}
My question is, what would be the best option to save RAM considering I am storing the image data in files and reading then using Storage module. I know that option 1 is not the best one but I just listed because I have it.
I am getting the best rendering output when using Option 1 or 2
-
Hi @NebbishHacker, How about compress the output using heatshrink??
-
-
I am scanning BLE peripheries using NRF.findDevices() /NRF.requestDevice() calls. None of the methods returning the local-name/ name of the discovered devices.
I am using latest BangleJS firmware V.08
NRF.findDevices(function(devices) { : console.log(devices); :}, 1000); =undefined [ BluetoothDevice: { "id": "1d:0d:90:b3:74:f1 private-nonresolvable", "rssi": -55, "data": new Uint8Array([24, 255, 6, 0, 1, 9, 33, 10, 80, 19, 206, 177, 8, 16, 65, 66, 72, 73, 78, 65, 86, 45, 80, 67, 56]).buffer, "manufacturer": 6, "manufacturerData": new Uint8Array([1, 9, 33, 10, 80, 19, 206, 177, 8, 16, 65, 66, 72, 73, 78, 65, 86, 45, 80, 67, 56]).buffer }, BluetoothDevice: { "id": "f0:d1:ff:48:71:b7 random", "rssi": -56, "data": new Uint8Array([2, 1, 6, 3, 3, 170, 254, 21, 22, 170, 254, 0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).buffer, "services": [ "feaa" ], "serviceData": { "feaa": new Uint8Array([0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).buffer } } ] >
But my device is advertising the name. I can see in noble.js scan output
id: 'f0d1ff4871b7', uuid: 'f0d1ff4871b7', address: 'f0:d1:ff:48:71:b7', addressType: 'random', connectable: false, advertisement: { localName: 'BBC micro:bit [zevov]', txPowerLevel: undefined, manufacturerData: undefined, serviceData: [ [Object] ], serviceUuids: [ 'feaa' ], solicitationServiceUuids: [], serviceSolicitationUuids: [] }, rssi: -30, services: null, state: 'disconnected' } Peripheral { _noble: Noble { initialized: true, address: '00:1a:7d:da:71:13', _state: 'poweredOn', _bindings: NobleBindings { _state: 'poweredOn', _addresses: [Object], _addresseTypes: [Object], _connectable: [Object], _pendingConnectionUuid: null, _connectionQueue: [], _handles: {}, _gatts: {}, _aclStreams: {}, _signalings: {}, _hci: [Hci], _gap: [Gap], _events: [Object], _eventsCount: 21, onSigIntBinded: [Function: bound ], _scanServiceUuids: [] }, _peripherals: { '1d0d90b374f1': [Peripheral], f0d1ff4871b7: [Peripheral], cf937c826f4b: [Circular] }, _services: { '1d0d90b374f1': {}, f0d1ff4871b7: {}, cf937c826f4b: {} }, _characteristics: { '1d0d90b374f1': {}, f0d1ff4871b7: {}, cf937c826f4b: {} }, _descriptors: { '1d0d90b374f1': {}, f0d1ff4871b7: {}, cf937c826f4b: {} }, _discoveredPeripheralUUids: [ '1d0d90b374f1', 'f0d1ff4871b7', 'cf937c826f4b' ], _events: [Object: null prototype] { warning: [Function: bound ], newListener: [Function: bound ], stateChange: [Function], discover: [Function] }, _eventsCount: 4, _allowDuplicates: undefined }, id: 'cf937c826f4b', uuid: 'cf937c826f4b', address: 'cf:93:7c:82:6f:4b', addressType: 'random', connectable: true, advertisement: { localName: 'DS-D6 6f4b', txPowerLevel: undefined, manufacturerData: undefined, serviceData: [], serviceUuids: [ '6e400001b5a3f393e0a9e50e24dcca9e' ], solicitationServiceUuids: [], serviceSolicitationUuids: [] }, rssi: -86, services: null, state: 'disconnected' }
I dont have a clue!! I want to show the name of the device in search so that I can select the device based on name.
-
I found answer here
-
I want to preserve the content of Graphics buffer and reuse it later. But when I store in a new Uint8Array it and call graphics.clear(), it clears the saved variable also. See below example.
I am saving g.buffer in fb variable and after calling g.clear(), it clears fb also.
How to resolve this?
>g=Graphics.createArrayBuffer(8,8,8); =Graphics: { buffer: new ArrayBuffer(64) } >g.drawLine(0,0,7,7) =Graphics: { buffer: new Uint8Array([255, 0, 0, 0, 0, ... 0, 0, 0, 0, 255]).buffer } >var fb = (new Uint8Array(g.buffer)) =new Uint8Array([255, 0, 0, 0, 0, ... 0, 0, 0, 0, 255]) >print(fb); new Uint8Array([255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 255]) =undefined >g.clear(); =Graphics: { buffer: new ArrayBuffer(64) } >print(fb) new Uint8Array(64) =undefined
-
-
@Gordon so what will be the Make file command to create DFU package
bootloader hex
bootloader + softdevice hexWhen I use this command
make clean &&
NRF_SDK11=1
DFU_UPDATE_BUILD=1
BOARD=
RELEASE=1
USE_BOOTLADER=1
VERBOSE=1 makeand in BOARD.PY I have set
'bootloader' : 1,It generates the DFU package just having Espruino application hex. The hex works perfect with a device which already have a valid bootloader installed.
-
-
Great!! I will have a look.. @Gordon Another thing that I am planning to buy MDBT42Q
https://shop.espruino.com/ble/mdbt42q-breakoutHow I interface it to laptop/computer for stuff like flashing? I have a StLink V2 clone SWD and sole FTDI/TTL breakout. Will this work?
Also it does not have pins soldered, is it possible if I order one you can send(shipping UK) a pre soldered?
-
I want to compile Espruino bootloader but with a specific bootloader start address.
Default Espruino bootloader starts at 0x78000 and BangleJs at 0x7a000.As I know that there are no MAKE parameter is available to do, so I have to change the start address somewhere in the source (linker file???)...
Can some one give how to do it?
Actually I want to compile Espruino bootloader with starting address say 0x7a000 or 0x79000.
Cheers
-
Check setWatch function. https://www.espruino.com/Reference#l__global_setWatch
use BTN1/BTN2/BTN3 for pin to watch, and write your code in callback. remember that BTN2 does most of the watch framework like launch settings menu, and long hold BTN3 does simile to reset. So if you re-configure these buttons you may loose some of the bangjeJs watch functions and watch may respond with some unexpected things...
Let’s start collate an Idea and user of BangleJs design and develop it.
“Form the community, For the community” model.