BangleApps/apps/multiclock
Anton cad2ffe283 Bump version for all apps with fixed undefined variables 2024-03-13 11:56:27 +01:00
..
ChangeLog Bump version for all apps with fixed undefined variables 2024-03-13 11:56:27 +01:00
README.md update multiclock + initial B2 magnav 2021-11-19 15:08:45 +00:00
ana.face.js multiclock - new bangle 2 compatible 2021-11-01 17:46:50 +00:00
big.face.js Fix apps with undefined variables 2024-03-13 11:51:40 +01:00
clock.info multiclock - new bangle 2 compatible 2021-11-01 17:46:50 +00:00
digi.face.js final release fixes 2021-11-01 20:38:22 +00:00
dk.face.js Fix apps with undefined variables 2024-03-13 11:51:40 +01:00
metadata.json Bump version for all apps with fixed undefined variables 2024-03-13 11:56:27 +01:00
multiclock-icon.img fix file names 2021-11-01 18:06:15 +00:00
multiclock-icon.js fix file names 2021-11-01 18:06:15 +00:00
multiclock.app.js update multiclock + initial B2 magnav 2021-11-19 15:08:45 +00:00
multiclock.png fix file names 2021-11-01 18:06:15 +00:00
nifty.face.js update multiclock + initial B2 magnav 2021-11-19 15:08:45 +00:00
screen-ana.png add screenshots 2021-11-20 11:17:39 +00:00
screen-big.png add screenshots 2021-11-20 11:17:39 +00:00
screen-date.png add screenshots 2021-11-20 11:17:39 +00:00
screen-nifty.png add screenshots 2021-11-20 11:17:39 +00:00
screen-sec.png fix screenshots 2021-11-20 11:27:23 +00:00
screen-td.png fix screenshots 2021-11-20 11:27:23 +00:00
screen-word.png fix screenshots 2021-11-20 11:27:23 +00:00
txt.face.js final release fixes 2021-11-01 20:38:22 +00:00

README.md

Multiclock

This is a clock app that supports multiple clock faces. The user can switch between faces while retaining widget state which makes the switch fast. Currently there are four clock faces as shown below. There are currently an anlog, digital, text, big digit, time and date, and a clone of the Nifty-A-Clock faces.

Analog Clock Face

Controls

Uses setUI("clockupdown") BTN1 & BTH3 switch faces on the Bangle. Touch upper right and lower right quadrant switch faces on the Bangle 2.

Adding a new face

Clock faces are described in javascript storage files named name.face.js. For example, the Analog Clock Face is described in ana.face.js. These files have the following structure:

(() => {
    function getFace(){
	    function onSecond(){
	       //draw digits, hands etc
	    }
	    function drawAll(){
	       //draw background + initial state of digits, hands etc
	    }
    	return {init:drawAll, tick:onSecond, tickpersec:true};
    }
    return getFace;
})();

For those familiar with the structure of widgets, this is similar, however, there is an additional level of function nesting. This means that although faces are loaded when the clock app starts running they are not instantiated until their getFace function is called, i.e. memory is not allocated to structures such as image buffer arrays declared in getFace until the face is selected. Consequently, adding a face does not require a lot of extra memory.

The app at start up loads all files *.face.js. The simplest way of adding a face is thus to load it into Storage using the WebIDE. Similarly, to remove an unwanted face, simply delete it from Storage using the WebIDE.

If tickpersec is false then tick is only called each minute as this is more power effcient - especially on the BAngle 2.