-
-
-
Wow, that is an odd one. You could try pinMode(BTN1,'pulldown') and see if that helps?
No... Only the simple pinMode statetment seems to help. Odd...
>setInterval(function(){print(digitalRead(BTN1))},1000) =4 0 0 // Multiple BTN1 presses 0 0 0 0 0 0 0 0 0 0 0 0 >pinMode(BTN1,"input_pulldown") =undefined 0 // Multiple BTN1 presses 0 0 0 0 0 0 0 0 0 >pinMode(BTN1) =undefined 0 // 1 BTN1 press 0 1 > ____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v10.89 (c) 2021 G.Williams >
Remark the Espruino prompt at the bottom : after a (detected) BTN1 press, I see the Settings/About/... screen, but no responses to BTN1 anymore. Also the setInterval seems to have stopped ??
When you do pinMode do the 0 and 1 correspond to your actual button presses or are they random?
The 0/1 values follow the BTN1 presses
If you're pressing the button for >1 second then you'd expect the Loading screen to appear though as it tries to reload the default app - could that be it?
I don't think so. I've tried to 'quickly' press BTN1. This is below 1 second, I guess
Also when it's not working could you run getPinMode(BTN1) and...
> >getPinMode(BTN1) ="input_pulldown" >
Strange...
I continued my search after I discovered the factory reset function. This should really put everything back to a know state, I suppose. I then installed a simple setWatch :
> >Bangle.factoryReset() Erasing Storage Area... Erase complete. Writing initial storage contents... Write complete. =undefined >setWatch(function(){print("Yes!")},BTN1, {edge:"rising", debounce:50, repeat:true}) =2 > // BTN1 presses, no result > > >pinMode(BTN1) =undefined > // BTN1 presses, no result !!!???
Next I uploaded Espruino's RAM, where I found something strange - to me at least :
//... setInterval(function (undefined) {return WIDGETS["bat"].draw()}, 60000); // 3 // [native code]???? setWatch(function () { [native code] }, D17, { repeat:true, edge:'falling', debounce : 24.99961853027 }); setWatch(function () {print("Yes!")}, D17, { repeat:true, edge:'rising', debounce : 49.99923706054 }); // Code saved with E.setBootCode //...
Is that '[native code]' part supposed to be there ?
-
I have a Bangle.js 2 which no longer wakes up at a BTN1 press. I've completely cleaned the watch ('Remove all Apps' and 'Install default Apps' from https://banglejs.com/apps/) , but to no extent.
When in the Web IDE, I can indeed see that the BTN1 pin stays at zero, whether pressed or not.
>reset() =undefined ____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v10.89 (c) 2021 G.Williams // BTN1 released >digitalRead(BTN1) =0 // BTN1 pressed >digitalRead(BTN1) =0 // BTN1 pressed >digitalRead(BTN1) =0
One could assume hardware failure, but the strange thing is that after a 'pinMode(BTN1)' statement, a digitalRead does react as expected.
>setInterval(function(){print(digitalRead(BTN1))},1000) =1 0 0 // Various BTN1 presses following 0 0 0 0 0 0 0 0 0 0 0 >pinMode(BTN1) =undefined 0 0 //BTN 1 detected !!! 1 0 1 1 0 1 0 1 1 > // Here the watch suddenly shows 'loading' and returns to the normal screen with non-functional BTN1
Then after a few seconds, out of the blue, the watch shows 'loading...', the normal screen reappears and BTN1 is again disfunctional (!).
So, I guess one of my previous experiments has 'destroyed' the normal functioning of BTN1 and I cannot restore it back to normal ?The 'settings.json' looks normal to me
{"ble":true,"blerepl":true,"log":false,"timeout":10,"vibrate":true,"beep":"vib","timezone":1,"HID":false,"clock":null,"12hour":false,"brightness":1,"options":{"wakeOnBTN1":true,"wakeOnBTN2":true,"wakeOnBTN3":true,"wakeOnFaceUp":false,"wakeOnTouch":false,"wakeOnTwist":true,"twistThreshold":819.2,"twistMaxY":-800,"twistTimeout":1000}}
Anything I can try ?
-
Hi,
We keep track of serial numbers for anything we deliver to customers. Time has come to do the same for our Bangle.js 2 devices we will be shipping (soon).I've noticed that for 3 devices that we bought with the same order, the serial numbers are very different :
// Connected to Bangle.js 8382 >getSerial() ="c5a488b7-1440c5e7" // Connected to Bangle.js 62e4 >getSerial() ="5bb6f7f0-75a2ae14" // Connected to Bangle.js 5e55 >getSerial() ="5705650f-3ec9f6bf" >
Is there some kind of logic in these serials or are they just 'random' ?
-
For 'Graphics.setFontCustom()', one can specify the font's 'firstChar' for which the documentation states :
firstChar - The first character in the font - usually 32 (space)
I am in the process of including true internationalisation for a Bangle.js 2 app and as such I am designing a custom font (with multiple font pages).
Reading the above doc, I was under the impression one could choose the 'firstChar' value freely and so I started at 0 (zero). Now it seems that character 0x0D (new line) is processed as new line, even if setFontCustom indicated the characters start at 0x00 (and 0x0D is 'just another character')...
I didn't verify if Espruino treats other 'below 0x20' characters in a special way, but it would have saved me a lot of debug time if it had been mentioned in the documentation that 'going below 0x20' is a dangerous adventure...
Just a suggestion to please modify the (excellent) documentation - thanks
-
Hi,
The Bangle.js 2 feature page notes :256kB RAM 1024kB on-chip flash, 8MB external flash
I'm confused about Espruino's various getFree() outputs :
>process.version ="2v10.89" >process.memory() ={ free: 7172, usage: 4828, total: 12000, history: 34, gc: 0, gctime: 20.99609375, blocksize: 15, stackEndAddress: 537085312, flash_start: 0, flash_binary_end: 523848, flash_code_start: 1610612736, flash_length: 1048576 }
'flash_length' would then be the size of the internal flash ?
And then there is :
>require("Flash").getFree() =[ { addr: 524288, length: 483328 } ] >require("Storage").getFree() =8277864 >
After reading
Flash Library
This module allows you to read and write the nonvolatile flash memory of your device.
Also see the Storage library, which provides a safer file-like interface to nonvolatile storage.I thought the 'Flash' and 'Storage' modules accessed the same Flash memory, with a separate API (roughly page vs file). But how then is the getFree() output to be interpreted ? Do I actually have 8 MByte available for access through the 'Storage' module ?
What then is the length of 483328 for the 'Flash' module ?
(I have about 60 kByte of code and files on the Bangle.js 2 for the moment, so I don't think it has anything to do with the Flash not being consecutive anymore.)
(All these questions because I need 'a lot' of space for storing a Far-East unicode font...)
-
Hi,
I have an app user complaining about not being able 'to charge the Bangle.js 2 to 100%'.
After some testing with 3 Bangles, I must conclude he's right : the 3 parts report 93..95 % after one day of charging.One of those units outputs values as follows :
>process.version ="2v10.89" >E.getBattery() =94 >NRF.getBattery() =3.28623046874 >
(I studied Espruino's 'jswrap_bangle.c', but there I see low and high values of 0.246V and 0.32V, which I don't understand.)
So my question : is there a better way to detect the 'end-of-charge' condition ?
(I know I can cheat and introduce a correction factor for the 'E.getBattery' result, but...)
-
Rebooting to the bootloader has proven very useful on several occasions, so I'm not sure it's a good idea to compromise that functionality.
I'm also not familiar enough with the bare metal code of Bangle.js 2 to make a meaningful suggestion for a watchdog functionality. (Previous experiences with an Espruino Pico gave me the watchdog functionality I'd expect, but in a Bangle.js 2 it is probably far more complex to ensure reboot and BLE accessibility at all times.)
Conclusion : for now, I'll take the risk of running my firmware without a 'high level' watchdog. I will see how this turns out (the Bangle.js 2 is after all not completely headless, the user can press the button for 3 seconds and force a re-load himself.)Thanks.
-
No stability issues so far, but I always tend to monitor all of my software modules for 'bad behaviour' and the only real solution, for e.g. an occasional unintended loop, often is a watchdog reboot. Just an experience that has proved worthwhile after years of firmware development....
So, for my understanding : the 'isAuto' flag for 'E.enableWatchdog' has no effect for a Bangle.js 2 ?
-
-
Yes I'm familiar with iconv (and libiconv), but to be able to convert UTF8 to what the (binary !) characters originally were, one needs to know the character encoding of the platform the UTF8 was generated on. That encoding was used to transform 0xF9 and oxF0 characters in the corresponding UTF8 characters and is needed to properly specify the 'decoding' libiconv must perform.
It remains unexplainable that a string declared as
x="\x0c\x05\x81\x00 \x07\x00\xF9\xF0\x0E\x00@"
gets transformed into something UTF8 :
'\f\x05\x81\0 \x07\0ùð\x0E\0@'
Why not just leave binary valued characters in strings as they are ? After all, the string for a drawImage call is not really a string anyhow ...
(Just an opinion of someone totally unfamiliar with the inner workings of Espruino and the Web IDE.)
-
The 'testOut.js' file is sent down using c-code in our devices. These are industrial terminals using an ARM CPU. This download works as it should : connecting, waiting for the prompt then copying 'testOut.js' byte by byte down to Bangle.js 2. Bangle.js 2 responds as it should, so nothing wrong there.
It is the 'testOut.js' file that is already 'wrong' : the erroneous bytes C3 B9 C3 B0 are the UTF8 representation for 'ùð' : ( https://onlineunicodetools.com/convert-unicode-to-utf8 ), and not the original F9 Fo. So using another way for download will not change anything I'm afraid.
For now, I've changed my code to avoid strings with binary 'characters', using a btoa-version of the binary values. For the example above, this comes down to :
g.clear().drawImage(atob("DAWBACAHAPnwDgBA"), 10, 10, {scale:4});
So I'm in the clear for now, but this is a bit of a clumsy workaround of course.
-
Hello again,
I ran into another difference while using Web IDE vs Espruino Tools. My programming flow for Bangle.js 2 bracelets involves building a single 'output file' for later download to multiple bracelets. It is mentioned on https://github.com/espruino/EspruinoTools that programming is as simple as :This file can then be sent directly to Espruino at some later time - sometimes just cat file.js > /dev/ttyACM0 is enough.
Unfortunately I ran into an issue with 'special character strings'. Consider the following code (this the double arrow image used in Bangle's menu) :
g.clear().drawImage("\x0c\x05\x81\x00 \x07\x00\xF9\xF0\x0E\x00@", 10, 10, {scale:4});
This is prepared for download with :
espruino --board BANGLEJS2 --config MINIFICATION_LEVEL=ESPRIMA --config SAVE_ON_SEND=1 /tmp/test.js -o /tmp/testOut.js
'testOut.js' looks like :
setTime(1634026260.035);E.setTimeZone(-7) require("Storage").write(".bootcde","g.clear().drawImage('\\f\\x05\\x81\\0 \\x07\\0ùð\\x0E\\0@',10,10,{scale:4})",0,67); load()
When downloading this to the bracelet, the error 'Too much data for file size' is returned. After some tracing it turns out the download is 69 byte, not 67 (attached image). The image on the bracelet is - obviously - 'mangled'. A dump() looks messed up :
| __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v10.89 (c) 2021 G.Williams > > >dump() // Code saved with E.setBootCode g.clear().drawImage('\f\x05\x81\0 \x07\0 extends in extends throw\x0E\0@',10,10,{scale:4})=undefined >
Using the Web IDE and 'Send to Espruino' Flash, the file downloads OK and is 67 byte in size (attached). The dump () :
> >dump() // Code saved with E.setBootCode g.clear().drawImage('\f\x05\x81\0 \x07\0 ?[249] ?[240]\x0E\0@',10,10,{scale:4})=undefined >
The difference are the codes for the 'ùð' characters. The strange thing is that the console dumps in Web IDE (development tools) show the same characters in the 'Sending' prompt, but result in a correct file being stored.
>>> Sending... settingsConsole.js:30 ---> "\u0010reset();\n\u0010print()\n\u0010require(\"Storage\").write(\".bootcde\",\"g.clear().drawImage('\\\\f\\\\x05\\\\x81\\\\0 \\\\x07\\\\0ùð\\\\x0E\\\\0@',10,10,{scale:4})\",0,67);\n\u0010load()\n\n"
So obviously 'someone' is altering the output of the minified source before sending it down BLE. How then is it possible to just 'cat' an output file to a bracelet ? What are the additional modifications a minified source needs before 'just copying' to a Bangle.js 2 ?
-
-
With your suggestions above, I've got a working solution :
Bangle.setOptions({wakeOnTouch:true}); Bangle.on("touch", function(b, xy) { console.log("main - touch",b,xy, Bangle.isLocked()); });
But it looks like, when in locked state, I have to tap twice - not a 'double tap', but tap - wait - tap :
____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v10.89 (c) 2021 G.Williams > >Bangle.isLocked() =true // Tap // No response <============ // Tap // Response main - touch 2 { "x": 91, "y": 77, "type": 0 } false // Tap // Response main - touch 1 { "x": 58, "y": 112, "type": 0 } false // Tap // Response main - touch 1 { "x": 62, "y": 110, "type": 0 } false // // Wait until locked // // Tap // No response <============ // Tap // Response main - touch 2 { "x": 90, "y": 76, "type": 0 } false // Tap // Response main - touch 2 { "x": 92, "y": 78, "type": 0 } false >
Or is this normal behavior ?
-
-
With the above solution I've been using a 'wake on tap' mechanism to get the Bangle.js 2 out of the locked state with a tap on the screen. With 2V09 firmware, this works flawlessly.
>process.version ="2v09.120" >Bangle.on("tap",function(t){console.log("tap",t)}) =undefined > // Tap on a locked Bangle.js 2 tap { "dir": "back", "double": false, "x": 0, "y": 0, "z": 1 } > >
I now have a Bangle.js 2 with 2V10 firmware. All of the above no longer works. How can I use the 'tap' event in 2V10 ?
> >process.version ="2v10.89" >Bangle.on("tap",function(t){console.log("tap",t)}) =undefined > // Some taps here >
-
I'm confused. Bangle.js 2 has a '3 bit colour LCD display'.
With firmware 2V09, this translates nicely to :>process.version ="2v09.120" >g.theme ={ fg: 0, bg: 7, fg2: 1, bg2: 3, fgH: 0, bgH: 1, dark: false } >g.getBPP() =3 >
But with firmware 2V10, the result confuses me :
>process.version ="2v10.89" >g.theme ={ fg: 0, bg: 65535, fg2: 31, bg2: 2047, fgH: 0, bgH: 2047, dark: false } >g.getBPP() =16 >
Why does it return 16 bits per pixel ? And those 16 bit color values ?
All of these questions because I have an application running on both 2V09 and 2V10 firmwares and the user can save his preferred colour scheme. The (saved) colour values for 2V09 were 0..7 and now 2V10 apparently expects 0..65535. The saved preferences result in a troubled display, with unreadable menus for changing the user colour, causing a lot of havoc of course.
(I can't seem to find the 'What's changed' for 2V10 - can someone provide a link - thanks)
-
Yes, now it works ! The resulting number of bytes from the message 'No errors. Minified xxx bytes to yyy bytes.' is identical in both cases, so chances are both builds come up with the exact same result.
As it happens, in this case the esmangle development has been really flaky
I also struggle with the 'wonderful world' of open source modules. One can usually only guess at things like quality and longevity, but hey, apart from time spent, it's free....
In the open source world, the Espruino project is a notable exception in terms of quality and support.
Thank you again for the quick response.
-
That already is better, but...
Another error is presented (which I do not have in Web IDE). I can reproduce it with the following :var dummy = 123; console.log(`dummy = ${dummy}`); var mod = require("esprimaMod");
with 'esprimaMod.js' as :
function something() { } exports.connect = function () { return something; };
and the resulting error at line 29 and 42:
root@ubuntu:~# espruino --verbose --board BANGLEJS2 --config MINIFICATION_LEVEL=ESPRIMA --config MODULE_MINIFICATION_LEVEL=ESPRIMA --config PRETOKENISE=true --config SAVE_ON_SEND=1 --config MODULE_EXTENSIONS=.js --config MODULE_URL=SmartBracelet/software/modules --minify SmartBracelet/software/projects/esprima.js -o SmartBracelet/software/es.js 0.1.39 Espruino Command-line Tool 0.1.39 ----------------------------------- Acorn library not found - you''ll need it for compiled code Found /usr/local/lib/node_modules/espruino/libs/targz.js ... Initialising CoreModules Command-line option set Espruino.Config.MINIFICATION_LEVEL to "ESPRIMA" Command-line option set Espruino.Config.MODULE_MINIFICATION_LEVEL to "ESPRIMA" Command-line option set Espruino.Config.PRETOKENISE to true Command-line option set Espruino.Config.SAVE_ON_SEND to 1 Command-line option set Espruino.Config.MODULE_EXTENSIONS to ".js" Command-line option set Espruino.Config.MODULE_URL to "SmartBracelet/software/modules" Explicit board JSON supplied: "BANGLEJS2" Loading http://www.espruino.com/json/BANGLEJS2.json Board JSON loaded Manual board JSON load complete No port supplied, but output file listed - not connecting Loading modules loadModule(esprimaMod) - esprimaMod requires [] Minifyingn esprimaMod No errors in esprimaMod. Minified 81 bytes to 66 bytes. Minification complete Since Acorn 8.0.0, options.ecmaVersion is required. Defaulting to 2020, but this will stop working in the future. { SyntaxError: Unexpected token (1:54) at Parser.pp$5.raise (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:3416:15) at Parser.pp.unexpected (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:741:10) at Parser.pp.semicolon (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:718:66) at Parser.pp$1.parseExpressionStatement (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:1201:10) at Parser.pp$1.parseStatement (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:934:26) at Parser.pp$1.parseBlock (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:1217:23) at Parser.pp$4.parseFunctionBody (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:3242:24) at Parser.pp$1.parseFunction (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:1339:10) at Parser.pp$4.parseExprAtom (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:2772:19) at Parser.pp$4.parseExprSubscripts (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:2583:21) pos: 54, loc: Position { line: 1, column: 54 }, raisedAt: 55 } Error parsing JavaScript, but uploading anyway.<br/>SyntaxError: Unexpected token (1:54) Minifying Error: Line 1: Unexpected token { Error: Line 1: Unexpected token { at ErrorHandler.constructError (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:5012:22) at ErrorHandler.createError (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:5028:27) at Parser.unexpectedTokenError (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:1985:39) at Parser.throwUnexpectedToken (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:1995:21) at Parser.consumeSemicolon (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:2297:23) at Parser.parseLabelledStatement (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:4029:19) at Parser.parseStatement (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:4122:97) at Parser.parseStatementListItem (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:3393:31) at Parser.parseFunctionSourceElements (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:4195:29) at Parser.parseFunctionExpression (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:4408:26) Minification complete (node:69905) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected character '«' (1:76) at Parser.pp$5.raise (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:3416:15) at Parser.pp$9.getTokenFromCode (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:5081:10) at Parser.pp$9.readToken (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:4765:17) at Parser.pp$9.nextToken (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:4756:17) at Parser.pp$9.next (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:4717:10) at Parser.pp$9.getToken (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:4721:10) at Object.next (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:115:20) at pretokenise (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:164:17) at Array.eval (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:31:7) at cb (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:98:15) (node:69905) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:69905) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
No idea where that 'unexpected token {' would be at in above simple code...
I honestly thought Espruino Tools used the very same chain of tools as Web IDE does, but apparently this is not the case ? I'm trying to use the tools for distributing an app to multiple Bangle.js 2's, but if Espruino Tools builds 'something different' as compared to Web IDE (where the app was fully debugged), I do not feel particularly comfortable...
-
Hi,
I'm building a 'command-line-script' to download an application to multiple Bangle.js 2 devices using Espruino Tools on Linux. I ran into a strange problem.Consider this (isolated) piece of code :
var dummy = 123; console.log(`dummy = ${dummy}`);
When minifying this is the Web IDE, no problems (of course...).
When running minification with the Espruino Tools, a strange error is reported (line 62 below):
root@ubuntu:~# espruino --verbose --board BANGLEJS2 --config MINIFICATION_LEVEL=ESPRIMA --config MODULE_MINIFICATION_LEVEL=ESPRIMA --config PRETOKENISE=true --config SAVE_ON_SEND=1 --minify SmartBracelet/software/projects/esprima.js -o SmartBracelet/software/es.js 0.1.38 Espruino Command-line Tool 0.1.38 ----------------------------------- Acorn library not found - you''ll need it for compiled code Found /usr/local/lib/node_modules/espruino/libs/targz.js ... Found /usr/local/lib/node_modules/espruino/core/serial_winnus.js Not on Windows, Winnus not needed Found /usr/local/lib/node_modules/espruino/core/terminal.js Found /usr/local/lib/node_modules/espruino/core/utils.js Found /usr/local/lib/node_modules/espruino/plugins/assembler.js Found /usr/local/lib/node_modules/espruino/plugins/boardJSON.js Found /usr/local/lib/node_modules/espruino/plugins/compiler.js Found /usr/local/lib/node_modules/espruino/plugins/getGitHub.js Found /usr/local/lib/node_modules/espruino/plugins/localModules.js Found /usr/local/lib/node_modules/espruino/plugins/minify.js Found /usr/local/lib/node_modules/espruino/plugins/pretokenise.js Found /usr/local/lib/node_modules/espruino/plugins/saveOnSend.js Found /usr/local/lib/node_modules/espruino/plugins/setTime.js Found /usr/local/lib/node_modules/espruino/plugins/unicode.js UTF8 Library loaded successfully Found /usr/local/lib/node_modules/espruino/plugins/versionChecker.js Initialising CodeWriter Initialising Config Initialising Env Initialising Flasher Initialising FlasherESP8266 Initialising Modules Initialising Notifications Initialising Serial - Initialising Serial Noble Bluetooth LE - Initialising Serial Node Socket - Initialising Serial Web Audio - Initialising Serial Web Bluetooth - Initialising Serial Web Serial Initialising Utils Initialising Status Initialising Assembler Initialising BoardJSON Initialising Compiler Initialising GetGitHub Initialising LocalModules Initialising Minify Initialising Pretokenise Initialising SaveOnSend Initialising SetTime Initialising Unicode Initialising VersionChecker Initialising CoreModules Command-line option set Espruino.Config.MINIFICATION_LEVEL to "ESPRIMA" Command-line option set Espruino.Config.MODULE_MINIFICATION_LEVEL to "ESPRIMA" Command-line option set Espruino.Config.PRETOKENISE to true Command-line option set Espruino.Config.SAVE_ON_SEND to 1 Explicit board JSON supplied: "BANGLEJS2" Loading http://www.espruino.com/json/BANGLEJS2.json Board JSON loaded Manual board JSON load complete No port supplied, but output file listed - not connecting Minifying TypeError: Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined at Controller.traverse (/usr/local/lib/node_modules/espruino/node_modules/esmangle/node_modules/estraverse/estraverse.js:411:38) at Object.traverse (/usr/local/lib/node_modules/espruino/node_modules/esmangle/node_modules/estraverse/estraverse.js:556:27) at annotateDirective (/usr/local/lib/node_modules/espruino/node_modules/esmangle/lib/annotate-directive.js:131:16) at Object.optimize (/usr/local/lib/node_modules/espruino/node_modules/esmangle/lib/esmangle.js:159:16) at obfuscate (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:117:23) at minifyCodeEsprima (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:98:18) at minify (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:212:23) at Array.eval (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:60:7) at cb (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:98:15) at compileCode (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:154:7) Minification complete Since Acorn 8.0.0, options.ecmaVersion is required. Defaulting to 2020, but this will stop working in the future. Uploading 45 bytes to flash Writing output to SmartBracelet/software/es.js Done
Platform is Ubuntu 18.04, Node version is V8.10.0, espruino (tools) is V0.1.38.
-
-
A use case for a Bangle.js 2 device requires me to replace the complete set of 'Default Applicactions' that normally live on the device.
I've accomplished that with
require("Storage").eraseAll()
followed with a 'Send to Espruino Flash'. This has all been successful and my application is running fine.
One question I have is how to prevent console messages and system errors from appearing on the Bangle.js 2 display.I've studied the default 'settings.js' app that toggles the 'log' attribute in 'setting.json' but makes no application call to inform Espruino.
I've written a 'setting.json' file to Flash with 'log' set to false, but messages keep displaying (in a very small font where I can only make out the word 'Bluetooth' every time a BLE message is received).
I have not experimented with E.setConsole() since I did not want to lose my console the next time I connect with the IDE - or is this of no concern ?
So, how does one disable debug messages from appearing on a Bangle.js 2 ?
Hi,
We've recently bought a new batch of 'Bangle.js 2' devices. These are programmed with our application in the production department of our company and, to our surprise, the application failed on all devices. Font sizes were wrong, dark/light theme switching did not work, etc...
After a day's worth of debugging, I tracked this down to a change in 'Bangle.setUI()' which now seems to reset the Graphics object to its default state. This means that after every call to setUI(), one needs to re-initialise the graphics engine (in my case : g.setFont, g.setColor, g.setBackground, g.setFontAlign, ...).
Our application uses setUI() a lot because, depending on the display mode, different touch gestures are used (and thus distinct callbacks are often removed/registered).
Is my analysis correct ?
If so, may I ask that, in future firmware releases, such large changes are implemented in a new method (e.g. Bangle.setUIAndReset() ?) so that these do not break existing applications?
Thank you.