Anton clock: Smaller seconds, weekday with seconds, seconds without colon, cleaner configuration

master
Dirk Hillbrecht (home) 2022-01-05 22:21:55 +01:00
parent 7829af0ef2
commit d36743032c
3 changed files with 101 additions and 86 deletions

View File

@ -11,8 +11,8 @@ The basic time representation only shows hours and minutes of the current time.
* Date can be shown in three different formats: * Date can be shown in three different formats:
* ISO-8601: 2021-12-19 * ISO-8601: 2021-12-19
* short local format: 19/12/2021, 19.12.2021 * short local format: 19/12/2021, 19.12.2021
* long local format (not together with seconds): DEC 19 2021 * long local format: DEC 19 2021
* Weekday can be shown (not together with seconds) * Weekday can be shown (on seconds screen only instead of year)
## Usage ## Usage
@ -33,9 +33,10 @@ You configure Anton clock through several "on/off" switches in two menus.
The main menu contains several settings covering Anton clock in general. The main menu contains several settings covering Anton clock in general.
* **Seconds...** - Opens the submenu for configuring the presentation of the current time's seconds. * **Seconds...** - Opens the submenu for configuring the presentation of the current time's seconds.
* **ISO8601 date** - Show the date in ISO-8601 format, irrespective of the current locale. * **Date** - Format of the date representation. Possible values are
* **Long date** - Show the date in long format (usually with month in letters instead of number). * **Long** - "Long" date format in the current locale. Usually with the month as name, not number.
Exact format depends on the current locale. _Only evaluated if ISO8601 date is not set._ * **Short** - "Short" date format in the current locale. Usually with the month as number.
* **ISO8601** - Show the date in ISO-8601 format (YYYY-MM-DD), irrespective of the current locale.
* **Show Weekday** - Weekday is shown in the time presentation without seconds. * **Show Weekday** - Weekday is shown in the time presentation without seconds.
Weekday name depends on the current locale. Weekday name depends on the current locale.
If seconds are shown, the weekday is never shown as there is not enough space on the watch face. If seconds are shown, the weekday is never shown as there is not enough space on the watch face.
@ -49,21 +50,28 @@ Otherwise, a scaled version of the built-in 6x8 pixels font is used.
The "Seconds" submenu configures how (and if) seconds are shown on the "Anton" watch face. The "Seconds" submenu configures how (and if) seconds are shown on the "Anton" watch face.
* **Always** - Seconds are _always_ shown, irrespective of the display's unlock state. * **Show** - Configure when the seconds should be shown at all:
If this is enabled, weekdays will never been shown. * **Never** - Seconds are never shown.
_Enabling this option increases power consumption as the watch face will update once per second instead of once per minute._ In this case, hour and minute are a bit more centered on the screen and the clock will always only update every minute.
* **If unlocked** - Seconds are shown if the display is unlocked. This saves battery power.
On a locked display, only hour, minutes, date and weekday are shown. * **Unlocked** - Seconds are shown if the display is unlocked.
"Always" overrides this option. On locked displays, only hour, minutes, date and optionally the weekday are shown.
_This option is highly recommended on the Bangle.js 2!_ _This option is highly recommended on the Bangle.js 2!_
* **Coloured** - If enabled, seconds are shown in blue instead of black. * **Always** - Seconds are _always_ shown, irrespective of the display's unlock state.
_Enabling this option increases power consumption as the watch face will update once per second instead of once per minute._
* **With ":"** - If enabled, a colon ":" is prepended to the seconds.
This resembles the usual time representation "hh:mm:ss", even though the seconds are printed on a separate line.
* **Color** - If enabled, seconds are shown in blue instead of black.
If the date is shown on the seconds screen, it is colored read instead of black.
This make the visual orientation much easier on the watch face. This make the visual orientation much easier on the watch face.
* **With date** - If enabled, the date is shown together with the seconds. * **Date** - It is possible to show the date together with the seconds:
Depending on the "ISO8601 date" settings, ISO8601 or short local format is used. * **No** - Date is _not_ shown in the seconds screen.
The date is coloured in red if the "Coloured" option is chosen. In this case, the seconds are centered below hour and minute.
* **Year** - Date is shown with day, month, and year. If "Date" in the main settings is configured to _ISO8601_, this is used here, too. Otherwise, the short local format is used.
* **Weekday** - Date is shown with day, month, and weekday.
If neither "Always" nor "If unlocked" is selected, Anton clock does _never_ show seconds. The date is coloured in red if the "Coloured" option is chosen.
## Compatibility ## Compatibility
Anton clock makes use of core Bangle.js 2 features (coloured display, display lock state). It also runs on the Bangle.js 1 but these features are not available there due to the hardware features. Anton clock makes use of core Bangle.js 2 features (coloured display, display lock state). It also runs on the Bangle.js 1 but these features are not available there due to hardware restrictions.

File diff suppressed because one or more lines are too long

View File

@ -11,28 +11,34 @@
require('Storage').writeJSON(FILE, settings); require('Storage').writeJSON(FILE, settings);
} }
// Helper method which uses int-based menu item for set of string values
function stringItems(startvalue, writer, values) {
return {
value: (startvalue === undefined ? 0 : values.indexOf(startvalue)),
format: v => values[v],
min: 0,
max: values.length - 1,
wrap: true,
step: 1,
onchange: v => {
writer(values[v]);
writeSettings();
}
};
}
// Helper method which breaks string set settings down to local settings object
function stringInSettings(name, values) {
return stringItems(settings[name], v => settings[name] = v, values);
}
var mainmenu = { var mainmenu = {
"": { "": {
"title": "Anton clock" "title": "Anton clock"
}, },
"< Back": () => back(), "< Back": () => back(),
"Seconds...": () => E.showMenu(secmenu), "Seconds...": () => E.showMenu(secmenu),
"ISO8601 date": { "Date": stringInSettings("dateOnMain", ["Short", "Long", "ISO8601"]),
value: (settings.dateAsISO !== undefined ? settings.dateAsISO : false),
format: v => v ? "On" : "Off",
onchange: v => {
settings.dateAsISO = v;
writeSettings();
}
},
"Long date": {
value: (settings.longDate !== undefined ? settings.longDate : true),
format: v => v ? "On" : "Off",
onchange: v => {
settings.longDate = v;
writeSettings();
}
},
"Show Weekday": { "Show Weekday": {
value: (settings.weekDay !== undefined ? settings.weekDay : true), value: (settings.weekDay !== undefined ? settings.weekDay : true),
format: v => v ? "On" : "Off", format: v => v ? "On" : "Off",
@ -65,23 +71,16 @@
"title": "Show seconds..." "title": "Show seconds..."
}, },
"< Back": () => E.showMenu(mainmenu), "< Back": () => E.showMenu(mainmenu),
"Always": { "Show": stringInSettings("secondsMode", ["Never", "Unlocked", "Always"]),
value: (settings.secondsAlways !== undefined ? settings.secondsAlways : false), "With \":\"": {
value: (settings.secondsWithColon !== undefined ? settings.secondsWithColon : false),
format: v => v ? "On" : "Off", format: v => v ? "On" : "Off",
onchange: v => { onchange: v => {
settings.secondsAlways = v; settings.secondsWithColon = v;
writeSettings(); writeSettings();
} }
}, },
"If unlocked": { "Color": {
value: (settings.secondsOnUnlock !== undefined ? settings.secondsOnUnlock : false),
format: v => v ? "On" : "Off",
onchange: v => {
settings.secondsOnUnlock = v;
writeSettings();
}
},
"Coloured": {
value: (settings.secondsColoured !== undefined ? settings.secondsColoured : false), value: (settings.secondsColoured !== undefined ? settings.secondsColoured : false),
format: v => v ? "On" : "Off", format: v => v ? "On" : "Off",
onchange: v => { onchange: v => {
@ -89,14 +88,7 @@
writeSettings(); writeSettings();
} }
}, },
"With date": { "Date": stringInSettings("dateOnSecs", ["No", "Year", "Weekday"])
value: (settings.dateOnSecs !== undefined ? settings.dateOnSecs : false),
format: v => v ? "On" : "Off",
onchange: v => {
settings.dateOnSecs = v;
writeSettings();
}
}
}; };
// Actually display the menu // Actually display the menu