-
-
-
well, I just launched AC-AC (A Customizable Analog Clock) - a name which is hopefully interesting enough...
-
Indeed, I try to "overwrite" both widget areas in order to keep the analog clock as large as possible - this is done using a smart clock size calculation - what an impressive word for a little bit of geometry and equation solving...
-
-
this looks as if you would draw concentric rings with an increasing radius. How can you prove, that discretisation does not produce small "holes" in your ring?
Addendum: I'm currently reading the french Wikipedia entry (well, after translation into german - my french is not good enough for maths) and it seems to be a characteristic of that algorithm that no holes are left
-
Ok, I found some time and hacked AC-AC, which you may configure online and then install on your Bangle.js 2 - with absolutely no programming required!
-
While playing around with AC-AC, I noticed that there is no possibility to customize an app for the emulator? You may send a customized version of an app to a real device, but the emulator always receives its "default" version.
Wouldn't that be a nice extension?
-
Based on my Analog Clock Construction Kit (ACCK) and in view of the situation, that people want to get s.th. they can "install", I used the Bangle.js App Customiser (@Gordon: what a brilliant idea) and hacked "AC-AC" ("A Configurable Analog Clock") - yes, "AC-DC" would then be "A Configurable Digital Clock".
The customizer does not look pretty - and, particularly, it does not check whether the URLs you may enter are valid and point to valid code or not (that's your task!) - but it gives you the chance to build your own, personal analog clock for the Bangle.js 2 (out of approx. 102144 possible built-in combinations - and out of endless combinations when including external modules) without having to program yourself!
Because of the ACCK, you currently have the choice between
- 2 different clock sizes,
- 4 different clock faces,
- 3 different clock hands and
- 4 different complications
Alternatively, you may specify the URL of ACCK compatible modules for external clock sizes, faces, hands or complications - this makes ACCK and AC-AC extensible in the future.
Additionally, you may use the currently configured global theme or configure your own colors for clock fore- and background and second hands.
With greetings from Germany: have fun!
- 2 different clock sizes,
-
What surprises me: I do not seem to consume that much memory (measured with
process.memory()
:before I start drawing:
{ "free": 10203, "usage": 1797, "total": 12000, "history": 70, "gc": 0, "gctime": 23.59008789062, "blocksize": 15, "stackEndAddress": 537087280, "flash_start": 0, "flash_binary_end": 582576, "flash_code_start": 1610612736, "flash_length": 1048576 }
after drawing:
{ "free": 10197, "usage": 1803, "total": 12000, "history": 70, "gc": 0, "gctime": 23.52905273437, "blocksize": 15, "stackEndAddress": 537087280, "flash_start": 0, "flash_binary_end": 582576, "flash_code_start": 1610612736, "flash_length": 1048576 }
Thus, there seems to be (and should be) plenty of memory left?
Or does the graphics buffer consume a lot?
-
After a program continued to run but no longer drew any graphics, I tried to isolate the error - particularly, because it drew its graphics without any problems while the LCD display was "off", but stopped doing so when it was turned "on" (or the screen locked and unlocked)
Interpreter error: [ "MEMORY_BUSY" ] New interpreter error: MEMORY_BUSY
As this message does not seem to crash my application: when is it thrown or printed to the console?
-
-
Well, and what is "lcdPower" then good for?
I thought, it would describe the backlight intensity - and would normally be off and just switched on from time to time when the watch is turned over.
From the docs of
Bangle.setLCDTimeout
With power saving on, the display will turn on if a button is pressed, the watch is turned face up, or the screen is updated (see Bangle.setOptions for configuration). It'll turn off automatically after the given timeout.
I want to get an event when backlight is switched on (in order to show more detailed information) or off, "lock" describes the touchscreen
-
After trying to isolate a severe problem in my code for more than an hour now, I ended up with the following code that does not seem to work on my real device(!)
Bangle.on('lcdPower', (on) => { print('> on',on); print('> Bangle.isLCDOn',Bangle.isLCDOn()); });
After entering these lines into the right-hand side of the Web IDE, uploading to my Bangle.js,
and switching between LCD on and off (by waiting and moving the clock) I do not get any response back!I'm running firmware 2v11
Does anybody have any idea why?
-
-
looks very interesting - thank you very much!
What always surprises me is the remark "Note: This is only available in !devices with low flash memory with !'Original' Espruino boards" at the end of many method descriptions - but the Bangle.js 2 is neither an original Espruino board nor has it low flash memory, right?
-
No, you do not install anything.
Instead, you take the code shown as a basis for your own clock implementation - e.g., by copying it into the right-hand side of the Web IDE.
Then you choose the parts you like and copy their
require
statements as described in the part's documentation.If everything is correct, you may just upload your code to your watch in order to test it. If your clock meets your expectations, you may save your code into a file, e.g.
app.js
(on your PC) and add any other files needed to complete a regular app (I may provide templates for these files as well). Then fork Gordon's BangleApps repo and add your clock to the list of apps.Et voilà, you made your very own and personal clock! After a pull request, this clock is even available for others as well - clock implementation made simple!
-
You may use the kit right away, just visit the repository on GitHub and follow the instructions or modify an example.
There is no need for a battery complication, as there are widgets for that purpose - and widgets may still be shown. I guess, the same applies to Gadgetbridge.
I already thought of sunrise and sunset - but I don't have much time left since I have to concentrate on other things now (to earn my living).
However, anybody is free to develop her/his own parts which may then be plugged into a "clockwork" like those I've already implemented myself.
-
Developing an "analog clock" for the Bangle.js 2 may not be too complicated - but it still requires some knowledge of JavaScript in general and the Bangle.js environment in particular.
The "Analog Clock Construction Kit" tries to simplify development and customization of such clocks by splitting the implementation into commonly seen parts and providing a framework into which all these parts fit.
As a consequence, people may easily combine already existing (and tested) parts in order to get the desired clock and - if this approach is not already sufficient - to customize or implement only those parts which cannot yet be found elsewhere.
A minimal example for an analog clock based on the "analog Clock Construction Kit" looks as follows:
let Clockwork = require('https://raw.githubusercontent.com/rozek/banglejs-2-simple-clockwork/main/Clockwork.js'); Clockwork.windUp();
A more interesting clock would probably look as follows
let Clockwork = require('https://raw.githubusercontent.com/rozek/banglejs-2-simple-clockwork/main/Clockwork.js'); Clockwork.windUp({ face: require('https://raw.githubusercontent.com/rozek/banglejs-2-rainbow-clock-face/main/ClockFace.js'), hands:require('https://raw.githubusercontent.com/rozek/banglejs-2-hollow-clock-hands/main/ClockHands.js'), complications: { t:require('https://raw.githubusercontent.com/rozek/banglejs-2-calendar-week-complication/main/Complication.js'), l:require('https://raw.githubusercontent.com/rozek/banglejs-2-weekday-complication/main/Complication.js'), r:require('https://raw.githubusercontent.com/rozek/banglejs-2-moon-phase-complication/main/Complication.js'), b:require('https://raw.githubusercontent.com/rozek/banglejs-2-date-complication/main/Complication.js'), } },{ Foreground:'#FFFFFF', Background:'#000000', Seconds:'#FFFF00', withDots:true });
and produce the clock shown in the screenshot.
As you can see, quite often no real programming is required - and if something should be missing (or not meet your expectations), only that part of the clock has actually to be developed by yourself.
Parts of an Analog Clock
In the context of this kit, an analog clock consists of the following parts:
- a clockwork (defines the overall behaviour of a clock)
- a clock size calculator (computes the space a clock may occupy without disturbing any widgets)
- a clock background (draws a background for the clock)
- a clock face (draws the clock's face)
- clock hands (actually display the current time by drawing any clock hands)
- optional complications (draw additional complications - e.g., to show the current date)
Right now, the following clock part implementations are available:
- clockwork:
- simple clockwork with up to 6 complications
- simple clockwork with up to 6 complications
- clock size calculations:
- simple clock size calculation
- smart clock size calculation - should be combined with "Widgets on Background"
- simple clock size calculation
- clock backgrounds:
- bitmap background - should be combined with "Widgets on Background"
- bitmap background - should be combined with "Widgets on Background"
- clock faces:
- clock hands:
- simple clock hands
- rounded clock hands
- hollow clock hands, optionally filled
- simple clock hands
- complications:
It's your turn now!
Feel free to use this kit to develop your own analog clocks - either from the given parts or by extending existing/developing new parts!
- a clockwork (defines the overall behaviour of a clock)
-
The function to draw a moon phase has been converted into an external module that may be
require
d directly from GitHub -
Documentation complete
Additionally, there is also a method to draw filled circular rings (g.fillRing) which might become handy when implementing analog clocks
-
meanwhile, I've implemented g.drawRoundRect and g.fillRoundRect as external modules which may easily be loaded into your program.
g.drawRoundRect
has already been documented, the docs forg.fillRoundRect
will follow a.s.a.p. -
-
That problem should be solved by using the smart Clock Size Calculator as part of my Analog Clock Construction Kit
just good luck - but now I'll have to go to bed. Tomorrow will be a new day!