-
• #27
Not enough memory or storage left?
That should be shown in the IDE though. -
• #28
This is very strange. Do you think you could just give me a list of the minimum apps needed (from a fresh install) to get this to happen - and what order you installed them in?
I guess it could be out of memory, but if you have the IDE running I'd expect it would tell you in the console.
-
• #29
I'll keep testing.
-
• #30
@Gordon I seem to have found a reliable and simple way of recreating the issue:
- Reset watch
- Install "Battery Level Widget with percentage"
- Set alarm 1 (say 12:00)
- Set alarm 2 (say 13:00)
- Delete alarm 1 or alarm 2
Now it seems like alarm.json no longer can be edited (no errors showing in the Web IDE).
I do not know if this is specific to the battery widget or if other widgets/apps also may cause the issue. This is just the one I did find that reliably could show the problem (although I can confirm that the "Tiny Battery Widget" does not cause it).
Edit: steps 3 to 5 aren't the only way to reproduce, just what I found to be a quick way. The key seems to be to set and delete alarms at least three or four times, until there's no or only one alarm.
- Reset watch
-
• #31
During my i18n of alarms work https://github.com/espruino/BangleApps/pull/202 I also experienced these king of problems. When I commented out putting the initial empty json file on the bangle.js during install, the problems went away cf. https://github.com/DerGuteWolf/BangleApps/blob/a794c64c3196f2247aff86ea7150befbd8a19bd5/apps/alarm/alarm.html#L91
-
• #32
I just tried exactly that, and couldn't reproduce!
In the IDE (when in the alarms app and it's not working), please can you try:
alarms // what does this print? require("Storage").readJSON("alarm.json") // what does this print? // then require("Storage").write("alarm.json",JSON.stringify([ { on: true, hr: 12, last: 14, rp: true }, { on: true, hr: 13, last: 14, rp: true } ])); // then require("Storage").readJSON("alarm.json") // what does this print?
-
• #33
Here's what I got (hope I did it right):
>alarms =[ { on: true, hr: 13, last: 14, rp: true } ] >require("Storage").readJSON("alarm.json") =[ { on: true, hr: 13, last: 14, rp: true } ] >require("Storage").write("alarm.json",JSON.stringify([ : { on: true, hr: 12, last: 14, rp: true }, : { on: true, hr: 13, last: 14, rp: true } : ])); =true >require("Storage").readJSON("alarm.json") =[ { on: true, hr: 13, last: 14, rp: true } ] >
As you can see, at this point I have an alarm at 13:00 that I cannot delete.
-
• #34
Wow, interesting - so it's a very low level problem. Not an app thing, but Bangle.js just can't write to the file.
That may happen if memory was totally full, but it shouldn't happen normally as you've got 4MB of memory and you should have done 'Install Default Apps' first to erase all of it, then only installed a few kb of apps.
And you're definitely using a Bangle.js from the KickStarter campaign and not something with a different firmware?
Please can you tell me what
require("Storage").getFree()
says? -
• #35
It's a Kickstarter Bangle.js for sure, unless you sent me something else. :D
I ran the same procedure (Resetting the watch with "Install Default Apps", installing the Battery widget with percent, setting and deleting alarms) and this time I ended up with an empty alarm.json that I couldn't save any new alarms to.
>alarms =[ ] >require("Storage").readJSON("alarm.json") =[ ] >require("Storage").write("alarm.json",JSON.stringify([ : { on: true, hr: 12, last: 14, rp: true }, : { on: true, hr: 13, last: 14, rp: true } : ])); =true >require("Storage").readJSON("alarm.json") =[ ] >require("Storage").getFree() =4130004
-
• #36
That's absolutely crazy. And
require("Storage").write
returnedtrue
so it thinks it wrote it ok.What does
print(require("Storage").list())
show? I guess it's possible that somehow there are twoalarm.json
files. -
• #37
Did you remove the old battery widget, or did you leave both on?
-
• #38
I leave both on, since I found it makes no difference for the outcome.
Leaving the old widget installed was just slightly faster when I was doing a bunch of testing, and the result was the same: can't write to alarm.json.
-
• #39
That's it! There are two alarm.json:
>print(require("Storage").list()) [ ".boot0", ".bootcde", "boot.info", "launch.app.js", "launch.info", "mclock.app.js", "mclock.img", "mclock.info", "setting.app.js", "setting.boot.js", "setting.img", "about.info", "setting.info", "about.app.js", "about.img", "alarm.app.js", "alarm.boot.js", "alarm.js", "alarm.img", "alarm.wid.js", "alarm.info", "widbat.wid.js", "widbat.info", "widbt.wid.js", "widbt.info", "widbatpc.settings.json", "alarm.json", "welcome.boot.js", "welcome.app.js", "welcome.settings.js", "welcome.img", "welcome.info", "setting.json", "widbatpc.wid.js", "widbatpc.settings.js", "widbatpc.info", "alarm.json" ] =undefined >
-
• #40
Wow, that's crazy. I'm just not sure how it can even happen!
Please can you try running the following code and post up the result?
var f = require("Flash"); function getHeader(addr) { var d = f.read(32,addr); var d32 = new Uint32Array(d.buffer); if (d32[0]==0xFFFFFFFF) return undefined; var h = { addr : addr, name : "", size : d32[0]&0xFFFFFF, flags : d32[0]>>24 }; for (var i=4;d[i]&&i<d.length;i++) h.name += String.fromCharCode(d[i]); return h; } function dumpStorage() { var addr = 0x40000000; var h = getHeader(addr); while(h) { while (h) { print(h); addr += ((h.size+3)&~3) + 32; h = getHeader(addr); } addr = (addr&~4095)+4096; h = getHeader(addr); if (h) print("NEW PAGE 0x"+addr.toString(16)); } } dumpStorage();
-
• #41
I recreated the issue using the App Loader at banglejs.com/apps and here's the output below. Interestingly I couldn't recreate the issue when using the development App Loader.
>dumpStorage(); { "addr": 1073741824, "name": ".boot0", "size": 1990, "flags": 0 } { "addr": 1073743848, "name": ".bootcde", "size": 1345, "flags": 0 } { "addr": 1073745228, "name": "boot.info", "size": 122, "flags": 0 } { "addr": 1073745384, "name": "launch.app.js", "size": 1825, "flags": 0 } { "addr": 1073747244, "name": "launch.info", "size": 140, "flags": 0 } { "addr": 1073747416, "name": "mclock.app.js", "size": 3715, "flags": 0 } { "addr": 1073751164, "name": "mclock.img", "size": 1155, "flags": 0 } { "addr": 1073752352, "name": "mclock.info", "size": 175, "flags": 0 } { "addr": 1073752560, "name": "setting.app.js", "size": 11628, "flags": 0 } { "addr": 1073764220, "name": "setting.boot.js", "size": 267, "flags": 0 } { "addr": 1073764520, "name": "", "size": 334, "flags": 0 } { "addr": 1073764888, "name": "setting.img", "size": 1155, "flags": 0 } { "addr": 1073766076, "name": "setting.info", "size": 189, "flags": 0 } { "addr": 1073766300, "name": "about.app.js", "size": 8818, "flags": 0 } { "addr": 1073775152, "name": "about.img", "size": 2308, "flags": 0 } { "addr": 1073777492, "name": "about.info", "size": 130, "flags": 0 } { "addr": 1073777656, "name": "alarm.app.js", "size": 2551, "flags": 0 } { "addr": 1073780240, "name": "alarm.boot.js", "size": 874, "flags": 0 } { "addr": 1073781148, "name": "alarm.js", "size": 1662, "flags": 0 } { "addr": 1073782844, "name": "", "size": 2, "flags": 0 } { "addr": 1073782880, "name": "alarm.img", "size": 1156, "flags": 0 } { "addr": 1073784068, "name": "alarm.wid.js", "size": 437, "flags": 0 } { "addr": 1073784540, "name": "alarm.info", "size": 178, "flags": 0 } { "addr": 1073784752, "name": "widbat.wid.js", "size": 1089, "flags": 0 } { "addr": 1073785876, "name": "widbat.info", "size": 114, "flags": 0 } { "addr": 1073786024, "name": "widbt.wid.js", "size": 478, "flags": 0 } { "addr": 1073786536, "name": "widbt.info", "size": 107, "flags": 0 } { "addr": 1073786676, "name": "widbatpc.settings.json", "size": 2, "flags": 0 } { "addr": 1073786712, "name": "", "size": 41, "flags": 0 } { "addr": 1073786788, "name": "alarm.json", "size": 40, "flags": 0 } NEW PAGE 0x4000b000 { "addr": 1073786880, "name": "welcome.boot.js", "size": 285, "flags": 0 } { "addr": 1073787200, "name": "welcome.app.js", "size": 9391, "flags": 0 } { "addr": 1073796624, "name": "welcome.settings.js", "size": 466, "flags": 0 } { "addr": 1073797124, "name": "welcome.img", "size": 2308, "flags": 0 } { "addr": 1073799464, "name": "welcome.info", "size": 213, "flags": 0 } { "addr": 1073799712, "name": "", "size": 334, "flags": 0 } { "addr": 1073800080, "name": "setting.json", "size": 350, "flags": 0 } { "addr": 1073800464, "name": "widbatpc.wid.js", "size": 3401, "flags": 0 } { "addr": 1073803900, "name": "widbatpc.settings.js", "size": 1582, "flags": 0 } { "addr": 1073805516, "name": "widbatpc.info", "size": 192, "flags": 0 } { "addr": 1073805740, "name": "", "size": 80, "flags": 0 } { "addr": 1073805852, "name": "", "size": 2, "flags": 0 } { "addr": 1073805888, "name": "alarm.json", "size": 2, "flags": 0 } =undefined
-
• #42
Found it - issue filed here and I'll try and get a fix in soon: https://github.com/espruino/Espruino/issues/1801
-
• #43
Yay! That's a fun little bug.
-
• #44
Thanks for tracking that down, I'm pretty sure I'm getting the same thing. The alarm stops saving sometimes, but when I delete alarm.json the alarm I was trying to add reappears of its own accord.
-
• #45
If you try the latest builds from http://www.espruino.com/binaries/travis/master/ then it should be fixed :)
-
• #46
Thanks Gordon. Seems good now. I did have to jump in and delete the two json files as they were still there when I tried to add an alarm after doing the firmware update.
Also, would be good to add the banglejs instruction link to this page: https://www.espruino.com/Download
-
• #47
Thanks - just done, it'll update soon
@Gordon Had an opportunity to do some testing and have the following to report:
As already stated, following the steps of first clearing the device by first installing the Default apps then setting up an alarm works fine. But, as soon as I install my list of apps it is no longer possible to set any alarms. With one exception: It is possible to set an alarm once, but after that no longer.
The way that I set the clock up is to simply scroll from the top to the bottom of the App Loader and delete and install apps as I reach them in the list.
I started testing by deleting and installing one app at a time, each time attempting to set an alarm afterwards and it worked after every deletion/install. So, it's not a specific app that is causing it.
@Raik When it is possible to set an alarm the alarm.json file is present and contains the correct data, like in your screenshot. But, as I said above, after setting the clock up as described this only works once. After that the alarm.json stays empty (apart from the square brackets), no matter what alarm I try to set. It almost seems like the app can't write to the .json file anymore (no errors in the IDE though).
But, I can get things working by doing the same setup as described above, with one small change. Instead of deleting and install apps as I go, I install all the apps I want and only when they all are installed do I delete the ones I do not want. It does not matter in which order the apps are installed or in which order they are deleted, as long as the deletions happen last it seems.
Since I'm now out of time for today, I haven't tested if it's a certain number of installs/deletions that matter, if it has any impact as to what apps are installed/deleted, if setting an alarm before doing my setup changes the outcome, etc. That's for another day, if necessary.
Hope that helps in any way.