How to allow setting date + time with custom application stored in Flash? #5222
Replies: 1 comment
-
Posted at 2022-09-25 by @thyttan Generally, don't upload to 'flash' but to 'ram' or 'storage' instead. :) Read more here: http://microcosm.app/out/uFdti Or via this comment: http://forum.espruino.com/conversations/379195/#16672250 Posted at 2022-09-26 by @gfwilliams As @thyttan says really. You'll want to reinstall the bootloader app to get rid of the code that's currently saved to flash, and then you can write to a Storage file instead and all the existing Bangle.js code will be there to help out - but hopefully http://www.espruino.com/Bangle.js+Development (linked above) or http://www.espruino.com/Bangle.js+First+App#making-an-app should be a good start. If you want to have just a single app that always runs, maybe just set it up as a clock face (http://www.espruino.com/Bangle.js+Clock) and then delete the default clock and you'll have your app always running - but can still open the launcher and start whatever apps you want Posted at 2022-09-27 by Leo Awesome, thank you @thyttan and @gfwilliams! That was exactly what I was looking for. Added
to my code. Saved it to Storage (instead of to Flash). Added it to the launcher, and set it as watch face using Settings > Set Clock. Perfect! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2022-09-24 by Leo
Hi Espruino community!
I'm new to the BangleJS, and my question may be naiive.
But how can I set the time on the watch if I'm running a custom application?
I wrote a simple application that displays the time and some other data. I've uploaded this app using the Espruino IDE to the Flash memory of my BangleJS (version 1).
Now the app runs on the watch. It also persists when I reboot the watch.
However, when the battery runs out, and I re-charge, the time on the watch resets to (I guess) midnight of January 1st 1970. And with my app running in the foreground, I can't access the settings menu to set the correct time.
What's the best way to handle that?
Should I implement a "setting time and date" functionality into my app itself?
Or do I just need to set up some event listener that says "If user presses button B, then display the settings menu"? So that the user can then set the time in the regular settings menu, and when he exists it, he's back inside my application.
Grateful for any pointers.
Beta Was this translation helpful? Give feedback.
All reactions