-
Mon 2021.10.11
@TTBangler while I'm not up to speed using the graphics class on Bangle.js that code block does produce errors for me. I don't have a Bangle to test/troubleshoot and I'm not entirely sure whether the user is required to define a container for it.
The entire code block takes roughtly 20-30 seconds to upload using the native app and there is plenty of free space remaining.
>process.memory() ={ free: 1207, usage: 393, total: 1600, history: 5, gc: 0, gctime: 1.572 } >
These errors occured using the native app as I don't have a Bangle connected, and no Emulator access within that app.
>Uncaught ReferenceError: "g" is not defined at line 275 col 2 g.clear(); ^ Uncaught ReferenceError: "g" is not defined at line 130 col 2 g.clear();if(options.title!=undefined){g.setFont("Vector",30);g.setCol... ^ in function "drawChoices" called from line 13 col 132 ...choices;drawChoices(options);if(options.choices==2){return new Promise(... ^ in function "getChoice" called from line 308 col 8 }).then((v) => { ^ { "free": 1232, "usage": 368, "total": 1600, "history": 672, "gc": 0, "gctime": 1.853 } Uncaught ReferenceError: "Bangle" is not defined at line 323 col 7 Bangle.on('swipe', swipeMemoryLogger); ^ >
-
Mon 2021.10.11
I took that source code file verbatim and loaded into notepad++ to determine it's size. I then stripped the comments as that is what occurs during the upload. Should the leading whitespace chars and blank lines be removed, we'd get down to the ~400 JSVars that Espruino finally unpacks.
9077 / 16 = 567
7961 / 16 = 497Bytes / Bytes per JSVar = JSvars
So plenty of Free memory remaining.
>process.memory() ={ free: 1207, usage: 393, total: 1600, history: 5,
Some techy stuff that might pique your interest:which I conveniently retrieved from a thread I created:
I ran into a similar issue five years ago and ideas here might provide some insight:
Note that my code file was three times larger!!
-
Mon 2021.10.11
'Are you still getting this exact same error:'
Yes and now another as a prefix:
ERROR: Found module, but search took too long.
I'm just sending the single line require snippet as in post #1
nfo":"","Sound_Success":"","Sound_Warning":"","Speak_Error":false,"Speak_Info":false,"Speak_Success":false,"Speak_Warning":false,"UI_MODE":"Normal","WEBCAM_CONSTRAINTS":0,"projectEntry":"3283B07BECAAF13E2A9156A1F2A10BC4"} loadModule(AT24) ERROR: Found module, but search took too long. ERROR: getURL("https://www.espruino.com/modules/AT24.min.js") error : Error: certificate has expired ERROR: getURL("https://www.espruino.com/modules/AT24.js") error : Error: certificate has expired WARNING: [notify_warn] Module AT24 not found Found a prompt... great! >>> Sending... ---> "\u0010reset();\n\u0010\n\u0010\u001b[2dvar ee = require(\"AT24\").connect(i2c, pagesize, capacity, i2caddress);\n\n" Splitting for reset(), delay 250 >>> Sent SET chrome.storage.sync = {"AUTO_SAVE_CODE":true,"BAUD_RATE":"115200","BLOCKLY_EXTENSIONS":"|bluetooth|robot|","BLOCKLY_LANGUAGE":"en","BLOCKLY_TO_JS":false,"BOARD_JSON_URL":"http://www.espruino
'I believe a quick fix is just to go to Settings -> Communications -> Module URL'
Did that and success!
The first line below of the module is now fetched:
fo":"","Sound_Success":"","Sound_Warning":"","Speak_Error":false,"Speak_Info":false,"Speak_Success":false,"Speak_Warning":false,"UI_MODE":"Normal","WEBCAM_CONSTRAINTS":0,"projectEntry":"3283B07BECAAF13E2A9156A1F2A10BC4"} Config.MODULE_URL => http://www.espruino.com/modules - AT24 requires [] Found a prompt... great! >>> Sending... ---> "\u0010reset();\n\u0010Modules.addCached(\"AT24\",\" /* Copyright (C) 2014-2015 Spence Konde. See the file LICENSE for copying permission. */\\n /*\\nThis module interfaces with I2C EEPROMs, like the AT24C256. \\n\\nThis only supports EEPROMs with 16-
'Since you're native, the lack of HTTPS won't matter'
Learned something. I was under the impression that requests would be denied to the requester should the certificate not be active and the 's' URL request is not made. As (assumption) the native app .js module request doesn't appear as a browser request, we get away with it in this instance.
'I guess possibly the NW.js version used for the Native IDE'
Unknown what that file does or how to access it.
It is interesting that the browser request using the online ide is accepted, but the native app isn't. The certificate isn't changing, the URL request goes to the same location, just the request to a secure server is different.
-
Sun 2021.10.10
'I've noticed that after a while . . . '
@TTBangler Approx how many upload attempts?
'the Web IDE stops working'
What version of IDE and is the online one in use or the native app?
Please post
process.env
for current flashed version please.'I'm seeing this with a 250 line, ~8k file'
FWIW I have been successful at over a 30K ~1000+ line file (which would minimize to 9K with comments removed) upload to a Pico. While doing this I kept an eye on available memory.
process.memory()
Once Free memory started getting below 150 JSVars, I would experience similar issues. I don't have a Bangle handy to check available memory, would you also post that. Were you checking free memory as left hand console snippets were uploaded?
-
Sun 2021.10.10
And, . . . it gets just as tricky for all the apps that the original authors may not update, along with those that are compatible on both versions.
Also, what happens when a question would apply to both, and one might not check the other forum category?
I'll agree that it does get a bit questionable even to attempt to respond to a forum post, when it might not be known which version we are dealing with. It makes more sense for the poster to indicate which version they have, but getting consistency there may be a challenge.
-
Fri 2021.10.08 - 10:59am CST
'I believe everything is back to normal now?'
No
Just tried several times. However, this seems specific to the native app and not the online IDE.
I am able to build/run a local project with the content as a module, not all recent members may know of this technique, and that presumes the .js module had been previously saved to disk.
While I realize the online IDE will be the future, the native app
Web IDE version 0.70.6
is more stable for my use, as the online IDE is still a bit buggy on Windows.If the issue was related to link in post #2, I'm wondering what subtle difference exists that wont allow the native app making the same module .js fetch, errors in comparison to the online IDE making the similar browser request?
-
Wed 2021.10.06
'your original issue I believe could be that you're building for Linux natively and are then switching to a different device and are not cleaning the build:'
Thank you for the analysis @Gordon.
'could be that you're building for Linux natively'
'then switching to a different device'I'm not entirely sure I'm performing the task referenced here. Just to be clear, I'm not intentionally changing the device for the nRF52840 build.
Please (anyone) correct me if my understanding is incorrect, but all my commands are being entered inside the terminal window that is launched from the VSCode menu. My belief (as I'm sure I'm not fully understanding) is that WSL is the binding that allows a user to enter/execute Unix like commands on a DOS based PC. Kinda like a Unix virtual machine running inside it's own frame. (not sure if 'window' is a good choice of words for Unix) So, I don't believe I need a separate terminal window like the Putty app, just using the one VSCode provides.
When you explain 'building for Linux natively' and should that mean creating the .hex file and then 'switching to a different device' is something I'm not (intentionally) doing.
I was however during frantic now what the expletive do I do now sessions, did try combinations of clean and switching the provision scripts as that sequence did a couple of times seem to allow me to make progress. (errors changed and were never repeatable)
The insight @fanoush observed seems to be what is happening based on my file write delay hunch.
Over the weekend, I'll try that post #10 sequence with the additional step and make (no pun - okay pun) sure I repeat that exact sequence each time.Also, the additional J-Link adapter board arrived today so I'll have a chance to attempt the debug suggestions @fanoush provided, once I locate a brief operations tutorial and pin-out for the SEGGER board. I'll also play with the PATH environment var within the terminal window as my belief is that the update of nRFConnect has done somethong within the registry that when I launch a cmd window, VSCode and nRFConnect from a clean boot, the Win10 PATH environment var starts duplicating itself, running out of space, thereby corrupting it and blocking apps/processes from running cleanly. If I can get to the bottom of
that, I'll post results. Leaving that here in case others stumble across similar issues as in this thread. -
-
Tue 2021.10.05
reply to post #13
'I lost the ability to send from the website to the watch now, as pressing the button that calls the function Puck.write('E.showMessage("HELLO","Message")'); instead of making the watch show it as before, it asks for a new ble connection.'
Another struggle was maintaining page state and still update sections within the page. It was likely that a page refresh or something of the sort caused the OTA connection to be lost. One quick verification check, did a new reloading the page and then interacting with BLE allow the re-pairing and re-connecting to occur?
The trick is to update a part of the page without refreshing the entire page. This keeps the DOM intact after establishing the BLE connection. I played with hidden divs and iframes along with global vs local and attempts with IIFE but never really settled on one technique.
-
Tue 2021.10.05
reply to post #12
'But don't know how to set a handler on the website to catch the info.'
One of my biggest hurdles was to keep separate which side of the fence I was on, along with un-learning the DOM event model within the browser for code on the micro side. One of the reasons I suggested starting a new monolithic page was to be able to track the DOM event model within the browser debugger. Keepng the events such as when setWatch() fires on the micro side mentally separate from the behavior within the browser DOM can at time have one in fits. My only suggestion is to just keep plugg'n away with small one line code change baby steps. Take and modify the first successful button press event that was captured successfully and build on that. It does get easier after each iteration and after a bit of thinking time.
After some effort has been put in, post some code and I'm sure others will provide suggestions.
-
Tue 2021.10.05
Hi @seriousStuff and it appears we are stuck with some serious stuff to deal with! ;-)
I'm going to collect a bit more detail for others to resolve which will save some time in the
back-n-forth that they would have to do.'I tried to flash the firmware, for that I use the Flasher tool'
Different tools, different processes, different OS's, etc
Q1: Could you explain which tool and/or process along with PC environment/OS please?Q2: Which version is being flashed and by chance do you recall what version was there, ballpark okay? One of these perhaps, or some other file?
Q3: Was any attempt made to try the 'Advanced Reflashing' ?
Q4: Was an attempt made to flash directly from the WebIDE?
https://www.espruino.com/ide/
Upper Right :: Settings >> Flasher -
Mon 2021.10.04
Nicely done @ThomasVikström !
psst! . . . Hey @Gordon me thinks you have found your new tutorial writer!! wink, wink ;-)
-
Mon 2021.10.04
reply to post #6
'how I can send a bTN press to the website and be detected'
As I'm not aware of your level of coding expertise, forgive if this is a bit too basic.
Beneath heading: Reading from Puck.js halfway down the page
Puck.eval("BTN.read()",function(x) { console.log(x); })
Is the example that you are after. Now, that said, how it functions is a bit trickier. Having a foundation and background with the request/response model along with a solid understanding of callbacks and promises will be required, along with GATT familiarity.
Here is my go to source along with a 'Try It' window:
https://www.w3schools.com/jsref/jsref_eval.asp
https://www.w3schools.com/js/js_callback.asp
https://www.w3schools.com/js/js_promise.aspThe easiest way is to take a peek at the source, follow the inclusion to the .js source
<script src="https://www.puck-js.com/puck.js" script>
and load that file in the browser from: https://www.puck-js.com/puck.js
go the the end of that file and search backwards for:
eval : function(expr, cb)
and study the relationships between the example send event and the code file receive/decode event.If I were doing this and as a suggestion, create a new page and embed that code source into that page to make easier debug breakpoint setting and step through several times to see the sequence in action.
Remember this must be served from an https: server such as deployed at github.
Practical usage will be more beneficial in the long run, than trying to explain what to do.
-
Mon 2021.10.04
reply to post #5
'I wasn't aware it was the same as puck.'
I posted this same question three years ago, and as functionality demand was really low, it appears the time/cost involvement in competition with KickStarter campaigns for new devices, to re-write in a more generic sense that wouldn't get confused with existing names, mainly BT, BLE and the like, it has been acceptable to leave as is, as it does in fact work for all authentic boards with BT. if it ain't broke, don't fix it It was a bit un-nerving for me at the time to include 'puck.js' in a file to support the MDBT42Q for instance.
What is the Pixl and MDBT42Q equivalent to puck.js Puck.connect() for BLE
-
Thank you for posting the article link @user134951
'Blame on my being a consumer, not a developer.'
Hey go easy on yourself. It is admirable that you took the time to detail your inquiry here and also having the fore thought to ask questions to have an informed decision before making a purchase.
-
Sun 2021.010.03
Previously working code now produces the error:
Error: certificate has expired
var ee = require("AT24").connect(i2c, pagesize, capacity, i2caddress);
WebIDE console output
loadModule(espruinowifi) loadModule(wifi) loadModule(AT24) ERROR: getURL("https://www.espruino.com/modules/AT24.min.js") error : Error: certificate has expired ERROR: getURL("https://www.espruino.com/modules/wifi.min.js") error : Error: certificate has expired ERROR: getURL("https://www.espruino.com/modules/espruinowifi.min.js") error : Error: certificate has expired ERROR: getURL("https://www.espruino.com/modules/AT24.js") error : Error: certificate has expired WARNING: [notify_warn] Module AT24 not found ERROR: getURL("https://www.espruino.com/modules/wifi.js") error : Error: certificate has expired WARNING: [notify_warn] Module wifi not found ERROR: getURL("https://www.espruino.com/modules/espruinowifi.js") error : Error: certificate has expired WARNING: [notify_warn] Module espruinowifi not found
Interestingly, the Chrome browser is able to fetch - cache maybe?
https://www.espruino.com/modules/AT24.js
https://www.espruino.com/modules/
Clicking on padlock icon: SSL Expires Wednesday, November 17, 2021 6:42:34 PM -
Sun 2021.010.03
Bangle/Puck bi-directional Try It examples here:
https://www.espruino.com/Web%20Bluetooth
https://www.puck-js.com/go
A quite helpful list of links: -
Sun 2021.10.03
Thank you @user134951 for your interest in Espruino and Bangle v2
'what attracts me to the project is it was advertised as "open source" in the 1st article I read'
Although this isn't mission critical, by chance do you have the link to that article as it would be interesting to see how open source was described there. Maybe a bit of polish on the wording could lead to an easier understanding for others.
-
Sun 2021.10.03
Thank you @fanoush for the quick reply. Now have the rest of the weekend to maneuver the last of the jigsaw puzzle pieces.
-
Sat 2021.10.02
Re-read
https://www.espruino.com/AdvancedDebug
https://github.com/espruino/Espruino/blob/master/README_BuildProcess.mdWhile I'm able to flash both a release and a debug .hex version built from VSCode using nRFConnect, and am able to build and debug the Nordic blinky and blinky_pwm examples using SEGGER embedded studio, I'm not able to understand (yet) the basic process I need to debug a running Espruino snippet.
I see and can navigate the Espruino .c source within VSCode. I am able to see the SEGGER blinky main.c example but not up to speed on where the background (SDK?) files are just yet, and can place breakpoints within SES and single step debug.
What jigsaw piece conceptually am I missing to somehow use either tool to configure the environment to step through from the WebIDE JS command down to the .c source that activates the hardware?
-
Fri 2021.10.01
Install comment: I thought I was installing the files within WSL using the git link to clone the respository from within the terminal window. I'll go back over those steps again, to validate.
A lot to digest there, but I believe you have hit the nail on the head with your quick eye and analysis regarding the case sensitivity.
Thank you @fanoush as with that quick response, will give me a good head start on checking that all out this weekend starting early Saturday morning. I'll have my work cut out for me!!
-
Fri 2021.10.01
'. . . the heart rate sensor. Chips used?'
Accessible from any Espruino site web page:
Menu >> Documentation >> Bangle.js 2
@user107850 Beneath the Features heading lists the mfg and part number.
-
Thr 2021.09.30
This parallels the build issues here:
build error: src/jslex.o make: *** [espruino_2v08.220_nrf52840.elf] Error 1
Rather than monitor two separate threads, I'm continuing resolution at the above link.
Using the online IDE, upload takes about three seconds using the Emulator:
It is interesting to note that as Espruino does it's housekeeping, some blocks are freed as I typed this ten seconds after the render above: