-
For my "Advanced PPM" I recorded temperature and drift at multiple stable temperatures and then calculated needed quadratic equation from those datapoints.
While it would be possible for widget to automatically follow temperature and detect when temperature has remained stable long enough, problem is that GPS only works outside and so you can't use e.g. freezer for stable cold temperature, or room temperature for another datapoint as I did.
I don't see how user would be able to get the needed datapoints at multiple stable temperatures with GPS.
(I guess it might be possible to calculate needed quadratic equation without stable temperatures but my math skills aren't enough for that.)
-
-
-
All properties/functions of a widget are globally available as
WIDGETS.widgetname.property
, for example my widget has functionsetClockError
which is available asWIDGETS.adjust.setClockError(x)
.The reason is that certain processes should not be interrupted when the user presses the button to go to the setting screen.
All widgets are stopped and restarted when user goes to settings screen, just like when user changes to any other app. (Settings is just one of the apps.)
-
-
-
Not necessarily. For example 8x8 bitmap font needs 8 bytes per character and as of Unicode 14.0 there are 144 697 characters, so full font would take about 1.1 MB and would easily fit into Bangle.js 2
(This ignores the fact that you shouldn't just render each character as-is as there are complex rules of how some Unicode characters should be rendered.)
-
-
Actually documentation of
require("Storage").read
says that it does NOT use RAM. It returns some kind of reference to the file data.https://www.espruino.com/Reference#l_Storage_read
(But in general using more RAM can be a downside of creating variables outside functions.)
-
Ah, so does naming the variables at the beginning only load them once?
Any code outside functions is only executed once - when app starts.
Would I be better off naming '''var d = new Date();''' and such at the beginning, outside of my draw functions?
Usually it's better to keep variable inside function if that is possible, i.e.
var d = new Date();
should be inside function.But those images might be an exception if loading them from storage is too slow.
-
That code looks correct except for
setTimeout(0);
which does nothing I think.I havn't used images so I wonder if reading them is too slow here. You could try code like this instead so you read images once when app starts and not every time it's drawn (this code is replacement for your
daylight
function):var faceDaylight = require("Storage").read("FaceDaylight.gif"); var hourHandDay = require("Storage").read("HourHandDay.gif"); var minHandDay = require("Storage").read("MinHandDay.gif"); var secHandDay = require("Storage").read("SecHandDay.gif"); function daylight() { var d = new Date(); var h = d.getHours() % 12 || 12; //var time = (""+h).substr(-2) + ":" + ("0"+m).substr(-2); var HoursAngle = (d.getHours()+(d.getMinutes()/60))/12 * twoPi - Pi; var MinutesAngle = (d.getMinutes()/60) * twoPi - Pi; //var SecondsAngle = (d.getSeconds()/60) * twoPi - Pi; var SecondsAngle = (d.getSeconds()/60+d.getMilliseconds()/60000) * twoPi - Pi; g.reset(); g.clear(); g.drawImage(faceDaylight); //DateWindow g.setFont("6x8"); g.setFontAlign(0,0); g.setColor(0,0,0); g.drawString(d.toISOString().substr(8,2), 138, 88, 0); g.drawString(d.toISOString().substr(8,2), 139, 88, 0); g.drawImage(hourHandDay,xc,yc,{scale:1,rotate:HoursAngle}); g.drawImage(minHandDay,xc,yc,{scale:1,rotate:MinutesAngle}); g.drawImage(secHandDay,xc,yc,{scale:1,rotate:SecondsAngle}); queueDraw(); }
And similar change for
nightglow
function. -
-
One thing I don't fully understand is why we need Bangle.on('lock', on => { draw(); });
That creates an event which calls
draw
every time lock state changes, i.e. when watch is locked or unlocked. This is used so that draw is done immediately after state change. Without this draw would happen at next queued draw, i.e. with up to 250 ms delay with your current 250ms interval.... if we're going to call the draw function right afterward anyway.
That
draw();
at end is so that first draw when app starts is immediate. This also starts queued draws whenqueueDraw
is called during that draw.I'm still seeing the lag when changing images
I don't understand why that would happen. Can you show your
daylight()
andnightglow()
functions? -
-
Also I prefer using
setTimeout
instead ofsetInterval
so that I can draw exactly when second changes and not e.g. 700 ms "too late". (This isn't that significant with 1 second interval, but this same code can be used also with 1 minute interval and there I definitely don't want to draw e.g. 40 seconds "too late".)For example in following example you can call
draw
whenever you want and it will first redraw and then (re)queue next draw call. If there is already draw queued it's first cleared withclearTimeout
.function draw() { // ... draw using isLocked ... queueDraw(); } var drawTimeout; function queueDraw() { if (drawTimeout) clearTimeout(drawTimeout); drawTimeout = setTimeout(() => { drawTimeout = undefined; draw(); }, 1000 - (Date.now() % 1000)); } Bangle.on('lock', on => { draw(); }); draw();
-
-
-
Features lists water resistance as "IP67 Water resistant (up to 1 meter for 30 minutes - everyday use, not swimming)"
-
Hardware reference also has some small examples under BluetoothDevice and BluetoothRemoteGATT* types
-
Since I have my own website I prefer keeping my niche apps (currently just "BLE Clock Sync" widget which requires my bluetooth broadcaster) in my own app loader.
Main problem with this is that someone could add different widget with same ID to official app loader and cause confusion.
-
After few tries with 2v12.93 I then tried to update to normal 2v12 which failed with some message about file already existing with different content (shown in App Loader), after which I got messages on Bangle.js 2 screen about storage corruption and erasing storage.
After all that updating to 2v12.93 finally succeeded
-
I've just uploaded firmware 2v12.93 t0 Bangle.js 2 using "Firmware Update" in App Loader and after that Bangle.js is stuck at starting screen which shows logo, firmware version (currently 2v12.89) and some other text.
If I long press button then Bangle.js 2 restarts with some text and then goes back to starting screen and is stuck there.
Uploading firmware again gives same behavior, I've tried 4 times now.
-
-
It depends. ppm is most stable around 20°C - 30°C, so if you mostly keep watch in wrist or in room temperature then you don't see much difference in ppm. But if you wear watch in winter on top of clothing the difference can be large.
Here's graph of my Bangle 2 ppm from year ago:
(horizontal scale is temperature in Celsius, vertical scale is ppm)