-
Only ESPs have extra flash areas.
So how many there are?
The second area currently supported is configured like this
https://github.com/espruino/Espruino/blob/master/boards/BANGLEJS2.py#L116Then when creating file one of them is "filename" and the other is using C: driver letter like "c:filename" (forgot which one is default). When reading file both areas are searched for the file name so it is some kind of overlay.
The idea was to not really have two separate 'disks' but one merged from both areas.
The code is in common layer
https://github.com/espruino/Espruino/blob/master/src/jsflash.c#L31
https://github.com/espruino/Espruino/blob/master/src/jsflash.c#L651
so could be usable also for ESP32. -
I could not figure out yet if it would be possible to "inline" lenghty C/C++ code into Espruino
Inline C is meant for short bits of code because the code+data is linked into small binary blob that runs from RAM. There is not that much RAM available for large code. It can be abused a lot and there could be hacks to the Inline C compiler to link it in different way so that it runs code from flash but nobody did that. Also Inline C is easier to use if you pass just simple types or pointers to flat byte arrays via (up to 4) parameters. Using JS variables/objects from inline C is a bit more complicated. All that is easier when code is built as part of Espruino firmware so for something that is not short and relatively simple linking the library to the firmware is better way and would take less space. And BTW the inline C source is actually passed to c++ compiler so c++ syntax in inline C works. The compiled javascript https://www.espruino.com/Compilation is translating JS into C++ and then compiling it. Here is reference counting class stolen from it https://gist.github.com/fanoush/4a5dcf777503461297cedf7e21e3c6b3#file-swd-js-L46 and used as part of Inline C https://gist.github.com/fanoush/4a5dcf777503461297cedf7e21e3c6b3#file-swd-js-L125
Anyway, all the magic of calling native code is done by E.nativeCall() which is pretty generic so you can build your own compiler and linker and as long as you get your executable binary into ram or internal flash of the device you can run it.
and if Espruino compiler can compile C++ code, too?
tensorflow is c++ and is used as part of Espruino build, check https://github.com/espruino/Espruino/tree/master/libs/tensorflow
-
Was thinking about it a bit and maybe setting scan window and iterval and stopping and starting scanning can do what you want, see this answer https://devzone.nordicsemi.com/f/nordic-q-a/11377/how-can-i-decide-scan-window-interval-for-continuous-scanning
..... after each scan interval where it will change frequency to the next advertisment channel, during this period it can't receive any advertisement packet. It will rotate between the 3 advertisment channels after each scan interval.
so you could let the scan run only one or two scan interval(s) and then stop it and start it again to let it scan only one or two channels. EDIT: well unless softdevice won't alllow to stop it until all 3 channnels are scanned
It is also described in article https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-2-bluetooth-le-advertising/topic/advertising-process/ you've probably seen already since it contains the picture you linked.
Also if you remember when exactly you got first advertising packet from the device you could schedule starting/stopping the scan and tune the window and interval to not miss it (+/- the 10ms random delay). If the advertising interval is longer like 500ms or even 1s or more, then such scheduling could save power while scanning when the window is shorter and interval would match advertising interval of the device.
However it becomes more complicated when there are more advertising devices to scan for which is probably your case. Well unless you manage to sync time between your beacons and start advertising on all of them in some synchronized way.
-
Not sure this is possible to do with softdevice (here is old post where it is solved outside of BLE stack by running custom code in radio timeslot https://devzone.nordicsemi.com/f/nordic-q-a/8902/scan-in-a-single-channel ) but recently at least the scan window and interval became configurable if that helps a bit https://github.com/espruino/Espruino/blob/0325da029cc828c377a76c5dea684a8d7520e1b0/ChangeLog#L8
Would it make sense to add it as a feature to the official Espruino build?
Well those three channels is how BLE Advertising works, there is a reason for advertising on multiple channels. You risk missing some packets when your selected channel becomes temporarily unusable due to noise.
BTW there is interesting related technology called PAWR in BT 5.4 https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/periodic-advertising-with-responses-pawr-a-practical-guide that improves advertising for better timing and bidirectional communication to avoid using connections but have similar features. Sadly using 5.4 means moving away from SoftDevice and classic SDK.
-
BLE is quite easy to use, tx/rx is just writing to characteristic and reading=getting notifications, the manual is here https://fcc.report/FCC-ID/2AKS8DX-BT18/4216091 near the end there are default service and characteristics IDs.
Not sure there is better ready to use module but you could simply use the ble_uart module https://www.espruino.com/BLE+UART and replace nordic uuids in the source https://www.espruino.com/modules/ble_uart.js by those from the manual (or reconfigure the module to use nordic ones but that is probably harder)
also if you have android phone the "Serial Bluetooth Terminal" app is good to try with the module - you should be able to connect over BLE and test how it works. It also has custom mode where you can scan ble device and pick rx/tx characteristic by id from the list
-
HC-05 cannot do BLE and MDBT42Q cannot do classic bluetooth, either you replace HC05 with HM-10 or 11, JDY-08 or similar BLE to serial module and then use MDBT42Q directly to talk over BLE to it or you get another HC-05 that you connect to serial pins of Espruino device without using BLE and pair both HC-05 together
some info about HM-10 also here https://www.espruino.com/Bluetooth+BLE
-
more or less yes, there is also difference in display driver, there are three - one mine in javascript+inline c, two made by jeffmer - lcd_spi_unbuf -unbuffered driver - sends data to screen directly as it is drawn (a bit slow) - this is also part of my build but unused/untested. Later jeffmer also made buffered driver similar to mine. both of his drivers are part of espruino binary. so you need to check how the js code draws to screen - buffered driver needs to call
g.flip()
when you want to push currently modified area to screen.also another difference is where the storage is - internal nrf52 flash (about 600kb) or spi flash 8MB or both. my latest build on github is for internal flash but no problem to build other variants (i just don't use them much, 600kb was enough for me)
-
1) there was a bug with advertising so device was not accessible with 6.1.x, it was fixed recently https://github.com/espruino/Espruino/issues/2000 and there was another fix needed for internal flash to be stable with 6.1.x, if you build from latest Espruino source then S140 6.1.x works. my older builds have some quick fix so advertising works but without patch it does not work, jeffmer's builds may not have it, and nowadays it is not worth patching old source, better is updating to latest version. And BTW Bangle2 still uses 6.0.0 so moving down from 6.1.1 to 6.0.0 was also meant for better compatibility. 6.1.1 is needed only for coded phy with extended advertising support which is useful only in special cases.
2) not in one go, dafit bin has limit on firmware size, first bin file is smaller and has some stuff compiled out to fit. maybe with some heavy compression and some custom installer that would unpack parts (bootloader, espruino, storage) into right places it could work
-
-
You are flashing the espruino_2v10.102_magic3-dafit.bin file right? no, no workaround for that step, worked for me many times, yes try different Android device. Once you have first Espruino from the -dafit.bin then you can update bootloader by copy pasting the bootloader and updating UICR via IDE (step 6 in readme) and then you can use any other DFU tool - like nrfConnect. But for the first step with the DaFit .bin file format only DaFlasher works.
And BTW once you flash Espruino the screen is blank, you need to run some js code to use it.
-
-
there is more here https://github.com/espruino/Espruino/blob/55fbab3847975a40341dd2272d4693b341cc0ffe/targetlibs/nrf5x_12/components/softdevice/s130/headers/ble.h#L212-L295
so when filled properly it should be configured in similar way to this https://github.com/espruino/Espruino/blob/55fbab3847975a40341dd2272d4693b341cc0ffe/targets/nrf5x/bluetooth.c#L2567C5-L2575C6
-
Currently cheapest is probably the C17/Magic3 - about 11 usd including VAT and shipping on aliexpress, which is great price for nrf52840 based smartwatch. One random seller https://www.aliexpress.com/item/1005005373233740.html
is it possible to run Espruino on a non-Bangle smartwatch
Yes but Espruino != Bangle.js, the interpreter works fine including BLE and all hardware but the UI part and Bangle apps from official repo work well only with official Bangle.js watches. However you can certainly use C17 running Espruino as a watch with custom subset of tweaked apps. C17 has 280x240 touch screen, one button and no gps or barometer. Also the HR sensor gives just raw data so is not that much usable out of box, same for step counting.
For Bangle api layer it is perhaps best to start from here https://github.com/jeffmer/WatchApps -
Oh, that explains it. It is is the same item I have wishlisted but I get "Sorry, the page you requested can not be found:(" when clicking it. In wishlist I have "Currently unavailable" next to it. So it is some geo restriction if you still see it. It worked for me some time ago.
EDIT: Oh I see small text "Sorry, this item's currently unavailable in your location." there too.
And I see it also on this
https://www.aliexpress.com/item/1005002480008305.html
which should be Lenovo HX11 / Desay DS-D20F band possibly with gpios on USB too. https://fccid.io/2AEMN-D20 Maybe somebody can see it? -
-
-
-
yes, the
poke32(0x10001014,0x7A000);while(!peek32(0x4001e400));
line is unique to Bangle 1 watch as per https://github.com/espruino/Espruino/blob/master/targetlibs/nrf5x_12/nrf5x_linkers/banglejs_dfu.ld#L14 for all other nrf52832 devices it is different value https://github.com/espruino/Espruino/blob/master/targetlibs/nrf5x_12/nrf5x_linkers/secure_dfu_gcc_nrf52.ld#L14anyway, the device is bricked now, you need to take it apart and use SWD debugger to restore at least that value at
0x10001014
to get it booting again -
no, not me, but @yngv126399 did something with adding e-ink to Magic3 recently and other people mentioned some stuff on discord over years with some photos. but I guess you already opened it many times so you already know the inside,
here is some recent photo of PCB, at least the TXD and maybe the one next to it (RXD?) and one button pin should be usable? -
It is very old watch now, likely nowhere to be found for years already. Just checked and I bought F18 on aliexpress in 2019, you can't even buy much newer watches.
it is this thing https://www.amazon.co.uk/F18-Smartwatch-Bluetooth-Waterproof-Pedometer-Red/dp/B07JLV7ZF1
here is youtube reviewhttps://www.youtube.com/watch?v=tpjtu02M_DI
EDIT: you also can't find it on https://www.dtno1.com/search/index.php?keyword=F18 which is company that sold it, google "dt no.1 f18"
-
-
-
fanoush may know of a band that could work and is still on sale
DS-D6 was unique because it has two generic GPIOS on the usb data pins. Only few smart bands made by same Desay company had this feature DS-D9,DS-D6, HX03(W,F) and also SMA Q2 had it. Sadly none are available for sale nowadays. I don't have any more new DS-D6, only few used used ones (maybe atc1441 https://youtu.be/3gjmEdEDJ5A?t=6
still has some ?) , I still have two boxed HX03W.If you just want nrf52 device with battery and screen and don't mind taking it apart to get GPIOs then the Magic3/C17 is cheapest and is even nrf52840 and relatively easy to open (price is about 11EUR with shipping and taxes from aliexpress)
-
where did you find those firmwares?
Well, it is from Smart Health app - firmware update functionality available from their servers, sadly there is no firmware file named R8, btw is b8:37 part of your device mac address? I'll search other binaries for R8 maybe the file has different name.
EDIT: searched all binaries and sadly don't see any with "R8" inside. for R1 and R2 the name is probably done in same way as there is this in the binary
R2..%s %02X%02X
so R2 gets formatted with two hex numbers (possibly from MAC address)
Here are device names with nrf52 firmware update available from SmartHealthBNR860,DEFIRO,E04S,E10PROA,E20E10A,E20E10I,E20E10J,E66C,E67,E68,E80A,E80C,E80DL,E80DLA,E80DLF,E86,E86DL,ES09,F81,FW46,H01,H28,H6,H6B,M18PLUS,M8,P50C,R01,R02,R1,R2,R2C,S2,S2D1,S6,S6Glu,TYFE80A,U32,V6,YB,YC,YC024,YC030,YC31,YC66
most of them are probably smartwatches (their firmware is much bigger, over 300KB vs <200KB for rings)
don't know about specific commit but
https://www.espruino.com/Reference#l_NRF_setScan is the documentation,for options it points to
https://www.espruino.com/Reference#l_NRF_requestDevice
So like there is "phy" or "extended" option there is new "window" and "interval" options with value in miliseconds
https://github.com/espruino/Espruino/blob/master/targets/nrf5x/bluetooth.c#L3008
so something like
should probably scan one channel for 1 second. Once you find the device in the callback you may record current time, stop the scanning
NRF.setScan();
and start it again somehow synchronized to expected advertising interval. like if that is 1 second then start after 900ms and scan e.g with window of 200 for interval 1000 if that improves things and packets will hit the 200ms window every second. I did not actually try this idea yet.