Merge branch 'master' into no-unused-vars

pull/3213/head
Anton 2024-03-06 11:03:23 +01:00 committed by GitHub
commit 5e074ecce7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 552 additions and 18 deletions

View File

@ -4,4 +4,5 @@
Store all icons in a separate binary file (much faster lookup)
0.04: Add message icon for 'clock'
0.05: Add message icon for 'jira'
0.06: Minor code improvements
0.06: Add message icon for 'molly' and 'threema libre'
0.07: Minor code improvements

View File

@ -71,7 +71,9 @@ Promise.all(promises).then(function() {
require("fs").writeFileSync(__dirname+"/../icons.img", Buffer.from(iconData,"binary"));
console.log("Saving library");
require("fs").writeFileSync(__dirname+"/../lib.js", `exports.getImage = function(msg) {
require("fs").writeFileSync(__dirname+"/../lib.js", `// This file is auto-generated - DO NOT MODIFY
// If you want to add icons, change icons/icon_names.json and re-run icons/generate.js
exports.getImage = function(msg) {
if (msg.img) return atob(msg.img);
let s = (("string"=== typeof msg) ? msg : (msg.src || "")).toLowerCase();
if (msg.id=="music") s="music";
@ -86,16 +88,15 @@ exports.getColor = function(msg,options) {
if (st.iconColorMode == 'mono') return options.default;
const s = (("string"=== typeof msg) ? msg : (msg.src || "")).toLowerCase();
return {
// This file is generated by /icons/generate.js. If you need to modify its content, you should do it there instead.
// generic colors, using B2-safe colors
// DO NOT USE BLACK OR WHITE HERE, just leave the declaration out and then the theme's fg color will be used
/* generic colors, using B2-safe colors */ ${ /* DO NOT USE BLACK OR WHITE HERE, just leave the declaration out and then the theme's fg color will be used */"" }
"airbnb": "#ff385c", // https://news.airbnb.com/media-assets/category/brand/
"mail": "#ff0",
"music": "#f0f",
"phone": "#0f0",
"sms message": "#0ff",
// brands, according to https://www.schemecolor.com/?s (picking one for multicolored logos)
// all dithered on B2, but we only use the color for the icons. (Could maybe pick the closest 3-bit color for B2?)
"sms message": "#0ff", ${ /*
brands, according to https://www.schemecolor.com/?s (picking one for multicolored logos)
all dithered on B2, but we only use the color for the icons. (Could maybe pick the closest 3-bit color for B2?)
*/""}
"bibel": "#54342c",
"bring": "#455a64",
"discord": "#5865f2", // https://discord.com/branding

View File

@ -80,6 +80,7 @@
{ "app":"infinity", "icon":"reddit.png" },
{ "app":"slide", "icon":"reddit.png" },
{ "app":"signal", "icon":"signal.png" },
{ "app":"molly", "icon":"signal.png" },
{ "app":"skype", "icon":"skype.png" },
{ "app":"slack", "icon":"slack.png" },
{ "app":"snapchat", "icon":"snapchat.png" },
@ -89,6 +90,7 @@
{ "app":"telegram", "icon":"telegram.png" },
{ "app":"telegram foss", "icon":"telegram.png" },
{ "app":"threema", "icon":"threema.png" },
{ "app":"threema libre", "icon":"threema.png" },
{ "app":"tiktok", "icon":"tiktok.png" },
{ "app":"to do", "icon":"task.png" },
{ "app":"opentasks", "icon":"task.png" },

View File

@ -1,3 +1,5 @@
// This file is auto-generated - DO NOT MODIFY
// If you want to add icons, change icons/icon_names.json and re-run icons/generate.js
exports.getImage = function(msg) {
if (msg.img) return atob(msg.img);
let s = (("string"=== typeof msg) ? msg : (msg.src || "")).toLowerCase();
@ -13,16 +15,12 @@ exports.getColor = function(msg,options) {
if (st.iconColorMode == 'mono') return options.default;
const s = (("string"=== typeof msg) ? msg : (msg.src || "")).toLowerCase();
return {
// This file is generated by /icons/generate.js. If you need to modify its content, you should do it there instead.
// generic colors, using B2-safe colors
// DO NOT USE BLACK OR WHITE HERE, just leave the declaration out and then the theme's fg color will be used
/* generic colors, using B2-safe colors */
"airbnb": "#ff385c", // https://news.airbnb.com/media-assets/category/brand/
"mail": "#ff0",
"music": "#f0f",
"phone": "#0f0",
"sms message": "#0ff",
// brands, according to https://www.schemecolor.com/?s (picking one for multicolored logos)
// all dithered on B2, but we only use the color for the icons. (Could maybe pick the closest 3-bit color for B2?)
"sms message": "#0ff",
"bibel": "#54342c",
"bring": "#455a64",
"discord": "#5865f2", // https://discord.com/branding
@ -67,4 +65,4 @@ exports.getColor = function(msg,options) {
"youtube": "#f00", // https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors
}[s]||options.default;
};

View File

@ -0,0 +1,3 @@
0.1: (2024-02-23) initial alpha upload
0.2: (2024-02-23) fixed minor issues with settings
0.3: (2024-03-01) advanced settings, rearanged ui elements, fixed rendering problems

View File

@ -0,0 +1,74 @@
# Regatta Timer 5-4-1 countdown
## Modes
* **Idle**
On startup the application is in idle mode showing a large 5 in the centre of the screen and the time of day below.
`Button` switches to start mode.
* **Start**
During the countdown, the screen changes the layout several times to use as much space as
possible to display the numbers.
When time is up the buzzer sounds and the application switches to race mode.
`Button` switches to idle mode.
* **Race**
Race time, local time, SOA, number reachable GPS satellites and battery level are shown.
`Button` switches to "stopped mode".
* **Stoped**
The race counter stops.
`Button` switches to idle mode.
## Screenshots
*Idle mode: showing a big 5 and time of day below*
![Idle mode: showing a big 5 and time of day below](screenshot-1.png)
*Start mode: minutes and seconds*
![Start mode: minutes and seconds](screenshot-2.png)
*Start mode: seconds*
![Start mode: seconds](screenshot-3.png)
*Race mode: elapsed time, time of day, speed, satellites, battery*
![Race mode: elapsed time, time of day, speed, satellites, battery](screenshot-4.png)
*Race mode: with german abbreviations*
![Race mode: with german abbreviations](screenshot-5.png)
*Settings page: main*
![Settings page: main](screenshot-6.png)
*Settings page: choose the theme*
![Settings page: choose the theme](screenshot-7.png)
## Localization
Localization is done by the Bangle.js 2 app "Languages"
* Go to [banglejs.com/apps](https://banglejs.com/apps/)
* Search for app "Languages"
* Click the "arrow up" or "burger" icon
* Choose your language from the dropdown
* Click `upload`
**Some nautical abbreviations which are not part of the Bangle.js 2 app "Languages" app are stored in `translations.json`.**
## Feedback
Report bugs or request a feature at [github.com/naden](https://github.com/naden)
## Roadmap
* add a seconds coundown layout; mimic a classic regatta chronograph
* add recording of gps course and race time
* add icons for light mode
* add flag icons
## Created by
© 2021 - 2024 [naden.de](https://naden.de)
Icons by [Icons8](https://icons8.com/)

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEw4f/8H/A4NgtfgzkgoVg50g40Awg5lnmSpMk4ARMkMkCQNgCJkJCKM////0AQLgNJkBZP5OACB0B5OKjJqNgGJLINOEZprDCJ0rmVJoARMzfAg1JLh8AQCIRNGQPghg1NhQgBghZOhMmoR9ClmSqDXJR4NLAwMhknQEhEsCINwboQRKgG59RuDCJYADLgIRPqVnCJ9CuYROgOSwYjPyUDCJ0IzwRP4mQCIsRlARH8mZWYPJbgK/BCJOSR4OTCIMGCJ8MAoIRIi3btUk3UACJYABLIcapMJCJxZLCKbMFCP4R/COQAo"))

335
apps/regattatimer/app.js Normal file

File diff suppressed because one or more lines are too long

BIN
apps/regattatimer/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 980 B

View File

@ -0,0 +1,18 @@
{
"id": "regattatimer",
"name": "Regatta Timer",
"shortName": "RegattaTimer",
"version": "0.3",
"description": "Regatta Timer with 5-4-1 Countdown",
"icon": "icon.png",
"tags": "tool,outdoors,sailing,race,regatta,boat,timer",
"supports": ["BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name": "regattatimer.app.js", "url": "app.js"},
{"name": "regattatimer.settings.js", "url": "settings.js"},
{"name": "regattatimer.img", "url": "app-icon.js", "evaluate": true}
],
"data": [{"name": "regattatimer.json"}],
"screenshots": [{"url": "screenshot.png"},{"url": "screenshot-1.png"},{"url": "screenshot-2.png"},{"url": "screenshot-3.png"},{"url": "screenshot-4.png"},{"url": "screenshot-5.png"},{"url": "screenshot-6.png"},{"url": "screenshot-7.png"}]
}

View File

@ -0,0 +1,8 @@
{
"debug": false,
"buzzer": true,
"dial": "Numeric",
"gps": true,
"record": false,
"theme": "Dark"
}

View File

@ -0,0 +1,10 @@
{
"de": {
"speed": "FüG",
"speed_unit": "kn"
},
"en": {
"speed": "SOA",
"speed_unit": "kn"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,78 @@
(function(back) {
var
file = "regattatimer.json",
storage = require("Storage"),
dials = ["Numeric", "Discs"],
themes = ["Light", "Dark"],
settings = Object.assign({
"debug": false,
"buzzer": true,
"dial": "Numeric",
"gps": true,
"record": false,
"theme": "Dark",
}, storage.readJSON(file, true) || {});
function save(key, value) {
settings[key] = value;
storage.writeJSON(file, settings);
}
E.showMenu({
"" : { "title" : "Regatta Timer" },
"< Back" : () => back(),
"GPS": {
value: !!settings.gps, // !! converts undefined to false
onchange: v => {
save("gps", v);
}
},
"THEME": {
value: themes.indexOf(settings.theme),
min: 0,
max: themes.length - 1,
step: 1,
wrap: true,
format: v => themes[v],
onchange: (d) => {
save("theme", themes[d]);
}
},
"BUZZER": {
value: !!settings.buzzer, // !! converts undefined to false
onchange: v => {
save("buzzer", v);
}
},
/*
"DIAL": {
value: dials.indexOf(settings.dial),
min: 0,
max: dials.length - 1,
step: 1,
wrap: true,
format: v => dials[v],
onchange: (d) => {
save("dial", dials[d]);
}
},
"RECORD": {
value: !!settings.record, // 0| converts undefined to 0
onchange: v => {
settings.record = v;
save("record", v);
}
},
*/
"DEBUG": {
value: !!settings.debug, // 0| converts undefined to 0
onchange: v => {
save("debug", v);
}
},
});
})

View File

@ -1,2 +1,3 @@
0.01: First commit
0.02: Add tap-to-lock functionality
0.03: Disable tap-to-lock if back button is present

View File

@ -1,8 +1,8 @@
{
"id": "widlockunlock",
"name": "Lock/Unlock Widget",
"version": "0.02",
"description": "On devices with always-on display (Bangle.js 2) this displays lock icon whenever the display is locked, or an unlock icon otherwise. Tap to lock the lcd",
"version": "0.03",
"description": "On devices with always-on display (Bangle.js 2) this displays lock icon whenever the display is locked, or an unlock icon otherwise. Tap to lock the lcd (unless the back button is shown, in which case it takes priority)",
"icon": "widget.png",
"type": "widget",
"tags": "widget,lock",

View File

@ -1,6 +1,8 @@
Bangle.on("lock", () => Bangle.drawWidgets());
Bangle.on('touch', (_btn, xy) => {
if (WIDGETS["back"]) return;
const oversize = 5;
const w = WIDGETS.lockunlock;
@ -11,6 +13,8 @@ Bangle.on('touch', (_btn, xy) => {
if(w.x - oversize <= x && x < w.x + 14 + oversize
&& w.y - oversize <= y && y < w.y + 24 + oversize)
{
E.stopEventPropagation && E.stopEventPropagation();
Bangle.setLocked(true);
const backlightTimeout = Bangle.getOptions().backlightTimeout; // ms

@ -1 +1 @@
Subproject commit 2ab71a33d69bfda40465174ffe57adb03c21fc42
Subproject commit af870d7b8386bfa824b07b268bce414e4daf3fbb