-
• #2
Mon 2020.02.03
'I only get a black screen'
While I'm not 100% sure of all the workings of Bangle.js (yet) could it be the same as what is covered here?
Quick Start Best Practices - Proper way to call init() on start up
'following the "creating an app" directions'
@johanbove would you mind posting the link to the above please, as I've not been able to locate that specific content.
-
• #3
@johanbove would you mind posting the link to the above please, as I've not been able to locate that specific content.
Thank you for the reply @Robin ; here is the link to the documentation I referred to: https://www.espruino.com/Bangle.js+Development
See the "Next Steps" links at the bottom of that page.
-
• #4
I think your issue is actually to do with how templated Strings are handled. I notice you have
\n
inside a string, inside the templated String in the call toStorage.write
. The\n
gets interpreted by the templated string, not the 'normal' string as you wanted. Easier to explain with an example:print(`"Hello\nWorld"`) "Hello World" // when what you wanted was "Hello\nWorld" print(`"Hello\\nWorld"`) "Hello\nWorld"
So unfortunately it's not quite as easy as just adding backticks on either side of your code. It normally works, but not when you have escape sequences in Strings.
Where did you see the example using
require("Storage").write
? I'm trying to remove references to it for this reason :(What I'd suggest is you clone the BangleApps repo and copy the example app to a new directory and modify the files: https://github.com/espruino/BangleApps/tree/master/apps/_example_app
You can then either host your own BangleApps repo and then use the app loader to write everything to the watch, or you can just use the new Web IDE storage feature (the cylinder icon in the middle of the screen on http://www.espruino.com/ide/) to upload the files from disk manually.
I'm working on extending the IDE such that you can choose to upload directly to a file, which should really help with development.
-
• #5
Where did you see the example using require("Storage").write? I'm trying to remove references to it for this reason :(
@Gordon Found that example on the "step 2" Workshop page from Node Conf
and also on the BangleApps Readme in the "offline" section.Thank you for the suggestion to double-escape the new line chars! Will try it out later today.
-
• #6
I will also redo the "app" following the example application.
-
• #7
Thanks! I've just updated 'step 2' to add a bit of a warning about this :)
-
• #8
I got the demo app and my own instance of "BangleApps" to work. It runs even in the emulator.
See https://www.espruino.com/ide/emulator.html?codeurl=https://blog.johanbove.info/BangleApps/apps/jbm8b/app.js&uploadThis is pretty neat stuff. Thanks again!
Only issue I still have is with the app.png file dimensions. It's exceeding the list item row height. Will check this later.
-
• #9
Tue 2020.02.04
Now @johanbove that working example is as I see it, a must have app installed for many users seeking their anxiety fix. Clever indeed. smiling
-
• #10
Great! Not sure I understand about the icon though? It should normally be 48x48px
-
• #11
I simply made the image binary file too big. I overlooked the spec...
Will adapt it later today. -
• #12
Thanks 😊 Planning to add motion detection too to give the app that nice old school motion trigger with a flick of the wrist. I’m not great at programming graphics, so it’ll be text only for a while.
-
• #13
Wed 2020.02.05
'Planning to add motion detection'
Yep, cooler yet!
Even thought of another usage, what about guessing the shape and color using the same 8-Ball usage theme?
EDIT: WoW! This is my 1000th post!  '8-Ball' magic?  hummmmmm
'I’m not great at programming graphics'
@allObjects created a simple colored circle solution that could be used as a foundation to start:
Firmware: 2v04.76
Hi all.
My code for a simple "Magic 8-Ball" demo was working fine when directly running it on the Bangle.js watch as well as in the emulator, however when I "package it" following the "creating an app" directions, and then I run the selected app from the launcher menu, I only get a black screen. Is there something wrong in my code? Thankful for some help.
My attempt can be found here: https://github.com/johanbove/espruino-magic8ball