-
-
-
While not a perfect solution, a simulation of, say a twist event, could be pre-determined/coded such that either a Touch event or as an interval/timeout end occurs, that code block would then execute, emulating the physical event.
https://www.espruino.com/Reference#l__global_setTimeout
https://www.espruino.com/Reference#l__global_setIntervalhttps://banglejs.com/reference#l_Bangle_tap
https://banglejs.com/reference#l_Bangle_twist -
Sun 2021.10.17
Thank you @user135414 for clarifying:
https://www.espruino.com/Gadgetbridge
http://forum.espruino.com/conversations/341437/ -
Sun 2021.10.17
Did the long press not return to the default app?
As Espruino is an interpreter each line of your code is read separately, then executed before moving on to the next line of code. If not inside a loop, once there are no more instructions to interpret and execute, that code block at that point is effectively ended.
The code could look out for a button press or screen tap and respond accordingly, such as returning to the default clock or to the app launcher.
Timers and set watches could be used looking for events.
https://www.espruino.com/Bangle.js+Development
https://www.espruino.com/Bangle.js#tutorials -
-
-
Sun 2021.10.17
'that I create a module for each of these fonts '
I believe having a separate file or module for each will allow for easier upkeep should subtle changes be needed down the road. Pluggable in case more fonts evolve.
It also appears you have the conceptual idea on using each font as a length string of chars as in
FontDylex7x13.jsI'd use the example loader, maybe have one in each font file and push those into storage.
https://www.espruino.com/Bangle.js+Storage
https://www.espruino.com/Data+CollectionRetrieve the selected one based on the menu or random array selection you envision.
-
Sat 2021.10.16
'I believe you have enabled the Project mode and it seems you also have the module stored locally on your hard disk?'
Well, you know your stuff! I am working from a project, and when the cert error popped up, I quick grabbed a copy of AT24.js and saved it, in case the ability to recover never occurs. My main concern is that other recent end users may not have the knowledge on how to work that way, So I create this thread.
'I ended up globally raising the time limit just for you'
I had forgotten that, dug it up and re-read:
Placing module code in local modules folder doesn't appear
post #12 there http://forum.espruino.com/comments/14419110/
I re-read @Wilberforce #10 and link along with @allObjects #11 (there - above link) source reference and it appears post #22 that the order was never updated.
'but it's possible you might have copied all the modules into your local project folder'
No. I only have the one AT24.js file there. One thought that has popped up is that it appears most are developing within a Linux/Unix environment, as I seem to be one of a few that have ongoing devlopment, and on Windows10. I have noticed over the last two years, that at times, my PC comes to a dead stop. Often wondered what it was up to, and discovered that as I have the Windows Update feature set to download in background and allow the user to install option selected, was done as in automatic mode, my system would be taken prisoner until the update completed. At one point, it took over 48 hours to update! I had no access to the Internet, email, news etc until that was complete. Horrid! I have less headaches having the files d/l in the background, but at times the system locks up. When I check the WindowsUpdate.log file, I can see multiple failed attempts with the current time/date stamp, at gaining the ability to d/l files it requires. This seems to be the culprit.
Another thought, I was ping-pong'ing back-n-forth placing a prefix tilde on the AT24.js file so that it wouldn't be located to force a fetch across the web. Maybe the queue during the folder file retrieval somehow became corrupt?
'maybe the overhead of searching them all'
While I have only the one .js file in the modules folder, I do have around ten feature flavors for each of the projects or devices I'm working on, selectable by Settings >> Project all in the root. I've been under the impression that the WebIDE would only search within the modules folder of the currently selected project, which is how most apps function. Could it be that having multiple modules folders is somehow being traversed? Doesn't appear likely as from Wilberforce #10 and link git source above.
-
Sat 2021.10.16
reply to post #6
'no case to be made that it is a semantic restriction of Espruino or its debugging mechanism'
No, not semantic restriction, I don't believe it is possible to insert the debugger statement within a list/container as, (previously discovered years ago) must be on it's own line. Haven't tested recently.
ref: 'then what's the point of Espruino at all?'
A month ago I put together some links on the history and comparison to the evolution of Arduino:
'I came here in the expectation that things would “just work” without too much hassle'
Arduino had an army of devlopers over a twenty year period while Espruino is one/couple/community in just over a five year period. IMO Espruino is light years ahead with it's ease of setup (just plug it in) and near instant ability to start writing code and interactive debugging. Major bonus for the young mind and those just exploring the world of code.
As this thread has now uncovered, agrees with my assessment that Espruino is starting down the path of bloatware trying to do too many things with too little resources. Microsoft tried that and look what happened to their marketshare.
'if you really hate the comma operator so passionately, why allow it in if and switch?'
That question should be directed at the originators of the project. I'm an end user like yourself with a need to support 10-16 year olds with just the basics along with the Blockly graphical editor. Espruino ver 1V95 was perfect as ES5 features are all I require.
Point of note: With the close of the Bangle V2 KickStarter campaign, It is likely that shipping will be under way with their limited time to respond timely.
-
Sat 2021.10.16
This L14
blocksize: 13
raises a red flag for me. Don't know the answer, but I've only seen 16 or 12 on older boards.Was this somehow forced? @TTBangler or an anomaly that's popped up using the emulator?
I'm also somewhat concerned about the actual char count in relation to the number of JsVars that are being reported in use. I've noticed that what I thought I understood (project years ago) and what seems to be occurring/reported now doesn't add up to what I believed at that time. In your case, file size is around twice what the actual JsVar usage appears to be. Will continue to monitor and realize the need to do more size/reservation calculations, Trace, debug, dump, flat string length, etc. in order to cement what is going on in memory, before the dreaded 'LOW_MEMORY' flag appears. -
Sat 2021.10.16
Thank you for posting that link @user135362 allowing us all to be on the same page. It eliminates the reader's possible confusion as to which reference is being used. The number of times a reference has been made to inacurate document detail, or an in process document constantly changing.
The references I mentioned indicate a conditional expression to be evaluated within the while, while that comma operator contains both a statement expression as well. So should the statement expression also be evaluated as a conditional as in the reference example shown?
As you pointed, I've only ever seen that in use to separate a list of increment operators inside the end of a for loop, and I have to agree with @allObjects that it adds too much confusion when not quickly readable/understandable by the onlooker.
Another 'gotcha' is that it wouldn't be possible to insert Espruino's WebIDE editor side debugger statement at that point in order to single step debug. (didn't test that though)
Also, if we keep expanding our expectations, feature creep will eventually not leave enough RAM for us to play!
-
Fri 2021.10.15
Hi @TTBangler a couple of points as numbers didn't seem to add up.
'Minified 74751 bytes to 37349 bytes.'
'process.memory() usage from 1239 down to 1215'Note: 37349 / 16 = 2334
I'm not so sure the value returned from the emulator is representative of the physical Bangle hardware.
As Espruino will require some of the free JsVars for housekeeping, stack, vars, function returns, etc., depending on what your code is doing, my target minimum remaining would leave around 1900 JsVars available for your code. Not sure what the capacity of Bangle V2 is but,
The results of my Bangle V1
>process.env ={ VERSION: "2v04.218", GIT_COMMIT: "5439331a", BOARD: "BANGLEJS", FLASH: 524288, RAM: 65536, SERIAL: "330b0ad8-0c11713d", CONSOLE: "Bluetooth", MODULES: "Flash,Storage,hea" ... "ow,graphical_menu", EXPTR: 536883676 } >process.memory() ={ free: 2057, usage: 43, total: 2100, history: 13, gc: 0, gctime: 3.20434570312, "stackEndAddress": 536923072, flash_start: 0, "flash_binary_end": 471492, "flash_code_start": 1073741824, flash_length: 524288 } >
-
Fri 2021.10.15
Thank you @Gordon Understood
-
Fri 2021.10.15
'Per the standard, the condition in loops is an Expression,'
Hi @user135362 when challenging referencing an outside document, providing the link to that document will assist us all in evaluating your concern.
As I see it:
The conditional expression for a while statement must evaluate true or false.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator
In the sample provided
x = costlyAccessor(i++)
will always evaluate TRUE based on the truthy rules. Result: endless loopAlso,
>while(0,0);
can never evalute TRUE. Result: never executesSo, as I see it, and as none of the references I have just found make any mention of using the comma operator within a while conditional, seems problematic.
Could be other reasons, but I'm sure this will open up to others for discussion. . . .
-
-
Thr 2021.10.14
post #16 'really not sure what to suggest as 9k of data shouldn't be anywhere near enough to cause quote issues!'
To @Gordon, I have a feeling that my evaluation of the source provided
post #6 '9077 / 16 = 567'
and measured usage after removing comments and whitespace
usage: 393
was for the file ttchoice.app.js initially uploaded in post #5 and not the actual code ref post #13 and #15
I'm wondering if in fact that QUOTA limit is being reached as the actual app is now being uploaded and not the subset ttchoice.app.js as I'm guessing is what you may have felt was the source being used as was I.
post #3 'My full program (of which these four functions are only a part) is ~2.5K lines/~80K'
post #11 'Unfortunately, the code I uploaded here is just a small subset of my app.'For comparison, my very large ongoing app MVLOA pushing the limits I know, comprised of four modules that totaled nearly 40K with comments with a combination of online and hand minification while attempting to upload, nearly filled the ~2200 JSVars the Pico has. While I don't know the capacity of Bangle or the Emulator, should the the actual app be what is in use, it seems very likely that even with minification, there is likely to be some capacity issues here.
Super rough estimate here: as Espruino requires half the space to unpack (the reason I used several small modules to get around - uploading the largest first allowed nearly 30K max for me) should a Pico be used, 2200 / 2 = 1100 * 16 ~= 17K of minified source. Much more above that is eeking out the limits I'm afraid. What is the capacity est for Bangle and emulator?
To @TTBangler is this in fact the case here? pp. I'm wondering if
-
Wed 2021.10.13
'I'm using an ESP32. Any recommendations?'
What were the results of
process.memory()
before entering the compact command?
By chance mixing Storage and StorageFile?
Hi @MisterG while the ESP32 falls under the not 'officially supported' category, have you tried the same on an authentic Espruino or maybe consider supporting the community over Patreon?While I have no direct experience with the Storage class, I might be willing to give it a go to learn a bit myself. A project I'm attempting may require I go down this path in any event using the Storage class, but my plan was to dive in next month.
I could attempt to duplicate the errors you are seeing using your code module, to see if the same anomalies exist on a different platform. Having another set of eyes might uncover a process/procedure type of situation.
Up to you as I continue to incrementally slog through a bizarre conversion issue.
-
Wed 2021.10.13
'This is what we used to use in the late 1970s when those first computers first came out.'
Try telling that to the kids of today and they wont beleive ya.Try believing monochrome lime green phosphor!!
The first consumer PC 1978 I used pre-dated the Comodore 64 and Timex Sinclair by four years and I built as a kit:
The Heathkit H89
https://www.old-computers.com/museum/computer.asp?st=1&c=135
see H89 https://en.wikipedia.org/wiki/Heathkit_H8I paid over $1500 USA dollars which was a third of a years salary (electronics tech) then. With Yes Fragile and Rush Fly By Night albums playing still took six weekends to build, along with parts to wire wrap the additional 16K board (to save the $150 for a new board) so that I had the maximum amount, 64K!!
It had an amazing single color lime green phosphor 80 char output. Yeah I was top kid on the block back then!! I still have it, fired it up a could of years ago and was amazed at the blazing speed of 6 minutes just to boot off the 100K hard sectored 5 1/4 floppies.
Incidentally, NASA has offered me ~$1000 just for both the Z80 and 8080 processors inside as they are much needed for repair stock and no longer manufactured.
I challenge your 1970's claim @HughB as that would have had to have been early / mid 80's ;-)Commodore 64 Date introduced: August 1982
The Timex Sinclair 1000 was introduced in July 1982
The first Macintosh was introduced on January 24, 1984
. . . and I thought I was dating myself! -
Wed 221.10.13
From post #3 'This is my IDE.'
What IDE version is displayed?
From that image, I see that a recent flash of Espruino was done. Was this flashed using the WebIDE itself, or some other means?
While the Chrome browser is mentioned, what is the PC OS the Chrome browser is running on?
By chance have you tried the online IDE directly?
-
Wed 221.10.13
Hi @coat while I don't have any experience with micro:bit there are a few areas that will need some clarification for others to zero in on in your particular case.
'I have simply copy and past the code on Epruino IDE'
'I can't write on the left-hand side'So to confirm, as I understand the above, what does work is to cut-n-paste into the R-Hand editor side only?
'message say "Prompt not detected - upload failed. Trying to recover..."'
Are you connected by the USB cable from a port on the PC? (to remove Bluetooth connectivity as a possibility using battery)
Was an attempt to disconnect or power down, then re-connect or power up, done?
After the numerous 'Initialising Utils, Initialising Config, . . .' entries, are any other errors reported within the IDE console output?Upper Right of IDE :: Settings >> Console
-
Reply post #3
'and by that I mean add it to the right-hand source code pane--then "Send to Espruino" no longer does anything.'
As explained in post #3 I'm cut-n-paste in both the R-Hand editor side and upload, along with just the first two functions followed by the rest in the L-Hand console side.
What browser and PC OS are you running on?
I'm not having issues with
ttchoice.app.js
using Chrome on Windows10 -
Mon 2021.10.11
Reply to post #3
post #3 'Sorry but I don't really understand how to interpret the numbers returned by process.memory() or trace() for that matter'
Glance over as previously provided
Simple answer, Total - Usage = Free
For me, when Free gets to below ~150 it's time to take a break and figure out what to take out.
History is what occurs as one uploads from the L-Hand console side. Espruino will retain until it determines possible memory issues then do some housekeeping to clear. See my link in post #6 on one way to clear if desired. Although I wondered what might go awry, that value may be ignored for most development.
Sun 2021.10.17
External EEPROM 8 pin DIP
One example: uses I2C and not SPI as suggested in #5 post
It's likely the 52840 watch DK has the 8M of external SPI accessible