-
I changed the widget position from bottom left to top left and now it is working.
@Gordon are widgets at the bottom line not supported?WIDGETS["chronowid"]={area:"bl",width:width,draw:draw,reload:function() WIDGETS["chronowid"]={area:"tl",width:width,draw:draw,reload:function()
-
-
-
-
-
Sure. All this is based on dates (including time) written to a file.
Basically, you set the timer to one hour, then the goal time is now+1h.
When the widget is loaded, the target time is read again and compared to now. If the difference is <= 0 you get an alert. Only thing is that the widget has to be running to alert. But it does not have to run the whole time, like a timer app.You could create a setting where reminders should start and write that to the file.
Then after a certain time alert and write the next alerting time to the file. -
I was 100% sure yesterday, that my inital code worked before (stored the info to memory).
Then it stopped working, why I opened this thread.
With another app (Chrono Widget) I had to delete the JSON file from time to time or I would get strange behavior. Maybe something corrupt in the file or file system?
Loading the file it looked ok though. -
I wanted to have a timer which does not need an app to be opened to run.
So I created a widget.
Have fun with it and provide feedback :)https://github.com/espruino/BangleApps/tree/master/apps/chronowid
-
-
However I think at some point we'll have to have an effort to go through widgets and clocks particularly to try and reduce their memory footprints.
Yes, I am afraid so. I am hitting limits already.
But minification will already save a lot of space for my apps/widgets because of long variable names and a lot of comments.You mean via the Storage button? It might be we can do something about that.
Yes.
One solution is just to type reset() in the IDE - that'll remove any running apps, which should then give you the space.
That would make it easier, kind of annoying to always go to the app launcher first :)
-
However realistically unless there are some that have a big memory impact, you'll run out of space for widgets on screen before you run out of RAM
I do not agree :)
Currently I have loaded- Gadgebridge
- Days Left
- Active Pedometer
- Battery widget with percentage
- Chrono Widget (not yet published)
- RAM Widget
- Pipboy clock
I still have space for more widgets in the bottom area.
RAM Widget says 65%.
This memory utilization leads to errors in IDE when accessing the file list (low memory), so I always have to go to the app launcher, so that widgets do not use up the needed memory. - Gadgebridge
-
-
-
-
-
-
The kill event is built into the firmware, so should always be fired
Ah, I just tried it and it should work.
I thought the event would only be triggered when the watch itself is 'killed', but it is already triggered when the widget is 'killed'.Of course it makes sense to only write the timer progress to the file on the kill event, not every second (or even regularly without need).
Thanks.
-
Hi,
I do not know why the JSON is not saved.
I am setting a variable
var settings = { hours : 0, minutes : 0, seconds : 0, started : false, counter : 0 };
Then I store this to a JSON file
const storage = require('Storage'); storage.writeJSON('test.json', settings);
Then I change the variable
settings.counter = 12345;
Then I store again
storage.writeJSON('test.json', settings);
And reload
settings2 = storage.readJSON('test.json',1);
Why is the counter (settings2.counter) not stored? It is 0 after reload, not 12345.
This is the full code.
var settings = { hours : 0, minutes : 0, seconds : 0, started : false, counter : 0 }; const storage = require('Storage'); storage.writeJSON('test.json', settings); settings.counter = 12345; print(settings.counter); //=12345 storage.writeJSON('test.json', settings); settings2 = storage.readJSON('test.json',1); print(settings2.counter); //=0, why is the counter not saved?
Thanks
Christian -
See the app / widget / readme here: https://github.com/Purple-Tentacle/BangleAppsDev/tree/master/apps/chronowid
-
-
It is a widget counting down and displaying time.
Each second 1000 ms are substracted from the counter.
The counter (time left) is written to a file each second, to not lose progress.The user interaction is done via an app to set hours, minutes, seconds and to activate the timer. When activated, the widget is shown.
-
Hi,
Is this section completely inactive?
@Gordon
Is there a better way to support you instead using Patreon?Thanks
Christian -
Eventually, especially as there are 86,400 seconds in a day!
I am only storing once a second as long as the timer is active. When the timer is not active, the widget is loaded, but not shown.
Just archive when idle, or before the widget is dismissed.
Yeah, that would be better. But how can I detect that widget is being dismissed?
-
Hi,
I am developing a timer widget.
As this only counts the seconds when it is loaded, I am storing the current seconds to flash.
This way it can pick up where it left when the widget is loaded again.const storage = require('Storage'); storage.write('chronowid.json', settings);
Currently I am doing this every second, but could this hurt the flash memory?
Thanks
And in v2.05.442.