-
There may be persistent vars in the future, but the relatively restricted nature of the device means that any app with a memory leak would effectively make the watch unusable ...
Such a feature should definitely have some kind of per-app limit for persistent data size. Perhaps a max size in bytes in
metadata.json
or in settings? -
When you change app (e.g. go to settings which is also an app) then all variables, including globals, are deleted and new app starts from empty state. Only way to save data beyond that is to use flash.
You can use
kill
event to save data when your widget is about to get shut down:E.on('kill', () => { // save data to flash });
-
But have you tried using Bangle.on('pressure' and Bangle.setBarometerPower(1)? If you're doing a reading every 10 seconds it's probably better and far more reliable just to keep the barometer on all the time rather than repeatedly powering it on and off
yes, that works better, but in my clock adjust widget the update interval can be much longer than 10 seconds and
Bangle.on('pressure'
causes several updates each second so it likely uses a lot more power. -
ok, I got I2C error but I don't quite understand this.
try...catch
catches something but still output says that there is uncaught error.Output:
23.60415923008 23.60415923008 OUTER: undefined Uncaught Error: Unhandled promise rejection: Error: I2C Error: Arbitration (start) 23.64360367590 23.64360367590
Code:
setInterval(() => { try { Bangle.getPressure().then(d => { console.log(d.temperature); }).catch(error => { console.log("INNER: " + error); }); } catch (error) { console.log("OUTER: " + error); } }, 10 * 1000);
-
I've been running with that for over 2 hours now without I2C error, I'll report here if I manage to reproduce that again. (So good news is that it has become quite rare.)
But I did notice that
d.temperature
from that code sometimes returns completely wrong value. For example here is a list of some successive values:23.70770094008 23.71263150090 23.72249262342 23.73235374710 -0.01203159983 23.83589561600 23.89013188427 23.92464589151 23.95422933763
-
I actually implemented something like that already for this webpage. All measurements are now saved in local storage and you can compare any two of them to get clock drift in PPM.
It's somewhat inaccurate so I'd recommend taking 3-4 measurements in a row to see that they are consistent and removing all except one which seems like best measurement. Then wait at least few hours before repeating that.
-
For clock drift I've just released a small widget which can counter clock drift by continually adjusting clock in the background. (It doesn't measure clock drift, so you need to measure it yourself and then configure correct clock drift in settings.)
It's not yet in main app loader, but can be installed from devel app loader: Adjust Clock
-
-
-
-
-
-
I noticed that
E.showScroller
is using internallyBangle.setUI
withmode: "custom"
but if I try to do the same in my scroller I get error "Unknown UI mode".Is there some way to use this "custom" mode, or some other way to create custom scroller? Basically I want what
E.showScroller
does with the addition that select-callback receives touch x-coordinate in addition to id of selected item. -
-
Not sure what you mean by:
Also pressing button does nothing in that menu, i.e. it doesn't go back to previous menu.
though
I meant that if I go to
Settings > Bluetooth > HID
and then decide that I don't want to change it after all then I can't get back by pressing the button, I need to re-select the option that is currently selected to get back.But actually I'm not sure if button is even intended to work there.
-
-
Kill event documentation says that "This event is called just before the device shuts down ..." but I'm seeing this event in my widget every time widget is stopped, for example if I enter launcher and then again if I enter Settings in launcher.
Is this intended behavior?
-
Basic logic of how this widget reaches under 10 ms accuracy with
setTime
(in versionv0.00-beta-026
):- Internal clock error counter is updated periodically according to given clock drift.
- If clock error exceeds given threshold then clock update is attempted.
setTime
can only set time to full seconds. To set time more accurately
a short delay is done until next full second, and thensetTime
is used.- Sometimes this delay can be longer than intented, e.g. if watch is
busy doing something else. In this casesetTime
after too long delay
would be inaccurate and so it is skipped and retried again later.
- Internal clock error counter is updated periodically according to given clock drift.
-
-
I started new thread for my widget: new widget: Adjust Clock (BETA)
-
I'm making a widget which adjusts Bangle.js 2 clock continually in the background to counter clock drift.
Widget doesn't attempt to determine clock drift in anyway. You need to measure clock drift yourself and then enter that value to the widget.
Beta version is available from my app loader for now as this still needs more testing before adding to main app loader.
I'll also publish source a bit later in GitHub as there are still few things I want to fix first. Of course code is available in my app loader (widget.js) if you want to see it. (Code includes some initial support for temperature correction but that isn't enabled yet.)
ps. Update interval setting doesn't do anything yet, interval is currently fixed to 10 seconds. That is the next bug I'll fix. (EDIT: Fixed in version
v0.00-beta-018
) -
Is there any (simple) way to measure power consumption?
Somehow disconnecting internal battery and using only USB power would be ideal, but I don't think that is possible?