diff --git a/README.md b/README.md
index 20ae8afb2..8e186cf79 100644
--- a/README.md
+++ b/README.md
@@ -384,14 +384,18 @@ Example `settings.js`
```js
// make sure to enclose the function in parentheses
(function(back) {
- function get(key, def) { return require('Settings').get('myappid', key, def); }
- function set(key, value) { require('Settings').set('myappid', key, value); }
+ let settings = require('Storage').readJSON('myappid.json',1)||{};
+ if (typeof settings.monkeys !== "number") settings.monkeys = 12; // default value
+ function save(key, value) {
+ settings[key] = value;
+ require('Storage').write('myappid.json', settings);
+ }
const appMenu = {
'': {'title': 'App Settings'},
'< Back': back,
'Monkeys': {
- value: get('monkeys', 12),
- onchange: (m) => set('monkeys', m)
+ value: settings.monkeys,
+ onchange: (m) => {save('monkeys', m)}
}
};
E.showMenu(appMenu)
diff --git a/apps.json b/apps.json
index 2e338a432..c379a1de4 100644
--- a/apps.json
+++ b/apps.json
@@ -1,9 +1,9 @@
[
{
"id": "fwupdate",
- "name": "Firmware Update (BETA)",
- "version": "0.01",
- "description": "Uploads new Espruino firmwares to Bangle.js 2",
+ "name": "Firmware Update",
+ "version": "0.02",
+ "description": "[BETA] Uploads new Espruino firmwares to Bangle.js 2. For now, please use the instructions under https://www.espruino.com/Bangle.js2#firmware-updates",
"icon": "app.png",
"type": "RAM",
"tags": "tools,system",
@@ -11,12 +11,12 @@
"custom": "custom.html",
"customConnect": true,
"storage": [],
- "sortorder": -20
+ "sortorder": 20
},
{
"id": "boot",
"name": "Bootloader",
- "version": "0.36",
+ "version": "0.39",
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
"icon": "bootloader.png",
"type": "bootloader",
@@ -29,10 +29,55 @@
],
"sortorder": -10
},
+ {
+ "id": "hebrew_calendar",
+ "name": "Hebrew Calendar",
+ "shortName": "HebCal",
+ "version": "0.04",
+ "description": "lists the date according to the hebrew calendar",
+ "icon": "app.png",
+ "allow_emulator": false,
+ "tags": "tool,locale",
+ "supports": [
+ "BANGLEJS",
+ "BANGLEJS2"
+ ],
+ "readme": "README.md",
+ "storage": [
+ {
+ "name": "hebrew_calendar.app.js",
+ "url": "app.js"
+ },
+ {
+ "name": "hebrewDate",
+ "url": "hebrewDate.js"
+ },
+ {
+ "name": "hebrew_calendar.img",
+ "url": "app-icon.js",
+ "evaluate": true
+ }
+ ]
+ },
+ { "id": "golfscore",
+ "name": "Golf Score",
+ "shortName":"golfscore",
+ "version":"0.02",
+ "description": "keeps track of strokes during a golf game",
+ "icon": "app.png",
+ "tags": "outdoors",
+ "allow_emulator": true,
+ "supports" : ["BANGLEJS","BANGLEJS2"],
+ "readme": "README.md",
+ "storage": [
+ {"name":"golfscore.app.js","url":"app.js"},
+ {"name":"golfscore.img","url":"app-icon.js","evaluate":true}
+ ]
+ },
{
"id": "messages",
"name": "Messages",
- "version": "0.07",
+ "version": "0.13",
"description": "App to display notifications from iOS and Gadgetbridge",
"icon": "app.png",
"type": "app",
@@ -47,14 +92,15 @@
{"name":"messages","url":"lib.js"}
],
"data": [{"name":"messages.json"},{"name":"messages.settings.json"}],
+ "screenshots": [{"url":"screenshot.png"},{"url":"screenshot-notify.gif"}],
"sortorder": -9
},
{
"id": "android",
"name": "Android Integration",
"shortName": "Android",
- "version": "0.04",
- "description": "(BETA) App to display notifications from Gadgetbridge on Android. This will eventually replace the Gadgetbridge widget.",
+ "version": "0.05",
+ "description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.",
"icon": "app.png",
"tags": "tool,system,messages,notifications",
"dependencies": {"messages":"app"},
@@ -70,8 +116,8 @@
{
"id": "ios",
"name": "iOS Integration",
- "version": "0.03",
- "description": "(BETA) App to display notifications from iOS devices",
+ "version": "0.07",
+ "description": "Display notifications/music/etc from iOS devices",
"icon": "app.png",
"tags": "tool,system,ios,apple,messages,notifications",
"dependencies": {"messages":"app"},
@@ -87,7 +133,7 @@
"id": "health",
"name": "Health Tracking",
"version": "0.08",
- "description": "Logs health data and provides an app to view it (BETA - requires firmware 2v11)",
+ "description": "Logs health data and provides an app to view it (requires firmware 2v10.100 or later)",
"icon": "app.png",
"tags": "tool,system,health",
"supports": ["BANGLEJS","BANGLEJS2"],
@@ -104,7 +150,7 @@
"id": "launch",
"name": "Launcher",
"shortName": "Launcher",
- "version": "0.08",
+ "version": "0.10",
"description": "This is needed to display a menu allowing you to choose your own applications. You can replace this with a customised launcher.",
"icon": "app.png",
"type": "launch",
@@ -112,14 +158,16 @@
"supports": ["BANGLEJS","BANGLEJS2"],
"storage": [
{"name":"launch.app.js","url":"app-bangle1.js","supports":["BANGLEJS"]},
- {"name":"launch.app.js","url":"app-bangle2.js","supports":["BANGLEJS2"]}
+ {"name":"launch.app.js","url":"app-bangle2.js","supports":["BANGLEJS2"]},
+ {"name":"launch.settings.js","url":"settings.js","supports":["BANGLEJS2"]}
],
+ "data": [{"name":"launch.json"}],
"sortorder": -10
},
{
"id": "setting",
"name": "Settings",
- "version": "0.33",
+ "version": "0.37",
"description": "A menu for setting up Bangle.js",
"icon": "settings.png",
"tags": "tool,system",
@@ -135,7 +183,7 @@
{
"id": "about",
"name": "About",
- "version": "0.11",
+ "version": "0.12",
"description": "Bangle.js About page - showing software version, stats, and a collaborative mural from the Bangle.js KickStarter backers",
"icon": "app.png",
"tags": "tool,system",
@@ -170,7 +218,7 @@
{
"id": "locale",
"name": "Languages",
- "version": "0.10",
+ "version": "0.14",
"description": "Translations for different countries",
"icon": "locale.png",
"type": "locale",
@@ -236,16 +284,17 @@
"id": "mywelcome",
"name": "Customised Welcome",
"shortName": "My Welcome",
- "version": "0.12",
+ "version": "0.13",
"description": "Appears at first boot and explains how to use Bangle.js. Like 'Welcome', but can be customised with a greeting",
"icon": "app.png",
"tags": "start,welcome",
- "supports": ["BANGLEJS"],
+ "supports": ["BANGLEJS","BANGLEJS2"],
"custom": "custom.html",
"screenshots": [{"url":"bangle1-customized-welcome-screenshot.png"}],
"storage": [
{"name":"mywelcome.boot.js","url":"boot.js"},
- {"name":"mywelcome.app.js","url":"app.js"},
+ {"name":"mywelcome.app.js","url":"app-bangle1.js","supports": ["BANGLEJS"]},
+ {"name":"mywelcome.app.js","url":"app-bangle2.js","supports": ["BANGLEJS2"]},
{"name":"mywelcome.settings.js","url":"settings.js"},
{"name":"mywelcome.img","url":"app-icon.js","evaluate":true}
],
@@ -254,8 +303,8 @@
{
"id": "gbridge",
"name": "Gadgetbridge",
- "version": "0.24",
- "description": "The default notification handler for Gadgetbridge notifications from Android. This will eventually be replaced by the 'Android' app.",
+ "version": "0.25",
+ "description": "(NOT RECOMMENDED) Displays Gadgetbridge notifications from Android. Please use the 'Android' Bangle.js app instead.",
"icon": "app.png",
"type": "widget",
"tags": "tool,system,android,widget",
@@ -269,6 +318,20 @@
],
"data": [{"name":"gbridge.json"}]
},
+ { "id": "gbdebug",
+ "name": "Gadgetbridge Debug",
+ "shortName":"GB Debug",
+ "version":"0.01",
+ "description": "Debug info for Gadgetbridge. Run this app and when Gadgetbridge messages arrive they are displayed on-screen.",
+ "icon": "app.png",
+ "tags": "",
+ "supports" : ["BANGLEJS2"],
+ "readme": "README.md",
+ "storage": [
+ {"name":"gbdebug.app.js","url":"app.js"},
+ {"name":"gbdebug.img","url":"app-icon.js","evaluate":true}
+ ]
+ },
{
"id": "mclock",
"name": "Morphing Clock",
@@ -449,22 +512,22 @@
]
},
{
- "id": "mandlebrotclock",
- "name": "Mandlebrot Clock",
+ "id": "mandelbrotclock",
+ "name": "Mandelbrot Clock",
"version": "0.01",
- "description": "A mandlebrot set themed clock cool",
- "icon": "mandlebrotclock.png",
- "screenshots": [{ "url": "screenshot_mandlebrotclock.png" }],
+ "description": "A mandelbrot set themed clock cool",
+ "icon": "mandelbrotclock.png",
+ "screenshots": [{ "url": "screenshot_mandelbrotclock.png" }],
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS2"],
"readme": "README.md",
"allow_emulator": true,
"storage": [
- { "name": "mandlebrotclock.app.js", "url": "mandlebrotclock.js" },
+ { "name": "mandelbrotclock.app.js", "url": "mandelbrotclock.js" },
{
- "name": "mandlebrotclock.img",
- "url": "mandlebrotclock-icon.js",
+ "name": "mandelbrotclock.img",
+ "url": "mandelbrotclock-icon.js",
"evaluate": true
}
]
@@ -496,7 +559,7 @@
"icon": "clock-impword.png",
"type": "clock",
"tags": "clock",
- "supports": ["BANGLEJS"],
+ "supports": ["BANGLEJS","BANGLEJS2"],
"screenshots": [{"url":"bangle1-impercise-word-clock-screenshot.png"}],
"allow_emulator": true,
"storage": [
@@ -685,10 +748,11 @@
{
"id": "gpsrec",
"name": "GPS Recorder",
- "version": "0.26",
+ "version": "0.27",
"description": "Application that allows you to record a GPS track. Can run in background",
"icon": "app.png",
"tags": "tool,outdoors,gps,widget",
+ "screenshots": [{"url":"screenshot.png"}],
"supports": ["BANGLEJS","BANGLEJS2"],
"readme": "README.md",
"interface": "interface.html",
@@ -781,7 +845,7 @@
{
"id": "weather",
"name": "Weather",
- "version": "0.11",
+ "version": "0.13",
"description": "Show Gadgetbridge weather report",
"icon": "icon.png",
"screenshots": [{"url":"screenshot.png"}],
@@ -872,7 +936,7 @@
"id": "widbatpc",
"name": "Battery Level Widget (with percentage)",
"shortName": "Battery Widget",
- "version": "0.13",
+ "version": "0.14",
"description": "Show the current battery level and charging status in the top right of the clock, with charge percentage",
"icon": "widget.png",
"type": "widget",
@@ -1084,7 +1148,7 @@
{
"id": "qrcode",
"name": "Custom QR Code",
- "version": "0.02",
+ "version": "0.04",
"description": "Use this to upload a customised QR code to Bangle.js",
"icon": "app.png",
"tags": "qrcode",
@@ -1635,14 +1699,15 @@
"id": "rtorch",
"name": "Red Torch",
"shortName": "RedTorch",
- "version": "0.01",
- "description": "Turns screen RED to help you see in the dark without breaking your night vision. Select from the launcher or press BTN3,BTN1,BTN3,BTN1 quickly to start when in any app that shows widgets",
+ "version": "0.02",
+ "description": "Turns screen RED to help you see in the dark without breaking your night vision. Select from the launcher or on Bangle 1 press BTN3,BTN1,BTN3,BTN1 quickly to start when in any app that shows widgets",
"icon": "app.png",
"tags": "tool,torch",
- "supports": ["BANGLEJS"],
+ "supports": ["BANGLEJS","BANGLEJS2"],
+ "allow_emulator": true,
"storage": [
{"name":"rtorch.app.js","url":"app.js"},
- {"name":"rtorch.wid.js","url":"widget.js"},
+ {"name":"rtorch.wid.js","url":"widget.js", "supports": ["BANGLEJS"]},
{"name":"rtorch.img","url":"app-icon.js","evaluate":true}
]
},
@@ -1712,7 +1777,7 @@
"id": "cliock",
"name": "Commandline-Clock",
"shortName": "CLI-Clock",
- "version": "0.14",
+ "version": "0.15",
"description": "Simple CLI-Styled Clock",
"icon": "app.png",
"screenshots": [{"url":"screenshot_cli.png"}],
@@ -1894,6 +1959,19 @@
{"name":"widmp.wid.js","url":"widget.js"}
]
},
+ {
+ "id": "widmpsh",
+ "name": "Moon Phase Widget Southern Hemisphere",
+ "version": "0.01",
+ "description": "Display the current moon phase in blueish for the southern hemisphere in eight phases",
+ "icon": "widget.png",
+ "type": "widget",
+ "tags": "widget,tools",
+ "supports": ["BANGLEJS","BANGLEJS2"],
+ "storage": [
+ {"name":"widmpsh.wid.js","url":"widget.js"}
+ ]
+ },
{
"id": "minionclk",
"name": "Minion clock",
@@ -1914,11 +1992,12 @@
"id": "openstmap",
"name": "OpenStreetMap",
"shortName": "OpenStMap",
- "version": "0.09",
- "description": "[BETA] Loads map tiles from OpenStreetMap onto your Bangle.js and displays a map of where you are",
+ "version": "0.11",
+ "description": "Loads map tiles from OpenStreetMap onto your Bangle.js and displays a map of where you are. Once installed this also adds map functionality to `GPS Recorder` and `Recorder` apps",
"icon": "app.png",
- "tags": "outdoors,gps",
+ "tags": "outdoors,gps,osm",
"supports": ["BANGLEJS","BANGLEJS2"],
+ "screenshots": [{"url":"screenshot.png"}],
"custom": "custom.html",
"customConnect": true,
"storage": [
@@ -1948,11 +2027,12 @@
"id": "chronowid",
"name": "Chrono Widget",
"shortName": "Chrono Widget",
- "version": "0.03",
+ "version": "0.04",
"description": "Chronometer (timer) which runs as widget.",
"icon": "app.png",
"tags": "tool,widget",
"supports": ["BANGLEJS","BANGLEJS2"],
+ "screenshots": [{"url":"screenshot.png"}],
"readme": "README.md",
"storage": [
{"name":"chronowid.wid.js","url":"widget.js"},
@@ -2041,12 +2121,12 @@
"id": "numerals",
"name": "Numerals Clock",
"shortName": "Numerals Clock",
- "version": "0.09",
+ "version": "0.10",
"description": "A simple big numerals clock",
"icon": "numerals.png",
"type": "clock",
"tags": "numerals,clock",
- "supports": ["BANGLEJS"],
+ "supports": ["BANGLEJS","BANGLEJS2"],
"allow_emulator": true,
"screenshots": [{"url":"bangle1-numerals-screenshot.png"}],
"storage": [
@@ -2086,6 +2166,20 @@
{"name":"snake.img","url":"snake-icon.js","evaluate":true}
]
},
+ { "id": "snek",
+ "name": "The snek game",
+ "shortName":"Snek",
+ "version": "0.02",
+ "description": "A snek game where you control a snek to eat all the apples!",
+ "screenshots": [{"url":"screenshot_snek.png"}],
+ "icon": "snek.png",
+ "supports": ["BANGLEJS2"],
+ "tags": "game,fun",
+ "storage": [
+ {"name":"snek.app.js","url":"snek.js"},
+ {"name":"snek.img","url":"snek.icon.js","evaluate":true}
+ ]
+ },
{
"id": "calculator",
"name": "Calculator",
@@ -2335,7 +2429,7 @@
{
"id": "calendar",
"name": "Calendar",
- "version": "0.02",
+ "version": "0.03",
"description": "Simple calendar",
"icon": "calendar.png",
"screenshots": [{"url":"screenshot_calendar.png"}],
@@ -2345,8 +2439,10 @@
"allow_emulator": true,
"storage": [
{"name":"calendar.app.js","url":"calendar.js"},
+ {"name":"calendar.settings.js","url":"settings.js"},
{"name":"calendar.img","url":"calendar-icon.js","evaluate":true}
- ]
+ ],
+ "data": [{"name":"calendar.json"}]
},
{
"id": "hidjoystick",
@@ -2584,12 +2680,12 @@
"id": "widviz",
"name": "Widget Visibility Widget",
"shortName": "Viz Widget",
- "version": "0.02",
+ "version": "0.03",
"description": "Swipe left to hide top bar widgets, swipe right to redisplay.",
"icon": "eye.png",
"type": "widget",
"tags": "widget",
- "supports": ["BANGLEJS"],
+ "supports": ["BANGLEJS","BANGLEJS2"],
"storage": [
{"name":"widviz.wid.js","url":"widget.js"}
]
@@ -3201,7 +3297,7 @@
{
"id": "dtlaunch",
"name": "Desktop Launcher",
- "version": "0.05",
+ "version": "0.07",
"description": "Desktop style App Launcher with six (four for Bangle 2) apps per page - fast access if you have lots of apps installed.",
"screenshots": [{"url":"shot1.png"},{"url":"shot2.png"},{"url":"shot3.png"}],
"icon": "icon.png",
@@ -3212,8 +3308,11 @@
"storage": [
{"name":"dtlaunch.app.js","url":"app-b1.js", "supports": ["BANGLEJS"]},
{"name":"dtlaunch.app.js","url":"app-b2.js", "supports": ["BANGLEJS2"]},
+ {"name":"dtlaunch.settings.js","url":"settings-b1.js", "supports": ["BANGLEJS"]},
+ {"name":"dtlaunch.settings.js","url":"settings-b2.js", "supports": ["BANGLEJS2"]},
{"name":"dtlaunch.img","url":"app-icon.js","evaluate":true}
- ]
+ ],
+ "data": [{"name":"dtlaunch.json"}]
},
{
"id": "HRV",
@@ -3722,7 +3821,7 @@
"id": "gbmusic",
"name": "Gadgetbridge Music Controls",
"shortName": "Music Controls",
- "version": "0.07",
+ "version": "0.08",
"description": "Control the music on your Gadgetbridge-connected phone",
"icon": "icon.png",
"screenshots": [{"url":"screenshot_v1.png"},{"url":"screenshot_v2.png"}],
@@ -3797,10 +3896,11 @@
"id": "qmsched",
"name": "Quiet Mode Schedule and Widget",
"shortName": "Quiet Mode",
- "version": "0.03",
- "description": "Automatically turn Quiet Mode on or off at set times",
+ "version": "0.05",
+ "description": "Automatically turn Quiet Mode on or off at set times, and change LCD options while Quiet Mode is active.",
"icon": "app.png",
- "screenshots": [{"url":"screenshot_edit.png"},{"url":"screenshot_main.png"},{"url":"screenshot_widget_alarms.png"},{"url":"screenshot_widget_silent.png"}],
+ "screenshots": [{"url":"screenshot_b1_main.png"},{"url":"screenshot_b1_edit.png"},{"url":"screenshot_b1_lcd.png"},
+ {"url":"screenshot_b2_main.png"},{"url":"screenshot_b2_edit.png"},{"url":"screenshot_b2_lcd.png"}],
"tags": "tool,widget",
"supports": ["BANGLEJS","BANGLEJS2"],
"readme": "README.md",
@@ -3914,11 +4014,11 @@
{
"id": "thermom",
"name": "Thermometer",
- "version": "0.03",
+ "version": "0.04",
"description": "Displays the current temperature in degree Celsius, updated every 20 seconds",
"icon": "app.png",
"tags": "tool",
- "supports": ["BANGLEJS"],
+ "supports": ["BANGLEJS", "BANGLEJS2"],
"allow_emulator": true,
"storage": [
{"name":"thermom.app.js","url":"app.js"},
@@ -4021,7 +4121,7 @@
{"name":"carcrazy.img","url":"app-icon.js","evaluate":true},
{"name":"carcrazy.settings.js","url":"settings.js"}
],
- "data": [{"name":"app.json"}]
+ "data": [{"name":"CarCrazy.csv"}]
},
{
"id": "shortcuts",
@@ -4043,14 +4143,17 @@
{
"id": "vectorclock",
"name": "Vector Clock",
- "version": "0.02",
+ "version": "0.03",
"description": "A digital clock that uses the built-in vector font.",
"icon": "app.png",
"type": "clock",
"tags": "clock",
- "supports": ["BANGLEJS"],
+ "supports": ["BANGLEJS", "BANGLEJS2"],
"allow_emulator": true,
- "screenshots": [{"url":"bangle1-vector-clock-screenshot.png"}],
+ "screenshots": [
+ {"url":"bangle2-vector-clock-screenshot.png"},
+ {"url":"bangle1-vector-clock-screenshot.png"}
+ ],
"storage": [
{"name":"vectorclock.app.js","url":"app.js"},
{"name":"vectorclock.img","url":"app-icon.js","evaluate":true}
@@ -4106,9 +4209,10 @@
"id": "pastel",
"name": "Pastel Clock",
"shortName": "Pastel",
- "version": "0.07",
- "description": "A Configurable clock with custom fonts and background",
+ "version": "0.08",
+ "description": "A Configurable clock with custom fonts and background. Has a cyclic information line that includes, day, date, battery, sunrise and sunset times",
"icon": "pastel.png",
+ "dependencies": {"mylocation":"app", "widpedom":"app"},
"screenshots": [{"url":"screenshot_pastel.png"}],
"type": "clock",
"tags": "clock",
@@ -4149,7 +4253,7 @@
"id": "waveclk",
"name": "Wave Clock",
"version": "0.02",
- "description": "A clock using a wave image by [Lillith May](https://www.instagram.com/_lilustrations_/). **Note: This requires firmware 2v11 or later Bangle.js 1**",
+ "description": "A clock using a wave image by [Lillith May](https://www.instagram.com/_lilustrations_/). **Note: Works on any Bangle.js 2, but requires firmware 2v11 or later on Bangle.js 1**",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],
"type": "clock",
@@ -4165,7 +4269,7 @@
"id": "floralclk",
"name": "Floral Clock",
"version": "0.01",
- "description": "A clock with a flower background by [Lillith May](https://www.instagram.com/_lilustrations_/). **Note: This requires firmware 2v11 or later Bangle.js 1**",
+ "description": "A clock with a flower background by [Lillith May](https://www.instagram.com/_lilustrations_/). **Note: Works on any Bangle.js 2 but requires firmware 2v11 or later on Bangle.js 1**",
"icon": "app.png",
"screenshots": [{"url":"screenshot_floral.png"}],
"type": "clock",
@@ -4280,7 +4384,7 @@
"version": "0.01",
"description": "A touch based GPS watch, shows OS map reference",
"icon": "gpstouch.png",
- "screenshots": [{"url":"screenshot1.png"},{"url":"screenshot2.png"},{"url":"screenshot3.png"},{"url":"screenshot4.png"}],
+ "screenshots": [{"url":"screenshot4.png"},{"url":"screenshot2.png"},{"url":"screenshot3.png"},{"url":"screenshot1.png"}],
"tags": "tools,app",
"supports": ["BANGLEJS2"],
"readme": "README.md",
@@ -4309,7 +4413,7 @@
"name": "Q Alarm and Timer",
"shortName": "Q Alarm",
"icon": "app.png",
- "version": "0.02",
+ "version": "0.03",
"description": "Alarm and timer app with days of week and 'hard' option.",
"tags": "tool,alarm,widget",
"supports": ["BANGLEJS", "BANGLEJS2"],
@@ -4327,7 +4431,7 @@
"id": "emojuino",
"name": "Emojuino",
"shortName": "Emojuino",
- "version": "0.02",
+ "version": "0.03",
"description": "Emojis & Espruino: broadcast Unicode emojis via Bluetooth Low Energy.",
"icon": "emojuino.png",
"screenshots": [
@@ -4349,7 +4453,7 @@
"id": "cliclockJS2Enhanced",
"name": "Commandline-Clock JS2 Enhanced",
"shortName": "CLI-Clock JS2",
- "version": "0.02",
+ "version": "0.03",
"description": "Simple CLI-Styled Clock with enhancements. Modes that are hard to use and unneded are removed (BPM, battery info, memory ect) credit to hughbarney for the original code and design. Also added HID media controlls, just swipe on the clock face to controll the media! Gadgetbride support coming soon(hopefully) Thanks to t0m1o1 for media controls!",
"icon": "app.png",
"screenshots": [{"url":"screengrab.png"}],
@@ -4367,9 +4471,9 @@
"name": "A Battery Widget (with percentage)",
"shortName":"A Battery Widget",
"icon": "widget.png",
- "version":"1.01",
+ "version":"1.02",
"type": "widget",
- "supports": ["BANGLEJS2"],
+ "supports": ["BANGLEJS", "BANGLEJS2"],
"readme": "README.md",
"description": "Simple and slim battery widget with charge status and percentage",
"tags": "widget,battery",
@@ -4433,7 +4537,7 @@
"shortName": "AuthWatch",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],
- "version": "0.01",
+ "version": "0.04",
"description": "Google Authenticator compatible tool.",
"tags": "tool",
"interface": "interface.html",
@@ -4462,7 +4566,7 @@
{"name":"schoolCalendar.img","url":"app-icon.js","evaluate":true}
],
"data": [
- {"name":"app.json"}
+ {"name":"calendarItems.csv"}
]
},
{ "id": "timecal",
@@ -4515,7 +4619,7 @@
"shortName":"93 Dub",
"icon": "93dub.png",
"screenshots": [{"url":"screenshot.png"}],
- "version":"0.03",
+ "version":"0.05",
"description": "Fan recreation of orviwan's 91 Dub app for the Pebble smartwatch. Uses assets from his 91-Dub-v2.0 repo",
"tags": "clock",
"type": "clock",
@@ -4533,9 +4637,10 @@
"version":"0.01",
"description": "Simple app to power off your Bangle.js",
"icon": "app.png",
- "tags": "poweroff, shutdown",
- "supports" : ["BANGLEJS", "BANGLEJS2"],
+ "tags": "tool, poweroff, shutdown",
+ "supports" : ["BANGLEJS", "BANGLEJS2"],
"readme": "README.md",
+ "allow_emulator": true,
"storage": [
{"name":"poweroff.app.js","url":"app.js"},
{"name":"poweroff.img","url":"app-icon.js","evaluate":true}
@@ -4545,9 +4650,17 @@
"id": "sensible",
"name": "SensiBLE",
"shortName": "SensiBLE",
- "version": "0.02",
+ "version": "0.04",
"description": "Collect, display and advertise real-time sensor data.",
"icon": "sensible.png",
+ "screenshots": [
+ { "url": "screenshot-top.png" },
+ { "url": "screenshot-acc.png" },
+ { "url": "screenshot-bar.png" },
+ { "url": "screenshot-gps.png" },
+ { "url": "screenshot-hrm.png" },
+ { "url": "screenshot-mag.png" }
+ ],
"type": "app",
"tags": "tool,sensors",
"supports" : [ "BANGLEJS2" ],
@@ -4557,5 +4670,338 @@
{ "name": "sensible.app.js", "url": "sensible.js" },
{ "name": "sensible.img", "url": "sensible-icon.js", "evaluate": true }
]
-}
+},
+ {
+ "id": "widbars",
+ "name": "Bars Widget",
+ "version": "0.01",
+ "description": "Display several measurements as vertical bars.",
+ "icon": "icon.png",
+ "screenshots": [{"url":"screenshot.png"}],
+ "readme": "README.md",
+ "type": "widget",
+ "tags": "widget",
+ "supports": ["BANGLEJS","BANGLEJS2"],
+ "storage": [
+ {"name":"widbars.wid.js","url":"widget.js"}
+ ]
+},
+{
+ "id":"a_speech_timer",
+ "name":"Speech Timer",
+ "icon": "app.png",
+ "version":"1.01",
+ "description": "A timer designed to help keeping your speeches and presentations to time.",
+ "tags": "tool,timer",
+ "readme":"README.md",
+ "supports":["BANGLEJS2"],
+ "storage": [
+ {"name":"a_speech_timer.app.js","url":"app.js"},
+ {"name":"a_speech_timer.img","url":"app-icon.js","evaluate":true}
+ ]
+},
+ { "id": "mylocation",
+ "name": "My Location",
+ "shortName":"My Location",
+ "icon": "mylocation.png",
+ "type": "app",
+ "screenshots": [{"url":"screenshot_1.png"}],
+ "version":"0.01",
+ "description": "Sets and stores the lat and long of your preferred City or it can be set from the GPS. mylocation.json can be used by other apps that need your main location lat and lon. See README",
+ "readme": "README.md",
+ "tags": "tool,utility",
+ "supports": ["BANGLEJS", "BANGLEJS2"],
+ "storage": [
+ {"name":"mylocation.app.js","url":"mylocation.app.js"},
+ {"name":"mylocation.img","url":"mylocation.icon.js","evaluate": true }
+ ],
+ "data": [
+ {"name":"mylocation.json"}
+ ]
+ },
+ {
+ "id": "pebble",
+ "name": "Pebble Clock",
+ "shortName": "Pebble",
+ "version": "0.04",
+ "description": "A pebble style clock to keep the rebellion going",
+ "readme": "README.md",
+ "icon": "pebble.png",
+ "screenshots": [{"url":"pebble_screenshot.png"}],
+ "type": "clock",
+ "tags": "clock",
+ "supports": ["BANGLEJS2"],
+ "storage": [
+ {"name":"pebble.app.js","url":"pebble.app.js"},
+ {"name":"pebble.settings.js","url":"pebble.settings.js"},
+ {"name":"pebble.img","url":"pebble.icon.js","evaluate":true}
+ ]
+ },
+ { "id": "pooqroman",
+ "name": "pooq Roman watch face",
+ "shortName":"pooq Roman",
+ "version":"0.03",
+ "description": "A classic watch face with a certain dynamicity. Most amusing in 24h mode. Slide up to show more hands, down for less(!). By design does not support standard widgets, sorry!",
+ "icon": "app.png",
+ "type": "clock",
+ "tags": "clock",
+ "supports" : ["BANGLEJS2"],
+ "allow_emulator":true,
+ "readme": "README.md",
+ "storage": [
+ {"name":"pooqroman.app.js","url":"app.js"},
+ {"name":"pooqroman.img","url":"app-icon.js","evaluate":true}
+ ],
+ "data": [
+ {"name":"pooqroman.json"}
+ ]
+ },
+ {
+ "id": "widbata",
+ "name": "Battery Level Widget (Themed)",
+ "shortName":"Battery Theme",
+ "icon": "widbata.png",
+ "screenshots": [{"url":"screenshot_widbata_1.png"}],
+ "version":"0.01",
+ "type": "widget",
+ "supports": ["BANGLEJS2"],
+ "readme": "README.md",
+ "description": "Shows the current battery level status in the top right using the clocks colour theme",
+ "tags": "widget,battery",
+ "storage": [
+ {"name":"widbata.wid.js","url":"widbata.wid.js"}
+ ]
+ },
+ {
+ "id": "weatherClock",
+ "name": "Weather Clock",
+ "version": "0.04",
+ "description": "A clock which displays current weather conditions (requires Gadgetbridge and Weather apps).",
+ "icon": "app.png",
+ "screenshots": [{"url":"screens/screen1.png"}],
+ "type": "clock",
+ "tags": "clock, weather",
+ "supports": ["BANGLEJS","BANGLEJS2"],
+ "allow_emulator": true,
+ "readme": "README.md",
+ "storage": [
+ {"name":"weatherClock.app.js","url":"app.js"},
+ {"name":"weatherClock.img","url":"app-icon.js","evaluate":true}
+ ]
+ },
+ {
+ "id": "menuwheel",
+ "name": "Wheel Menus",
+ "version": "0.01",
+ "description": "Replace Bangle.js 2's menus with a version that contains variable-size text and a back button",
+ "readme": "README.md",
+ "icon": "icon.png",
+ "screenshots": [
+ {"url":"screenshot_b1_dark.png"},{"url":"screenshot_b1_edit.png"},{"url":"screenshot_b1_light.png"},
+ {"url":"screenshot_b2_dark.png"},{"url":"screenshot_b2_edit.png"},{"url":"screenshot_b2_light.png"}
+ ],
+ "type": "boot",
+ "tags": "system",
+ "supports": ["BANGLEJS","BANGLEJS2"],
+ "storage": [
+ {"name":"menuwheel.boot.js","url":"boot.js"}
+ ]
+ },
+ { "id": "widChargingStatus",
+ "name": "Charging Status",
+ "shortName":"ChargingStatus",
+ "icon": "widget.png",
+ "version":"0.1",
+ "type": "widget",
+ "description": "A simple widget that shows a yellow lightning icon to indicate whenever the watch is charging. This way one can see the charging status at a glance, no matter which battery widget is being used.",
+ "tags": "widget",
+ "supports": ["BANGLEJS","BANGLEJS2"],
+ "storage": [
+ {"name":"widChargingStatus.wid.js","url":"widget.js"}
+ ]
+ },
+ {
+ "id": "flow",
+ "name": "FLOW",
+ "shortName": "FLOW",
+ "version": "0.01",
+ "description": "A game where you have to help a flow avoid white obstacles thing by tapping! This is a demake of an app which I forgot the name of. Press BTN(1) to restart. See if you can get to 2500 score!",
+ "icon": "app.png",
+ "tags": "game",
+ "supports" : ["BANGLEJS", "BANGLEJS2"],
+ "readme": "README.md",
+ "storage": [
+ {"name": "flow.app.js", "url": "app.js" },
+ {"name": "flow.img", "url": "app-icon.js","evaluate": true }
+ ]
+ },
+ { "id": "scribble",
+ "name": "Scribble",
+ "shortName":"Scribble",
+ "version":"0.01",
+ "type": "app",
+ "description": "A keyboard on your wrist! Swipe right for space, left for delete.",
+ "icon": "app.png",
+ "allow_emulator": true,
+ "tags": "tools, keyboard, text, scribble",
+ "supports" : ["BANGLEJS2"],
+ "readme": "README.md",
+ "storage": [
+ {"name":"scribble.app.js","url":"app.js"},
+ {"name":"scribble.img","url":"app-icon.js","evaluate":true}
+ ],
+ "screenshots":[
+ { "url":"screenshot.png" }
+ ]
+ },
+ {
+ "id": "ptlaunch",
+ "name": "Pattern Launcher",
+ "shortName": "Pattern Launcher",
+ "version": "0.10",
+ "description": "Directly launch apps from the clock screen with custom patterns.",
+ "icon": "app.png",
+ "screenshots": [{"url":"main_menu_add.png"}, {"url":"add_pattern.png"}, {"url":"select_app.png"}, {"url":"main_menu_manage.png"}, {"url":"manage_patterns.png"}],
+ "tags": "tools",
+ "supports": ["BANGLEJS2"],
+ "readme": "README.md",
+ "storage": [
+ { "name": "ptlaunch.app.js", "url": "app.js" },
+ { "name": "ptlaunch.boot.js", "url": "boot.js" },
+ { "name": "ptlaunch.img", "url": "app-icon.js", "evaluate": true }
+ ],
+ "data": [{"name":"ptlaunch.patterns.json"}]
+ },
+ {
+ "id": "rebble",
+ "name": "Rebble Clock",
+ "shortName": "Rebble",
+ "version": "0.02",
+ "description": "A Pebble style clock, with configurable background, three sidebars including steps, day, date, sunrise, sunset, long live the rebellion",
+ "readme": "README.md",
+ "icon": "rebble.png",
+ "dependencies": {"mylocation":"app"},
+ "screenshots": [{"url":"screenshot_rebble.png"}],
+ "type": "clock",
+ "tags": "clock",
+ "supports": ["BANGLEJS2"],
+ "storage": [
+ {"name":"rebble.app.js","url":"rebble.app.js"},
+ {"name":"rebble.settings.js","url":"rebble.settings.js"},
+ {"name":"rebble.img","url":"rebble.icon.js","evaluate":true}
+ ]
+ },
+ { "id": "snaky",
+ "name": "Snaky",
+ "shortName":"Snaky",
+ "version":"0.01",
+ "description": "The classic snake game. Eat apples and don't bite your tail. Control the snake with the touch screen.",
+ "tags": "game,fun",
+ "icon": "snaky.png",
+ "supports" : ["BANGLEJS2"],
+ "readme": "README.md",
+ "storage": [
+ {"name":"snaky.app.js","url":"snaky.js"},
+ {"name":"snaky.img","url":"snaky-icon.js","evaluate":true}
+ ]
+ },
+ {
+ "id": "clicompleteclk",
+ "name": "CLI complete clock",
+ "shortName":"CLI cmplt clock",
+ "version":"0.03",
+ "description": "Command line styled clock with lots of information",
+ "icon": "app.png",
+ "allow_emulator": true,
+ "type": "clock",
+ "tags": "clock,cli,command,bash,shell,weather,hrt",
+ "supports" : ["BANGLEJS", "BANGLEJS2"],
+ "readme": "README.md",
+ "storage": [
+ {"name":"clicompleteclk.img","url":"app-icon.js","evaluate":true},
+ {"name":"clicompleteclk.settings.js","url":"settings.js"}
+ ],
+ "data": [{"name":"clicompleteclk.json"}]
+ },
+ {
+ "id":"awairmonitor",
+ "name":"Awair Monitor",
+ "icon": "app.png",
+ "allow_emulator": true,
+ "version":"0.01",
+ "description": "Displays the level of CO2, VOC, PM 2.5, Humidity and Temperature, from your Awair device.",
+ "tags": "tool,health",
+ "readme":"README.md",
+ "supports":["BANGLEJS2"],
+ "storage": [
+ {"name":"awairmonitor.app.js","url":"app.js"},
+ {"name":"awairmonitor.img","url":"app-icon.js","evaluate":true}
+ ]
+ },
+ { "id": "pooqround",
+ "name": "pooq Round watch face",
+ "shortName":"pooq Round",
+ "version":"0.00",
+ "description": "A 24 hour analogue watchface with high legibility and a novel style.",
+ "icon": "app.png",
+ "type": "clock",
+ "tags": "clock",
+ "supports" : ["BANGLEJS2"],
+ "allow_emulator":true,
+ "readme": "README.md",
+ "storage": [
+ {"name":"pooqround.app.js","url":"app.js"},
+ {"name":"pooqround.img","url":"app-icon.js","evaluate":true}
+ ],
+ "data": [
+ {"name":"pooqround.json"}
+ ]
+ },
+ {
+ "id": "coretemp",
+ "name": "Core Temp Display",
+ "version": "0.01",
+ "description": "Display CoreTemp device sensor data",
+ "icon": "coretemp.png",
+ "type": "app",
+ "tags": "health",
+ "readme": "README.md",
+ "supports": ["BANGLEJS","BANGLEJS2"],
+ "storage": [
+ {"name":"coretemp.boot.js","url":"boot.js"},
+ {"name":"coretemp.app.js","url":"coretemp.js"},
+ {"name":"coretemp.img","url":"coretemp-icon.js","evaluate":true}
+ ]
+ },
+ {
+ "id": "showimg",
+ "name": "simple image viewer",
+ "shortName":"showImage",
+ "version":"0.1",
+ "description": "Displays the image file in showimage.user.img. Returns to watch face after 60s or button push. I use it to display my vaccination certificate.",
+ "icon": "app.png",
+ "tags": "tool",
+ "supports" : ["BANGLEJS2"],
+ "storage": [
+ {"name":"showimg.app.js","url":"app.js"},
+ {"name":"showimg.img","url":"app-icon.js","evaluate":true}
+ ]
+ },
+ {
+ "id": "lapcounter",
+ "name": "Lap Counter",
+ "version": "0.01",
+ "description": "Click button to count laps. Shows count and total time snapshot (like a stopwatch, but laid back).",
+ "icon": "app.png",
+ "screenshots": [{"url":"screenshot.png"}],
+ "type": "app",
+ "tags": "tool,outdoors",
+ "readme":"README.md",
+ "supports": ["BANGLEJS", "BANGLEJS2"],
+ "allow_emulator": true,
+ "storage": [
+ {"name":"lapcounter.app.js","url":"app.js"},
+ {"name":"lapcounter.img","url":"app-icon.js","evaluate":true}
+ ]
+ }
]
diff --git a/apps/93dub/ChangeLog b/apps/93dub/ChangeLog
index 5fbfe4fa3..c1b2588bb 100644
--- a/apps/93dub/ChangeLog
+++ b/apps/93dub/ChangeLog
@@ -1,3 +1,5 @@
0.01: Initial version for upload
0.02: DiscoMinotaur's adjustments (removed battery and adjusted spacing)
0.03: Code style cleanup
+0.04: Set 00:00 to 12:00 for 12 hour time
+0.05: Display time, even on Thursday
diff --git a/apps/93dub/README.md b/apps/93dub/README.md
index fd24d54d8..4d1ade582 100644
--- a/apps/93dub/README.md
+++ b/apps/93dub/README.md
@@ -5,7 +5,8 @@
Uses many portions from Espruino documentation, example watchfaces, and the waveclk app. It also sourced from Jon Barlow's 91 Dub v2.0 source code and resources and adapted for Bangle.js 2's screen. Time, date and the battery display works. It is not pixel perfect to the original.
Contributors:
-Leer10
-Orviwan (original watchface and assets)
-Gordon Williams (Bangle.js, watchapps for reference code and documentation)
-DiscoMinotaur (adjustments)
+* Leer10
+* Orviwan (original watchface and assets)
+* Gordon Williams (Bangle.js, watchapps for reference code and documentation)
+* DiscoMinotaur (adjustments)
+* Ray Holder (minor 12 hour time rendering adjustment, fix Thursdays)
diff --git a/apps/93dub/app.js b/apps/93dub/app.js
index 92544304c..1b0f69a94 100644
--- a/apps/93dub/app.js
+++ b/apps/93dub/app.js
@@ -78,6 +78,9 @@ function draw(){
} else {
h = " " + h;
}
+ } else if (h === 0) {
+ // display 12:00 instead of 00:00 for 12 hr mode
+ h = "12";
}
//draw separator
@@ -90,7 +93,7 @@ function draw(){
if (w == 1) {imgW = imgMon;}
if (w == 2) {imgW = imgTue;}
if (w == 3) {imgW = imgWed;}
- if (w == 4) {imgW = imgThr;}
+ if (w == 4) {imgW = imgThu;}
if (w == 5) {imgW = imgFri;}
if (w == 6) {imgW = imgSat;}
g.drawImage(imgW, 85, 63);
diff --git a/apps/a_speech_timer/ChangeLog b/apps/a_speech_timer/ChangeLog
new file mode 100644
index 000000000..b3aa9e0dd
--- /dev/null
+++ b/apps/a_speech_timer/ChangeLog
@@ -0,0 +1,2 @@
+1.00: Release (2021/12/01)
+1.01: Grey font when timer is frozen (2021/12/04)
diff --git a/apps/a_speech_timer/README.md b/apps/a_speech_timer/README.md
new file mode 100644
index 000000000..098c352f3
--- /dev/null
+++ b/apps/a_speech_timer/README.md
@@ -0,0 +1,16 @@
+# A Speech Timer
+
+* A timer designed to help keeping your speeches and presentations to time
+* Vibrates 1-2-3 times and changes screen color within the target time range.
+ * Example for a 5 to 7 minutes speech: vibrates once at 5:00 (green), twice at 6:00 (yellow), thrice at 7:00 (red).
+* Use the buttons to start a timer
+* Swipe left or right to choose different target times
+* Touching the timer on the upper part of the screen locks (or unlocks) the buttons to prevent accidental changes
+
+
+
+
+
+
+## Creator
+[@alainsaas](https://github.com/alainsaas)
diff --git a/apps/a_speech_timer/app-icon.js b/apps/a_speech_timer/app-icon.js
new file mode 100644
index 000000000..1fdb2c509
--- /dev/null
+++ b/apps/a_speech_timer/app-icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("mEwgP//kAj//AAP5/+PApH7//PAonvAoXzAonj//nApHggEHAoWAgA5BAAJCCAoU/IYIFCv///w0CAonrv/HAoXLv+DAogLFgPeAoV+nlOAoV4/8+AoV79+eFIVzAof7u/v5xBCs4FL84FE//O74FBu4FB64FD73TAoNz/+eAoV5IIIFCvl8vwFCv8A/wFDO4IFFFIQFCGoSVFUIqtDh65D/1vYof+Y4LLDw7dD/0ndIYRCeoQFC/P/z/+i///oFBGoX8gEfAgI="))
diff --git a/apps/a_speech_timer/app.js b/apps/a_speech_timer/app.js
new file mode 100644
index 000000000..440cd92c6
--- /dev/null
+++ b/apps/a_speech_timer/app.js
@@ -0,0 +1,173 @@
+Graphics.prototype.setFontMichroma36 = function() {
+g.setFontCustom(atob("AAAAAAAAAAAAAAAAeAAAAAeAAAAAeAAAAAeAAAAAAAAAAAAAAAAAAAAAAAGAAAAA+AAAAD+AAAAP+AAAA/8AAAD/wAAAf/AAAB/4AAAH/gAAAf+AAAB/4AAAH/gAAAf+AAAAfwAAAAfAAAAAcAAAAAAAAAAAAAAAAAAAAAAAA///AAD///wAH///4AP///8APwAD+APAAAeAeAAAeAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAeAPAAAeAPwAD+AP///8AH///4AD///wAA///AAAAAAAAAAAAAAAAAAAAAEAAAAAOAAAAAfAAAAA+AAAAB8AAAAD8AAAAH4AAAAPwAAAAPgAAAAfAAAAAf///+Af///+Af///+Af///+AAAAAAAAAAAAAAAAAAAAAAAAAA/Af+AD/A/+AH/B/+AP/D/+APwD4eAPADweAfADweAeADweAeADweAeADweAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHge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AAA"), 46, atob("BAgQCBAQEBAQEBAQBA=="), 16+(scale<<8)+(1<<16));
+};
+
+function timeToString(duration) {
+ var hrs = ~~(duration / 3600);
+ var mins = ~~((duration % 3600) / 60);
+ var secs = ~~duration % 60;
+ var ret = "";
+ if (hrs > 0) {
+ ret += "" + hrs + ":" + (mins < 10 ? "0" : "");
+ }
+ ret += "" + mins + ":" + (secs < 10 ? "0" : "");
+ ret += "" + secs;
+ return ret;
+}
+
+var newtimer_left_from = 60;
+var newtimer_left_to = 2*60;
+
+var newtimer_right_from = 5*60;
+var newtimer_right_to = 7*60;
+
+var current_from = 5*60;
+var current_mid = 6*60;
+var current_to = 7*60;
+var current_value = 0;
+
+var timerinterval;
+var istimeron = false;
+
+var islocked = false;
+
+function countDown() {
+ current_value++;
+ draw();
+
+ if (current_value == current_from) {
+ Bangle.buzz(500);
+ } else if (current_value == current_mid) {
+ Bangle.buzz(400).then(()=>{
+ return new Promise(resolve=>setTimeout(resolve, 800));
+ }).then(()=>{
+ return Bangle.buzz(500);
+ });
+ } else if (current_value == current_to) {
+ Bangle.buzz(300).then(()=>{
+ return new Promise(resolve=>setTimeout(resolve, 600));
+ }).then(()=>{
+ Bangle.buzz(300).then(()=>{
+ return new Promise(resolve=>setTimeout(resolve, 600));
+ }).then(()=>{
+ return Bangle.buzz(500);
+ });
+ });
+ }
+
+}
+
+Bangle.on('touch',(touchside, touchdata)=>{
+ if (!islocked && istimeron && touchdata.y > (100+10)) {
+ Bangle.buzz(40);
+ istimeron = false;
+ clearInterval(timerinterval);
+ } else if (touchdata.y > 24 && touchdata.y < (100-10)) {
+ Bangle.buzz(40);
+ islocked = !islocked;
+ } else if (!islocked && touchdata.y > (100+10) && touchdata.x > 88 + 10) {
+ Bangle.buzz(40);
+ current_from = newtimer_right_from;
+ current_to = newtimer_right_to;
+ current_mid = (current_from + current_to) / 2;
+ current_value = 0;
+ if (timerinterval) clearInterval(timerinterval);
+ timerinterval = setInterval(countDown, 1000);
+ istimeron = true;
+ } else if (!islocked && touchdata.y > (100+10) && touchdata.x < 88 - 10) {
+ Bangle.buzz(40);
+ current_from = newtimer_left_from;
+ current_to = newtimer_left_to;
+ current_mid = (current_from + current_to) / 2;
+ current_value = 0;
+ if (timerinterval) clearInterval(timerinterval);
+ timerinterval = setInterval(countDown, 1000);
+ istimeron = true;
+ }
+ showInstructions = false;
+ draw();
+});
+
+Bangle.on('swipe',(swiperight, swipedown)=>{
+ console.log(swiperight);
+ console.log(swipedown);
+
+ if (swiperight == -1) {
+ if (newtimer_left_from >= 60) {
+ newtimer_left_from += 60;
+ newtimer_left_to += 60;
+ } else { // special case for 0:30 to 1:00
+ newtimer_left_from = 60;
+ newtimer_left_to = 120;
+ }
+ newtimer_right_from += 60;
+ newtimer_right_to += 60;
+ draw();
+ } else if (swiperight == 1) {
+ if (newtimer_left_from > 60) {
+ newtimer_left_from -= 60;
+ newtimer_left_to -= 60;
+ } else { // special case for 0:30 to 1:00
+ newtimer_left_from = 30;
+ newtimer_left_to = 60;
+ }
+
+ if (newtimer_right_from > 120) {
+ newtimer_right_from -= 60;
+ newtimer_right_to -= 60;
+ }
+ draw();
+ }
+});
+
+var drawTimeout;
+var showInstructions = true;
+
+function draw() {
+ g.reset();
+ if (current_value >= current_to) { g.setBgColor("#F00"); }
+ else if (current_value >= current_mid) { g.setBgColor("#FF0"); }
+ else if (current_value >= current_from) { g.setBgColor("#8F8"); }
+ g.clearRect(0,24,176,176);
+
+ g.reset().setFontAlign(0, 0).setColor(istimeron ? "#000" : "#444");
+ g.setFont("Michroma36").drawString(timeToString(current_value), 88, 62);
+
+ g.reset().setFontAlign(0, 0);
+
+ g.setFont("HaxorNarrow7x17");
+ g.drawString(timeToString(current_from), 44, 62+26);
+ g.drawString(timeToString(current_mid), 88, 62+26);
+ g.drawString(timeToString(current_to), 132, 62+26);
+
+ if (current_value >= current_from) { g.drawRect(44-1,62+26+9,44+1,62+26+9+1); }
+ if (current_value >= current_mid) { g.drawRect(88-1,62+26+9,88+1,62+26+9+1); }
+ if (current_value >= current_to) { g.drawRect(132-1,62+26+9,132+1,62+26+9+1); }
+
+ if (showInstructions) {
+ g.setFont("6x8").drawString("Tapping timer locks buttons", 88, 100+5);
+ g.setFont("6x8").drawString("<= Swipe to change time =>", 88, 168);
+ }
+
+ g.setColor(islocked ? "#444" : "#000");
+ g.setFont("Michroma16");
+ g.drawString(timeToString(newtimer_left_from), 44, 138-9);
+ g.drawString(timeToString(newtimer_left_to), 44, 138+9);
+ g.drawString(timeToString(newtimer_right_from), 132, 138-9);
+ g.drawString(timeToString(newtimer_right_to), 132, 138+9);
+
+ g.drawRect(0+8,138-24, 88-9+1, 138+22+1);
+ g.drawRect(0+8,138-24, 88-9, 138+22);
+ g.drawRect(88+8,138-24, 176-10+1, 138+22+1);
+ g.drawRect(88+8,138-24, 176-10, 138+22);
+}
+
+require("FontHaxorNarrow7x17").add(Graphics);
+g.clear();
+Bangle.loadWidgets();
+Bangle.drawWidgets();
+draw();
diff --git a/apps/a_speech_timer/app.png b/apps/a_speech_timer/app.png
new file mode 100644
index 000000000..1eb777fa7
Binary files /dev/null and b/apps/a_speech_timer/app.png differ
diff --git a/apps/a_speech_timer/screenshot0.png b/apps/a_speech_timer/screenshot0.png
new file mode 100644
index 000000000..ee3ababc1
Binary files /dev/null and b/apps/a_speech_timer/screenshot0.png differ
diff --git a/apps/a_speech_timer/screenshot1.png b/apps/a_speech_timer/screenshot1.png
new file mode 100644
index 000000000..69ea91e95
Binary files /dev/null and b/apps/a_speech_timer/screenshot1.png differ
diff --git a/apps/a_speech_timer/screenshot2.png b/apps/a_speech_timer/screenshot2.png
new file mode 100644
index 000000000..fd511e0f6
Binary files /dev/null and b/apps/a_speech_timer/screenshot2.png differ
diff --git a/apps/a_speech_timer/screenshot3.png b/apps/a_speech_timer/screenshot3.png
new file mode 100644
index 000000000..7b67b6f01
Binary files /dev/null and b/apps/a_speech_timer/screenshot3.png differ
diff --git a/apps/about/ChangeLog b/apps/about/ChangeLog
index 03e920a9a..f5638fdd2 100644
--- a/apps/about/ChangeLog
+++ b/apps/about/ChangeLog
@@ -9,3 +9,4 @@
0.09: Actual Bangle.js 1 pixels as of 13 Oct 2021
0.10: Added separate Bangle.js 2 file with Bangle.js 2 kickstarter pixels (as of 28 Oct 2021)
0.11: Bangle.js2: New pixels, btn1 to exit
+0.12: Actual pixels as of 29th Nov 2021
diff --git a/apps/about/app-bangle2.js b/apps/about/app-bangle2.js
index 32e5bafae..978d36193 100644
--- a/apps/about/app-bangle2.js
+++ b/apps/about/app-bangle2.js
@@ -6,7 +6,7 @@ var ENV = process.env;
var MEM = process.memory();
var s = require("Storage");
-var img = atob("sIwDkm2S66DYwA2AAAAAHAHGSRxJEkAAgmGGBxDIADIdAFJIbAHF9HP00kBUC6DtzDgAgGOxwkgAGbA86CW2222kkgB4hO26/XDDwAwkEEEgYYA+VW22wEAAggwAG2AZZZTFotMIDAA9vB520AJUnXAtwAgAgGxOw2wo+bAmiSAH4AQUkAHMkO2/66TY2GwgggghB5/+SRxJAEAAlm2ABxADLKYFFFBADA/99HP00kHoC6DuzAAAAGOxwkg+uzG86CQH7bSUgAB+iSQAAADDAAtEkEkAAAA2khxIAHAAgmGLADIDLLoAAAEDDSQQCAAAAAHA4AAuwAAAAADDDDDAwAIIAAMgAYQUAAA4iongAAAGABqEkkkAHHGGhhxIHHXa66ADYbAACcEHzUBDbQCSSQAAAAHAttDDDDAAAADDDDA14GGGABEEAYQWBAIDiQ84AAowwIYQkkiS4g42khxIA4inNPAA1wAATkkABCSAASQQikm2SQHAFAAAGwAAAAotoouJwAIIABEgYYAAJIIoCI84AFt2wBCAEkbYEEHPABxIAAfSqqSQ1wACcEEAACSAAAAAggmACtv/91gGgEwH/AtoFFG2wGGAABEEDYAAJJAtAI2Gw9twwwYAAm2AH/55AR0k0RAHNPKo2wAT4AAoFCShYCSAgkmwCoAAFWoWgEyCSAottoub2GAAAAMgAAAAJJAFCAwww9FAGwA49th5Ag/PER22T/AC66KoBGCd8kksAE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kkkgRAQIIGwGBJABAIAIRu0w2wDAAz3HHHbYAFEGEBBADbfJIIOuSrYAAHgoG/kkn+B8AkgAJQCCAzbYaHf/n/km222xAKQIMwAGBhABIIBMH3GewkQgAAA4444FAFogmoIwDbfPJIO2AAAAwAgoA38k/wAFllllJICCGGAAAH//n/2wAAABBCQAEGEmBJFoAABIoooxwgPoAddoCEkFFFAEwwAGwAHJIIJBAAAG2AjDAG/n+AABBBBAggXi3/xI13/////4AAABICQDEk0mBAFqABIHCSH2wkgw4FDCCHnAooAoGAAAAAwFttGAAAAGGAkkkkn/ttrADAAAAAX6nPhStv////+mmbYBBCQZY2AGAAACABIoqSookEAAADFCSEnbbbAFigAAAMEAFA2wAAA/q6gEkAA4AAFBBEAkgEHghJiR13////880cYBAIDLLAAAAAkCABAHCSHCAkBBHAJKCDbFArAAEEgkIMkAFAGAAAAvq6DE8AYGPOFAAEAggEUiOOIJbf////+mmbYAAABZZA2wEggiQQQAowoAQCBIHBICIDAFFYA2GEEENMEAFAGAQQYtqSw0kDDAHAFCCEYggcHgJxIAfb////840BJA9FALIAAAggkACCkEnAHACopB/JJJJDbFrDSww0AEAIwAFAkgSTZJmBwwgjbGIOFBJEYkgcAAH/BpbbAAADAAmIQHFoABHMkkEAggAAgkgggEgEDbG222PvvFdCAwwwBJJIAAAAAAQQZBgB2wgjbAAAADAAbADYAUg4FFkjAAHDgE0IQA9FAABMkgAAgEAAkEEABJJJDr2GG2PvvFAoSDADBJJAAGWAAAoABJgBwwAAAAAARP8gYYYYAWg4FIijbDDbkEmQSQAAAAEkkgAAAAgAAAAggAAgjb2222PvvbDbADYbBJJAACiAAAooBhk5YDH/CACCBP8gbADYAUg4BFkjDADDgk0gQQkgAAGAAAGABJg2AAHEHAAEAF2AA1PvvDbAYDDDYBAYAGWAAAoEkA/ADY//6CCARP8gSQAAAbbYAAtrADDDwAmgSQAkkkAYDAFGSIkGAAASkkAggA+228N//AYDDDAAbBAYAbYAAAov/gA/DY446HCCAJJFQFAE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kkkAFwQAQAGAD7AwAQUEAoAkgkgFEkoGDtoooAWSACAQAAAAAHAQYAxggGwFtDbbAAYAE//AIACAAAAAJIOk/JAoAAgAHIUkQAAABJAAAGEgGMIAAAArsJtwztFFFFSSQSQQAkQ/9AoEAGGVQk1AAFroAbYAEngBxFtAA/HABBG4kISQ4EAAAAQQQCCFFotAFFsEtAAAAAFdEMAwDdoooAQSCCCQAmgJIbAkkG2qoG2wADrtoqSJEACAIFkoAAHABGOE4IAAAkkAAAiSgCCAIAIAAAAAAAAH//FoFFAGbbYAAAACACAQAUgSQSX4AGGqsE2ASDbvooABEATQbdkoI/HQAAACQAkkgAAAAAkEgAAFJANGG2GAYAAYHAQQFFAAwZJAAEgkBIAA444QQQX6SSSVUkxwXUgttqSBEAQQYdtBI/AAAAAQCw/X4w84AAgggAQFIINGGAGADADknAEAYAYwwZAH/EEEIAAABJASQSABAiBqsE2ISU8oooBBECACbdAOxICSAAAWyA6S4AigAAgAgAQFIBNGAGGADDD2nGEGD7AGAZBHPEEEIAAAAgAQAQQBkEBVUExwQUgooqSJMgFAYFFhJJSSQAAQCAkkgA84AAgAgCCFIAN2G2GwAYY03A2wXAH/6ZJH/EAEBIAAHHAQASABgkB");
var imgHeight = g.imageMetrics(img).height;
var imgScroll = Math.floor(Math.random()*imgHeight);
diff --git a/apps/alarm/alarm.js b/apps/alarm/alarm.js
index bb5722106..a655dad1e 100644
--- a/apps/alarm/alarm.js
+++ b/apps/alarm/alarm.js
@@ -21,8 +21,8 @@ function showAlarm(alarm) {
Bangle.loadWidgets();
Bangle.drawWidgets();
E.showPrompt(msg,{
- title:alarm.timer ? "TIMER!" : "ALARM!",
- buttons : {"Sleep":true,"Ok":false} // default is sleep so it'll come back in 10 mins
+ title:alarm.timer ? /*LANG*/"TIMER!" : /*LANG*/"ALARM!",
+ buttons : {/*LANG*/"Sleep":true,/*LANG*/"Ok":false} // default is sleep so it'll come back in 10 mins
}).then(function(sleep) {
buzzCount = 0;
if (sleep) {
diff --git a/apps/alarm/app.js b/apps/alarm/app.js
index 53c7154bc..17062d44a 100644
--- a/apps/alarm/app.js
+++ b/apps/alarm/app.js
@@ -33,16 +33,16 @@ function getCurrentHr() {
function showMainMenu() {
const menu = {
'': { 'title': 'Alarm/Timer' },
- '< Back' : ()=>{load();},
- 'New Alarm': ()=>editAlarm(-1),
- 'New Timer': ()=>editTimer(-1)
+ /*LANG*/'< Back' : ()=>{load();},
+ /*LANG*/'New Alarm': ()=>editAlarm(-1),
+ /*LANG*/'New Timer': ()=>editTimer(-1)
};
alarms.forEach((alarm,idx)=>{
if (alarm.timer) {
- txt = "TIMER "+(alarm.on?"on ":"off ")+formatMins(alarm.timer);
+ txt = /*LANG*/"TIMER "+(alarm.on?/*LANG*/"on ":/*LANG*/"off ")+formatMins(alarm.timer);
} else {
- txt = "ALARM "+(alarm.on?"on ":"off ")+formatTime(alarm.hr);
- if (alarm.rp) txt += " (repeat)";
+ txt = /*LANG*/"ALARM "+(alarm.on?/*LANG*/"on ":/*LANG*/"off ")+formatTime(alarm.hr);
+ if (alarm.rp) txt += /*LANG*/" (repeat)";
}
menu[txt] = function() {
if (alarm.timer) editTimer(idx);
@@ -70,27 +70,27 @@ function editAlarm(alarmIndex) {
as = a.as;
}
const menu = {
- '': { 'title': 'Alarm' },
- '< Back' : showMainMenu,
- 'Hours': {
+ '': { 'title': /*LANG*/'Alarm' },
+ /*LANG*/'< Back' : showMainMenu,
+ /*LANG*/'Hours': {
value: hrs,
onchange: function(v){if (v<0)v=23;if (v>23)v=0;hrs=v;this.value=v;} // no arrow fn -> preserve 'this'
},
- 'Minutes': {
+ /*LANG*/'Minutes': {
value: mins,
onchange: function(v){if (v<0)v=59;if (v>59)v=0;mins=v;this.value=v;} // no arrow fn -> preserve 'this'
},
- 'Enabled': {
+ /*LANG*/'Enabled': {
value: en,
format: v=>v?"On":"Off",
onchange: v=>en=v
},
- 'Repeat': {
+ /*LANG*/'Repeat': {
value: en,
format: v=>v?"Yes":"No",
onchange: v=>repeat=v
},
- 'Auto snooze': {
+ /*LANG*/'Auto snooze': {
value: as,
format: v=>v?"Yes":"No",
onchange: v=>as=v
@@ -108,14 +108,14 @@ function editAlarm(alarmIndex) {
last : day, rp : repeat, as: as
};
}
- menu["> Save"] = function() {
+ menu[/*LANG*/"> Save"] = function() {
if (newAlarm) alarms.push(getAlarm());
else alarms[alarmIndex] = getAlarm();
require("Storage").write("alarm.json",JSON.stringify(alarms));
showMainMenu();
};
if (!newAlarm) {
- menu["> Delete"] = function() {
+ menu[/*LANG*/"> Delete"] = function() {
alarms.splice(alarmIndex,1);
require("Storage").write("alarm.json",JSON.stringify(alarms));
showMainMenu();
@@ -136,18 +136,18 @@ function editTimer(alarmIndex) {
en = a.on;
}
const menu = {
- '': { 'title': 'Timer' },
- 'Hours': {
+ '': { 'title': /*LANG*/'Timer' },
+ /*LANG*/'Hours': {
value: hrs,
onchange: function(v){if (v<0)v=23;if (v>23)v=0;hrs=v;this.value=v;} // no arrow fn -> preserve 'this'
},
- 'Minutes': {
+ /*LANG*/'Minutes': {
value: mins,
onchange: function(v){if (v<0)v=59;if (v>59)v=0;mins=v;this.value=v;} // no arrow fn -> preserve 'this'
},
- 'Enabled': {
+ /*LANG*/'Enabled': {
value: en,
- format: v=>v?"On":"Off",
+ format: v=>v?/*LANG*/"On":/*LANG*/"Off",
onchange: v=>en=v
}
};
diff --git a/apps/alarm/boot.js b/apps/alarm/boot.js
index 47dae5361..dffb3a37f 100644
--- a/apps/alarm/boot.js
+++ b/apps/alarm/boot.js
@@ -7,7 +7,7 @@
active = active.sort((a,b)=>(a.hr-b.hr)+(a.last-b.last)*24);
var hr = time.getHours()+(time.getMinutes()/60)+(time.getSeconds()/3600);
if (!require('Storage').read("alarm.js")) {
- console.log("No alarm app!");
+ console.log(/*LANG*/"No alarm app!");
require('Storage').write('alarm.json',"[]");
} else {
var t = 3600000*(active[0].hr-hr);
diff --git a/apps/android/ChangeLog b/apps/android/ChangeLog
index 35fa0e386..c2c4ea6be 100644
--- a/apps/android/ChangeLog
+++ b/apps/android/ChangeLog
@@ -3,3 +3,4 @@
Fix music control
0.03: Handling of message actions (ok/clear)
0.04: Android icon now goes to settings page with 'find phone'
+0.05: Fix handling of message actions
diff --git a/apps/android/boot.js b/apps/android/boot.js
index 97e3a5641..59ffe006d 100644
--- a/apps/android/boot.js
+++ b/apps/android/boot.js
@@ -65,7 +65,7 @@
// Message response
Bangle.messageResponse = (msg,response) => {
if (msg.id=="call") return gbSend({ t: "call", n:response?"ACCEPT":"REJECT" });
- if (isFinite(msg.id)) return gbSend({ t: "notify", n:response?"OPEN":"DISMISS" });
+ if (isFinite(msg.id)) return gbSend({ t: "notify", n:response?"OPEN":"DISMISS", id: msg.id });
// error/warn here?
};
})();
diff --git a/apps/authentiwatch/ChangeLog b/apps/authentiwatch/ChangeLog
index 7b83706bf..e1b8ed5bc 100644
--- a/apps/authentiwatch/ChangeLog
+++ b/apps/authentiwatch/ChangeLog
@@ -1 +1,4 @@
+0.04: Fix tapping at very bottom of list, exit on inactivity
+0.03: Add "Calculating" placeholder, update JSON save format
+0.02: Fix JSON save format
0.01: First release
diff --git a/apps/authentiwatch/README.md b/apps/authentiwatch/README.md
index 403770c2b..8d0e74a0c 100644
--- a/apps/authentiwatch/README.md
+++ b/apps/authentiwatch/README.md
@@ -1,5 +1,8 @@
# Authentiwatch - 2FA Authenticator
+* GitHub: https://github.com/andrewgoz/Authentiwatch <-- Report bugs here
+* Bleeding edge AppLoader: https://andrewgoz.github.io/Authentiwatch/
+
## Supports
* Google Authenticator compatible 2-factor authentication
diff --git a/apps/authentiwatch/app-icon.js b/apps/authentiwatch/app-icon.js
index 27ced695e..c901fb843 100644
--- a/apps/authentiwatch/app-icon.js
+++ b/apps/authentiwatch/app-icon.js
@@ -1 +1 @@
-require("heatshrink").decompress(atob("mUywkBiIADCxoTFAAcQGBwY/DDQIKDBiMDDCgGCBI4YMGAIDFDCAFEBQwYLFgIYEGQgYMApoYJGAJjFMogYMSQgCDDBwDCY4oMEDBZgHHQQYQf4oYVBgwYQBogYPPYZpFDBKMEDAbdDCxT9IDYIFFABqSEAogySQYoWNFgrFDJZoQBJggYRBwhLGDBwyFDCZGEDCYAEDGrIMbwhnGDEpLGAwxlLFQgQDJiYoFDDAZDDCpMDMpQOCNxQYNBo4KKBpwYYBYJ8NeJgYkLBQY8UYQXVGQIwN"))
+require("heatshrink").decompress(atob("mEwxH+AH4AD64ADFlgAFF04INFz4LUF0QwjEBwv/FzwwgF/4v/F6nMAAWi1AFD5nOeEHPEweoFooAB5/X5wvdFwotG5nN6/WAoQuaEoguHSYPQLwIIDF8uo5ouB6AJEFzuiFwup5/WFwI6GL0esXYKMBHYy9j1WqfBSOhBIYKJF8gAKF/4v6cZAvhGDAuWSDAvXMCwuYF+AwUFzX+0XGGAgxKFrYuBAAQxEeg4tcF4oABBQnGAAgv/F6b5KXsIvIGAqNnF/69fX8ZeSF7btNR8IuOF75ePL8ouOd74NKF8IANF94wEF1QAXA"))
diff --git a/apps/authentiwatch/app.js b/apps/authentiwatch/app.js
index 43eff4709..c0cb608c0 100644
--- a/apps/authentiwatch/app.js
+++ b/apps/authentiwatch/app.js
@@ -6,8 +6,15 @@ const algos = {
"SHA256":{sha:crypto.SHA256,retsz:32,blksz:64 },
"SHA1" :{sha:crypto.SHA1 ,retsz:20,blksz:64 },
};
+const calculating = "Calculating";
+const notokens = "No tokens";
+const notsupported = "Not supported";
-var tokens = require("Storage").readJSON("authentiwatch.json", true) || [];
+// sample settings:
+// {tokens:[{"algorithm":"SHA1","digits":6,"period":30,"issuer":"","account":"","secret":"Bbb","label":"Aaa"}],misc:{}}
+var settings = require("Storage").readJSON("authentiwatch.json", true) || {tokens:[],misc:{}};
+if (settings.data ) tokens = settings.data ; /* v0.02 settings */
+if (settings.tokens) tokens = settings.tokens; /* v0.03+ settings */
// QR Code Text
//
@@ -66,9 +73,8 @@ function do_hmac(key, message, algo) {
var v = new DataView(ret, ret[ret.length - 1] & 0x0F, 4);
return v.getUint32(0) & 0x7FFFFFFF;
}
-function hotp(token) {
+function hotp(d, token, dohmac) {
var tick;
- var d = new Date();
if (token.period > 0) {
// RFC6238 - timed
var seconds = Math.floor(d.getTime() / 1000);
@@ -81,15 +87,17 @@ function hotp(token) {
var v = new DataView(msg.buffer);
v.setUint32(0, tick >> 16 >> 16);
v.setUint32(4, tick & 0xFFFFFFFF);
- var ret = "";
- try {
- var hash = do_hmac(b32decode(token.secret), msg, token.algorithm.toUpperCase());
- ret = "" + hash % Math.pow(10, token.digits);
- while (ret.length < token.digits) {
- ret = "0" + ret;
+ var ret = calculating;
+ if (dohmac) {
+ try {
+ var hash = do_hmac(b32decode(token.secret), msg, token.algorithm.toUpperCase());
+ ret = "" + hash % Math.pow(10, token.digits);
+ while (ret.length < token.digits) {
+ ret = "0" + ret;
+ }
+ } catch(err) {
+ ret = notsupported;
}
- } catch(err) {
- ret = "Not supported";
}
return {hotp:ret, next:((token.period > 0) ? ((tick + 1) * token.period * 1000) : d.getTime() + 30000)};
}
@@ -109,7 +117,7 @@ function drawToken(id, r) {
var y1 = r.y;
var x2 = r.x + r.w - 1;
var y2 = r.y + r.h - 1;
- var adj;
+ var adj, sz;
g.setClipRect(Math.max(x1, Bangle.appRect.x ), Math.max(y1, Bangle.appRect.y ),
Math.min(x2, Bangle.appRect.x2), Math.min(y2, Bangle.appRect.y2));
if (id == state.curtoken) {
@@ -129,7 +137,7 @@ function drawToken(id, r) {
adj = (y1 + y2) / 2;
}
g.clearRect(x1, y1, x2, y2);
- g.drawString(tokens[id].label, (x1 + x2) / 2, adj, false);
+ g.drawString(tokens[id].label.substr(0, 10), (x1 + x2) / 2, adj, false);
if (id == state.curtoken) {
if (tokens[id].period > 0) {
// timed - draw progress bar
@@ -140,11 +148,14 @@ function drawToken(id, r) {
// counter - draw triangle as swipe hint
let yc = (y1 + y2) / 2;
g.fillPoly([0, yc, 10, yc - 10, 10, yc + 10, 0, yc]);
- adj = 5;
+ adj = 10;
}
// digits just below label
- g.setFont("Vector", (state.otp.length > 8) ? 26 : 30);
- g.drawString(state.otp, (x1 + x2) / 2 + adj, y1 + 16, false);
+ sz = 30;
+ do {
+ g.setFont("Vector", sz--);
+ } while (g.stringWidth(state.otp) > (r.w - adj));
+ g.drawString(state.otp, (x1 + adj + x2) / 2, y1 + 16, false);
}
// shaded lines top and bottom
g.setColor(0.5, 0.5, 0.5);
@@ -154,9 +165,14 @@ function drawToken(id, r) {
}
function draw() {
+ var timerfn = exitApp;
+ var timerdly = 10000;
var d = new Date();
if (state.curtoken != -1) {
var t = tokens[state.curtoken];
+ if (state.otp == calculating) {
+ state.otp = hotp(d, t, true).hotp;
+ }
if (d.getTime() > state.nextTime) {
if (state.hide == 0) {
// auto-hide the current token
@@ -167,7 +183,7 @@ function draw() {
state.nextTime = 0;
} else {
// time to generate a new token
- var r = hotp(t);
+ var r = hotp(d, t, state.otp != "");
state.nextTime = r.next;
state.otp = r.hotp;
if (t.period <= 0) {
@@ -191,11 +207,13 @@ function draw() {
y += tokenentryheight;
}
if (drewcur) {
- // the current token has been drawn - draw it again in 1sec
- if (state.drawtimer) {
- clearTimeout(state.drawtimer);
+ // the current token has been drawn - schedule a redraw
+ if (tokens[state.curtoken].period > 0) {
+ timerdly = (state.otp == calculating) ? 1 : 1000; // timed
+ } else {
+ timerdly = state.nexttime - d.getTime(); // counter
}
- state.drawtimer = setTimeout(draw, (tokens[state.curtoken].period > 0) ? 1000 : state.nexttime - d.getTime());
+ timerfn = draw;
if (tokens[state.curtoken].period <= 0) {
state.hide = 0;
}
@@ -210,14 +228,18 @@ function draw() {
} else {
g.setFont("Vector", 30);
g.setFontAlign(0, 0, 0);
- g.drawString("No tokens", Bangle.appRect.x + Bangle.appRect.w / 2,Bangle.appRect.y + Bangle.appRect.h / 2, false);
+ g.drawString(notokens, Bangle.appRect.x + Bangle.appRect.w / 2, Bangle.appRect.y + Bangle.appRect.h / 2, false);
}
+ if (state.drawtimer) {
+ clearTimeout(state.drawtimer);
+ }
+ state.drawtimer = setTimeout(timerfn, timerdly);
}
function onTouch(zone, e) {
if (e) {
var id = Math.floor((state.listy + (e.y - Bangle.appRect.y)) / tokenentryheight);
- if (id == state.curtoken || tokens.length == 0) {
+ if (id == state.curtoken || tokens.length == 0 || id >= tokens.length) {
id = -1;
}
if (state.curtoken != id) {
@@ -231,37 +253,34 @@ function onTouch(zone, e) {
if (y > Bangle.appRect.h) {
state.listy += (y - Bangle.appRect.h);
}
+ state.otp = "";
}
state.nextTime = 0;
state.curtoken = id;
state.hide = 2;
- draw();
}
}
+ draw();
}
function onDrag(e) {
if (e.x > g.getWidth() || e.y > g.getHeight()) return;
if (e.dx == 0 && e.dy == 0) return;
var newy = Math.min(state.listy - e.dy, tokens.length * tokenentryheight - Bangle.appRect.h);
- newy = Math.max(0, newy);
- if (newy != state.listy) {
- state.listy = newy;
- draw();
- }
+ state.listy = Math.max(0, newy);
+ draw();
}
function onSwipe(e) {
- if (e == 1) {
- Bangle.showLauncher();
- }
if (e == -1 && state.curtoken != -1 && tokens[state.curtoken].period <= 0) {
tokens[state.curtoken].period--;
- require("Storage").writeJSON("authentiwatch.json", tokens);
+ let newsettings={tokens:tokens,misc:settings.misc};
+ require("Storage").writeJSON("authentiwatch.json", newsettings);
state.nextTime = 0;
+ state.otp = "";
state.hide = 2;
- draw();
}
+ draw();
}
function bangle1Btn(e) {
@@ -281,16 +300,22 @@ function bangle1Btn(e) {
state.curtoken = -1;
state.nextTime = 0;
onTouch(0, fakee);
+ } else {
+ draw(); // resets idle timer
}
}
+function exitApp() {
+ Bangle.showLauncher();
+}
+
Bangle.on('touch', onTouch);
Bangle.on('drag' , onDrag );
Bangle.on('swipe', onSwipe);
if (typeof BTN2 == 'number') {
- setWatch(function(){bangle1Btn(-1); }, BTN1, {edge:"rising", debounce:50, repeat:true});
- setWatch(function(){Bangle.showLauncher();}, BTN2, {edge:"rising", debounce:50, repeat:true});
- setWatch(function(){bangle1Btn( 1); }, BTN3, {edge:"rising", debounce:50, repeat:true});
+ setWatch(function(){bangle1Btn(-1);}, BTN1, {edge:"rising", debounce:50, repeat:true});
+ setWatch(function(){exitApp(); }, BTN2, {edge:"rising", debounce:50, repeat:true});
+ setWatch(function(){bangle1Btn( 1);}, BTN3, {edge:"rising", debounce:50, repeat:true});
}
Bangle.loadWidgets();
diff --git a/apps/authentiwatch/app.png b/apps/authentiwatch/app.png
index 208fb63b3..8775d3e40 100644
Binary files a/apps/authentiwatch/app.png and b/apps/authentiwatch/app.png differ
diff --git a/apps/authentiwatch/interface.html b/apps/authentiwatch/interface.html
index 12c0c1d8d..26533b17b 100644
--- a/apps/authentiwatch/interface.html
+++ b/apps/authentiwatch/interface.html
@@ -35,8 +35,9 @@ const otpAuthUrl = 'otpauth://';
const tokentypes = ['TOTP (Timed)', 'HOTP (Counter)'];
-/* Array of TOTP tokens */
-var tokens=[];
+/* Settings */
+var settings = {tokens:[], misc:{}};
+var tokens = settings.tokens;
/* Remove any non-base-32 characters from the given string and collapses
* whitespace to a single space. Optionally removes all whitespace from
@@ -261,6 +262,7 @@ qrcode.callback = res => {
scanning = false;
editToken(parseInt(document.forms['edittoken'].elements['tokenid'].value));
t['label'] = (t['issuer'] == '') ? t['account'] : t['issuer'] + ' (' + t['account'] + ')';
+ t['label'] = t['label'].substr(0, 10);
var fe = document.forms['edittoken'].elements;
if (res.startsWith(otpAuthUrl + 'hotp/')) {
t['period'] = '30';
@@ -319,21 +321,21 @@ function doScan() {
*/
function loadTokens() {
Util.showModal('Loading...');
- Puck.eval(`require('Storage').read(${JSON.stringify('authentiwatch.json')})`,data=>{
+ Puck.eval(`require('Storage').readJSON(${JSON.stringify('authentiwatch.json')})`,data=>{
Util.hideModal();
- try {
- tokens = JSON.parse(data);
- updateTokens();
- } catch {
- tokens = [];
- }
+ if (data.data ) settings.tokens = data.data ; /* v0.02 settings */
+ if (data.tokens) settings.tokens = data.tokens; /* v0.03+ settings */
+ if (data.misc ) settings.misc = data.misc ; /* v0.03+ settings */
+ tokens = settings.tokens;
+ updateTokens();
});
}
/* Save settings as a JSON file on the watch.
*/
function saveTokens() {
Util.showModal('Saving...');
- Puck.write(`\x10require('Storage').write(${JSON.stringify('authentiwatch.json')},${JSON.stringify(tokens)})\n`,()=>{
+ let newsettings={tokens:tokens,misc:settings.misc};
+ Puck.write(`\x10require('Storage').writeJSON(${JSON.stringify('authentiwatch.json')},${JSON.stringify(newsettings)})\n`,()=>{
Util.hideModal();
});
}
diff --git a/apps/awairmonitor/ChangeLog b/apps/awairmonitor/ChangeLog
new file mode 100644
index 000000000..0cc9a42b0
--- /dev/null
+++ b/apps/awairmonitor/ChangeLog
@@ -0,0 +1 @@
+0.01: Beta version for Bangle 2 paired with Chrome (2021/12/11)
diff --git a/apps/awairmonitor/README.md b/apps/awairmonitor/README.md
new file mode 100644
index 000000000..69894fea2
--- /dev/null
+++ b/apps/awairmonitor/README.md
@@ -0,0 +1,22 @@
+# Awair Monitor
+
+Displays the level of CO2, VOC, PM 2.5, Humidity and Temperature, from your Awair device.
+
+* What you need:
+ * A BangleJS 2
+ * An Awair device [with local API enabled](https://support.getawair.com/hc/en-us/articles/360049221014-Awair-Local-API-Feature)
+ * The web app [awair_to_bangle.html](awair_to_bangle.html) that will retrive the data from your Awair device and sent it to your BangleJS 2 through Chrome's Bluetooth LE connection
+* How to get started
+ * Open awair_to_bangle.html with a text/code editor and input the IP address of your Awair on top (const awair_ip_1 = "192.168.xx.xx")
+ * Launch the Awair Monitor app on your BangleJS
+ * Open awair_to_bangle.html on Chrome and click "Connect BangleJS" - it connects to your watch the same way as the Bangle app store
+ * Once connected to the watch with the app running, the watch app is updated once per second
+
+
+
+
+
+## Creator
+[@alainsaas](https://github.com/alainsaas)
+
+Contributions are welcome, send me your Pull Requests!
diff --git a/apps/awairmonitor/app-icon.js b/apps/awairmonitor/app-icon.js
new file mode 100644
index 000000000..9d4dcf4a3
--- /dev/null
+++ b/apps/awairmonitor/app-icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("mEwgP/AD38g4FD8EAAoeAgE/AoUD/EfAgP+AYMPDgQPBw4FB/F///DAoPwAQPjAQPBAQPxDgJVCAoP4gYaCCwIcBAoM/8P8h0HjEP8f4h0Gp0H4/44lj5+H4/54lzj/jx/5/lyDgIFDh/xAoQRBAoXsuY8Bx4jCAoeEkYFB447CAoRxBOAPxM4RmC8IFD4ZZD/8H/DHDh/+AoaSBUAIABCoYATVwS2Ct4FE84REXQQLCk4RJAo0XGxY="))
diff --git a/apps/awairmonitor/app.js b/apps/awairmonitor/app.js
new file mode 100644
index 000000000..a5a1d1a72
--- /dev/null
+++ b/apps/awairmonitor/app.js
@@ -0,0 +1,98 @@
+Graphics.prototype.setFontMichroma36 = function() {
+g.setFontCustom(atob("AAAAAAAAAAAAAAAAeAAAAAeAAAAAeAAAAAeAAAAAAAAAAAAAAAAAAAAAAAGAAAAA+AAAAD+AAAAP+AAAA/8AAAD/wAAAf/AAAB/4AAAH/gAAAf+AAAB/4AAAH/gAAAf+AAAAfwAAAAfAAAAAcAAAAAAAAAAAAAAAAAAAAAAAA///AAD///wAH///4AP///8APwAD+APAAAeAeAAAeAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAPAeAAAeAPAAAeAPwAD+AP///8AH///4AD///wAA///AAAAAAAAAAAAAAAAAAAAAEAAAAAOAAAAAfAAAAA+AAAAB8AAAAD8AAAAH4AAAAPwAAAAPgAAAAfAAAAAf///+Af///+Af///+Af///+AAAAAAAAAAAAAAAAAAAAAAAAAA/Af+AD/A/+AH/B/+AP/D/+APwD4eAPADweAfADweAeADweAeADweAeADweAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAHgeAeAPgeAeAPAeAeAPAeAeAPAeAeAPAeAfAPAeAPw/AeAP/+AeAH/+AeAD/8AeAB/wAOAAAAAAAAAAAAAAAAAA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/3/8AP///+AP//A+AfB+AeAeA+AeAeA+APAeA+APAeA+APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA+APAeA+APAeA+APAeA+AOAeA+AeAPh/A+AP///+AP/3/8AH/3/8AB/D/wAAAA/AAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAD/4HAAH/8HwAP/+H4AP5/H8AfAfA8AeAPAeAeAPAeAeAPAeAeAHgfAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHgPAeAHAPAeAPAOAeAPAeAPAPAeAPwfB+AP///8AH///4AD///wAA///AAAAAAAAAAAAAAAAAAAAAAAAAAAB8DwAAB8HwAAB8HwAAB8DwAAAAAAAAAAAAA"), 46, atob("CBIkESMjJCMjIyMjCA=="), 36+(1<<8)+(1<<16));
+};
+
+var drawTimeout;
+
+function queueNextDraw() {
+ if (drawTimeout) clearTimeout(drawTimeout);
+ drawTimeout = setTimeout(function() {
+ drawTimeout = undefined;
+ draw();
+ }, 1000 - (Date.now() % 1000));
+}
+
+var locale = require("locale");
+
+var bt_current_co2 = 0;
+var bt_current_voc = 0;
+var bt_current_pm25 = 0;
+var bt_current_humi = 0;
+var bt_current_temp = 0;
+var bt_last_update = 0;
+
+var last_update = 0;
+var bt_co2_history = new Array(10).fill(0);
+var bt_voc_history = new Array(10).fill(0);
+var bt_pm25_history = new Array(10).fill(0);
+var bt_humi_history = new Array(10).fill(0);
+var bt_temp_history = new Array(10).fill(0);
+
+var internal_last_update = -1;
+
+function draw() {
+ g.reset().clearRect(0,24,g.getWidth(),g.getHeight());
+
+ var date = new Date();
+ g.setFontAlign(0,0);
+ g.setFont("Michroma36").drawString(locale.time(date,1), g.getWidth()/2, 56);
+
+ g.setFont("6x8");
+ g.drawString(locale.date(new Date(),1), g.getWidth()/2, 80);
+
+ g.setFont("6x8");
+ g.drawString("CO2", 20, 100);
+ g.drawString("VOC", 55, 100);
+ g.drawString("PM25", 90, 100);
+ g.drawString("Humi", 125, 100);
+ g.drawString("Temp", 160, 100);
+
+ g.setFont("HaxorNarrow7x17");
+ g.drawString(""+bt_current_co2, 18, 110);
+ g.drawString(""+bt_current_voc, 53, 110);
+ g.drawString(""+bt_current_pm25, 88, 110);
+ g.drawString(""+bt_current_humi, 123, 110);
+ g.drawString(""+bt_current_temp, 158, 110);
+
+ if (last_update != bt_last_update) {
+ last_update = bt_last_update;
+ internal_last_update = last_update;
+ if (last_update % 10 == 0) {
+ bt_co2_history.shift(); bt_co2_history.push(bt_current_co2);
+ bt_voc_history.shift(); bt_voc_history.push(bt_current_voc);
+ bt_pm25_history.shift(); bt_pm25_history.push(bt_current_pm25);
+ bt_humi_history.shift(); bt_humi_history.push(bt_current_humi);
+ bt_temp_history.shift(); bt_temp_history.push(bt_current_temp);
+ }
+ }
+
+ if (internal_last_update == -1) {
+ g.drawString("Waiting for connection", 88, 164);
+ } else if (internal_last_update > last_update + 5) {
+ g.drawString("Trying to reconnect since " + (internal_last_update - last_update), 88, 164);
+ }
+
+
+ for (i = 0; i < 10; i++) {
+ // max height = 32
+ g.drawLine(10+i*2, 150-(Math.min(Math.max(bt_co2_history[i],400), 1200)-400)/25, 10+i*2, 150);
+ g.drawLine(45+i*2, 150-(Math.min(Math.max(bt_voc_history[i],0), 1440)-0)/45, 45+i*2, 150);
+ g.drawLine(80+i*2, 150-(Math.min(Math.max(bt_pm25_history[i],0), 32)-0)/1, 80+i*2, 150);
+ g.drawLine(115+i*2, 150-(Math.min(Math.max(bt_humi_history[i],20), 60)-20)/1.25, 115+i*2, 150);
+ g.drawLine(150+i*2, 150-(Math.min(Math.max(bt_temp_history[i],19), 27)-19)*4, 150+i*2, 150);
+
+ // target humidity level
+ g.setColor("#00F").drawLine(115, 150-(40-20)/1.25, 115+18, 150-(40-20)/1.25);
+ g.reset();
+ }
+
+ if (internal_last_update != -1) { internal_last_update++; }
+ queueNextDraw();
+}
+
+// init
+require("FontHaxorNarrow7x17").add(Graphics);
+g.clear();
+Bangle.loadWidgets();
+Bangle.drawWidgets();
+draw();
diff --git a/apps/awairmonitor/app.png b/apps/awairmonitor/app.png
new file mode 100644
index 000000000..26a5d0cff
Binary files /dev/null and b/apps/awairmonitor/app.png differ
diff --git a/apps/awairmonitor/awair-monitor-photo.jpg b/apps/awairmonitor/awair-monitor-photo.jpg
new file mode 100644
index 000000000..8b62faa24
Binary files /dev/null and b/apps/awairmonitor/awair-monitor-photo.jpg differ
diff --git a/apps/awairmonitor/awair_to_bangle.html b/apps/awairmonitor/awair_to_bangle.html
new file mode 100644
index 000000000..2926cca9e
--- /dev/null
+++ b/apps/awairmonitor/awair_to_bangle.html
@@ -0,0 +1,195 @@
+
+
+
+
+
+
+
+
+
+
+
+How to use
+
+Step 1: Enable the Local API on your Awair: https://support.getawair.com/hc/en-us/articles/360049221014-Awair-Local-API-Feature
+
+Step 2: Modify this HTML file to input the IP address of your Awair on top (const awair_ip_1 = "192.168.xx.xx")
+
+Step 3: Launch the Awair Monitor app on your BangleJS
+
+Step 4: Click "Connect BangleJS"
+
+Step 5: Optionally, open the web inspector's console (Right click > Inspector > Console) to read the bluetooth logs
+
+
+
+ Connect BangleJS
+ Disconnect BangleJS
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/awairmonitor/screenshot.png b/apps/awairmonitor/screenshot.png
new file mode 100644
index 000000000..51ca0aa44
Binary files /dev/null and b/apps/awairmonitor/screenshot.png differ
diff --git a/apps/boot/ChangeLog b/apps/boot/ChangeLog
index 98f80efd9..5c929421b 100644
--- a/apps/boot/ChangeLog
+++ b/apps/boot/ChangeLog
@@ -40,3 +40,6 @@
0.35: Add Bangle.appRect polyfill
Don't set beep vibration up on Bangle.js 2 (built in)
0.36: Add comments to .boot0 to make debugging a bit easier
+0.37: Remove Quiet Mode settings: now handled by Quiet Mode Schedule app
+0.38: Option to log to file if settings.log==2
+0.39: Fix passkey support (fix https://github.com/espruino/Espruino/issues/2035)
diff --git a/apps/boot/bootupdate.js b/apps/boot/bootupdate.js
index d642426c2..e338d9020 100644
--- a/apps/boot/bootupdate.js
+++ b/apps/boot/bootupdate.js
@@ -23,8 +23,14 @@ if (s.ble!==false) {
boot += `bleServiceOptions.hid=Bangle.HID;\n`;
}
}
-if (s.blerepl===false) { // If not programmable, force terminal off Bluetooth
- if (s.log) boot += `Terminal.setConsole(true);\n`; // if showing debug, force REPL onto terminal
+if (s.log==2) { // logging to file
+ boot += `_DBGLOG=require("Storage").open("log.txt","a");
+`;
+} if (s.blerepl===false) { // If not programmable, force terminal off Bluetooth
+ if (s.log==2) boot += `_DBGLOG=require("Storage").open("log.txt","a");
+LoopbackB.on('data',function(d) {_DBGLOG.write(d);Terminal.write(d);});
+LoopbackA.setConsole(true);\n`;
+ else if (s.log) boot += `Terminal.setConsole(true);\n`; // if showing debug, force REPL onto terminal
else boot += `E.setConsole(null,{force:true});\n`; // on new (2v05+) firmware we have E.setConsole which allows a 'null' console
/* If not programmable add our own handler for Bluetooth data
to allow Gadgetbridge commands to be received*/
@@ -41,7 +47,10 @@ Bluetooth.on('line',function(l) {
try { global.GB(JSON.parse(l.slice(3,-1))); } catch(e) {}
});\n`;
} else {
- if (s.log) boot += `if (!NRF.getSecurityStatus().connected) Terminal.setConsole();\n`; // if showing debug, put REPL on terminal (until connection)
+ if (s.log==2) boot += `_DBGLOG=require("Storage").open("log.txt","a");
+LoopbackB.on('data',function(d) {_DBGLOG.write(d);Terminal.write(d);});
+if (!NRF.getSecurityStatus().connected) LoopbackA.setConsole();\n`;
+ else if (s.log) boot += `if (!NRF.getSecurityStatus().connected) Terminal.setConsole();\n`; // if showing debug, put REPL on terminal (until connection)
else boot += `Bluetooth.setConsole(true);\n`; // else if no debug, force REPL to Bluetooth
}
// we just reset, so BLE should be on.
@@ -78,14 +87,8 @@ boot += `E.on('errorFlag', function(errorFlags) {
if (global.save) boot += `global.save = function() { throw new Error("You can't use save() on Bangle.js without overwriting the bootloader!"); }\n`;
// Apply any settings-specific stuff
if (s.options) boot+=`Bangle.setOptions(${E.toJS(s.options)});\n`;
-if (s.quiet && s.qmOptions) boot+=`Bangle.setOptions(${E.toJS(s.qmOptions)});\n`;
-if (s.quiet && s.qmBrightness) {
- if (s.qmBrightness!=1) boot+=`Bangle.setLCDBrightness(${s.qmBrightness});\n`;
-} else {
- if (s.brightness && s.brightness!=1) boot+=`Bangle.setLCDBrightness(${s.brightness});\n`;
-}
-if (s.quiet && s.qmTimeout) boot+=`Bangle.setLCDTimeout(${s.qmTimeout});\n`;
-if (s.passkey!==undefined && s.passkey.length==6) boot+=`NRF.setSecurity({passkey:${s.passkey}, mitm:1, display:1});\n`;
+if (s.brightness && s.brightness!=1) boot+=`Bangle.setLCDBrightness(${s.brightness});\n`;
+if (s.passkey!==undefined && s.passkey.length==6) boot+=`NRF.setSecurity({passkey:${E.toJS(s.passkey.toString())}, mitm:1, display:1});\n`;
if (s.whitelist) boot+=`NRF.on('connect', function(addr) { if (!(require('Storage').readJSON('setting.json',1)||{}).whitelist.includes(addr)) NRF.disconnect(); });\n`;
// Pre-2v10 firmwares without a theme/setUI
delete g.theme; // deleting stops us getting confused by our own decl. builtins can't be deleted
diff --git a/apps/calendar/ChangeLog b/apps/calendar/ChangeLog
index 8bafff34a..de887bfa7 100644
--- a/apps/calendar/ChangeLog
+++ b/apps/calendar/ChangeLog
@@ -1,2 +1,3 @@
0.01: Basic calendar
0.02: Make Bangle 2 compatible
+0.03: Add setting to start week on Sunday
diff --git a/apps/calendar/README.md b/apps/calendar/README.md
index 19a60afc0..e22d06573 100644
--- a/apps/calendar/README.md
+++ b/apps/calendar/README.md
@@ -6,3 +6,8 @@ Basic calendar
- Use `BTN4` (left screen tap) to go to the previous month
- Use `BTN5` (right screen tap) to go to the next month
+
+## Settings
+
+- Starts on Sunday: whether the calendar should start on Sunday (default is Monday).
+
diff --git a/apps/calendar/calendar.js b/apps/calendar/calendar.js
index 6f3c33164..5707bd97a 100644
--- a/apps/calendar/calendar.js
+++ b/apps/calendar/calendar.js
@@ -18,6 +18,10 @@ const gray2 = "#888888";
const gray3 = "#bbbbbb";
const red = "#d41706";
+let settings = require('Storage').readJSON("calendar.json", true) || {};
+if (settings.startOnSun === undefined)
+ settings.startOnSun = false;
+
function drawCalendar(date) {
g.setBgColor(color4);
g.clearRect(0, 0, maxX, maxY);
@@ -61,13 +65,18 @@ function drawCalendar(date) {
);
g.setFont("6x8", fontSize);
- const dowLbls = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"];
+ let dowLbls;
+ if (settings.startOnSun) {
+ dowLbls = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
+ } else {
+ dowLbls = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"];
+ }
dowLbls.forEach((lbl, i) => {
g.drawString(lbl, i * colW + colW / 2, headerH + rowH / 2);
});
date.setDate(1);
- const dow = date.getDay();
+ const dow = date.getDay() + (settings.startOnSun ? 1 : 0);
const dowNorm = dow === 0 ? 7 : dow;
const monthMaxDayMap = {
diff --git a/apps/calendar/settings.js b/apps/calendar/settings.js
new file mode 100644
index 000000000..f9c7783a3
--- /dev/null
+++ b/apps/calendar/settings.js
@@ -0,0 +1,24 @@
+(function(back) {
+ var FILE = "calendar.json";
+ var settings = require('Storage').readJSON(FILE, true) || {};
+ if (settings.startOnSun === undefined)
+ settings.startOnSun = true;
+
+ function writeSettings() {
+ require('Storage').writeJSON(FILE, settings);
+ }
+
+ E.showMenu({
+ "" : { "title" : "Calendar" },
+ "< Back" : () => back(),
+ 'Start on Sunday': {
+ value: settings.startOnSun,
+ format: v => v?"Yes":"No",
+ onchange: v => {
+ settings.startOnSun = v;
+ writeSettings();
+ }
+ },
+ });
+})
+
diff --git a/apps/chronowid/ChangeLog b/apps/chronowid/ChangeLog
index e173467a1..ded543397 100644
--- a/apps/chronowid/ChangeLog
+++ b/apps/chronowid/ChangeLog
@@ -1,3 +1,5 @@
0.01: New widget and app!
0.02: Setting to reset values, timer buzzes at 00:00 and not later (see readme)
-0.03: Display only minutes:seconds when less than 1 hour left
\ No newline at end of file
+0.03: Display only minutes:seconds when less than 1 hour left
+0.04: Change to 7 segment font, move to top widget bar
+ Better auto-update behaviour, less RAM used
diff --git a/apps/chronowid/README.md b/apps/chronowid/README.md
index ec1d5dd46..6e0aba681 100644
--- a/apps/chronowid/README.md
+++ b/apps/chronowid/README.md
@@ -5,14 +5,13 @@ The advantage is, that you can still see your normal watchface and other widgets
The widget is always active, but only shown when the timer is on.
Hours, minutes, seconds and timer status can be set with an app.
-When there is less than one seconds left on the timer it buzzes.
+When there is less than one second left on the timer it buzzes.
The widget has been tested on Bangle 1 and Bangle 2
## Screenshots
-
-
+
## Features
@@ -28,15 +27,15 @@ There are no settings section in the settings app, timer can be set using an app
* Hours: Set the hours for the timer
* Minutes: Set the minutes for the timer
* Seconds: Set the seconds for the timer
-* Timer on: Starts the timer and displays the widget when set to 'On'. You have to leave the app to load the widget which starts the timer. The widget is always there, but only visible when timer is on.
+* Timer on: Starts the timer and displays the widget when set to 'On'. You have to leave the app to load the widget which starts the timer. The widget is always there, but only visible when timer is on.
## Releases
-* Offifical app loader: https://github.com/espruino/BangleApps/tree/master/apps/chronowid (https://banglejs.com/apps/)
+* Official app loader: https://github.com/espruino/BangleApps/tree/master/apps/chronowid (https://banglejs.com/apps/)
* Forked app loader: https://github.com/Purple-Tentacle/BangleApps/tree/master/apps/chronowid (https://purple-tentacle.github.io/BangleApps/index.html#)
* Development: https://github.com/Purple-Tentacle/BangleAppsDev/tree/master/apps/chronowid
## Requests
-If you have any feature requests, please write here: http://forum.espruino.com/conversations/345972/
\ No newline at end of file
+If you have any feature requests, please write here: http://forum.espruino.com/conversations/345972/
diff --git a/apps/chronowid/app.js b/apps/chronowid/app.js
index 0cacdee23..f38105e34 100644
--- a/apps/chronowid/app.js
+++ b/apps/chronowid/app.js
@@ -3,7 +3,6 @@ Bangle.loadWidgets();
Bangle.drawWidgets();
const storage = require('Storage');
-const boolFormat = v => v ? "On" : "Off";
let settingsChronowid;
function updateSettings() {
@@ -12,6 +11,7 @@ function updateSettings() {
now.getHours() + settingsChronowid.hours, now.getMinutes() + settingsChronowid.minutes, now.getSeconds() + settingsChronowid.seconds);
settingsChronowid.goal = goal.getTime();
storage.writeJSON('chronowid.json', settingsChronowid);
+ if (WIDGETS["chronowid"]) WIDGETS["chronowid"].reload();
}
function resetSettings() {
@@ -44,6 +44,7 @@ function showMenu() {
timerMenu.started.value = settingsChronowid.started;
}
},
+ '< Back' : ()=>{load();},
'Reset values': function() {
settingsChronowid.hours = 0;
settingsChronowid.minutes = 0;
@@ -84,15 +85,15 @@ function showMenu() {
},
'Timer on': {
value: settingsChronowid.started,
- format: boolFormat,
+ format: v => v ? "On" : "Off",
onchange: v => {
settingsChronowid.started = v;
updateSettings();
}
},
};
- timerMenu['-Exit-'] = ()=>{load();};
+
return E.showMenu(timerMenu);
}
-showMenu();
\ No newline at end of file
+showMenu();
diff --git a/apps/chronowid/chrono_with_pastel.jpg b/apps/chronowid/chrono_with_pastel.jpg
deleted file mode 100644
index 2f5993e79..000000000
Binary files a/apps/chronowid/chrono_with_pastel.jpg and /dev/null differ
diff --git a/apps/chronowid/chrono_with_wave.jpg b/apps/chronowid/chrono_with_wave.jpg
deleted file mode 100644
index 5f35bd28b..000000000
Binary files a/apps/chronowid/chrono_with_wave.jpg and /dev/null differ
diff --git a/apps/chronowid/screenshot.png b/apps/chronowid/screenshot.png
new file mode 100644
index 000000000..f94eece94
Binary files /dev/null and b/apps/chronowid/screenshot.png differ
diff --git a/apps/chronowid/widget.js b/apps/chronowid/widget.js
index f0e785efd..2d1c78941 100644
--- a/apps/chronowid/widget.js
+++ b/apps/chronowid/widget.js
@@ -1,93 +1,79 @@
(() => {
- const storage = require('Storage');
- settingsChronowid = storage.readJSON("chronowid.json",1)||{}; //read settingsChronowid from file
- var height = 23;
- var width = 58;
+ var settingsChronowid;
var interval = 0; //used for the 1 second interval timer
- var now = new Date();
+ var diff;
- var time = 0;
- var diff = settingsChronowid.goal - now;
-
//Convert ms to time
function getTime(t) {
var milliseconds = parseInt((t % 1000) / 100),
seconds = Math.floor((t / 1000) % 60),
minutes = Math.floor((t / (1000 * 60)) % 60),
hours = Math.floor((t / (1000 * 60 * 60)) % 24);
-
- hours = (hours < 10) ? "0" + hours : hours;
- minutes = (minutes < 10) ? "0" + minutes : minutes;
- seconds = (seconds < 10) ? "0" + seconds : seconds;
-
- return hours + ":" + minutes + ":" + seconds;
+ return hours.toString().padStart(2,0) + ":" + minutes.toString().padStart(2,0) + ":" + seconds.toString().padStart(2,0);
}
- function printDebug() {
- print ("Nowtime: " + getTime(now));
- print ("Now: " + now);
+ /*function printDebug() {
print ("Goaltime: " + getTime(settingsChronowid.goal));
print ("Goal: " + settingsChronowid.goal);
print("Difftime: " + getTime(diff));
print("Diff: " + diff);
print ("Started: " + settingsChronowid.started);
print ("----");
- }
+ }*/
//counts down, calculates and displays
function countDown() {
- now = new Date();
+ var now = new Date();
diff = settingsChronowid.goal - now; //calculate difference
- WIDGETS["chronowid"].draw();
- //time is up
+ // time is up
if (settingsChronowid.started && diff < 1000) {
Bangle.buzz(1500);
//write timer off to file
settingsChronowid.started = false;
- storage.writeJSON('chronowid.json', settingsChronowid);
+ require('Storage').writeJSON('chronowid.json', settingsChronowid);
clearInterval(interval); //stop interval
+ interval = undefined;
}
- //printDebug();
+ // calculates width and redraws accordingly
+ WIDGETS["chronowid"].redraw();
}
- // draw your widget
- function draw() {
- if (!settingsChronowid.started) {
- width = 0;
- return; //do not draw anything if timer is not started
- }
- g.reset();
- if (diff >= 0) {
- if (diff < 3600000) { //less than 1 hour left
- width = 58;
- g.clearRect(this.x,this.y,this.x+width,this.y+height);
- g.setFont("6x8", 2);
- g.drawString(getTime(diff).substring(3), this.x+1, this.y+5); //remove hour part 00:00:00 -> 00:00
- }
- if (diff >= 3600000) { //one hour or more left
- width = 48;
- g.clearRect(this.x,this.y,this.x+width,this.y+height);
- g.setFont("6x8", 1);
- g.drawString(getTime(diff), this.x+1, this.y+((height/2)-4)); //display hour 00:00:00
- }
- }
- // not needed anymoe, because we check if diff < 1000 now, so 00:00 is displayed.
- // else {
- // width = 58;
- // g.clearRect(this.x,this.y,this.x+width,this.y+height);
- // g.setFont("6x8", 2);
- // g.drawString("END", this.x+15, this.y+5);
- // }
- }
-
- if (settingsChronowid.started) interval = setInterval(countDown, 1000); //start countdown each second
-
// add the widget
- WIDGETS["chronowid"]={area:"bl",width:width,draw:draw,reload:function() {
- reload();
- Bangle.drawWidgets(); // relayout all widgets
+ WIDGETS["chronowid"]={area:"tl",width:0,draw:function() {
+ if (!this.width) return;
+ g.reset().setFontAlign(0,0).clearRect(this.x,this.y,this.x+this.width,this.y+23);
+ //g.drawRect(this.x,this.y,this.x+this.width-1, this.y+23);
+ var scale;
+ var timeStr;
+ if (diff < 3600000) { //less than 1 hour left
+ width = 58;
+ scale = 2;
+ timeStr = getTime(diff).substring(3); // remove hour part 00:00:00 -> 00:00
+ } else { //one hour or more left
+ width = 48;
+ scale = 1;
+ timeStr = getTime(diff); //display hour 00:00:00 but small
+ }
+ // Font5x9Numeric7Seg - just build this in as it's tiny
+ g.setFontCustom(atob("AAAAAAAAAAIAAAQCAQAAAd0BgMBdwAAAAAAAdwAB0RiMRcAAAERiMRdwAcAQCAQdwAcERiMRBwAd0RiMRBwAAEAgEAdwAd0RiMRdwAcERiMRdwAFAAd0QiEQdwAdwRCIRBwAd0BgMBAAABwRCIRdwAd0RiMRAAAd0QiEQAAAAAAAAAA="), 32, atob("BgAAAAAAAAAAAAAAAAYCAAYGBgYGBgYGBgYCAAAAAAAABgYGBgYG"), 9 + (scale<<8));
+ g.drawString(timeStr, this.x+this.width/2, this.y+12);
+ }, redraw:function() {
+ var last = this.width;
+ if (!settingsChronowid.started) this.width = 0;
+ else this.width = (diff < 3600000) ? 58 : 48;
+ if (last != this.width) Bangle.drawWidgets();
+ else this.draw();
+ }, reload:function() {
+ settingsChronowid = require('Storage').readJSON("chronowid.json",1)||{};
+ if (interval) clearInterval(interval);
+ interval = undefined;
+ // start countdown each second
+ if (settingsChronowid.started) interval = setInterval(countDown, 1000);
+ // reset everything
+ countDown();
}};
//printDebug();
- countDown();
-})();
\ No newline at end of file
+ // set width correctly, start countdown each second
+ WIDGETS["chronowid"].reload();
+})();
diff --git a/apps/cliclockJS2Enhanced/ChangeLog b/apps/cliclockJS2Enhanced/ChangeLog
index c7cb9e2c6..f4d146d5f 100644
--- a/apps/cliclockJS2Enhanced/ChangeLog
+++ b/apps/cliclockJS2Enhanced/ChangeLog
@@ -1,2 +1,3 @@
0.01: Submitted to App Loader
0.02: Removed unneded code, added HID controlls thanks to t0m1o1 for his code :p
+0.03: Load widgets after Bangle.setUI to ensure widgets know if they're on a clock or not (fix #970)
diff --git a/apps/cliclockJS2Enhanced/app.js b/apps/cliclockJS2Enhanced/app.js
index 70e86f3d6..b6172b497 100644
--- a/apps/cliclockJS2Enhanced/app.js
+++ b/apps/cliclockJS2Enhanced/app.js
@@ -50,7 +50,7 @@ if (next) {
setTimeout(drawApp, 1000);
Bangle.setLocked(true);
}, BTN1, { edge:"falling",repeat:true,debounce:50});
- Bangle.on('drag', function(e) {
+ Bangle.on('drag', function(e) {
if(!e.b){
console.log(lasty);
console.log(lastx);
@@ -91,7 +91,7 @@ if (next) {
lasty = lasty + e.dy;
}
});
-
+
}
@@ -144,14 +144,15 @@ function writeLine(str,line){
}
g.clear();
-Bangle.loadWidgets();
-Bangle.drawWidgets();
-drawAll();
+
Bangle.on('lcdPower',function(on) {
if (on) drawAll();
});
var click = setInterval(updateTime, 1000);
// Show launcher when button pressed
Bangle.setUI("clockupdown", btn=>{
- drawAll();
+ drawAll(); // why do we redraw here??
});
+Bangle.loadWidgets();
+Bangle.drawWidgets();
+drawAll();
diff --git a/apps/clicompleteclk/ChangeLog b/apps/clicompleteclk/ChangeLog
new file mode 100644
index 000000000..ee05bd582
--- /dev/null
+++ b/apps/clicompleteclk/ChangeLog
@@ -0,0 +1,2 @@
+0.01: New clock!
+0.02: Load steps from Health Tracking app (if installed)
diff --git a/apps/clicompleteclk/README.md b/apps/clicompleteclk/README.md
new file mode 100644
index 000000000..8b8094633
--- /dev/null
+++ b/apps/clicompleteclk/README.md
@@ -0,0 +1,24 @@
+# Command line complete clock
+
+Command line styled clock with lots of information:
+
+It can show the following (depending on availability) information:
+* Time data:
+ * Time
+ * Day of week
+ * Date
+* Additional information (can be toggled via settings):
+ * Weather conditions and temperature (requires app [Weather](https://banglejs.com/apps/#weather))
+ * Steps (requires app [Health Tracking](https://banglejs.com/apps/#health%20tracking) or a step widget)
+ * Heart rate (when screen is on and unlocked)
+
+## TODO
+* Make time font bigger
+* Show progress of steps (if any goal is set)
+* Show trend of HRM out of history data
+
+## Creator
+Marco ([myxor](https://github.com/myxor))
+
+## Icon
+Icon taken from [materialdesignicons](https://materialdesignicons.com) under Apache License 2.0
diff --git a/apps/clicompleteclk/app-icon.js b/apps/clicompleteclk/app-icon.js
new file mode 100644
index 000000000..b874bb6fa
--- /dev/null
+++ b/apps/clicompleteclk/app-icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("mEwgI/8/4ACAqYv/F/PwAqgA6A=="))
diff --git a/apps/clicompleteclk/app.js b/apps/clicompleteclk/app.js
new file mode 100644
index 000000000..a39b37e58
--- /dev/null
+++ b/apps/clicompleteclk/app.js
@@ -0,0 +1,250 @@
+const storage = require('Storage');
+const locale = require("locale");
+
+const font12 = g.getFonts().includes("12x20");
+const font = font12 ? "12x20" : "6x8";
+const fontsize = font12 ? 1: 2;
+const fontheight = 19;
+
+const marginTop = 5;
+const marginLeftTopic = 3; // margin of topics
+const marginLeftData = font12 ? 64 : 75; // margin of data values
+
+const topicColor = g.theme.dark ? "#fff" : "#000";
+const textColor = g.theme.dark ? "#0f0" : "#080";
+const textColorRed = g.theme.dark ? "#FF0000" : "#FF0000";
+
+let hrtValue;
+let hrtValueIsOld = false;
+
+let localTempValue;
+let weatherTempString;
+let lastHeartRateRowIndex;
+let lastStepsRowIndex;
+let i = 2;
+
+let settings;
+
+function loadSettings() {
+ settings = storage.readJSON('clicompleteclk.json', 1) || {};
+}
+
+function setting(key) {
+ if (!settings) { loadSettings(); }
+ const DEFAULTS = {
+ 'battery': true,
+ 'batteryLvl': 30,
+ 'weather': true,
+ 'steps': true,
+ 'heartrate': true
+ };
+ return (key in settings) ? settings[key] : DEFAULTS[key];
+}
+
+
+let showBattery = setting('battery');
+let batteryWarnLevel = setting('batteryLvl');
+let showWeather = setting('weather');
+let showSteps = setting('steps');
+let showHeartRate = setting('heartrate');
+
+
+var drawTimeout;
+function queueDraw() {
+ if (drawTimeout) clearTimeout(drawTimeout);
+ drawTimeout = setTimeout(function() {
+ drawTimeout = undefined;
+ drawAll(true);
+ }, 60000 - (Date.now() % 60000));
+}
+
+function drawAll(drawInfoToo){
+ let now = new Date();
+ updateTime(now);
+ if (drawInfoToo) {
+ drawInfo(now);
+ }
+ queueDraw();
+}
+
+function updateTime(now){
+ if (!Bangle.isLCDOn()) return;
+ writeLineTopic("TIME", 1);
+ writeLine(locale.time(now,1),1);
+}
+
+function drawInfo(now) {
+ if (now == undefined)
+ now = new Date();
+
+ i = 2;
+
+ writeLineTopic("DOWK", i);
+ writeLine(locale.dow(now),i);
+ i++;
+
+ writeLineTopic("DATE", i);
+ writeLine(locale.date(now,1),i);
+ i++;
+
+ if (showBattery) {
+ writeLineTopic("BATT", i);
+ const b = E.getBattery();
+ writeLine(b + "%", i, b < batteryWarnLevel ? textColorRed : textColor);
+ i++;
+ }
+
+ if (showWeather) {
+ drawWeather();
+ }
+
+ if (showSteps) {
+ drawSteps(i);
+ i++;
+ }
+
+ if (showHeartRate) {
+ drawHeartRate(i);
+ }
+}
+
+function drawWeather() {
+ const weatherJson = getWeather();
+ if(weatherJson && weatherJson.weather){
+ const currentWeather = weatherJson.weather;
+
+ const weatherTempValue = locale.temp(currentWeather.temp-273.15);
+ weatherTempString = weatherTempValue;
+ writeLineTopic("WTHR", i);
+ writeLine(currentWeather.txt,i);
+ i++;
+
+ writeLineTopic("TEMP", i);
+ writeLine(weatherTempValue,i);
+ i++;
+ }
+}
+
+function drawSteps(i) {
+ if (!showSteps) return;
+ if (i == undefined)
+ i = lastStepsRowIndex;
+ const steps = getSteps();
+ if (steps != undefined) {
+ writeLineTopic("STEP", i);
+ writeLine(steps, i);
+ }
+ lastStepsRowIndex = i;
+}
+
+function drawHeartRate(i) {
+ if (!showHeartRate) return;
+ if (i == undefined)
+ i = lastHeartRateRowIndex;
+ writeLineTopic("HRTM", i);
+ if (hrtValue != undefined) {
+ if (!hrtValueIsOld)
+ writeLine(hrtValue,i);
+ else
+ writeLine(hrtValue,i, topicColor);
+ }
+ lastHeartRateRowIndex = i;
+}
+
+
+function writeLineTopic(str, line) {
+ var y = marginTop+line*fontheight;
+ g.setFont(font,fontsize);
+ g.setColor(topicColor).setFontAlign(-1,-1);
+
+ g.clearRect(0,y,g.getWidth(),y+fontheight-1);
+ g.drawString("[" + str + "]",marginLeftTopic,y);
+}
+
+function writeLine(str,line,pColor){
+ if (pColor == undefined)
+ pColor = textColor;
+ var y = marginTop+line*fontheight;
+ g.setFont(font,fontsize);
+ g.setColor(pColor).setFontAlign(-1,-1);
+ g.drawString(str,marginLeftData,y);
+}
+
+
+function getSteps() {
+ var steps = 0;
+ let health;
+ try {
+ health = require("health");
+ } catch (e) {
+ // Module health not found
+ }
+ if (health != undefined) {
+ health.readDay(new Date(), h=>steps+=h.steps);
+ } else if (WIDGETS.wpedom !== undefined) {
+ return WIDGETS.wpedom.getSteps();
+ } else if (WIDGETS.activepedom !== undefined) {
+ return WIDGETS.activepedom.getSteps();
+ }
+ return steps;
+}
+
+function getWeather() {
+ let jsonWeather = storage.readJSON('weather.json');
+ return jsonWeather;
+}
+
+// EVENTS:
+
+// turn on HRM when the LCD is unlocked
+Bangle.on('lock', function(isLocked) {
+ if (!isLocked) {
+ if (showHeartRate) {
+ Bangle.setHRMPower(1,"clicompleteclk");
+ if (hrtValue == undefined)
+ hrtValue = "...";
+ else
+ hrtValueIsOld = true;
+ }
+ } else {
+ if (showHeartRate) {
+ hrtValueIsOld = true;
+ Bangle.setHRMPower(0,"clicompleteclk");
+ }
+ }
+ // Update steps and heart rate
+ drawSteps();
+ drawHeartRate();
+});
+
+Bangle.on('lcdPower',function(on) {
+ if (on) {
+ drawAll(true);
+ } else {
+ if (showHeartRate) {
+ hrtValueIsOld = true;
+ }
+ if (drawTimeout) clearTimeout(drawTimeout);
+ drawTimeout = undefined;
+ }
+});
+
+if (showHeartRate) {
+ Bangle.on('HRM', function(hrm) {
+ //if(hrm.confidence > 90){
+ hrtValueIsOld = false;
+ hrtValue = hrm.bpm;
+ if (Bangle.isLCDOn())
+ drawHeartRate();
+ //} else {
+ // hrtValue = undefined;
+ //}
+ });
+}
+
+g.clear();
+Bangle.setUI("clock");
+Bangle.loadWidgets();
+Bangle.drawWidgets();
+loadSettings();
+drawAll(true);
diff --git a/apps/clicompleteclk/app.png b/apps/clicompleteclk/app.png
new file mode 100644
index 000000000..104e6124a
Binary files /dev/null and b/apps/clicompleteclk/app.png differ
diff --git a/apps/clicompleteclk/settings.js b/apps/clicompleteclk/settings.js
new file mode 100644
index 000000000..2df20ed3e
--- /dev/null
+++ b/apps/clicompleteclk/settings.js
@@ -0,0 +1,54 @@
+(function(back) {
+ const storage = require('Storage');
+ let settings = storage.readJSON('clicompleteclk.json', 1) || {};
+ function save(key, value) {
+ settings[key] = value;
+ storage.write('clicompleteclk.json', settings);
+ }
+ E.showMenu({
+ '': { 'title': 'CLI complete clk' },
+ 'Show battery': {
+ value: "battery" in settings ? settings.battery : false,
+ format: () => (settings.battery ? 'Yes' : 'No'),
+ onchange: () => {
+ settings.battery = !settings.battery;
+ save('battery', settings.battery);
+ },
+ },
+ 'Battery warn': {
+ value: "batteryLvl" in settings ? settings.batteryLvl : 30,
+ min: 0,
+ max : 100,
+ step: 10,
+ format: x => {
+ return x + "%";
+ },
+ onchange: x => save('batteryLvl', x),
+ },
+ 'Show weather': {
+ value: "weather" in settings ? settings.weather : false,
+ format: () => (settings.weather ? 'Yes' : 'No'),
+ onchange: () => {
+ settings.weather = !settings.weather;
+ save('weather', settings.weather);
+ },
+ },
+ 'Show steps': {
+ value: "steps" in settings ? settings.steps : false,
+ format: () => (settings.steps ? 'Yes' : 'No'),
+ onchange: () => {
+ settings.steps = !settings.steps;
+ save('steps', settings.steps);
+ },
+ },
+ 'Show heartrate': {
+ value: "heartrate" in settings ? settings.heartrate : false,
+ format: () => (settings.heartrate ? 'Yes' : 'No'),
+ onchange: () => {
+ settings.heartrate = !settings.heartrate;
+ save('heartrate', settings.heartrate);
+ },
+ },
+ '< Back': back,
+ });
+});
diff --git a/apps/cliock/ChangeLog b/apps/cliock/ChangeLog
index 2a93a0d5f..68249b622 100644
--- a/apps/cliock/ChangeLog
+++ b/apps/cliock/ChangeLog
@@ -7,3 +7,4 @@
0.13: Use setUI, work with smaller screens and themes
0.14: Fix BTN1 (fix #853)
Add light/dark theme support
+0.15: Load widgets after Bangle.setUI to ensure widgets know if they're on a clock or not (fix #970)
diff --git a/apps/cliock/app.js b/apps/cliock/app.js
index 0fd6ea580..d9271bf15 100644
--- a/apps/cliock/app.js
+++ b/apps/cliock/app.js
@@ -183,9 +183,6 @@ Bangle.on('HRM', function(hrm) {
});
g.clear();
-Bangle.loadWidgets();
-Bangle.drawWidgets();
-drawAll();
Bangle.on('lcdPower',function(on) {
if (on) drawAll();
});
@@ -195,4 +192,7 @@ Bangle.setUI("clockupdown", btn=>{
if (btn<0) changeInfoMode();
if (btn>0) changeFunctionMode();
drawAll();
-});
\ No newline at end of file
+});
+Bangle.loadWidgets();
+Bangle.drawWidgets();
+drawAll();
diff --git a/apps/coretemp/ChangeLog b/apps/coretemp/ChangeLog
new file mode 100644
index 000000000..c7b309a74
--- /dev/null
+++ b/apps/coretemp/ChangeLog
@@ -0,0 +1 @@
+0.1: New app
diff --git a/apps/coretemp/README.md b/apps/coretemp/README.md
new file mode 100644
index 000000000..fac25df21
--- /dev/null
+++ b/apps/coretemp/README.md
@@ -0,0 +1,20 @@
+# CoreTemp display
+
+Basic bare-bones example of connecting to a bluetooth [CoreTemp](https://corebodytemp.com/) device and displaying the current body core temperature readings.
+
+## Usage
+
+On startup connects to a CoreTemp device (1809/2A1C) and emits a "Core, temp" value for each reading.
+The app simply displays these readings on screen.
+
+## TODO
+
+* Integrate with other tracking/sports apps to log data.
+* Add device selection
+* Provide enable/disable option
+* Check status, add Retry/reconnect
+* Also provide skin temp reading
+
+## Creator
+
+Ivor Hewitt
diff --git a/apps/coretemp/boot.js b/apps/coretemp/boot.js
new file mode 100644
index 000000000..59e227dad
--- /dev/null
+++ b/apps/coretemp/boot.js
@@ -0,0 +1,23 @@
+(function() {
+ var gatt;
+
+ //Would it be better to scan by uuid rather than name?
+ NRF.requestDevice({ timeout: 20000, filters: [{ name: 'CORE [a]' }] }).then(function(device) {
+ return device.gatt.connect();
+ }).then(function(g) {
+ gatt = g;
+ return gatt.getPrimaryService("1809");
+ }).then(function(service) {
+ return service.getCharacteristic("2A1C");
+ }).then(function(characteristic) {
+ characteristic.on('characteristicvaluechanged', function(event) {
+ var dv = event.target.value;
+ var core = (dv.buffer[2]*256+dv.buffer[1])/100;
+ Bangle.emit('Core',{
+ temp:core
+ });
+ });
+ return characteristic.startNotifications();
+ }).then(function() {
+ });
+})();
diff --git a/apps/coretemp/coretemp-icon.js b/apps/coretemp/coretemp-icon.js
new file mode 100644
index 000000000..5f36b9090
--- /dev/null
+++ b/apps/coretemp/coretemp-icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("mEw4UA///k0DxUFgsDCY8KwAfJlQLHhWglWq1WgBIcCA4QCB1WoComq0+iBYWqCwl//4OBAAQxChWlv/2BYIlCBYUqv9VvQLBwA9BBYWlqtV/QLBGoRIBgQLBr9aBYQ2BBYMKroLBtQLCgALClIKC1AXG1NVuoFBF4sC09V+woCBAJHCgWXq9oPQZrDgWdq9gBZG9rqgCTwSbCgVVqysDBYkK6tWYoa/DkEJ6vaaIgWBaAILCbQhUCBYXoc4wNBBZWqBfBtB1ALKKZILCR4J3FToQLBU4KPEWoQLNZYILIa4NVcYReEcYOnqtaDAbvDgALBcg4EBlNVqtqDoOgd4YoBBYNWytWCwQdCgQLBAAVaBYkA0oLDuwLFkv1BgZGDAAMJuoKCroWEGAOnDAVftShGr////1tDdG14LB+wiEAAdqHAjTHBYgA=="))
diff --git a/apps/coretemp/coretemp.js b/apps/coretemp/coretemp.js
new file mode 100644
index 000000000..226508c83
--- /dev/null
+++ b/apps/coretemp/coretemp.js
@@ -0,0 +1,19 @@
+Bangle.setLCDPower(1);
+Bangle.setLCDTimeout(0);
+var btm = g.getHeight()-1;
+
+function onCore(c) {
+ var px = g.getWidth()/2;
+ g.setFontAlign(0,0);
+ g.clearRect(0,24,g.getWidth(),80);
+ var str = c.temp + "C";
+ g.setFontVector(40).drawString(str,px,45);
+}
+Bangle.on('Core', onCore);
+
+g.clear();
+Bangle.loadWidgets();
+Bangle.drawWidgets();
+
+g.reset().setFont("6x8",2).setFontAlign(0,0);
+g.drawString("Please wait...",g.getWidth()/2,g.getHeight()/2 - 16);
diff --git a/apps/coretemp/coretemp.png b/apps/coretemp/coretemp.png
new file mode 100644
index 000000000..a573828f8
Binary files /dev/null and b/apps/coretemp/coretemp.png differ
diff --git a/apps/dtlaunch/ChangeLog b/apps/dtlaunch/ChangeLog
index c3102b4b9..c414c1ddc 100644
--- a/apps/dtlaunch/ChangeLog
+++ b/apps/dtlaunch/ChangeLog
@@ -3,3 +3,5 @@
0.03: cycle thru pages
0.04: reset to clock after 2 mins of inactivity
0.05: add Bangle 2 version
+0.06: Adds settings page (hide clocks or launchers)
+0.06: Adds setting for directly launching app on touch for Bangle 2
diff --git a/apps/dtlaunch/app-b1.js b/apps/dtlaunch/app-b1.js
index 9bbf3e219..ec0569127 100644
--- a/apps/dtlaunch/app-b1.js
+++ b/apps/dtlaunch/app-b1.js
@@ -2,6 +2,11 @@
*
*/
+var settings = Object.assign({
+ showClocks: true,
+ showLaunchers: true,
+}, require('Storage').readJSON("dtlaunch.json", true) || {});
+
function wdog(handle,timeout){
if(handle !== undefined){
wdog.handle = handle;
@@ -17,7 +22,13 @@ function wdog(handle,timeout){
wdog(load,120000)
var s = require("Storage");
-var apps = s.list(/\.info$/).map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}).filter(app=>app && (app.type=="app" || app.type=="clock" || !app.type));
+var apps = s.list(/\.info$/).map(app=>{
+ var a=s.readJSON(app,1);
+ return a && {
+ name:a.name, type:a.type, icon:a.icon, sortorder:a.sortorder, src:a.src
+ };}).filter(
+ app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || (app.type=="launch" && settings.showLaunchers) || !app.type));
+
apps.sort((a,b)=>{
var n=(0|a.sortorder)-(0|b.sortorder);
if (n) return n; // do sortorder first
diff --git a/apps/dtlaunch/app-b2.js b/apps/dtlaunch/app-b2.js
index 674fe3677..800ec456c 100644
--- a/apps/dtlaunch/app-b2.js
+++ b/apps/dtlaunch/app-b2.js
@@ -2,8 +2,20 @@
*
*/
+var settings = Object.assign({
+ showClocks: true,
+ showLaunchers: true,
+ direct: false,
+}, require('Storage').readJSON("dtlaunch.json", true) || {});
+
var s = require("Storage");
-var apps = s.list(/\.info$/).map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}).filter(app=>app && (app.type=="app" || app.type=="clock" || !app.type));
+var apps = s.list(/\.info$/).map(app=>{
+ var a=s.readJSON(app,1);
+ return a && {
+ name:a.name, type:a.type, icon:a.icon, sortorder:a.sortorder, src:a.src
+ };}).filter(
+ app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || (app.type=="launch" && settings.showLaunchers) || !app.type));
+
apps.sort((a,b)=>{
var n=(0|a.sortorder)-(0|b.sortorder);
if (n) return n; // do sortorder first
@@ -28,7 +40,7 @@ const YOFF = 30;
function draw_icon(p,n,selected) {
var x = (n%2)*72+XOFF;
var y = n>1?72+YOFF:YOFF;
- (selected?g.setColor(g.theme.fgH):g.setColor(g.theme.bg)).fillRect(x+10,y+2,x+60,y+52);
+ (selected?g.setColor(g.theme.fgH):g.setColor(g.theme.bg)).fillRect(x+11,y+3,x+60,y+52);
g.clearRect(x+12,y+4,x+59,y+51);
g.setColor(g.theme.fg);
try{g.drawImage(apps[p*4+n].icon,x+12,y+4);} catch(e){}
@@ -52,7 +64,7 @@ function drawPage(p){
}
for (var i=0;i<4;i++) {
if (!apps[p*4+i]) return i;
- draw_icon(p,i,selected==i);
+ draw_icon(p,i,selected==i && !settings.direct);
}
g.flip();
}
@@ -81,9 +93,9 @@ Bangle.on("touch",(_,p)=>{
for (i=0;i<4;i++){
if((page*4+i)=0) {
- if (selected!=i){
+ draw_icon(page,i,true && !settings.direct);
+ if (selected>=0 || settings.direct) {
+ if (selected!=i && !settings.direct){
draw_icon(page,selected,false);
} else {
load(apps[page*4+i].src);
diff --git a/apps/dtlaunch/settings-b1.js b/apps/dtlaunch/settings-b1.js
new file mode 100644
index 000000000..f3101da16
--- /dev/null
+++ b/apps/dtlaunch/settings-b1.js
@@ -0,0 +1,33 @@
+(function(back) {
+ var FILE = "dtlaunch.json";
+
+ var settings = Object.assign({
+ showClocks: true,
+ showLaunchers: true
+ }, require('Storage').readJSON(FILE, true) || {});
+
+ function writeSettings() {
+ require('Storage').writeJSON(FILE, settings);
+ }
+
+ E.showMenu({
+ "" : { "title" : "Desktop launcher" },
+ "< Back" : () => back(),
+ 'Show clocks': {
+ value: settings.showClocks,
+ format: v => v?"On":"Off",
+ onchange: v => {
+ settings.showClocks = v;
+ writeSettings();
+ }
+ },
+ 'Show launchers': {
+ value: settings.showLaunchers,
+ format: v => v?"On":"Off",
+ onchange: v => {
+ settings.showLaunchers = v;
+ writeSettings();
+ }
+ }
+ });
+})
diff --git a/apps/dtlaunch/settings-b2.js b/apps/dtlaunch/settings-b2.js
new file mode 100644
index 000000000..7f667d213
--- /dev/null
+++ b/apps/dtlaunch/settings-b2.js
@@ -0,0 +1,42 @@
+(function(back) {
+ var FILE = "dtlaunch.json";
+
+ var settings = Object.assign({
+ showClocks: true,
+ showLaunchers: true,
+ direct: false
+ }, require('Storage').readJSON(FILE, true) || {});
+
+ function writeSettings() {
+ require('Storage').writeJSON(FILE, settings);
+ }
+
+ E.showMenu({
+ "" : { "title" : "Desktop launcher" },
+ "< Back" : () => back(),
+ 'Show clocks': {
+ value: settings.showClocks,
+ format: v => v?"On":"Off",
+ onchange: v => {
+ settings.showClocks = v;
+ writeSettings();
+ }
+ },
+ 'Show launchers': {
+ value: settings.showLaunchers,
+ format: v => v?"On":"Off",
+ onchange: v => {
+ settings.showLaunchers = v;
+ writeSettings();
+ }
+ },
+ 'Direct launch': {
+ value: settings.direct,
+ format: v => v?"On":"Off",
+ onchange: v => {
+ settings.direct = v;
+ writeSettings();
+ }
+ }
+ });
+})
diff --git a/apps/emojuino/ChangeLog b/apps/emojuino/ChangeLog
index 1c99f1970..04367183f 100644
--- a/apps/emojuino/ChangeLog
+++ b/apps/emojuino/ChangeLog
@@ -1,2 +1,3 @@
0.01: New App!
0.02: Upgraded text to images, added welcome screen and subtitles.
+0.03: Advertise app name as Espruino manufacturer data when idle.
diff --git a/apps/emojuino/emojuino.js b/apps/emojuino/emojuino.js
index 5b7670652..d241063e6 100644
--- a/apps/emojuino/emojuino.js
+++ b/apps/emojuino/emojuino.js
@@ -32,6 +32,7 @@ const CYCLE_BUZZ_MILLISECONDS = 50;
const WELCOME_MESSAGE = 'Emojuino:\r\n\r\n< Swipe >\r\nto select\r\n\r\nTap\r\nto transmit';
// Non-user-configurable constants
+const APP_ID = 'emojuino';
const IMAGE_INDEX = 0;
const CODE_POINT_INDEX = 1;
const EMOJI_PX = 96;
@@ -40,12 +41,11 @@ const EMOJI_Y = (g.getHeight() - EMOJI_PX) / 2;
const TX_X = 68;
const TX_Y = 12;
const FONT_SIZE = 24;
-const BTN_WATCH_OPTIONS = { repeat: true, debounce: 20, edge: "falling" };
+const ESPRUINO_COMPANY_CODE = 0x0590;
const UNICODE_CODE_POINT_ELIDED_UUID = [ 0x49, 0x6f, 0x49, 0x44, 0x55,
0x54, 0x46, 0x2d, 0x33, 0x32 ];
-
// Global variables
let emojiIndex = 0;
let isToggleOn = false;
@@ -100,9 +100,22 @@ function transmitEmoji(image, codePoint, duration) {
}
+// Transmit the app name under the Espruino company code to facilitate discovery
+function transmitAppName() {
+ let options = {
+ showName: false,
+ manufacturer: ESPRUINO_COMPANY_CODE,
+ manufacturerData: JSON.stringify({ name: APP_ID }),
+ interval: 2000
+ }
+
+ NRF.setAdvertising({}, options);
+}
+
+
// Terminate the emoji transmission
function terminateEmoji(displayIntervalId) {
- NRF.setAdvertising({ });
+ transmitAppName();
isTransmitting = false;
clearInterval(displayIntervalId);
drawImage(EMOJIS[emojiIndex][IMAGE_INDEX], false);
@@ -169,3 +182,4 @@ g.setFontAlign(0, 0);
g.drawString(WELCOME_MESSAGE, g.getWidth() / 2, g.getHeight() / 2);
Bangle.on('touch', handleTouch);
Bangle.on('drag', handleDrag);
+transmitAppName();
diff --git a/apps/flow/README.md b/apps/flow/README.md
new file mode 100644
index 000000000..caeaf92d9
--- /dev/null
+++ b/apps/flow/README.md
@@ -0,0 +1,12 @@
+# FLOW
+
+This is a game where you have to help a flow avoid white obstacles thing by tapping!
+This is a demake of an app which I forgot the name of.
+Press BTN(1) to restart.
+See if you can get to 2500 score!
+
+## Screenshots
+
+
+
+
diff --git a/apps/flow/app-icon.js b/apps/flow/app-icon.js
new file mode 100644
index 000000000..969a608f4
--- /dev/null
+++ b/apps/flow/app-icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("mEw4X/AwX48EHgEC1WgCQkVqoDBBfuqBQcBqoLagEqGAguBqALaGAOoAoQuEBbEAKgIMBBQNUBbgMCyoKHBbBVBBYIKGBbEBtNVrQLfOgNaT4gLagp0CPQOABbcBFwNAgEKBgILbitVqAFClWq0ALZFwTDFGAQLZFwYwDBfg"))
diff --git a/apps/flow/app.js b/apps/flow/app.js
new file mode 100644
index 000000000..5f4da8f35
--- /dev/null
+++ b/apps/flow/app.js
@@ -0,0 +1,220 @@
+const isB2 = process.env.HWVERSION === 2;
+
+// Bangle.js 1 runs just too fast in direct mode??? (also no getPixel)
+if (!isB2) Bangle.setLCDMode("120x120");
+
+const options = Bangle.getOptions();
+
+options.lockTimeout = 0;
+options.lcdPowerTimeout = 0;
+
+Bangle.setOptions(options);
+
+g.reset();
+g.setBgColor(0, 0, 0);
+g.setColor(255, 255, 255);
+g.clear();
+const h = g.getHeight();
+
+function trigToCoord(ret) {
+ return ((ret + 1) * h) / 2;
+}
+
+function trigToLen(ret) {
+ return (ret * h) / 2;
+}
+
+let i = 0.2;
+let speedCoef = 0.014;
+
+let flowFile = require("Storage").readJSON("flow.json");
+
+let highestI = (flowFile && flowFile.hiscore) || 0.1;
+
+let colorA = [255, 255, 0];
+let colorB = [0, 255, 255];
+
+let x = 0;
+let xt = 0;
+let safeMode = false;
+let lost = false;
+
+function offsetRect(g, x, y, w) {
+ g.fillRect(x, y, x + w, y + w);
+}
+
+function getColor(num) {
+ return [
+ [1, 0, 0],
+ [0, 1, 0],
+ [0, 0, 1],
+ [1, 1, 0],
+ [0, 1, 1],
+ [1, 0, 1],
+ [0.5, 0.5, 1],
+ [1, 0.5, 0],
+ [0, 1, 0.5],
+ [0.5, 0.5, 0.5],
+ ][num];
+}
+
+function calculateColor(num) {
+ colorA = getColor(Math.floor((num % 1) * 10));
+ colorB = getColor(Math.floor((num % 10) - (num % 1)));
+}
+
+calculateColor(highestI);
+
+Bangle.on("touch", () => (safeMode = !safeMode));
+
+function resetGame() {
+ x = xt = 0;
+ safeMode = lost = false;
+ i = 0.2;
+ speedCoef = 0.014;
+ obstaclePeriod = 150;
+ obstacleMode = 1;
+ g.clear();
+ shownScore = false;
+ intervalId = setInterval(draw);
+}
+
+function checkCollision() {
+ lost = g.getPixel(trigToCoord(+x), (h * 2) / 3 - 4) !== 0;
+ if (lost) {
+ scoringI = i;
+ speedCoef = Math.min(speedCoef, 0.02);
+ g.setFont(isB2 ? "6x15" : "4x6", 3);
+ g.setColor(colorA[0], colorA[1], colorA[2])
+ .drawString(
+ "Game over",
+ trigToCoord(0) - g.stringWidth("Game over") / 2,
+ trigToCoord(0)
+ )
+ .setColor(1, 1, 1);
+ }
+}
+
+function drawPlayer() {
+ if (!safeMode) xt = Math.cos(i * Math.PI * 4) / 7.5;
+ else xt = -Math.cos(i * Math.PI * 2) / 20 + 0.35;
+ x = x * 0.8 + xt * 0.2;
+ if (highestI > 250) calculateColor(i);
+ g.setColor(colorA[0], colorA[1], colorA[2]);
+ offsetRect(g, trigToCoord(+x), (h * 2) / 3, 3);
+ g.setColor(colorB[0], colorB[1], colorB[2]);
+ offsetRect(g, trigToCoord(-x), (h * 2) / 3, 3);
+}
+
+let obstaclePeriod = 150;
+let obstacleMode = 1;
+
+function drawObstracle() {
+ g.setColor(1, 1, 1);
+ switch (obstacleMode) {
+ case 0:
+ offsetRect(g, trigToCoord(-0.15), 0, trigToLen(0.3));
+ break;
+ case 1:
+ offsetRect(g, trigToCoord(0.2), 0, trigToLen(0.2));
+ offsetRect(g, trigToCoord(-0.4), 0, trigToLen(0.2));
+ break;
+ case 2:
+ break;
+ }
+ obstaclePeriod--;
+ if (obstaclePeriod <= 0) {
+ // If we are off cooldown mode, pick a random actual mode
+ if (obstacleMode === 2) {
+ obstaclePeriod = Math.random() * 50 + 50;
+ obstacleMode = Math.round(Math.random());
+ } else if (Math.random() > 0.5) {
+ // Give it a chance to repeat with no cooldown
+ obstaclePeriod = 25 + 2.5 * speedCoef;
+ obstacleMode = 2;
+ }
+ }
+}
+
+let shownScore = false;
+let scoringI = 0;
+
+function draw() {
+ if (!lost) {
+ drawPlayer();
+ checkCollision();
+ speedCoef *= 1.0005;
+ drawObstracle();
+ } else {
+ speedCoef /= 1.05;
+ if (speedCoef <= 0.005) {
+ clearInterval(intervalId);
+ i -= speedCoef;
+ g.setFont(isB2 ? "6x15" : "4x6", 1);
+ const str = "Hiscore: " + Math.round(highestI * 10);
+ g.setColor(
+ scoringI > highestI ? 0 : 255,
+ 0,
+ scoringI > highestI ? 255 : 0
+ )
+ .drawString(
+ str,
+ trigToCoord(0) - g.stringWidth(str) / 2,
+ trigToCoord(0)
+ )
+ .setColor(255, 255, 255);
+ if (scoringI > highestI) {
+ highestI = scoringI;
+ require("Storage").writeJSON("flow.json", {
+ hiscore: highestI,
+ });
+ calculateColor(highestI);
+ }
+ setTimeout(resetGame, 3000);
+ } else if (speedCoef <= 0.01 && !shownScore) {
+ shownScore = true;
+ g.setFont(isB2 ? "6x15" : "4x6", 2);
+ const str = "Score: " + Math.round(scoringI * 10);
+ g.setColor(colorB[0], colorB[1], colorB[2])
+ .drawString(
+ str,
+ trigToCoord(0) - g.stringWidth(str) / 2,
+ trigToCoord(0)
+ )
+ .setColor(1, 1, 1);
+ }
+ }
+ i += speedCoef;
+ g.scroll(0, speedCoef * h);
+ g.flip();
+}
+
+let intervalId;
+
+if (BTN.read()) {
+ for (let i = 0; i < 10; i++) {
+ color = getColor(i);
+ g.setColor(color[0], color[1], color[2]);
+ g.fillRect((i / 10) * h, 0, ((i + 1) / 10) * h, h);
+ }
+ g.setColor(0);
+ g.setFont("Vector", 9);
+ let str = "Welcome to the debug screen!";
+ g.drawString(
+ str,
+ trigToCoord(0) - g.stringWidth(str) / 2,
+ trigToCoord(0) - 9
+ );
+ str = "Don't hold BTN while opening to play!";
+ g.drawString(str, trigToCoord(0) - g.stringWidth(str) / 2, trigToCoord(0));
+ g.flip();
+ setInterval(() => {
+ g.scroll(0, 0.014 * h);
+ i += 0.014;
+ calculateColor(i);
+ g.setColor(colorA[0], colorA[1], colorA[2]);
+ g.fillRect(0, 0, trigToCoord(0), 0.014 * h);
+ g.setColor(colorB[0], colorB[1], colorB[2]);
+ g.fillRect(trigToCoord(0), 0, trigToCoord(1), 0.014 * h);
+ }, 1000 / 30);
+} else intervalId = setInterval(draw, 1000 / 30);
diff --git a/apps/flow/app.png b/apps/flow/app.png
new file mode 100644
index 000000000..b35c3ca77
Binary files /dev/null and b/apps/flow/app.png differ
diff --git a/apps/flow/screenshot1.png b/apps/flow/screenshot1.png
new file mode 100644
index 000000000..fd5dee427
Binary files /dev/null and b/apps/flow/screenshot1.png differ
diff --git a/apps/flow/screenshot2.png b/apps/flow/screenshot2.png
new file mode 100644
index 000000000..e29691b69
Binary files /dev/null and b/apps/flow/screenshot2.png differ
diff --git a/apps/flow/screenshot3.png b/apps/flow/screenshot3.png
new file mode 100644
index 000000000..3e1c80ba7
Binary files /dev/null and b/apps/flow/screenshot3.png differ
diff --git a/apps/fwupdate/ChangeLog b/apps/fwupdate/ChangeLog
index ec66c5568..96e7e4e9b 100644
--- a/apps/fwupdate/ChangeLog
+++ b/apps/fwupdate/ChangeLog
@@ -1 +1,4 @@
0.01: Initial version
+0.02: Add support for ZIPs
+ Find and download ZIPs direct from the Espruino website
+ Take 'beta' tag off
diff --git a/apps/fwupdate/custom.html b/apps/fwupdate/custom.html
index 7230a77a8..8c2008e54 100644
--- a/apps/fwupdate/custom.html
+++ b/apps/fwupdate/custom.html
@@ -4,28 +4,45 @@
THIS IS CURRENTLY BETA - PLEASE USE THE NORMAL FIRMWARE UPDATE
- INSTRUCTIONS FOR BANGLE.JS 1 AND BANGLE.JS 2
+ INSTRUCTIONS FOR BANGLE.JS 1 AND BANGLE.JS 2 . For usage on Bangle.js 2 you'll likely need to have an updated bootloader.
+ Your current firmware version is unknown
-
Please upload a hex file here. This file should be the .app_hex
+
+
The currently available Espruino firmware releases are:
+
+
To update, click the link and then click the 'Upload' button that appears.
+
+
+
Or you can upload a hex or zip file here. This file should be an .app_hex
file, *not* the normal .hex (as that contains the bootloader as well).
-
-
Upload
+
+
Upload
+ Firmware updates via this tool work differently to the NRF Connect method mentioned on
+ the Bangle.js page . Firmware
+ is uploaded to a file on the Bangle. Once complete the Bangle reboots and the bootloader copies
+ the new firmware into internal Storage.
+
+
+
diff --git a/apps/gbdebug/ChangeLog b/apps/gbdebug/ChangeLog
new file mode 100644
index 000000000..5560f00bc
--- /dev/null
+++ b/apps/gbdebug/ChangeLog
@@ -0,0 +1 @@
+0.01: New App!
diff --git a/apps/gbdebug/README.md b/apps/gbdebug/README.md
new file mode 100644
index 000000000..47b1525b8
--- /dev/null
+++ b/apps/gbdebug/README.md
@@ -0,0 +1,26 @@
+# Gadgetbridge Debug
+
+This is useful if your Bangle isn't responding to the Gadgetbridge
+Android app properly.
+
+This app disables all existing Gadgetbridge handlers and then displays the
+messages that come from Gadgetbridge on the screen
+of the watch. It also saves the last 10 messages in a variable
+called `history`.
+
+More info on Gadgetbridge at http://www.espruino.com/Gadgetbridge
+
+## Usage
+
+* Run the `GB Debug` app on your Bangle
+* Connect your Bangle to Gadgetbridge
+* Do whatever was causing you problems (eg receiving a call)
+* The Gadgetbridge message should now be displayed on-screen
+
+If you want to get the *actual* data rather than copying it from the screen.
+
+* Ensure the `GB Debug` app is kept running after the above steps
+* Disconnect Gadgetbridge from the Bangle
+* Connect the Web IDE on your PC
+* Type `show()` on the left-hand side of the IDE and the
+last 10 messages from Gadgetbridge will be shown.
diff --git a/apps/gbdebug/app-icon.js b/apps/gbdebug/app-icon.js
new file mode 100644
index 000000000..a701ef3a9
--- /dev/null
+++ b/apps/gbdebug/app-icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("mEw4cBzsE/4AClMywH680rlOW9N9kmSpICnyBBBgQRMkBUDgIRKoBoGGRYAFHBGARpARHT5MJKxQAFLgzELCIlIBQkSCIsEPRKBHCIYbGoIRFiQRJhJgFCISeEBwMQOQykCCIqlBpMEBIgRHOQYRIYQbPDhAbBNwgRJVwOCTIgRFMAJKDgQRGOQprBCIMSGogHBJwwbBkC2FCJNbUgMNwHYBYPJCIhODju0yFNCIUGCJGCoE2NwO24EAmw1FHgWCpMGgQOBBIMwCJGSpMmyAjDCI6eBCIWAhu2I4IRCUIYREk+Ah3brEB2CzFAAIRCl3b23btsNCJckjoRC1h2CyAREtoNC9oDC2isCCIgHBjdt5MtCJj2CowjD2uyCIOSCI83lu123tAQIRI4EB28/++39/0mwRCoARCgbfByU51/3rev+mWCIQwCPok0EYIRB/gRDpJ+EcYQRJkARQdgq/Bl5HE7IRDZAltwAREyXbCIbIFgEfCIXsBwQCDQAYRNLgvfCIXtCI44Dm3JCIUlYoYCGkrjBk9bxMkyy9CChICFA="))
diff --git a/apps/gbdebug/app.js b/apps/gbdebug/app.js
new file mode 100644
index 000000000..ee5e46999
--- /dev/null
+++ b/apps/gbdebug/app.js
@@ -0,0 +1,21 @@
+E.showMessage("Waiting for message");
+Bangle.loadWidgets();
+Bangle.drawWidgets();
+
+var history = [];
+
+GB = function(e) {
+ if (history.length > 10)
+ history = history.slice(history.length-10);
+ history.push(e);
+
+ var s = JSON.stringify(e,null,2);
+
+ g.reset().clear(Bangle.appRect);
+ g.setFont("6x8").setFontAlign(-1,0);
+ g.drawString(s, 10, g.getHeight()/2);
+};
+
+function show() {
+ print(JSON.stringify(history,null,2));
+}
diff --git a/apps/gbdebug/app.png b/apps/gbdebug/app.png
new file mode 100644
index 000000000..f70bce7ad
Binary files /dev/null and b/apps/gbdebug/app.png differ
diff --git a/apps/gbmusic/ChangeLog b/apps/gbmusic/ChangeLog
index 9cebf0a31..316b98a84 100644
--- a/apps/gbmusic/ChangeLog
+++ b/apps/gbmusic/ChangeLog
@@ -5,3 +5,4 @@
0.05: Setting to disable double/triple press control, remove touch controls setting, reduce fadeout flicker
0.06: Bangle.js 2 support
0.07: Fix "previous" button image
+0.08: Fix scrolling title background color
diff --git a/apps/gbmusic/app.js b/apps/gbmusic/app.js
index f514dfccd..1bddf70f7 100644
--- a/apps/gbmusic/app.js
+++ b/apps/gbmusic/app.js
@@ -91,7 +91,7 @@ function rScroller(l) {
y = l.y+l.h/2;
l.offset = l.offset%w;
g.setClipRect(l.x, l.y, l.x+l.w-1, l.y+l.h-1)
- .setColor(l.col)
+ .setColor(l.col).setBgColor(l.bgCol) // need to set colors: iScroll calls this function outside Layout
.setFontAlign(-1, 0) // left center
.clearRect(l.x, l.y, l.x+l.w-1, l.y+l.h-1)
.drawString(l.label, l.x-l.offset+40, y)
diff --git a/apps/gbridge/ChangeLog b/apps/gbridge/ChangeLog
index fddb1eb80..67d421f33 100644
--- a/apps/gbridge/ChangeLog
+++ b/apps/gbridge/ChangeLog
@@ -24,3 +24,5 @@
0.22: Respect Quiet Mode
0.23: Allow notification dismiss to remove from phone too
0.24: tag HRM power requests to allow this to work alongside other widgets/apps (fix #799)
+0.25: workaround call notification
+ Fix inflated step number
diff --git a/apps/gbridge/widget.js b/apps/gbridge/widget.js
index 53f832b07..7cb7147ec 100644
--- a/apps/gbridge/widget.js
+++ b/apps/gbridge/widget.js
@@ -184,7 +184,7 @@
case "call":
var note = { size: 55, title: event.name, id: "call",
body: event.number, icon:require("heatshrink").decompress(atob("jEYwIMJj4CCwACJh4CCCIMOAQMGAQMHAQMDAQMBCIMB4PwgHz/EAn4CBj4CBg4CBgACCAAw="))}
- if (event.cmd === "incoming") {
+ if (event.cmd === "incoming" || event.cmd === "") {
require("notify").show(note);
if (!(require('Storage').readJSON('setting.json',1)||{}).quiet) {
Bangle.buzz();
@@ -262,7 +262,7 @@
// Send a summary of activity to Gadgetbridge
function sendActivity(hrm) {
var steps = currentSteps - lastSentSteps;
- lastSentSteps = 0;
+ lastSentSteps = currentSteps;
gbSend({ t: "act", stp: steps, hrm:hrm });
}
diff --git a/apps/golfscore/ChangeLog b/apps/golfscore/ChangeLog
new file mode 100644
index 000000000..4995dd59a
--- /dev/null
+++ b/apps/golfscore/ChangeLog
@@ -0,0 +1,2 @@
+0.01: New App!
+0.02: multiple player score support
\ No newline at end of file
diff --git a/apps/golfscore/README.md b/apps/golfscore/README.md
new file mode 100644
index 000000000..68552ad4b
--- /dev/null
+++ b/apps/golfscore/README.md
@@ -0,0 +1,37 @@
+# Golf Score
+
+Lets you keep track of strokes during a game of Golf.
+
+
+
+
+
+
+## Usage
+
+1. Open the app,
+1. scroll to setup
+2. set the number of holes (18 by default, but can be configured)
+3. set the number of players (4 by default, but can be 1-20)
+4. click back
+5. scroll to a hole (hole 1)
+6. scroll to a player and set the number of strokes they took (repeat as needed)
+7. click next hole and repeat #6 and #7 as needed; or click back
+8. at any time, check the score card for a sum total of all the strokes for each player
+
+## Features
+
+Track strokes for multiple players (1-20)
+Set number of holes on course
+
+## Controls
+
+N/A
+
+## Requests
+
+Michael Salaverry (github.com/barakplasma)
+
+## Creator
+
+Michael Salaverry
diff --git a/apps/golfscore/app-icon.js b/apps/golfscore/app-icon.js
new file mode 100644
index 000000000..238001688
--- /dev/null
+++ b/apps/golfscore/app-icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("mEwwIEBgOABQcD4AFDg1wAokYDokOAokDDwkBDwkADwn4nAFD/geDgP8gYFEDwn8gFgDocA+AFCkE/A4IABg//Aoc//4RDn/+Goc/8AFJj4FLEQYFGh4FLIAYFGg4FKh5sBApEfnhTEAok+Aol8vihEAon4AocB+F4ZQYFF8AFDg/AAocPAouAKYcfXQQFHjzEEhjvDA"))
diff --git a/apps/golfscore/app.js b/apps/golfscore/app.js
new file mode 100644
index 000000000..7c5c2d0e8
--- /dev/null
+++ b/apps/golfscore/app.js
@@ -0,0 +1,113 @@
+// @ts-check
+// @ts-ignore
+const menu = require("graphical_menu");
+/**
+ * @type {{showMenu: (config) => void}}
+ */
+let E;
+/**
+ * @type {{clear: () => void}}
+ */
+let g;
+
+let holes_count = 18;
+let player_count = 4;
+/**
+ * @type {number[][]}
+ */
+let course = new Array(holes_count).map(() => new Array(player_count).fill(0));
+
+const main_menu = {
+ "": {
+ "title": "-- Golf --"
+ },
+ "Setup": function () { E.showMenu(setup_menu); },
+ "Score Card": function () {
+ calculate_score();
+ E.showMenu(score_card);
+ },
+};
+
+function calculate_score() {
+ let scores = course.reduce((acc, hole) => {
+ hole.forEach((stroke_count, player) => {
+ acc[player] = acc[player]+stroke_count;
+ });
+ return acc;
+ }, new Array(player_count).fill(0));
+
+ score_card = {
+ "": {
+ "title": "score card"
+ },
+ "< Back": function () { E.showMenu(main_menu); },
+ };
+
+ for (let player = 0; player < player_count; player++) {
+ score_card["Player - " + (player + 1)] = {
+ value: scores[player]
+ };
+ }
+}
+
+let score_card = {};
+
+const setup_menu = {
+ "": {
+ "title": "-- Golf Setup --"
+ },
+ "Holes": {
+ value: holes_count,
+ min: 1, max: 20, step: 1, wrap: true,
+ onchange: v => { holes_count = v; add_holes(); }
+ },
+ "Players": {
+ value: player_count,
+ min: 1, max: 10, step: 1, wrap: true,
+ onchange: v => { player_count = v; }
+ },
+ "< Back": function () { E.showMenu(main_menu); },
+};
+
+function inc_hole(i, player) { return function (v) { course[i][player] = v; }; }
+
+function add_holes() {
+ for (let j = 0; j < 20; j++) {
+ delete main_menu["Hole - " + (j + 1)];
+ }
+ for (let i = 0; i < holes_count; i++) {
+ course[i] = new Array(player_count).fill(0);
+ main_menu["Hole - " + (i + 1)] = goto_hole_menu(i);
+ }
+ E.showMenu(main_menu);
+}
+
+function goto_hole_menu(i) {
+ return function () {
+ E.showMenu(hole_menu(i));
+ };
+}
+
+function hole_menu(i) {
+ let menu = {
+ "": {
+ "title": `-- Hole ${i + 1}--`
+ },
+ "Next hole": goto_hole_menu(i + 1),
+ "< Back": function () { E.showMenu(main_menu); },
+ };
+
+ for (let player = 0; player < player_count; player++) {
+ menu[`player - ${player + 1}`] = {
+ value: course[i][player],
+ min: 1, max: 20, step: 1, wrap: true,
+ onchange: inc_hole(i, player)
+ };
+ }
+
+ return menu;
+}
+
+// @ts-ignore
+g.clear();
+add_holes();
\ No newline at end of file
diff --git a/apps/golfscore/app.png b/apps/golfscore/app.png
new file mode 100644
index 000000000..fc5d51557
Binary files /dev/null and b/apps/golfscore/app.png differ
diff --git a/apps/golfscore/holemenu.png b/apps/golfscore/holemenu.png
new file mode 100644
index 000000000..ac214f182
Binary files /dev/null and b/apps/golfscore/holemenu.png differ
diff --git a/apps/golfscore/mainmenu.png b/apps/golfscore/mainmenu.png
new file mode 100644
index 000000000..3ebeb0ca7
Binary files /dev/null and b/apps/golfscore/mainmenu.png differ
diff --git a/apps/golfscore/scorecard.png b/apps/golfscore/scorecard.png
new file mode 100644
index 000000000..9e7ff1130
Binary files /dev/null and b/apps/golfscore/scorecard.png differ
diff --git a/apps/golfscore/setupmenu.png b/apps/golfscore/setupmenu.png
new file mode 100644
index 000000000..13158e2e7
Binary files /dev/null and b/apps/golfscore/setupmenu.png differ
diff --git a/apps/gpsrec/ChangeLog b/apps/gpsrec/ChangeLog
index cb22dd13f..365405846 100644
--- a/apps/gpsrec/ChangeLog
+++ b/apps/gpsrec/ChangeLog
@@ -28,3 +28,4 @@
0.24: Better support for Bangle.js 2, avoid widget area for Graphs, smooth graphs more
0.25: Fix issue where if Bangle.js 2 got a GPS fix but no reported time, errors could be caused by the widget (fix #935)
0.26: Multiple bugfixes
+0.27: Map drawing with light theme (fix #1023)
diff --git a/apps/gpsrec/README.md b/apps/gpsrec/README.md
index 72f744452..71b934111 100644
--- a/apps/gpsrec/README.md
+++ b/apps/gpsrec/README.md
@@ -8,3 +8,6 @@ This app allows you to record a GPS track. It can run in background. The data ca
When you turn on recording, a widget badge that looks like a satellite will appear immediately at the top of the screen. However, the recording does not begin immediately. It usually takes several minutes for the watch to get a [GPS fix](https://en.wikipedia.org/wiki/Time_to_first_fix). You will notice a blinking question mark at the lower left of the badge indicating currently getting a fix. The badge will change when a GPS fix is achieved and that is when the app actually starts writing data to the log file. You can [upload assistant files](https://banglejs.com/apps/#assisted%20gps%20update) to speed up the time spent on getting a GPS fix.
+## Viewing a track
+
+
diff --git a/apps/gpsrec/app.js b/apps/gpsrec/app.js
index df3353930..833a816ea 100644
--- a/apps/gpsrec/app.js
+++ b/apps/gpsrec/app.js
@@ -197,15 +197,14 @@ function plotTrack(info) {
g.setColor(1,0.5,0.5);
g.setFont("Vector",16);
g.drawString("Track"+info.fn.toString()+" - Loading",10,220);
- g.setColor(0,0,0);
+ g.setColor(g.theme.bg);
g.fillRect(0,220,239,239);
if (!info.qOSTM) {
g.setColor(1, 0, 0);
g.fillRect(9,80,11,120);
g.fillPoly([9,60,19,80,0,80]);
- g.setColor(1,1,1);
+ g.setColor(g.theme.fg);
g.drawString("N",2,40);
- g.setColor(1,1,1);
} else {
osm.lat = info.lat;
osm.lon = info.lon;
@@ -228,7 +227,7 @@ function plotTrack(info) {
g.setColor(0,1,0);
g.fillCircle(mp.x,mp.y,5);
if (info.qOSTM) g.setColor(1,0,0.55);
- else g.setColor(1,1,1);
+ else g.setColor(g.theme.fg);
l = f.readLine(f);
while(l!==undefined) {
c = l.split(",");
@@ -248,11 +247,11 @@ function plotTrack(info) {
g.setColor(1,0,0);
g.fillCircle(ox,oy,5);
if (info.qOSTM) g.setColor(0, 0, 0);
- else g.setColor(1,1,1);
+ else g.setColor(g.theme.fg);
g.drawString(require("locale").distance(dist),g.getWidth() / 2, g.getHeight() - 20);
g.setFont("6x8",2);
g.setFontAlign(0,0,3);
- g.drawString("Back",g.getWidth() - 10, g.getHeight() - 40);
+ g.drawString("Back",g.getWidth() - 10, g.getHeight()/2);
setWatch(function() {
viewTrack(info.fn, info);
}, global.BTN3||BTN1);
diff --git a/apps/gpsrec/screenshot.png b/apps/gpsrec/screenshot.png
new file mode 100644
index 000000000..f6e001749
Binary files /dev/null and b/apps/gpsrec/screenshot.png differ
diff --git a/apps/gpstouch/README.md b/apps/gpstouch/README.md
index 7329f9833..172b5da57 100644
--- a/apps/gpstouch/README.md
+++ b/apps/gpstouch/README.md
@@ -14,3 +14,5 @@



+
+Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)
diff --git a/apps/hebrew_calendar/ChangeLog b/apps/hebrew_calendar/ChangeLog
new file mode 100644
index 000000000..fdd29db66
--- /dev/null
+++ b/apps/hebrew_calendar/ChangeLog
@@ -0,0 +1,4 @@
+0.01: New App!
+0.02: using TS and rollup to bundle
+0.03: bug fixes and support bangle 1
+0.04: removing TS
\ No newline at end of file
diff --git a/apps/hebrew_calendar/LICENSE b/apps/hebrew_calendar/LICENSE
new file mode 100644
index 000000000..bdcdec9e4
--- /dev/null
+++ b/apps/hebrew_calendar/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+Copyright (c) 2021 Michael Salaverry
+Copyright (c) 2016-20 Ionică Bizău (https://ionicabizau.net)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/apps/hebrew_calendar/README.md b/apps/hebrew_calendar/README.md
new file mode 100644
index 000000000..7a96a97db
--- /dev/null
+++ b/apps/hebrew_calendar/README.md
@@ -0,0 +1,26 @@
+# Hebrew Calendar
+
+Displays the current hebrew calendar date
+Add screen shots (if possible) to the app folder and link then into this file with 
+
+## Usage
+
+Open the app, and it shows a menu with the date components
+
+## Features
+
+Shows the hebrew date, month, and year; alongside the gregorian date
+
+## Controls
+
+Name the buttons and what they are used for
+
+## Requests
+
+Michael Salaverry (github.com/barakplasma)
+
+## Creator
+
+Michael Salaverry
+with help from https://github.com/IonicaBizau/hebrew-date (MIT license)
+
\ No newline at end of file
diff --git a/apps/hebrew_calendar/app-icon.js b/apps/hebrew_calendar/app-icon.js
new file mode 100644
index 000000000..b6b0a53ae
--- /dev/null
+++ b/apps/hebrew_calendar/app-icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("AAODFVM//4AC+Betj4zD/Azth4zD/jY/RKgAD8CJuet0HGY71uADsBKo4AC/w0nGZX/Gc9/GZWAWv5WVRkzyLRlAzN4C2/Kyv//jyx//+Gcc/NBy3/Ky3/+Azhj4zP/Azhh4zP/i5/KyoAB4Azfg4zR8AzfgYzR+C7/KyoABGb0BGaeAGjwzT4C9/AAMfK6f8GbsPGafwGbs/Gaf4Xv8Ag5WTAAOAGbcDGavAGbcBGavgX/8/K6vwGbcfGav4GbcPGav8X30BKyoAB4AzZg4zX8AzZgYzXwC/9v5XX/AzZn4zX/gzZj4zX/y+8gZWXAAIzYgIzZwA0YGbPAX/cfK7PgGa8PGbPwGa8HGbP4X/ZWZ//8Ga9/GbP+Ga8/NDS+6g5Wa/+AGasDGbfAGasBGbfgX/M/I5f8B4JXM+AzVj4jL/wPBv4PL/AzVh5YMO6IA2gKtRLJSbCACatRaJYzVcZStGaJeAX/4AC8ATHRhXAGacHeSCMMI5AALgbyQI5i/4O5JWICha/e/gUJn6/neRAABj4UTAFt/II/+CpaMIahSqTCpbUTVSQdMPqoAqgZ1IwAWLg6hUAA0BDhHAJUTdP8BKiX+RWMAAMfC6wADh4bH+AXlAAcHDY/4C6y/2U5DXmU5mAC5sBX8anPa6wAnHzF/DA38GaIaYn4YG/wzRDTEfQI6/94AYPgK/h8AYPg6/hwAYPga/8OPf4GaKLH4AYPgIYG/gzRv4aG8C/7+AaqX7UfX68PUjIaaAEM/Hg2AX9SkYbTSkHQSUBDQ38X/Q7UX73+Gad/X6wXGX6aDcADz7H8AcTU67XXAAcPU6zXXAAcHGY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yHxVtPmC//QEi/cf0K//AD/2X5W3X9/7HZICBPeK//AAi/KQai/aDQzgaX/4Ai/a/Lt6/r/o4Ktu3PWS//AAq/Ltu/X9Q4eX/4An/qGL2y/pGpfbt55zX/4AGX5nbv6/mGrq//AFahGAQ+/X8gyMbqK//AFi/N2y/jGTi//AGCMN7d/X8AvNtu/X/6/+/qPO26/d/bvOt522X/4AJX5wCBX7f2Fh9/X/6//Ug4CK26/X/YpPbRa//JO6VS7d/X6gmQdJK//X/f/9qYRWYq/LBYwCNOfK//ABi/SAQS/LECnbv6//X/4AGU4wCva4S//X/4AG/a/z25x7X/4AO9q/yOHi//AB6/xv6//X/4AM/y/v75v9X/4ARX9u/Nvy//ACS/rt5s/X/4AS/y/p75r/X/4AVX8+/NH6//AC6/lv5m/X/4AZX8Zj/X/4Ac/q/gMP6//AD3+X7vfL/6//AEP9X7Rb/X/4AlX65X/X/4Ap+y/SKf6//AFy8Nv5O/X/4Az/y8F75H/X/6//I/6//X/5H/X/6//I/6//X/5H/X/6//I/6//X/5H/X/6//I/6//X/5H/X/6//I/6//X/5H/X/6//I/6//X/5H/X/6//I/6//X/5H/X/6//I/6//X/5H/X/6//I/6//X/5H/X/6//I/6//X/5H/X/6//I/6//X/5H/X/6//I/6//X/5H/X/6//I/6//X/5H/X/4Al+ytFAUhr/X/4ASXlICD36//X/4AO/y8rAQffX/6//ABq8tAQd/X/6//ABftX+NtX/6//ABX7XmACC26//X/4AJXmICDX/6//ABH2X+vbX/6//AA680AQV/X/6//AAv9X+9vX/6//AAvtX+9tX/6//AAq82AQW/X/6//AAf7X/O3X/6//AAa83AQa//X/6//X/6//AAX+X/ffX/6//AAP2X/fbX/6//X/6//X/4ABXnQCCv6//X/6//X/6///q/9t6//X/6//X/6//9q/9tq//X/6//X/6//X/6//X/688AQW/X/6//X/6//X/6//X/6//X/6//X/6//X/6/9/a//X/6//X/+3X/6//X/6//X/6//X/6//X/6//X/6//X/6//X/6//X/v/X/+/X/6//X/6//X/3tX/x22X/4AI/q/9t6//X///X/t/X/6////2X/h13X/4A/AH6//AH4A/X/4A/AH6//AH4A/X/4A/AH6//AH4A/X/4A/AH6//AH4A/X/4A/AH6//AH4A/X/4A/AH6//AH4A/X/4A/AH6//AH4A/X/4A/AH6/Qg5R/AH4At8C//AH6//X/4A/X/6/PgBR/AH4AtXyC//AH6//X/4A/X/8Aj5S/AH4Ar/C/RgZT/AH4Ar4C//AH6//X6MAv5U/AH4Ap/y+SgEPKv4A/AFPwX6cBKv4A/AFOAX/4A/X/6/TgEHK34A/AE/gXygABK/4A/AE6+WgEfLH4A/AEv4X68Av5a/AH4Aj/y+YgEBLf4A/AEeAX7MAg5c/AH4Ah8C+aAAV/L/4A/ADv+V54"))
\ No newline at end of file
diff --git a/apps/hebrew_calendar/app.js b/apps/hebrew_calendar/app.js
new file mode 100644
index 000000000..399d124f3
--- /dev/null
+++ b/apps/hebrew_calendar/app.js
@@ -0,0 +1,26 @@
+g.clear();
+
+let now = new Date();
+
+let today = require('hebrewDate').hebrewDate(now);
+
+var mainmenu = {
+ "": {
+ "title": "Hebrew Date"
+ },
+ greg: {
+ // @ts-ignore
+ value: require('locale').date(now, 1),
+ },
+ date: {
+ value: today.date,
+ },
+ month: {
+ value: today.month_name,
+ },
+ year: {
+ value: today.year,
+ }
+};
+// @ts-ignore
+E.showMenu(mainmenu);
\ No newline at end of file
diff --git a/apps/hebrew_calendar/app.png b/apps/hebrew_calendar/app.png
new file mode 100644
index 000000000..0dae731cd
Binary files /dev/null and b/apps/hebrew_calendar/app.png differ
diff --git a/apps/hebrew_calendar/hebrewDate.js b/apps/hebrew_calendar/hebrewDate.js
new file mode 100644
index 000000000..da0c9cf50
--- /dev/null
+++ b/apps/hebrew_calendar/hebrewDate.js
@@ -0,0 +1,311 @@
+/*!
+ * This script was taked from this page http://www.shamash.org/help/javadate.shtml and ported to Node.js by Ionică Bizău in https://github.com/IonicaBizau/hebrew-date
+ *
+ * This script was adapted from C sources written by
+ * Scott E. Lee, which contain the following copyright notice:
+ *
+ * Copyright 1993-1995, Scott E. Lee, all rights reserved.
+ * Permission granted to use, copy, modify, distribute and sell so long as
+ * the above copyright and this permission statement are retained in all
+ * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
+ *
+ * Bill Hastings
+ * RBI Software Systems
+ * bhastings@rbi.com
+ */
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
+var GREG_SDN_OFFSET = 32045, DAYS_PER_5_MONTHS = 153, DAYS_PER_4_YEARS = 1461, DAYS_PER_400_YEARS = 146097;
+var HALAKIM_PER_HOUR = 1080, HALAKIM_PER_DAY = 25920, HALAKIM_PER_LUNAR_CYCLE = 29 * HALAKIM_PER_DAY + 13753, HALAKIM_PER_METONIC_CYCLE = HALAKIM_PER_LUNAR_CYCLE * (12 * 19 + 7);
+var HEB_SDN_OFFSET = 347997, NEW_MOON_OF_CREATION = 31524, NOON = 18 * HALAKIM_PER_HOUR, AM3_11_20 = 9 * HALAKIM_PER_HOUR + 204, AM9_32_43 = 15 * HALAKIM_PER_HOUR + 589;
+var SUN = 0, MON = 1, TUES = 2, WED = 3, THUR = 4, FRI = 5, SAT = 6;
+function weekdayarr(d0, d1, d2, d3, d4, d5, d6) {
+ this[0] = d0;
+ this[1] = d1;
+ this[2] = d2;
+ this[3] = d3;
+ this[4] = d4;
+ this[5] = d5;
+ this[6] = d6;
+}
+function gregmontharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11) {
+ this[0] = m0;
+ this[1] = m1;
+ this[2] = m2;
+ this[3] = m3;
+ this[4] = m4;
+ this[5] = m5;
+ this[6] = m6;
+ this[7] = m7;
+ this[8] = m8;
+ this[9] = m9;
+ this[10] = m10;
+ this[11] = m11;
+}
+function hebrewmontharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13) {
+ this[0] = m0;
+ this[1] = m1;
+ this[2] = m2;
+ this[3] = m3;
+ this[4] = m4;
+ this[5] = m5;
+ this[6] = m6;
+ this[7] = m7;
+ this[8] = m8;
+ this[9] = m9;
+ this[10] = m10;
+ this[11] = m11;
+ this[12] = m12;
+ this[13] = m13;
+}
+function monthsperyeararr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, m16, m17, m18) {
+ this[0] = m0;
+ this[1] = m1;
+ this[2] = m2;
+ this[3] = m3;
+ this[4] = m4;
+ this[5] = m5;
+ this[6] = m6;
+ this[7] = m7;
+ this[8] = m8;
+ this[9] = m9;
+ this[10] = m10;
+ this[11] = m11;
+ this[12] = m12;
+ this[13] = m13;
+ this[14] = m14;
+ this[15] = m15;
+ this[16] = m16;
+ this[17] = m17;
+ this[18] = m18;
+}
+var gWeekday = new weekdayarr("Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur"), gMonth = new gregmontharr("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"), hMonth = new hebrewmontharr("Tishri", "Heshvan", "Kislev", "Tevet", "Shevat", "AdarI", "AdarII", "Nisan", "Iyyar", "Sivan", "Tammuz", "Av", "Elul"), mpy = new monthsperyeararr(12, 12, 13, 12, 12, 13, 12, 13, 12, 12, 13, 12, 12, 13, 12, 12, 13, 12, 13);
+/**
+ * hebrewDate
+ * Convert the Gregorian dates into Hebrew calendar dates.
+ *
+ * @name hebrewDate
+ * @function
+ * @param {Date|Number} inputDate The date object (representing the Gregorian date) or the year.
+ * @return {Object} An object containing:
+ *
+ * - `year`: The Hebrew year.
+ * - `month`: The Hebrew month.
+ * - `month_name`: The Hebrew month name.
+ * - `date`: The Hebrew date.
+ */
+function hebrewDate(inputDateOrYear) {
+ var inputMonth, inputDate;
+ var hebrewMonth = 0, hebrewDate = 0, hebrewYear = 0, metonicCycle = 0, metonicYear = 0, moladDay = 0, moladHalakim = 0;
+ function GregorianToSdn(inputYear, inputMonth, inputDay) {
+ var year = 0, month = 0, sdn = void 0;
+ // Make year a positive number
+ if (inputYear < 0) {
+ year = inputYear + 4801;
+ }
+ else {
+ year = inputYear + 4800;
+ }
+ // Adjust the start of the year
+ if (inputMonth > 2) {
+ month = inputMonth - 3;
+ }
+ else {
+ month = inputMonth + 9;
+ year--;
+ }
+ sdn = Math.floor(Math.floor(year / 100) * DAYS_PER_400_YEARS / 4);
+ sdn += Math.floor(year % 100 * DAYS_PER_4_YEARS / 4);
+ sdn += Math.floor((month * DAYS_PER_5_MONTHS + 2) / 5);
+ sdn += inputDay - GREG_SDN_OFFSET;
+ return sdn;
+ }
+ function SdnToHebrew(sdn) {
+ var tishri1 = 0, tishri1After = 0, yearLength = 0, inputDay = sdn - HEB_SDN_OFFSET;
+ FindTishriMolad(inputDay);
+ tishri1 = Tishri1(metonicYear, moladDay, moladHalakim);
+ if (inputDay >= tishri1) {
+ // It found Tishri 1 at the start of the year.
+ hebrewYear = metonicCycle * 19 + metonicYear + 1;
+ if (inputDay < tishri1 + 59) {
+ if (inputDay < tishri1 + 30) {
+ hebrewMonth = 1;
+ hebrewDate = inputDay - tishri1 + 1;
+ }
+ else {
+ hebrewMonth = 2;
+ hebrewDate = inputDay - tishri1 - 29;
+ }
+ return;
+ }
+ // We need the length of the year to figure this out,so find Tishri 1 of the next year.
+ moladHalakim += HALAKIM_PER_LUNAR_CYCLE * mpy[metonicYear];
+ moladDay += Math.floor(moladHalakim / HALAKIM_PER_DAY);
+ moladHalakim = moladHalakim % HALAKIM_PER_DAY;
+ tishri1After = Tishri1((metonicYear + 1) % 19, moladDay, moladHalakim);
+ }
+ else {
+ // It found Tishri 1 at the end of the year.
+ hebrewYear = metonicCycle * 19 + metonicYear;
+ if (inputDay >= tishri1 - 177) {
+ // It is one of the last 6 months of the year.
+ if (inputDay > tishri1 - 30) {
+ hebrewMonth = 13;
+ hebrewDate = inputDay - tishri1 + 30;
+ }
+ else if (inputDay > tishri1 - 60) {
+ hebrewMonth = 12;
+ hebrewDate = inputDay - tishri1 + 60;
+ }
+ else if (inputDay > tishri1 - 89) {
+ hebrewMonth = 11;
+ hebrewDate = inputDay - tishri1 + 89;
+ }
+ else if (inputDay > tishri1 - 119) {
+ hebrewMonth = 10;
+ hebrewDate = inputDay - tishri1 + 119;
+ }
+ else if (inputDay > tishri1 - 148) {
+ hebrewMonth = 9;
+ hebrewDate = inputDay - tishri1 + 148;
+ }
+ else {
+ hebrewMonth = 8;
+ hebrewDate = inputDay - tishri1 + 178;
+ }
+ return;
+ }
+ else {
+ if (mpy[(hebrewYear - 1) % 19] == 13) {
+ hebrewMonth = 7;
+ hebrewDate = inputDay - tishri1 + 207;
+ if (hebrewDate > 0)
+ return;
+ hebrewMonth--;
+ hebrewDate += 30;
+ if (hebrewDate > 0)
+ return;
+ hebrewMonth--;
+ hebrewDate += 30;
+ }
+ else {
+ hebrewMonth = 6;
+ hebrewDate = inputDay - tishri1 + 207;
+ if (hebrewDate > 0)
+ return;
+ hebrewMonth--;
+ hebrewDate += 30;
+ }
+ if (hebrewDate > 0)
+ return;
+ hebrewMonth--;
+ hebrewDate += 29;
+ if (hebrewDate > 0)
+ return;
+ // We need the length of the year to figure this out,so find Tishri 1 of this year.
+ tishri1After = tishri1;
+ FindTishriMolad(moladDay - 365);
+ tishri1 = Tishri1(metonicYear, moladDay, moladHalakim);
+ }
+ }
+ yearLength = tishri1After - tishri1;
+ moladDay = inputDay - tishri1 - 29;
+ if (yearLength == 355 || yearLength == 385) {
+ // Heshvan has 30 days
+ if (moladDay <= 30) {
+ hebrewMonth = 2;
+ hebrewDate = moladDay;
+ return;
+ }
+ moladDay -= 30;
+ }
+ else {
+ // Heshvan has 29 days
+ if (moladDay <= 29) {
+ hebrewMonth = 2;
+ hebrewDate = moladDay;
+ return;
+ }
+ moladDay -= 29;
+ }
+ // It has to be Kislev.
+ hebrewMonth = 3;
+ hebrewDate = moladDay;
+ }
+ function FindTishriMolad(inputDay) {
+ // Estimate the metonic cycle number. Note that this may be an under
+ // estimate because there are 6939.6896 days in a metonic cycle not
+ // 6940,but it will never be an over estimate. The loop below will
+ // correct for any error in this estimate.
+ metonicCycle = Math.floor((inputDay + 310) / 6940);
+ // Calculate the time of the starting molad for this metonic cycle.
+ MoladOfMetonicCycle();
+ // If the above was an under estimate,increment the cycle number until
+ // the correct one is found. For modern dates this loop is about 98.6%
+ // likely to not execute,even once,because the above estimate is
+ // really quite close.
+ while (moladDay < inputDay - 6940 + 310) {
+ metonicCycle++;
+ moladHalakim += HALAKIM_PER_METONIC_CYCLE;
+ moladDay += Math.floor(moladHalakim / HALAKIM_PER_DAY);
+ moladHalakim = moladHalakim % HALAKIM_PER_DAY;
+ }
+ // Find the molad of Tishri closest to this date.
+ for (metonicYear = 0; metonicYear < 18; metonicYear++) {
+ if (moladDay > inputDay - 74)
+ break;
+ moladHalakim += HALAKIM_PER_LUNAR_CYCLE * mpy[metonicYear];
+ moladDay += Math.floor(moladHalakim / HALAKIM_PER_DAY);
+ moladHalakim = moladHalakim % HALAKIM_PER_DAY;
+ }
+ }
+ function MoladOfMetonicCycle() {
+ var r1 = void 0, r2 = void 0, d1 = void 0, d2 = void 0;
+ // Start with the time of the first molad after creation.
+ r1 = NEW_MOON_OF_CREATION;
+ // Calculate gMetonicCycle * HALAKIM_PER_METONIC_CYCLE. The upper 32
+ // bits of the result will be in r2 and the lower 16 bits will be in r1.
+ r1 += metonicCycle * (HALAKIM_PER_METONIC_CYCLE & 0xFFFF);
+ r2 = r1 >> 16;
+ r2 += metonicCycle * (HALAKIM_PER_METONIC_CYCLE >> 16 & 0xFFFF);
+ // Calculate r2r1 / HALAKIM_PER_DAY. The remainder will be in r1,the
+ // upper 16 bits of the quotient will be in d2 and the lower 16 bits
+ // will be in d1.
+ d2 = Math.floor(r2 / HALAKIM_PER_DAY);
+ r2 -= d2 * HALAKIM_PER_DAY;
+ r1 = r2 << 16 | r1 & 0xFFFF;
+ d1 = Math.floor(r1 / HALAKIM_PER_DAY);
+ r1 -= d1 * HALAKIM_PER_DAY;
+ moladDay = d2 << 16 | d1;
+ moladHalakim = r1;
+ }
+ function Tishri1(metonicYear, moladDay, moladHalakim) {
+ var tishri1 = moladDay, dow = tishri1 % 7, leapYear = metonicYear == 2 || metonicYear == 5 || metonicYear == 7 || metonicYear == 10 || metonicYear == 13 || metonicYear == 16 || metonicYear == 18, lastWasLeapYear = metonicYear == 3 || metonicYear == 6 || metonicYear == 8 || metonicYear == 11 || metonicYear == 14 || metonicYear == 17 || metonicYear == 0;
+ // Apply rules 2,3 and 4
+ if (moladHalakim >= NOON || !leapYear && dow == TUES && moladHalakim >= AM3_11_20 || lastWasLeapYear && dow == MON && moladHalakim >= AM9_32_43) {
+ tishri1++;
+ dow++;
+ if (dow == 7)
+ dow = 0;
+ }
+ // Apply rule 1 after the others because it can cause an additional delay of one day.
+ if (dow == WED || dow == FRI || dow == SUN) {
+ tishri1++;
+ }
+ return tishri1;
+ }
+ var inputYear = inputDateOrYear;
+ if ((typeof inputYear === "undefined" ? "undefined" : _typeof(inputYear)) === "object") {
+ inputMonth = inputDateOrYear.getMonth() + 1;
+ inputDate = inputDateOrYear.getDate();
+ inputYear = inputDateOrYear.getFullYear();
+ }
+ SdnToHebrew(GregorianToSdn(inputYear, inputMonth, inputDate));
+ return {
+ year: hebrewYear,
+ month: hebrewMonth,
+ date: hebrewDate,
+ month_name: hMonth[hebrewMonth - 1]
+ };
+}
+
+exports.hebrewDate = hebrewDate;
diff --git a/apps/impwclock/ChangeLog b/apps/impwclock/ChangeLog
index 0592d4d04..7bc119426 100644
--- a/apps/impwclock/ChangeLog
+++ b/apps/impwclock/ChangeLog
@@ -1,3 +1,4 @@
0.01: New App!
0.02: Stopped watchface from flashing every interval
0.03: Move to Bangle.setUI to launcher support
+0.04: Tweaks for compatibility with BangleJS2
diff --git a/apps/impwclock/README.md b/apps/impwclock/README.md
index 30e42c95e..ac1341097 100644
--- a/apps/impwclock/README.md
+++ b/apps/impwclock/README.md
@@ -1,4 +1,4 @@
# Imprecise Word Clock
-This clock tells time in very rough approximation, as in "Late morning" or "Early afternoon." Good for vacations and weekends. Press button 1 to see the time in accurate, digital form. But do you really need to know the exact time?
+This clock tells time in very rough approximation, as in "Late morning" or "Early afternoon." Good for vacations and weekends. Touch the screen to see the time in accurate, digital form. But do you really need to know the exact time?
diff --git a/apps/impwclock/clock-impword.js b/apps/impwclock/clock-impword.js
index 5492eac15..8bb5da6ba 100644
--- a/apps/impwclock/clock-impword.js
+++ b/apps/impwclock/clock-impword.js
@@ -2,7 +2,7 @@
A remix of word clock
by Gordon Williams https://github.com/gfwilliams
- Changes the representation of time to be more general
-- Shows accurate digital time when button 1 is pressed
+- Toggles showing of accurate digital time when screen touched.
*/
/* jshint esversion: 6 */
@@ -34,14 +34,16 @@ const timeOfDay = {
};
+var big = g.getWidth()>200;
// offsets and increments
-const xs = 35;
-const ys = 31;
-const dy = 22;
-const dx = 25;
+const xs = big ? 35 : 20;
+const ys = big ? 31 : 28;
+const dx = big ? 25 : 20;
+const dy = big ? 22 : 16;
+
// font size and color
-const fontSize = 3; // "6x8"
+const fontSize = big ? 3 : 2; // "6x8"
const passivColor = 0x3186 /*grey*/ ;
const activeColorNight = 0xF800 /*red*/ ;
const activeColorDay = 0xFFFF /* white */;
@@ -115,6 +117,8 @@ function drawWordClock() {
// check whether we need to redraw the watchface
if (hidx !== hidxPrev) {
+ // Turn off showDigitalTime
+ showDigitalTime = false;
// draw allWords
var c;
var y = ys;
@@ -138,15 +142,14 @@ function drawWordClock() {
hidxPrev = hidx;
}
- // Display digital time while button 1 is pressed
- g.clearRect(0, 215, 240, 240);
+ // Display digital time when button is pressed or screen touched
+ g.clearRect(0, big ? 215 : 160, big ? 240 : 176, big ? 240 : 176);
if (showDigitalTime){
g.setColor(activeColor);
- g.drawString(time, 120, 215);
+ g.drawString(time, big ? 120 : 90, big ? 215 : 160);
}
}
-
Bangle.on('lcdPower', function(on) {
if (on) drawWordClock();
});
@@ -157,17 +160,14 @@ Bangle.drawWidgets();
setInterval(drawWordClock, 1E4);
drawWordClock();
-// Show digital time while top button is pressed (if we have physical buttons)
-if (global.BTN3) setWatch(function() {
- showDigitalTime = BTN1.read();
- drawWordClock();
-}, BTN1, {repeat:true,edge:"both"});
-// If LCD pressed (on Bangle.js 2) draw digital time
-Bangle.on('drag',e=>{
- var pressed = e.b!=0;
- if (pressed!=showDigitalTime) {
- showDigitalTime = pressed;
+// If LCD pressed, toggle drawing digital time
+Bangle.on('touch',e=>{
+ if (showDigitalTime){
+ showDigitalTime = false;
+ drawWordClock();
+ } else {
+ showDigitalTime = true;
drawWordClock();
}
});
diff --git a/apps/ios/ChangeLog b/apps/ios/ChangeLog
index 895f50e04..5e60068aa 100644
--- a/apps/ios/ChangeLog
+++ b/apps/ios/ChangeLog
@@ -1,3 +1,10 @@
0.01: New App!
0.02: Remove messages on disconnect
0.03: Handling of message actions (ok/clear)
+0.04: Added common bundleId's
+0.05: Added more bundleId's (app-id's which can be used to
+ determine a friendly app name in the notifications)
+0.06: Fix (not) popupping up old messages
+0.07: Added more details from music (instead of Undefined)
+ Added more app identifiers
+
diff --git a/apps/ios/README.md b/apps/ios/README.md
new file mode 100644
index 000000000..b4c2c6ac9
--- /dev/null
+++ b/apps/ios/README.md
@@ -0,0 +1,31 @@
+# iOS integration app
+
+This is the iOS integration app for Bangle.js. This app allows you to receive
+notifications from your iPhone. The Apple Notification Center Service (ANCS)
+sends all the messages to your watch.
+
+You can allow this if you connect your Bangle to your iPhone. It will be
+prompted for immediatly after you connect the Bangle to the iPhone.
+
+### Connecting your Bangle(2).js to your iPhone
+The Bangle watches are Bluetooth Low Energy (BLE) devices. Sometimes they
+will not be seen/detected by the Bluetooth scanner in your iPhone settings
+menu.
+
+To resolve this, you can download numerous apps who can actually scan
+for BLE devices. There are great ones out there, free and paid.
+
+We really like WebBLE, which we also recommend to load apps on your
+watch with your iOS device, as Safari does not support WebBluetooth
+for now. It's just a few bucks/pounds/euro's.
+
+If you like to try a free app first, you can always use NRF Toolbox or
+Bluetooth BLE Device Finder to find and connect your Bangle.
+
+## Requests
+
+Please file any issues on https://github.com/espruino/BangleApps/issues/new?title=ios%20app
+
+## Creator
+
+Gordon Williams
diff --git a/apps/ios/boot.js b/apps/ios/boot.js
index c3a30170d..8ccfb617d 100644
--- a/apps/ios/boot.js
+++ b/apps/ios/boot.js
@@ -26,6 +26,13 @@ E.on('ANCS',msg=>{
function ancsHandler() {
var msg = Bangle.ancsMessageQueue[0];
NRF.ancsGetNotificationInfo( msg.uid ).then( info => {
+
+ if(msg.preExisting === true){
+ info.new = false;
+ } else {
+ info.new = true;
+ }
+
E.emit("notify", Object.assign(msg, info));
Bangle.ancsMessageQueue.shift();
if (Bangle.ancsMessageQueue.length)
@@ -49,27 +56,66 @@ E.on('notify',msg=>{
"message" : string,
"messageSize" : string,
"date" : string,
+ "new" : boolean,
"posAction" : string,
"negAction" : string,
"name" : string,
*/
var appNames = {
- "com.netflix.Netflix" : "Netflix",
- "com.google.ios.youtube" : "YouTube",
+ "com.apple.facetime": "FaceTime",
+ "com.apple.mobilecal": "Calendar",
+ "com.apple.mobilemail": "Mail",
+ "com.apple.mobilephone": "Phone",
+ "com.apple.MobileSMS": "SMS Message",
+ "com.apple.Passbook": "iOS Wallet",
+ "com.apple.podcasts": "Podcasts",
+ "com.apple.reminders": "Reminders",
+ "com.apple.shortcuts": "Shortcuts",
+ "com.atebits.Tweetie2": "Twitter",
+ "com.burbn.instagram" : "Instagram",
+ "com.facebook.Facebook": "Facebook",
+ "com.facebook.Messenger": "Messenger",
+ "com.google.Chromecast" : "Google Home",
+ "com.google.Gmail" : "GMail",
"com.google.hangouts" : "Hangouts",
+ "com.google.ios.youtube" : "YouTube",
+ "com.hammerandchisel.discord" : "Discord",
+ "com.ifttt.ifttt" : "IFTTT",
+ "com.jumbo.app" : "Jumbo",
+ "com.linkedin.LinkedIn" : "LinkedIn",
+ "com.microsoft.Office.Outlook" : "Outlook Mail",
+ "com.nestlabs.jasper.release" : "Nest",
+ "com.netflix.Netflix" : "Netflix",
+ "com.reddit.Reddit" : "Reddit",
+ "com.skype.skype": "Skype",
"com.skype.SkypeForiPad": "Skype",
- "com.atebits.Tweetie2": "Twitter"
+ "com.spotify.client": "Spotify",
+ "com.strava.stravaride": "Strava",
+ "com.tinyspeck.chatlyio": "Slack",
+ "com.toyopagroup.picaboo": "Snapchat",
+ "com.ubercab.UberClient": "Uber",
+ "com.ubercab.UberEats": "UberEats",
+ "com.vilcsak.bitcoin2": "Coinbase",
+ "com.wordfeud.free": "WordFeud",
+ "com.zhiliaoapp.musically": "TikTok",
+ "net.whatsapp.WhatsApp": "WhatsApp",
+ "nl.ah.Appie": "Albert Heijn",
+ "nl.postnl.TrackNTrace": "PostNL",
+ "ph.telegra.Telegraph": "Telegram",
+ "tv.twitch": "Twitch",
+
// could also use NRF.ancsGetAppInfo(msg.appId) here
};
var unicodeRemap = {
'2019':"'"
};
var replacer = ""; //(n)=>print('Unknown unicode '+n.toString(16));
- if (appNames[msg.appId]) msg.a
+ //if (appNames[msg.appId]) msg.a
require("messages").pushMessage({
t : msg.event,
id : msg.uid,
src : appNames[msg.appId] || msg.appId,
+ new : msg.new,
title : msg.title&&E.decodeUTF8(msg.title, unicodeRemap, replacer),
subject : msg.subtitle&&E.decodeUTF8(msg.subtitle, unicodeRemap, replacer),
body : msg.message&&E.decodeUTF8(msg.message, unicodeRemap, replacer)
@@ -82,9 +128,10 @@ E.on('AMS',a=>{
function push(m) {
var msg = { t : "modify", id : "music", title:"Music" };
if (a.id=="artist") msg.artist = m;
- else if (a.id=="album") msg.artist = m;
- else if (a.id=="title") msg.tracl = m;
- else return; // duration? need to reformat
+ else if (a.id=="album") msg.album = m;
+ else if (a.id=="title") msg.track = m;
+ else if (a.id=="duration") msg.dur = m;
+ else return;
require("messages").pushMessage(msg);
}
if (a.truncated) NRF.amsGetMusicInfo(a.id).then(push)
diff --git a/apps/lapcounter/ChangeLog b/apps/lapcounter/ChangeLog
new file mode 100644
index 000000000..9db0e26c5
--- /dev/null
+++ b/apps/lapcounter/ChangeLog
@@ -0,0 +1 @@
+0.01: first release
diff --git a/apps/lapcounter/README.md b/apps/lapcounter/README.md
new file mode 100644
index 000000000..8866955e4
--- /dev/null
+++ b/apps/lapcounter/README.md
@@ -0,0 +1,19 @@
+# Lap Counter
+
+Click button to count laps (e.g. in a swimming pool).
+Also shows total duration snapshot (like a stopwatch, but laid back).
+
+
+
+## Usage
+
+* Click BTN1 to start counting. Counter becomes `0`, duration becomes `00:00.0`
+* Each time you click BTN1, counter is incremented, and you see duration between first and last clicks.
+
+## Features
+
+Disables LCD timeout (so that you can be _sure_ what BTN1 would do).
+
+## Creator
+
+[Nimrod Kerrett](https://zzzen.com)
diff --git a/apps/lapcounter/app-icon.js b/apps/lapcounter/app-icon.js
new file mode 100644
index 000000000..a443b3a41
--- /dev/null
+++ b/apps/lapcounter/app-icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("mEwwkBiIA/AH4A/AAkQgEBAREAC6oABdZQXkI6wuKC5iPUFxoXIOpoX/C6QFCC6IsCC6ZEDC/4XcPooXOFgoXQIgwX/C7IUFC5wsIC5ouCC6hcJC5h1DF9YwBChCPOAH4A/AH4Ap"))
diff --git a/apps/lapcounter/app.js b/apps/lapcounter/app.js
new file mode 100644
index 000000000..215f6140a
--- /dev/null
+++ b/apps/lapcounter/app.js
@@ -0,0 +1,53 @@
+const w = g.getWidth();
+const h = g.getHeight();
+const wid_h = 24;
+let tStart;
+let tNow;
+let counter=-1;
+
+const icon = require("heatshrink").decompress(atob("mEwwkBiIA/AH4A/AAkQgEBAREAC6oABdZQXkI6wuKC5iPUFxoXIOpoX/C6QFCC6IsCC6ZEDC/4XcPooXOFgoXQIgwX/C7IUFC5wsIC5ouCC6hcJC5h1DF9YwBChCPOAH4A/AH4Ap"));
+
+function timeToText(t) { // Courtesy of stopwatch app
+ let hrs = Math.floor(t/3600000);
+ let mins = Math.floor(t/60000)%60;
+ let secs = Math.floor(t/1000)%60;
+ let tnth = Math.floor(t/100)%10;
+ let text;
+
+ if (hrs === 0)
+ text = ("0"+mins).substr(-2) + ":" + ("0"+secs).substr(-2) + "." + tnth;
+ else
+ text = ("0"+hrs) + ":" + ("0"+mins).substr(-2) + ":" + ("0"+secs).substr(-2);
+ //log_debug(text);
+ return text;
+}
+
+function doCounter() {
+ if (counter<0) {
+ tStart = Date.now();
+ tNow = tStart;
+ } else {
+ tNow = Date.now();
+ }
+ counter++;
+ let dT = tNow-tStart;
+
+ g.clearRect(0,wid_h,w,h-wid_h);
+ g.setFontAlign(0,0);
+ g.setFont("Vector",72);
+ g.drawString(counter,w/2,h/2);
+ g.setFont("Vector",24);
+ g.drawString(timeToText(dT),w/2,h/2+50);
+}
+
+setWatch(doCounter, BTN1, true);
+
+g.clear(true);
+Bangle.loadWidgets();
+Bangle.drawWidgets();
+Bangle.setLCDTimeout(0);
+g.drawImage(icon,w/2-24,h/2-24);
+g.setFontAlign(0,0);
+require("Font8x12").add(Graphics);
+g.setFont("8x12");
+g.drawString("Click button to count.", w/2, h/2+22);
diff --git a/apps/lapcounter/app.png b/apps/lapcounter/app.png
new file mode 100644
index 000000000..7d6ca8317
Binary files /dev/null and b/apps/lapcounter/app.png differ
diff --git a/apps/lapcounter/screenshot.png b/apps/lapcounter/screenshot.png
new file mode 100644
index 000000000..f3113d86e
Binary files /dev/null and b/apps/lapcounter/screenshot.png differ
diff --git a/apps/launch/ChangeLog b/apps/launch/ChangeLog
index bd8a9bd03..0b2f134ad 100644
--- a/apps/launch/ChangeLog
+++ b/apps/launch/ChangeLog
@@ -6,3 +6,6 @@
0.06: Use Bangle.setUI for buttons
0.07: Theme colours fix
0.08: Merge Bangle.js 1 and 2 launchers
+0.09: Bangle.js 2 - pressing the button goes back to clock (fix #971)
+ After 10s of being locked, the launcher goes back to the clock screen
+0.10: added in selectable font in settings including scalable vector font
diff --git a/apps/launch/app-bangle1.js b/apps/launch/app-bangle1.js
index 3d4682e55..f779f5de4 100644
--- a/apps/launch/app-bangle1.js
+++ b/apps/launch/app-bangle1.js
@@ -64,3 +64,12 @@ Bangle.setUI("updown",dir=>{
});
Bangle.loadWidgets();
Bangle.drawWidgets();
+// 10s of inactivity goes back to clock
+if (Bangle.setLocked) Bangle.setLocked(false); // unlock initially
+var lockTimeout;
+Bangle.on('lock', locked => {
+ if (lockTimeout) clearTimeout(lockTimeout);
+ lockTimeout = undefined;
+ if (locked)
+ lockTimeout = setTimeout(_=>load(), 10000);
+});
diff --git a/apps/launch/app-bangle2.js b/apps/launch/app-bangle2.js
index 8b66247c5..156eecdf4 100644
--- a/apps/launch/app-bangle2.js
+++ b/apps/launch/app-bangle2.js
@@ -1,4 +1,22 @@
var s = require("Storage");
+let fonts = g.getFonts();
+var scaleval = 1;
+var vectorval = 20;
+var font = g.getFonts().includes("12x20") ? "12x20" : "6x8:2";
+let settings = require('Storage').readJSON("launch.json", true) || {};
+if ("vectorsize" in settings) {
+ vectorval = parseInt(settings.vectorsize);
+}
+if ("font" in settings){
+ if(settings.font == "Vector"){
+ scaleval = vectorval/20;
+ font = "Vector"+(vectorval).toString();
+ }
+ else{
+ font = settings.font;
+ scaleval = (font.split('x')[1])/20;
+ }
+}
var apps = s.list(/\.info$/).map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}).filter(app=>app && (app.type=="app" || app.type=="clock" || !app.type));
apps.sort((a,b)=>{
var n=(0|a.sortorder)-(0|b.sortorder);
@@ -11,8 +29,6 @@ apps.forEach(app=>{
if (app.icon)
app.icon = s.read(app.icon); // should just be a link to a memory area
});
-// FIXME: not needed after 2v11
-var font = g.getFonts().includes("12x20") ? "12x20" : "6x8:2";
// FIXME: check not needed after 2v11
if (g.wrapString) {
g.setFont(font);
@@ -22,9 +38,9 @@ if (g.wrapString) {
function drawApp(i, r) {
var app = apps[i];
if (!app) return;
- g.clearRect(r.x,r.y,r.x+r.w-1, r.y+r.h-1);
- g.setFont(font).setFontAlign(-1,0).drawString(app.name,64,r.y+32);
- if (app.icon) try {g.drawImage(app.icon,8,r.y+8);} catch(e){}
+ g.clearRect((r.x),(r.y),(r.x+r.w-1), (r.y+r.h-1));
+ g.setFont(font).setFontAlign(-1,0).drawString(app.name,64*scaleval,r.y+(32*scaleval));
+ if (app.icon) try {g.drawImage(app.icon,8*scaleval, r.y+(8*scaleval), {scale: scaleval});} catch(e){}
}
g.clear();
@@ -32,7 +48,7 @@ Bangle.loadWidgets();
Bangle.drawWidgets();
E.showScroller({
- h : 64, c : apps.length,
+ h : 64*scaleval, c : apps.length,
draw : drawApp,
select : i => {
var app = apps[i];
@@ -46,3 +62,16 @@ E.showScroller({
}
}
});
+
+// pressing button goes back
+setWatch(_=>load(), BTN1, {edge:"falling"});
+
+// 10s of inactivity goes back to clock
+Bangle.setLocked(false); // unlock initially
+var lockTimeout;
+Bangle.on('lock', locked => {
+ if (lockTimeout) clearTimeout(lockTimeout);
+ lockTimeout = undefined;
+ if (locked)
+ lockTimeout = setTimeout(_=>load(), 10000);
+});
diff --git a/apps/launch/settings.js b/apps/launch/settings.js
new file mode 100644
index 000000000..8be1adb36
--- /dev/null
+++ b/apps/launch/settings.js
@@ -0,0 +1,25 @@
+// make sure to enclose the function in parentheses
+(function(back) {
+ let settings = require('Storage').readJSON('launch.json',1)||{};
+ let fonts = g.getFonts();
+ function save(key, value) {
+ settings[key] = value;
+ require('Storage').write('launch.json',settings);
+ }
+ const appMenu = {
+ '': {'title': 'Launcher Settings'},
+ '< Back': back,
+ 'Font': {
+ value: fonts.includes(settings.font)? fonts.indexOf(settings.font) : fonts.indexOf("12x20"),
+ min:0, max:fonts.length-1, step:1,wrap:true,
+ onchange: (m) => {save('font', fonts[m])},
+ format: v => fonts[v]
+ },
+ 'Vector font size': {
+ value: settings.vectorsize || 10,
+ min:10, max: 20,step:1,wrap:true,
+ onchange: (m) => {save('vectorsize', m)}
+ }
+ };
+ E.showMenu(appMenu);
+});
diff --git a/apps/locale/ChangeLog b/apps/locale/ChangeLog
index 288dc6dde..448f8119a 100644
--- a/apps/locale/ChangeLog
+++ b/apps/locale/ChangeLog
@@ -10,3 +10,7 @@
0.08: Added Mavigation units and en_NAV
0.09: Added New Zealand en_NZ
0.10: Apply 12hour setting to time
+0.11: Added translations for nl_NL and changes one formatting
+0.12: Fixed nl_NL formatting, because the full months won't fit on the Bangle.js2's screen
+0.13: Now use shorter de_DE date format to more closely match other languages for size
+0.14: Added some first translations for Messages in nl_NL
diff --git a/apps/locale/locales.js b/apps/locale/locales.js
index 9e2624b77..2e3fa8713 100644
--- a/apps/locale/locales.js
+++ b/apps/locale/locales.js
@@ -37,11 +37,30 @@ const codePages = {
/* When it's not in the codepage, try and use
these conversions */
const charFallbacks = {
+ "ą":"a",
+ "ā":"a",
"č":"c",
- "ř":"r",
+ "ć":"c",
+ "ě":"e",
+ "ę":"e",
+ "ē":"e",
+ "ģ":"g",
+ "i":"ī",
+ "ķ":"k",
+ "ļ":"l",
+ "ł":"l",
+ "ń":"n",
+ "ņ":"n",
"ő":"o",
- "ě":"e"
-};
+ "ó":"o",
+ "ř":"r",
+ "ś":"s",
+ "š":"s",
+ "ū":"u",
+ "ż":"z",
+ "ź":"z",
+ "ž":"z",
+ };
/*
timePattern / datePattern:
@@ -130,7 +149,7 @@ var locales = {
temperature: "°C",
ampm: { 0: "", 1: "" },
timePattern: { 0: "%HH:%MM:%SS", 1: "%HH:%MM" },
- datePattern: { 0: "%A, %d. %B %Y", "1": "%d.%m.%Y" }, // Sonntag, 1. März 2020 // 01.01.20
+ datePattern: { 0: "%d. %b %Y", "1": "%d.%m.%Y" }, // 1. Mär 2020 // 01.03.20
abmonth: "Jan,Feb,Mär,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez",
month: "Januar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember",
abday: "So,Mo,Di,Mi,Do,Fr,Sa",
@@ -184,12 +203,30 @@ var locales = {
temperature: "°C",
ampm: { 0: "", 1: "" },
timePattern: { 0: "%HH:%MM:%SS", 1: "%HH:%MM" },
- datePattern: { 0: "%A %B %d %Y", 1: "%d.%m.%y" }, // zondag 1 maart 2020 // 01.01.20
+ datePattern: { 0: "%d %b %Y", 1: "%d-%m-%Y" }, // 28 feb 2020 // 28-02-2020
abday: "zo,ma,di,wo,do,vr,za",
day: "zondag,maandag,dinsdag,woensdag,donderdag,vrijdag,zaterdag",
abmonth: "jan,feb,mrt,apr,mei,jun,jul,aug,sep,okt,nov,dec",
month: "januari,februari,maart,april,mei,juni,juli,augustus,september,oktober,november,december",
- // No translation for english...
+ trans: { yes: "ja", Yes: "Ja", no: "nee", No: "Nee", ok: "ok", on: "aan", off: "uit",
+ "< Back": "< Terug", "Delete": "Verwijderen", "Mark Unread": "Markeer als ongelezen" }
+ },
+ "en_NL": { // English date units with Dutch number, currency and navigation units.
+ lang: "en_NL",
+ decimal_point: ",",
+ thousands_sep: ".",
+ currency_symbol: "€",
+ int_curr_symbol: "EUR",
+ speed: "km/h",
+ distance: { 0: "m", 1: "km" },
+ temperature: "°C",
+ ampm: { 0: "am", 1: "pm" },
+ timePattern: { 0: "%HH:%MM:%SS ", 1: "%HH:%MM" },
+ datePattern: { 0: "%b %d %Y", 1: "%d/%m/%Y" }, // Feb 28 2020" // "01/03/2020"(short)
+ abmonth: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",
+ month: "January,February,March,April,May,June,July,August,September,October,November,December",
+ abday: "Sun,Mon,Tue,Wed,Thu,Fri,Sat",
+ day: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",
},
"en_CA": {
lang: "en_CA",
@@ -586,6 +623,42 @@ var locales = {
day: "Domingo,Segunda-feira,Terça-feira,Quarta-feira,Quinta-feira,Sexta-feira,Sábado",
trans: { yes: "sim", Yes: "Sim", no: "não", No: "Não", ok: "ok", on: "on", off: "off" }
},
+ "pl_PL": {
+ lang: "pl_PL",
+ decimal_point: ",",
+ thousands_sep: " ",
+ currency_symbol: "zł",
+ int_curr_symbol: "PLN",
+ speed: "kmh",
+ distance: { 0: "m", 1: "km" },
+ temperature: "°C",
+ ampm: { 0: "", 1: "" },
+ timePattern: { 0: "%HH:%MM:%SS", 1: "%HH:%MM" },
+ datePattern: { 0: "%d. %b %Y", "1": "%d.%m.%Y" }, // 1. Mar 2021 // 01.03.2021
+ abmonth: "Sty,Lut,Mar,Kwi,Maj,Cze,Lip,Sie,Wrz,Paź,Lis,Gru",
+ month: "Styczeń,Luty,Marzec,Kwiecień,Maj,Czerwiec,Lipiec,Sierpień,Wrzesień,Październik,Listopad,Grudzień",
+ abday: "Ndz,Pon,Wt,Śr,Czw,Pt,Sob",
+ day: "Niedziela,Poniedziałek,Wtorek,Środa,Czwartek,Piątek,Sobota",
+ trans: { yes: "tak", Yes: "Tak", no: "nie", No: "Nie", ok: "ok", on: "on", off: "off", "< Back": "< Wstecz" }
+ },
+ "lv_LV": { // Using charfallbacks
+ lang: "lv_LV",
+ decimal_point: ",",
+ thousands_sep: " ",
+ currency_symbol: "€",
+ int_curr_symbol: "EUR",
+ speed: "kmh",
+ distance: { 0: "m", 1: "km" },
+ temperature: "°C",
+ ampm: { 0: "", 1: "" },
+ timePattern: { 0: "%HH:%MM:%SS", 1: "%HH:%MM" },
+ datePattern: { 0: "%d. %b %Y", "1": "%d.%m.%Y" }, // 1. Mar 2020 // 01.03.20
+ abmonth: "Jan,Feb,Mar,Apr,Mai,Jūn,Jūl,Aug,Sep,Okt,Nov,Dec",
+ month: "Janvāris,Februāris,Marts,Aprīlis,Maijs,Jūnijs,Jūlijs,Augusts,Septemberis,Oktobris,Novembris,Decembris",
+ abday: "Pr,Ot,Tr,Ce,Pk,Se,Sv",
+ day: "Pirmdiena,Otrdiena,Trešdiena,Ceturtdiena,Piektdiena,Sestdiena,Svētdiena",
+ trans: { yes: "jā", Yes: "Jā", no: "nē", No: "Nē", ok: "labi", on: "Ieslēgt", off: "Izslēgt", "< Back": "< Atpakaļ" }
+ },
/*,
"he_IL": { // This won't work until we get a font - see https://github.com/espruino/BangleApps/issues/399
codePage : "ISO8859-8",
diff --git a/apps/mandlebrotclock/ChangeLog b/apps/mandelbrotclock/ChangeLog
similarity index 100%
rename from apps/mandlebrotclock/ChangeLog
rename to apps/mandelbrotclock/ChangeLog
diff --git a/apps/mandlebrotclock/README.md b/apps/mandelbrotclock/README.md
similarity index 55%
rename from apps/mandlebrotclock/README.md
rename to apps/mandelbrotclock/README.md
index 8628a61d0..387343a9e 100644
--- a/apps/mandlebrotclock/README.md
+++ b/apps/mandelbrotclock/README.md
@@ -1,6 +1,6 @@
-# Mandlebrot Clock
+# Mandelbrot Clock
-A simple clock themed on the mandlebrot set.
+A simple clock themed on the mandelbrot set.
Written by [James Milner](https://www.github.com/jameslmilner)
diff --git a/apps/mandlebrotclock/app.png b/apps/mandelbrotclock/app.png
similarity index 100%
rename from apps/mandlebrotclock/app.png
rename to apps/mandelbrotclock/app.png
diff --git a/apps/mandlebrotclock/mandlebrotclock-icon.js b/apps/mandelbrotclock/mandelbrotclock-icon.js
similarity index 100%
rename from apps/mandlebrotclock/mandlebrotclock-icon.js
rename to apps/mandelbrotclock/mandelbrotclock-icon.js
diff --git a/apps/mandlebrotclock/mandlebrotclock.js b/apps/mandelbrotclock/mandelbrotclock.js
similarity index 99%
rename from apps/mandlebrotclock/mandlebrotclock.js
rename to apps/mandelbrotclock/mandelbrotclock.js
index 16cc8dfb8..94636056e 100644
--- a/apps/mandlebrotclock/mandlebrotclock.js
+++ b/apps/mandelbrotclock/mandelbrotclock.js
@@ -1,6 +1,6 @@
// MIT License - James Milner 2021
-const mandlebrotBmp = {
+const mandelbrotBmp = {
width: 176,
height: 176,
bpp: 8,
@@ -13,7 +13,7 @@ const mandlebrotBmp = {
};
function draw() {
- g.drawImage(mandlebrotBmp);
+ g.drawImage(mandelbrotBmp);
// work out how to display the current time
const d = new Date();
const h = d.getHours(),
diff --git a/apps/mandlebrotclock/mandlebrotclock.png b/apps/mandelbrotclock/mandelbrotclock.png
similarity index 100%
rename from apps/mandlebrotclock/mandlebrotclock.png
rename to apps/mandelbrotclock/mandelbrotclock.png
diff --git a/apps/mandlebrotclock/screenshot_mandlebrotclock.png b/apps/mandelbrotclock/screenshot_mandelbrotclock.png
similarity index 100%
rename from apps/mandlebrotclock/screenshot_mandlebrotclock.png
rename to apps/mandelbrotclock/screenshot_mandelbrotclock.png
diff --git a/apps/menuwheel/ChangeLog b/apps/menuwheel/ChangeLog
new file mode 100644
index 000000000..defdb5049
--- /dev/null
+++ b/apps/menuwheel/ChangeLog
@@ -0,0 +1 @@
+0.01: New menu!
diff --git a/apps/menuwheel/README.md b/apps/menuwheel/README.md
new file mode 100644
index 000000000..22cb49466
--- /dev/null
+++ b/apps/menuwheel/README.md
@@ -0,0 +1,25 @@
+# Wheel Menu
+
+Replace Bangle.js 2's menus with a version that contains variable-size text and a back button.
+
+Bangle.js 1:
+
+
+
+Bangle.js 2:
+
+
+
+
+
+## Features
+
+If the menu contains "Back" or "Exit", it is shown as a button instead.
+The menu wraps around, with a divider between the last and first items.
+
+## Controls
+
+Bangle.js 1: Use BTN1/BTN3 to scroll through items, BTN2 to open/edit the selected item.
+Bangle.js 2: Swipe up/down to scroll through items, tap/BTN to open/edit the selected item.
+
+Press the back button (if present) to go back.
\ No newline at end of file
diff --git a/apps/menuwheel/boot.js b/apps/menuwheel/boot.js
new file mode 100644
index 000000000..3e708e9a8
--- /dev/null
+++ b/apps/menuwheel/boot.js
@@ -0,0 +1,213 @@
+E.showMenu = function(items) {
+ g.clearRect(Bangle.appRect); // clear screen if no menu supplied
+ // clean up back button listener
+ if (Bangle.backHandler) Bangle.removeListener('touch', Bangle.backHandler)
+ delete Bangle.backHandler;
+ if (!items) {
+ Bangle.setUI();
+ return;
+ }
+
+ var B2 = process.env.HWVERSION===2,
+ loc = require("locale"),
+ menuItems = Object.keys(items),
+ options = items[""];
+ if (options) menuItems.splice(menuItems.indexOf(""),1);
+ if (!(options instanceof Object)) options = {};
+
+ // show "< Back" item (or similar) as button instead (i.e. remove from the menu)
+ var back,backLbl;
+ for (var b of ['Back', 'Exit', 'Cancel']) {
+ if (!items[b] && items['< '+b]) b = '< '+b;
+ back = items[b];
+ if (typeof back === "function") {
+ backLbl = loc.translate(b);
+ menuItems.splice(menuItems.indexOf(b),1);
+ break;
+ }
+ else back = undefined;
+ }
+ // font sizes
+ var small = B2?15:22,
+ large = B2?30:45;
+ if (options.selected === undefined) options.selected = 0;
+ var ar = Bangle.appRect,
+ x = ar.x,
+ x2 = ar.x2,
+ w = ar.w,
+ y = ar.y,
+ y2 = ar.y2;
+ if (options.title) y += 22;
+ var wrap = menuItems.length>3; // don't wrap if all items are always in view anyway
+
+ var vc=Math.round((y+y2)/2), // vertical center
+ hc = Math.round((x+x2)/2), // horizontal center
+ ih = large+small*2; // active item height
+
+ var getItem = idx => {
+ // we wrap out-of-range indexes
+ while (idx<0) idx+=menuItems.length;
+ idx = idx%menuItems.length;
+ var name = menuItems[idx];
+ var item = items[name];
+ var v;
+ if ("object"== typeof item) {
+ v = item.value;
+ if (item.format) v = item.format(v);
+ v = loc.translate(""+v);
+ }
+ return {lbl: loc.translate(name), v: v};
+ };
+ var l = {
+ lastIdx : null, // we want a complete redraw on first run
+ draw : function() {
+ var idx = options.selected,
+ edit = l.selectEdit;
+ g.reset();
+
+ // don't highlight whole item when editing
+ g.setColor(edit?g.theme.fg:g.theme.fgH)
+ .setBgColor(edit?g.theme.bg:g.theme.bgH)
+ .setFont('Vector', large);
+ var item = getItem(idx),
+ lw = g.stringWidth(item.lbl)+2;
+ if (lw+2 >= w) { // label width doesn't fit at large size: scale it down
+ g.setFont('Vector', Math.floor(large*ar.w/lw));
+ }
+ g.clearRect(x,vc-ih/2,x2,vc+ih/2)
+ .setFontAlign(0,0,0).drawString(item.lbl,hc,vc);
+
+ if (item.v !== undefined) {
+ g.setColor(g.theme.fgH).setBgColor(g.theme.bgH) // always highlighted: either as part of item, or while editing
+ .setFontAlign(0,1,0)
+ .setFont('Vector', small)
+ .clearRect(x,vc+ih/2-small-2,x2,vc+ih/2)
+ .drawString(item.v,hc,vc+ih/2-1);
+ if (edit) {
+ g.drawImage("\x0c\x05\x81\x00 \x07\x00\xF9\xF0\x0E\x00@",x2-23,vc+ih/2-small+(B2?1:5),{scale:2});
+ }
+ }
+ if (l.lastIdx !== idx) {
+ // we scrolled: redraw all
+ l.lastIdx=idx;
+ g.reset();
+
+ if (options.title) {
+ if (B2) g.setFont('12x20');
+ else g.setFont('6x8',2);
+ g.drawLine(x, y-2, x2, y-2)
+ .setFontAlign(0,1,0)
+ .drawString(options.title, (x+x2)/2, y-2);
+ }
+
+ // clear prev/next items area
+ g.clearRect(x,y,x2,vc-ih/2-1)
+ .clearRect(x,vc+ih/2+1,x2,y2);
+
+ // get display label by index
+ var lbl = idx => {
+ var item = getItem(idx);
+ if (item.v !== undefined) item.lbl+=': '+item.v;
+ return item.lbl;
+ }
+ // previous two items
+ g.setFontAlign(0, 1)
+ if (wrap||idx>0) g.setFont('Vector', small).drawString(lbl(idx-1), hc, vc-ih/2-5);
+ if (wrap||idx>1) g.setFont('Vector', small/2).drawString(lbl(idx-2), hc, vc-ih/2-small-10);
+ // next two items
+ g.setFontAlign(0, -1);
+ if (wrap||idx g.drawLine(x, y, x2, y);
+ if (idx===0) div(vc-ih/2-1);
+ if (idx===1) div(vc-ih/2-small-8);
+ // if (s === 2) div(vc-ih/2-small*1.5-13);
+ if (idx===menuItems.length-1) div(vc+ih/2+1);
+ if (idx===menuItems.length-2) div(vc+ih/2+small+6);
+ // if (s === 2) div(vc+ih/2+small*1.5+13);
+ }
+
+ if (back) {
+ g.setBgColor(g.theme.bg2)
+ .setFont('Vector', small);
+ var bw=g.stringWidth(backLbl);
+ g.clearRect(x,y, x+bw+2, y+small+2);
+ var bx1=x, by1=y, bx2=x+bw+2, by2=y+small+2;
+ // g.drawRect(x,y, x+bw+2, y+small+2);
+ var poly = [ // button outline
+ bx1+2,by1,
+ bx2-2,by1,
+ bx2, by1+2,
+ bx2, by2-2,
+ bx2-2,by2,
+ bx1+2,by2,
+ bx1, by2-2,
+ bx1, by1+2,
+ ]
+ g.setColor(g.theme.bg2).fillPoly(poly, true)
+ .setColor(g.theme.fg2).drawPoly(poly, true)
+ .setFontAlign(-1,-1,0).drawString(backLbl, x+2,y+2);
+ }
+ }
+ g.flip();
+ },
+ select : function() { // same as default menu
+ var item = items[menuItems[options.selected]];
+ if ("function" == typeof item) {l.lastIdx=null; item(l);} // force a redraw after callback
+ else if ("object" == typeof item) {
+ // if a number, go into 'edit mode'
+ if ("number" == typeof item.value)
+ l.selectEdit = l.selectEdit?undefined:item;
+ else { // else just toggle bools
+ if ("boolean" == typeof item.value) item.value=!item.value;
+ if (item.onchange) {l.lastIdx=null; item.onchange(item.value);} // force a redraw after callback
+ }
+ l.draw();
+ }
+ },
+ move : function(dir) {
+ if (l.selectEdit) { // same as default menu
+ var item = l.selectEdit;
+ item.value -= (dir||1)*(item.step||1);
+ if (item.min!==undefined && item.valueitem.max) item.value = item.wrap ? item.min : item.max;
+ if (item.onchange) {l.lastIdx=null; item.onchange(item.value);} // force a redraw after callback
+ } else {
+ if (B2) dir=-dir; // swipe vs button scrolling
+ if (!wrap && (options.selected+dir<0 || options.selected+dir>=menuItems.length)) {
+ return;
+ }
+ options.selected = (options.selected+dir+menuItems.length)%menuItems.length;
+ }
+ l.draw();
+ }
+ };
+ l.draw();
+ Bangle.setUI("updown",dir => {
+ if (dir) l.move(dir);
+ else l.select();
+ });
+ if (back) {
+ // we have a back button: check touches before passing them to setUI's touchHandler
+ if (B2) {
+ Bangle.removeListener('touch', Bangle.touchHandler);
+ Bangle.backHandler = (b, xy) => {
+ // anywhere top-left (but above the active item) = back button
+ if (xy.x {
+ // left side = back button
+ if (b===1) back();
+ }
+ }
+ // note: backHandler is cleaned up at the top of this file
+ Bangle.on('touch', Bangle.backHandler);
+ }
+ return l;
+};
diff --git a/apps/menuwheel/icon.png b/apps/menuwheel/icon.png
new file mode 100644
index 000000000..61f94a035
Binary files /dev/null and b/apps/menuwheel/icon.png differ
diff --git a/apps/menuwheel/screenshot_b1_dark.png b/apps/menuwheel/screenshot_b1_dark.png
new file mode 100644
index 000000000..c6dfb802b
Binary files /dev/null and b/apps/menuwheel/screenshot_b1_dark.png differ
diff --git a/apps/menuwheel/screenshot_b1_edit.png b/apps/menuwheel/screenshot_b1_edit.png
new file mode 100644
index 000000000..a39b0a832
Binary files /dev/null and b/apps/menuwheel/screenshot_b1_edit.png differ
diff --git a/apps/menuwheel/screenshot_b1_light.png b/apps/menuwheel/screenshot_b1_light.png
new file mode 100644
index 000000000..35ac01fe9
Binary files /dev/null and b/apps/menuwheel/screenshot_b1_light.png differ
diff --git a/apps/menuwheel/screenshot_b2_dark.png b/apps/menuwheel/screenshot_b2_dark.png
new file mode 100644
index 000000000..1393838a3
Binary files /dev/null and b/apps/menuwheel/screenshot_b2_dark.png differ
diff --git a/apps/menuwheel/screenshot_b2_edit.png b/apps/menuwheel/screenshot_b2_edit.png
new file mode 100644
index 000000000..bca98a9a5
Binary files /dev/null and b/apps/menuwheel/screenshot_b2_edit.png differ
diff --git a/apps/menuwheel/screenshot_b2_light.png b/apps/menuwheel/screenshot_b2_light.png
new file mode 100644
index 000000000..4ffe08fe3
Binary files /dev/null and b/apps/menuwheel/screenshot_b2_light.png differ
diff --git a/apps/messages/ChangeLog b/apps/messages/ChangeLog
index 87094a091..16d0010cc 100644
--- a/apps/messages/ChangeLog
+++ b/apps/messages/ChangeLog
@@ -8,3 +8,15 @@
Back now marks a message as read
Clicking top-left opens a menu which allows you to delete a message or mark unread
0.07: Added settings menu with option to choose vibrate pattern and frequency (fix #909)
+0.08: Fix rendering of long messages (fix #969)
+ buzz on new message (fix #999)
+0.09: Message now disappears after 60s if no action taken and clock loads (fix 922)
+ Fix phone icon (#1014)
+0.10: Respect the 'new' attribute if it was set from iOS integrations
+0.11: Open app when touching the widget (Bangle.js 2 only)
+0.12: Extra app-specific notification icons
+ New animated notifcationicon (instead of large blinking 'MESSAGES')
+ Added screenshots
+0.13: Add /*LANG*/ comments for internationalisation
+ Add 'Delete All' option to message options
+ Now update correctly when 'require("messages").clearAll()' is called
diff --git a/apps/messages/README.md b/apps/messages/README.md
index c243ec06a..4952b1877 100644
--- a/apps/messages/README.md
+++ b/apps/messages/README.md
@@ -1,16 +1,32 @@
# Messages app
-**THIS APP IS CURRENTLY BETA**
-
This app handles the display of messages and message notifications. It stores
a list of currently received messages and allows them to be listed, viewed,
and responded to.
It is a replacement for the old `notify`/`gadgetbridge` apps.
-## Usage
+## Settings
+
+You can change settings by going to the global `Settings` app, then `App Settings`
+and `Messages`:
+
+* `Vibrate` - This is the pattern of buzzes that should be made when a new message is received
+* `Repeat` - How often should buzzes repeat - the default of 4 means the Bangle will buzz every 4 seconds
+* `Unread Timer` - when a new message is received we go into the Messages app.
+If there is no user input for this amount of time then the app will exit and return
+to the clock where a ringing bell will be shown in the Widget bar.
+
+## Images
+_1. Screenshot of a notification_
+
+
+
+_2. What the notify icon looks like (it's touchable on Bangle.js2!)_
+
+
+
-...
## Requests
@@ -19,3 +35,11 @@ Please file any issues on https://github.com/espruino/BangleApps/issues/new?titl
## Creator
Gordon Williams
+
+## Contributors
+
+[Jeroen Peters](https://github.com/jeroenpeters1986)
+
+## Attributions
+
+Icons used in this app are from https://icons8.com
diff --git a/apps/messages/app.js b/apps/messages/app.js
index cb2b5c2cd..79009e77e 100644
--- a/apps/messages/app.js
+++ b/apps/messages/app.js
@@ -21,6 +21,7 @@
*/
var Layout = require("Layout");
+var fontSmall = "6x8";
var fontMedium = g.getFonts().includes("6x15")?"6x15":"6x8:2";
var fontBig = g.getFonts().includes("12x20")?"12x20":"6x8:2";
var fontLarge = g.getFonts().includes("6x15")?"6x15:2":"6x8:4";
@@ -41,16 +42,21 @@ try {
};
}
-
+/** this is a timeout if the app has started and is showing a single message
+but the user hasn't seen it (eg no user input) - in which case
+we should start a timeout for settings.unreadTimeout to return
+to the clock. */
+var unreadTimeout;
+/// List of all our messages
var MESSAGES = require("Storage").readJSON("messages.json",1)||[];
if (!Array.isArray(MESSAGES)) MESSAGES=[];
var onMessagesModified = function(msg) {
// TODO: if new, show this new one
- if (msg.new) {
+ if (msg && msg.new) {
if (WIDGETS["messages"]) WIDGETS["messages"].buzz();
else Bangle.buzz();
}
- showMessage(msg.id);
+ showMessage(msg&&msg.id);
};
function saveMessages() {
require("Storage").writeJSON("messages.json",MESSAGES)
@@ -59,6 +65,12 @@ function saveMessages() {
function getBackImage() {
return atob("FhYBAAAAEAAAwAAHAAA//wH//wf//g///BwB+DAB4EAHwAAPAAA8AADwAAPAAB4AAHgAB+AH/wA/+AD/wAH8AA==");
}
+function getNotificationImage() {
+ return atob("HBKBAD///8H///iP//8cf//j4//8f5//j/x/8//j/H//H4//4PB//EYj/44HH/Hw+P4//8fH//44///xH///g////A==");
+}
+function getFBIcon() {
+ return atob("GBiBAAAAAAAAAAAYAAD/AAP/wAf/4A/48A/g8B/g+B/j+B/n+D/n/D8A/B8A+B+B+B/n+A/n8A/n8Afn4APnwADnAAAAAAAAAAAAAA==");
+}
function getPosImage() {
return atob("GRSBAAAAAYAAAcAAAeAAAfAAAfAAAfAAAfAAAfAAAfBgAfA4AfAeAfAPgfAD4fAA+fAAP/AAD/AAA/AAAPAAADAAAA==");
}
@@ -68,18 +80,28 @@ function getNegImage() {
function getMessageImage(msg) {
if (msg.img) return atob(msg.img);
var s = (msg.src||"").toLowerCase();
- if (s=="Phone") return atob("FxeBABgAAPgAAfAAB/AAD+AAH+AAP8AAP4AAfgAA/AAA+AAA+AAA+AAB+AAB+AAB+OAB//AB//gB//gA//AA/8AAf4AAPAA=");
- if (s=="skype") return atob("GhoBB8AAB//AA//+Af//wH//+D///w/8D+P8Afz/DD8/j4/H4fP5/A/+f4B/n/gP5//B+fj8fj4/H8+DB/PwA/x/A/8P///B///gP//4B//8AD/+AAA+AA==");
+ if (s=="calendar") return atob("GBiBAAAAAAAAAAAAAA//8B//+BgAGBgAGBgAGB//+B//+B//+B9m2B//+B//+Btm2B//+B//+Btm+B//+B//+A//8AAAAAAAAAAAAA==");
+ if (s=="facebook") return getFBIcon();
if (s=="hangouts") return atob("FBaBAAH4AH/gD/8B//g//8P//H5n58Y+fGPnxj5+d+fmfj//4//8H//B//gH/4A/8AA+AAHAABgAAAA=");
- if (s=="whatsapp") return atob("GBiBAAB+AAP/wAf/4A//8B//+D///H9//n5//nw//vw///x///5///4///8e//+EP3/APn/wPn/+/j///H//+H//8H//4H//wMB+AA==");
- if (s=="telegram") return atob("GBiBAAAAAAAAAAAAAAAAAwAAHwAA/wAD/wAf3gD/Pgf+fh/4/v/z/P/H/D8P/Acf/AM//AF/+AF/+AH/+ADz+ADh+ADAcAAAMAAAAA==");
+ if (s=="instagram") return atob("GBiBAf////////////////wAP/n/n/P/z/f/b/eB7/c87/d+7/d+7/d+7/d+7/c87/eB7/f/7/P/z/n/n/wAP////////////////w==");
+ if (s=="gmail") return getNotificationImage();
+ if (s=="google home") return atob("GBiCAAAAAAAAAAAAAAAAAAAAAoAAAAAACqAAAAAAKqwAAAAAqroAAAACquqAAAAKq+qgAAAqr/qoAACqv/6qAAKq//+qgA6r///qsAqr///6sAqv///6sAqv///6sAqv///6sA6v///6sA6v///qsA6qqqqqsA6qqqqqsA6qqqqqsAP7///vwAAAAAAAAAAAAAAAAA==");
+ if (s=="mail") return getNotificationImage();
+ if (s=="messenger") return getFBIcon();
+ if (s=="outlook mail") return getNotificationImage();
+ if (s=="phone") return atob("FxeBABgAAPgAAfAAB/AAD+AAH+AAP8AAP4AAfgAA/AAA+AAA+AAA+AAB+AAB+AAB+OAB//AB//gB//gA//AA/8AAf4AAPAA=");
+ if (s=="skype") return atob("GhoBB8AAB//AA//+Af//wH//+D///w/8D+P8Afz/DD8/j4/H4fP5/A/+f4B/n/gP5//B+fj8fj4/H8+DB/PwA/x/A/8P///B///gP//4B//8AD/+AAA+AA==");
+ if (s=="slack") return atob("GBiBAAAAAAAAAABAAAHvAAHvAADvAAAPAB/PMB/veD/veB/mcAAAABzH8B3v+B3v+B3n8AHgAAHuAAHvAAHvAADGAAAAAAAAAAAAAA==");
+ if (s=="sms message") return getNotificationImage();
if (s=="twitter") return atob("GhYBAABgAAB+JgA/8cAf/ngH/5+B/8P8f+D///h///4f//+D///g///wD//8B//+AP//gD//wAP/8AB/+AB/+AH//AAf/AAAYAAA");
+ if (s=="telegram") return atob("GBiBAAAAAAAAAAAAAAAAAwAAHwAA/wAD/wAf3gD/Pgf+fh/4/v/z/P/H/D8P/Acf/AM//AF/+AF/+AH/+ADz+ADh+ADAcAAAMAAAAA==");
+ if (s=="whatsapp") return atob("GBiBAAB+AAP/wAf/4A//8B//+D///H9//n5//nw//vw///x///5///4///8e//+EP3/APn/wPn/+/j///H//+H//8H//4H//wMB+AA==");
+ if (s=="wordfeud") return atob("GBgCWqqqqqqlf//////9v//////+v/////++v/////++v8///Lu+v8///L++v8///P/+v8v//P/+v9v//P/+v+fx/P/+v+Pk+P/+v/PN+f/+v/POuv/+v/Ofdv/+v/NvM//+v/I/Y//+v/k/k//+v/i/w//+v/7/6//+v//////+v//////+f//////9Wqqqqqql");
if (msg.id=="music") return atob("FhaBAH//+/////////////h/+AH/4Af/gB/+H3/7/f/v9/+/3/7+f/vB/w8H+Dwf4PD/x/////////////3//+A=");
if (msg.id=="back") return getBackImage();
- return atob("HBKBAD///8H///iP//8cf//j4//8f5//j/x/8//j/H//H4//4PB//EYj/44HH/Hw+P4//8fH//44///xH///g////A==");
+ return getNotificationImage();
}
-
function showMapMessage(msg) {
var m;
var distance, street, target, eta;
@@ -121,7 +143,7 @@ function showMapMessage(msg) {
function showMusicMessage(msg) {
function fmtTime(s) {
var m = Math.floor(s/60);
- s = (s%60).toString().padStart(2,0);
+ s = (parseInt(s%60)).toString().padStart(2,0);
return m+":"+s;
}
@@ -135,7 +157,7 @@ function showMusicMessage(msg) {
{type:"h", fillx:1, bgCol:colBg, c: [
{ type:"btn", src:getBackImage, cb:back },
{ type:"v", fillx:1, c: [
- { type:"txt", font:fontLarge, label:msg.artist, pad:2 },
+ { type:"txt", font:fontMedium, label:msg.artist, pad:2 },
{ type:"txt", font:fontMedium, label:msg.album, pad:2 }
]}
]},
@@ -152,66 +174,89 @@ function showMusicMessage(msg) {
}
function showMessageSettings(msg) {
- E.showMenu({"":{"title":"Message"},
+ E.showMenu({"":{"title":/*LANG*/"Message"},
"< Back" : () => showMessage(msg.id),
- "Delete" : () => {
+ /*LANG*/"Delete" : () => {
MESSAGES = MESSAGES.filter(m=>m.id!=msg.id);
saveMessages();
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0});
},
- "Mark Unread" : () => {
+ /*LANG*/"Mark Unread" : () => {
msg.new = true;
saveMessages();
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0});
},
+ /*LANG*/"Delete all messages" : () => {
+ E.showPrompt(/*LANG*/"Are you sure?", {title:/*LANG*/"Delete All Messages"}).then(isYes => {
+ if (isYes) {
+ MESSAGES = [];
+ saveMessages();
+ }
+ checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0});
+ });
+ },
});
}
function showMessage(msgid) {
var msg = MESSAGES.find(m=>m.id==msgid);
- if (!msg) return checkMessages(); // go home if no message found
- if (msg.src=="Maps") return showMapMessage(msg);
- if (msg.id=="music") return showMusicMessage(msg);
+ if (!msg) return checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0}); // go home if no message found
+ if (msg.src=="Maps") {
+ cancelReloadTimeout(); // don't auto-reload to clock now
+ return showMapMessage(msg);
+ }
+ if (msg.id=="music") {
+ cancelReloadTimeout(); // don't auto-reload to clock now
+ return showMusicMessage(msg);
+ }
// Normal text message display
- var title=msg.title, titleFont = fontLarge;
+ var title=msg.title, titleFont = fontLarge, lines;
if (title) {
- var w = g.getWidth()-40;
+ var w = g.getWidth()-48;
if (g.setFont(titleFont).stringWidth(title) > w)
titleFont = fontMedium;
- if (g.setFont(titleFont).stringWidth(title) > w)
- title = g.wrapString(title, w).join("\n");
+ if (g.setFont(titleFont).stringWidth(title) > w) {
+ lines = g.wrapString(title, w);
+ title = (lines.length>2) ? lines.slice(0,2).join("\n")+"..." : lines.join("\n");
+ }
}
var buttons = [
{type:"btn", src:getBackImage(), cb:()=>{
- msg.new = false; // read mail
- saveMessages();
+ msg.new = false; saveMessages(); // read mail
+ cancelReloadTimeout(); // don't auto-reload to clock now
checkMessages({clockIfNoMsg:1,clockIfAllRead:0,showMsgIfUnread:1});
}} // back
];
if (msg.positive) {
buttons.push({type:"btn", src:getPosImage(), cb:()=>{
msg.new = false; saveMessages();
+ cancelReloadTimeout(); // don't auto-reload to clock now
Bangle.messageResponse(msg,true);
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1});
}});
}
if (msg.negative) {
buttons.push({type:"btn", src:getNegImage(), cb:()=>{
- console.log("Response");
msg.new = false; saveMessages();
+ cancelReloadTimeout(); // don't auto-reload to clock now
Bangle.messageResponse(msg,false);
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1});
}});
}
+ lines = g.wrapString(msg.body, g.getWidth()-10);
+ var body = (lines.length>4) ? lines.slice(0,4).join("\n")+"..." : lines.join("\n");
layout = new Layout({ type:"v", c: [
{type:"h", fillx:1, bgCol:colBg, c: [
- { type:"btn", src:getMessageImage(msg), cb:()=>showMessageSettings(msg) },
+ { type:"btn", src:getMessageImage(msg), pad: 3, cb:()=>{
+ cancelReloadTimeout(); // don't auto-reload to clock now
+ showMessageSettings(msg);
+ }},
{ type:"v", fillx:1, c: [
- {type:"txt", font:fontMedium, label:msg.src||"Message", bgCol:colBg, fillx:1, pad:2 },
+ {type:"txt", font:fontSmall, label:msg.src||"Message", bgCol:colBg, fillx:1, pad:2, halign:1 },
title?{type:"txt", font:titleFont, label:title, bgCol:colBg, fillx:1, pad:2 }:{},
]},
]},
- {type:"txt", font:fontMedium, label:msg.body||"", wrap:true, fillx:1, filly:1, pad:2 },
+ {type:"txt", font:fontMedium, label:body, fillx:1, filly:1, pad:2 },
{type:"h",fillx:1, c: buttons}
]});
g.clearRect(Bangle.appRect);
@@ -229,10 +274,10 @@ function checkMessages(options) {
options=options||{};
// If no messages, just show 'no messages' and return
if (!MESSAGES.length) {
- if (!options.clockIfNoMsg) return E.showPrompt("No Messages",{
- title:"Messages",
+ if (!options.clockIfNoMsg) return E.showPrompt(/*LANG*/"No Messages",{
+ title:/*LANG*/"Messages",
img:require("heatshrink").decompress(atob("kkk4UBrkc/4AC/tEqtACQkBqtUDg0VqAIGgoZFDYQIIM1sD1QAD4AIBhnqA4WrmAIBhc6BAWs8AIBhXOBAWz0AIC2YIC5wID1gkB1c6BAYFBEQPqBAYXBEQOqBAnDAIQaEnkAngaEEAPDFgo+IKA5iIOhCGIAFb7RqAIGgtUBA0VqobFgNVA")),
- buttons : {"Ok":1}
+ buttons : {/*LANG*/"Ok":1}
}).then(() => { load() });
return load();
}
@@ -244,7 +289,8 @@ function checkMessages(options) {
// no new messages - go to clock?
if (options.clockIfAllRead && newMessages.length==0)
return load();
-
+ // we don't have to time out of this screen...
+ cancelReloadTimeout();
// Otherwise show a menu
E.showScroller({
h : 48,
@@ -259,7 +305,7 @@ function checkMessages(options) {
var x = r.x+2, title = msg.title, body = msg.body;
var img = getMessageImage(msg);
if (msg.id=="music") {
- title = msg.artist || "Music";
+ title = msg.artist || /*LANG*/"Music";
body = msg.track;
}
if (img) {
@@ -286,9 +332,23 @@ function checkMessages(options) {
});
}
+function cancelReloadTimeout() {
+ if (!unreadTimeout) return;
+ clearTimeout(unreadTimeout);
+ unreadTimeout = undefined;
+}
+
+
g.clear();
Bangle.loadWidgets();
Bangle.drawWidgets();
setTimeout(() => {
+ var unreadTimeoutSecs = (require('Storage').readJSON("messages.settings.json", true) || {}).unreadTimeout;
+ if (unreadTimeoutSecs===undefined) unreadTimeoutSecs=60;
+ if (unreadTimeoutSecs)
+ unreadTimeout = setTimeout(function() {
+ print("Message not seen - reloading");
+ load();
+ }, unreadTimeoutSecs*1000);
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:1});
},10); // if checkMessages wants to 'load', do that
diff --git a/apps/messages/lib.js b/apps/messages/lib.js
index 3094b34e1..63f55dd03 100644
--- a/apps/messages/lib.js
+++ b/apps/messages/lib.js
@@ -1,10 +1,10 @@
+/* Push a new message onto messages queue, event is:
+ {t:"add",id:int, src,title,subject,body,sender,tel, important:bool, new:bool}
+ {t:"add",id:int, id:"music", state, artist, track, etc} // add new
+ {t:"remove-",id:int} // remove
+ {t:"modify",id:int, title:string} // modified
+*/
exports.pushMessage = function(event) {
- /* event is:
- {t:"add",id:int, src,title,subject,body,sender,tel, important:bool} // add new
- {t:"add",id:int, id:"music", state, artist, track, etc} // add new
- {t:"remove-",id:int} // remove
- {t:"modify",id:int, title:string} // modified
- */
var messages, inApp = "undefined"!=typeof MESSAGES;
if (inApp)
messages = MESSAGES; // we're in an app that has already loaded messages
@@ -16,7 +16,11 @@ exports.pushMessage = function(event) {
if (mIdx>=0) messages.splice(mIdx, 1); // remove item
mIdx=-1;
} else { // add/modify
- if (event.t=="add") event.new=true; // new message
+ if (event.t=="add"){
+ if(event.new === undefined ) { // If 'new' has not been set yet, set it
+ event.new=true; // Assume it should be new
+ }
+ }
if (mIdx<0) {
mIdx=0;
messages.unshift(event); // add new messages to the beginning
@@ -27,17 +31,27 @@ exports.pushMessage = function(event) {
// if in app, process immediately
if (inApp) return onMessagesModified(mIdx<0 ? {id:event.id} : messages[mIdx]);
// ok, saved now - we only care if it's new
- if (event.t!="add") return;
- // otherwise load after a delay, to ensure we have all the messages
+ if (event.t!="add") {
+ return;
+ } else if(event.new == false) {
+ return;
+ }
+ // otherwise load messages/show widget
+ var loadMessages = Bangle.CLOCK || event.important;
+ // first, buzz
+ if (loadMessages && global.WIDGETS && WIDGETS.messages)
+ WIDGETS.messages.buzz();
+ // after a delay load the app, to ensure we have all the messages
if (exports.messageTimeout) clearTimeout(exports.messageTimeout);
exports.messageTimeout = setTimeout(function() {
exports.messageTimeout = undefined;
// if we're in a clock or it's important, go straight to messages app
- if (Bangle.CLOCK || event.important) return load("messages.app.js");
+ if (loadMessages) return load("messages.app.js");
if (!global.WIDGETS || !WIDGETS.messages) return Bangle.buzz(); // no widgets - just buzz to let someone know
WIDGETS.messages.show();
}, 500);
}
+/// Remove all messages
exports.clearAll = function(event) {
var messages, inApp = "undefined"!=typeof MESSAGES;
if (inApp) {
diff --git a/apps/messages/screenshot-notify.gif b/apps/messages/screenshot-notify.gif
new file mode 100644
index 000000000..3d0ed0b32
Binary files /dev/null and b/apps/messages/screenshot-notify.gif differ
diff --git a/apps/messages/screenshot.png b/apps/messages/screenshot.png
new file mode 100644
index 000000000..a95045400
Binary files /dev/null and b/apps/messages/screenshot.png differ
diff --git a/apps/messages/settings.js b/apps/messages/settings.js
index ef6266cf6..fd8ce8f39 100644
--- a/apps/messages/settings.js
+++ b/apps/messages/settings.js
@@ -3,6 +3,7 @@
let settings = require('Storage').readJSON("messages.settings.json", true) || {};
if (settings.vibrate===undefined) settings.vibrate=".";
if (settings.repeat===undefined) settings.repeat=4;
+ if (settings.unreadTimeout===undefined) settings.unreadTimeout=60;
return settings;
}
function updateSetting(setting, value) {
@@ -30,6 +31,12 @@
format: v => v+"s",
onchange: v => updateSetting("repeat", v)
},
+ 'Unread timer': {
+ value: settings().unreadTimeout,
+ min: 0, max: 240, step : 10,
+ format: v => v?v+"s":"Off",
+ onchange: v => updateSetting("unreadTimeout", v)
+ },
};
E.showMenu(mainmenu);
})
diff --git a/apps/messages/widget.js b/apps/messages/widget.js
index 3a22b40fd..f01d22ec7 100644
--- a/apps/messages/widget.js
+++ b/apps/messages/widget.js
@@ -1,10 +1,9 @@
-
WIDGETS["messages"]={area:"tl",width:0,draw:function() {
+ Bangle.removeListener('touch', this.touch);
if (!this.width) return;
var c = (Date.now()-this.t)/1000;
- g.reset().setBgColor((c&1) ? "#0f0" : "#030").setColor((c&1) ? "#000" : "#fff");
- g.clearRect(this.x,this.y,this.x+this.width,this.y+23);
- g.setFont("6x8:1x2").setFontAlign(0,0).drawString("MESSAGES", this.x+this.width/2, this.y+12);
+ g.reset().clearRect(this.x,this.y,this.x+this.width,this.y+23);
+ g.drawImage((c&1) ? atob("GBiBAAAAAAAAAAAAAAAAAAAAAB//+DAADDAADDAADDwAPD8A/DOBzDDn/DA//DAHvDAPvjAPvjAPvjAPvh///gf/vAAD+AAB8AAAAA==") : atob("GBiBAAAAAAAAAAAAAAAAAAAAAB//+D///D///A//8CP/xDj/HD48DD+B8D/D+D/3vD/vvj/vvj/vvj/vvh/v/gfnvAAD+AAB8AAAAA=="), this.x, this.y);
//if (c<60) Bangle.setLCDPower(1); // keep LCD on for 1 minute
let settings = require('Storage').readJSON("messages.settings.json", true) || {};
if (settings.repeat===undefined) settings.repeat = 4;
@@ -13,9 +12,11 @@ WIDGETS["messages"]={area:"tl",width:0,draw:function() {
WIDGETS["messages"].buzz(); // buzz every 4 seconds
}
setTimeout(()=>WIDGETS["messages"].draw(), 1000);
-},show:function() {
+ if (process.env.HWVERSION>1) Bangle.on('touch', this.touch);
+},show:function(quiet) {
WIDGETS["messages"].t=Date.now(); // first time
WIDGETS["messages"].l=Date.now()-10000; // last buzz
+ if (quiet) WIDGETS["messages"].t -= 500000; // if quiet, set last time in the past so there is no buzzing
WIDGETS["messages"].width=64;
Bangle.drawWidgets();
Bangle.setLCDPower(1);// turns screen on
@@ -33,4 +34,15 @@ WIDGETS["messages"]={area:"tl",width:0,draw:function() {
if (c=="-") Bangle.buzz(500).then(()=>setTimeout(b,100));
}
b();
+},touch:function(b,c) {
+ var w=WIDGETS["messages"];
+ if (!w||!w.width||c.xw.x+w.width||c.yw.y+23) return;
+ load("messages.app.js");
}};
+/* We might have returned here if we were in the Messages app for a
+message but then the watch was never viewed. In that case we don't
+want to buzz but should still show that there are unread messages. */
+if (global.MESSAGES===undefined) (function() {
+ var messages = require("Storage").readJSON("messages.json",1)||[];
+ if (messages.some(m=>m.new)) WIDGETS["messages"].show(true);
+})();
diff --git a/apps/mylocation/ChangeLog b/apps/mylocation/ChangeLog
new file mode 100644
index 000000000..7b83706bf
--- /dev/null
+++ b/apps/mylocation/ChangeLog
@@ -0,0 +1 @@
+0.01: First release
diff --git a/apps/mylocation/README.md b/apps/mylocation/README.md
new file mode 100644
index 000000000..fd597397a
--- /dev/null
+++ b/apps/mylocation/README.md
@@ -0,0 +1,41 @@
+# My Location
+
+ *Sets and stores GPS lat and lon of your preferred city*
+
+* Select one of the preset Cities or setup through the GPS
+* Other Apps can read this information to do calculations based on location
+* When the City shows ??? it means the location has been set through the GPS
+
+## Example Code
+
+ const LOCATION_FILE = "mylocation.json";
+ let location;
+
+ // requires the myLocation app
+ function loadLocation() {
+ location = require("Storage").readJSON(LOCATION_FILE,1)||{"lat":51.5072,"lon":0.1276,"location":"London"};
+ }
+
+## Screenshots
+
+### Select one of the Preset Cities
+
+* The presets are London, Newcastle, Edinburgh, Paris, New York, Tokyo
+
+
+
+### Or select 'Set By GPS' to start the GPS
+
+
+
+### While the GPS is running you will see:
+
+
+
+### When a GPS fix is received you will see:
+
+
+
+
+
+Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)
diff --git a/apps/mylocation/mylocation.app.js b/apps/mylocation/mylocation.app.js
new file mode 100644
index 000000000..fb2f73fa7
--- /dev/null
+++ b/apps/mylocation/mylocation.app.js
@@ -0,0 +1,75 @@
+Bangle.loadWidgets();
+Bangle.drawWidgets();
+
+const SETTINGS_FILE = "mylocation.json";
+let settings;
+
+// initialize with default settings...
+let s = {
+ 'lat': 51.5072,
+ 'lon': 0.1276,
+ 'location': "London"
+}
+
+function loadSettings() {
+ settings = require('Storage').readJSON(SETTINGS_FILE, 1) || s;
+}
+
+function save() {
+ settings = s
+ require('Storage').write(SETTINGS_FILE, settings)
+}
+
+const locations = ["London", "Newcastle", "Edinburgh", "Paris", "New York", "Tokyo","???"];
+const lats = [51.5072 ,54.9783 ,55.9533 ,48.8566 ,40.7128 ,35.6762, 0.0];
+const lons = [-0.1276 ,-1.6178 ,-3.1883 ,2.3522 , -74.0060 ,139.6503, 0.0];
+
+function setFromGPS() {
+ Bangle.on('GPS', (gps) => {
+ //console.log(".");
+ if (gps.fix === 0) return;
+ //console.log("fix from GPS");
+ s = {'lat': gps.lat, 'lon': gps.lon, 'location': '???' }
+ Bangle.buzz(1500); // buzz on first position
+ Bangle.setGPSPower(0);
+ save();
+
+ Bangle.setUI("updown", ()=>{ load() });
+ E.showPrompt("Location has been saved from the GPS fix",{
+ title:"Location Saved",
+ buttons : {"OK":1}
+ }).then(function(v) {
+ load(); // load default clock
+ });
+ });
+
+ Bangle.setGPSPower(1);
+ E.showMessage("Waiting for GPS fix. Place watch in the open. Could take 10 minutes. Long press to abort", "GPS Running");
+ Bangle.setUI("updown", undefined);
+}
+
+function showMainMenu() {
+ console.log("showMainMenu");
+ const mainmenu = {
+ '': { 'title': 'My Location' },
+ '{ load(); },
+ 'City': {
+ value: 0 | locations.indexOf(s.location),
+ min: 0, max: 6,
+ format: v => locations[v],
+ onchange: v => {
+ if (v != 6) {
+ s.location = locations[v];
+ s.lat = lats[v];
+ s.lon = lons[v];
+ save();
+ }
+ }
+ },
+ 'Set From GPS': ()=>{ setFromGPS(); }
+ }
+ return E.showMenu(mainmenu);
+}
+
+loadSettings();
+showMainMenu();
diff --git a/apps/mylocation/mylocation.icon.js b/apps/mylocation/mylocation.icon.js
new file mode 100644
index 000000000..bfb38d5ac
--- /dev/null
+++ b/apps/mylocation/mylocation.icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("mEw4UA///t/7j/P3/vB4cBqtVoAbHBQIABBQ0FBYdQBYsVBYdUERIkGHIQADHoguEGAwuEGAwKFBZg8DHQw8EBYNf/1Vq3/8oLDIwNf/Wpv//0oLG9Wq3/qBYJUCBYuqBaBqBBYW+BepHEBbybCBYP+BYSnErYLDyoLFAANq/r8Ga5T7MBZZUBAAhSCfhA6DBZhIGBQg8FHQg8GHQgwGFwowFBQwwDFwwLMlS7Bqta1AKEn2q1K1C1WgBYf/1WqBYIDB1QKCgYLC0taBYoXB/QICBY0//7vBAAQ8EEgIABCwwME9QVEA"))
diff --git a/apps/mylocation/mylocation.png b/apps/mylocation/mylocation.png
new file mode 100644
index 000000000..7148990a4
Binary files /dev/null and b/apps/mylocation/mylocation.png differ
diff --git a/apps/mylocation/screenshot_1.png b/apps/mylocation/screenshot_1.png
new file mode 100644
index 000000000..a9c61b6b3
Binary files /dev/null and b/apps/mylocation/screenshot_1.png differ
diff --git a/apps/mylocation/screenshot_2.png b/apps/mylocation/screenshot_2.png
new file mode 100644
index 000000000..4c4404540
Binary files /dev/null and b/apps/mylocation/screenshot_2.png differ
diff --git a/apps/mylocation/screenshot_3.png b/apps/mylocation/screenshot_3.png
new file mode 100644
index 000000000..81570670b
Binary files /dev/null and b/apps/mylocation/screenshot_3.png differ
diff --git a/apps/mylocation/screenshot_4.png b/apps/mylocation/screenshot_4.png
new file mode 100644
index 000000000..ffae679c9
Binary files /dev/null and b/apps/mylocation/screenshot_4.png differ
diff --git a/apps/mywelcome/ChangeLog b/apps/mywelcome/ChangeLog
index b012da933..f2b54e42c 100644
--- a/apps/mywelcome/ChangeLog
+++ b/apps/mywelcome/ChangeLog
@@ -14,3 +14,4 @@
0.10: Add birthday style
0.11: Skip double buffering, use 240x240 size
0.12: Fix swipe direction (#800)
+0.13: Bangle.js 2 support
diff --git a/apps/mywelcome/app.js b/apps/mywelcome/app-bangle1.js
similarity index 100%
rename from apps/mywelcome/app.js
rename to apps/mywelcome/app-bangle1.js
diff --git a/apps/mywelcome/app-bangle2.js b/apps/mywelcome/app-bangle2.js
new file mode 100644
index 000000000..aeee6918d
--- /dev/null
+++ b/apps/mywelcome/app-bangle2.js
@@ -0,0 +1,254 @@
+// exec each function from seq one after the other
+function animate(seq,period) {
+ var c = g.getColor();
+ var i = setInterval(function() {
+ if (seq.length) {
+ var f = seq.shift();
+ g.setColor(c);
+ if (f) f();
+ } else clearInterval(i);
+ },period);
+}
+
+// Fade in to FG color with angled lines
+function fade(col, callback) {
+ var n = 0;
+ function f() {"ram"
+ g.setColor(col);
+ for (var i=n;i<240;i+=10) g.drawLine(i,0,0,i).drawLine(i,240,240,i);
+ g.flip();
+ n++;
+ if (n<10) setTimeout(f,0);
+ else callback();
+ }
+ f();
+}
+
+
+var SCENE_COUNT=11;
+function getScene(n) {
+ if (n==0) return function() {
+ console.log("Start app");
+ g.clear(1);
+ eval(require("Storage").read("mywelcome.custom.js"));
+ }
+ if (n==1) return function() {
+ g.reset().setBgColor(0).clearRect(0,0,176,176);
+ g.setFont("6x15");
+ var n=0;
+ var l = Bangle.getLogo();
+ var im = g.imageMetrics(l);
+ var i = setInterval(function() {
+ n+=0.1;
+ g.setColor(n,n,n);
+ g.drawImage(l,(176-im.width)/2,(176-im.height)/2);
+ if (n>=1) {
+ clearInterval(i);
+ setTimeout(()=>g.drawString("Open",44,104), 500);
+ setTimeout(()=>g.drawString("Hackable",44,116), 1000);
+ setTimeout(()=>g.drawString("Smart Watch",44,128), 1500);
+ }
+ },50);
+ };
+ if (n==2) return function() {
+ var img = require("heatshrink").decompress(atob("ptR4n/j/4gH+8H5wl+jOukVVoHZ8dt/n//n37OtgH9sHhwHp4H5xmkGiH72MRje/LL/7iIAEE7sPEgoAC+AlagIlIiMQErPxDwUYxAABwIHCj8N7nOl3uEqa6BEggnFjfM5nCkUil3gEq5KDAAQmC6QmBE4JxSEhIABiQmB8QmSXoQlCYRMdEwIlCAAIlNhYlOiO85nNEyMPEoZwIAAcsYIYmPXoYlMiKaFExX/u9VEqLBBOYrCH+czmtVqJyDEpiaCOYsgSYszmc3qtTEqMR7hzG8AlGmd1OQglOOY6aEgYlCmmZoJMCTBrnD6SaIEoU/zOUuolSjbnBJgqaCEoU5zOXX4RyQYBBzCS4X5zNDqqZCJiERJg5zBEoVJEoM1JgYlQjhMHc4JLEmZMEEp6ZIJgPzS4WTmZMVTILmFYAK+BmglCmd1JgUYJiPNEorABEIOZygDBm5MCiJMQlhMH8ByBXwIlBJgUxJiMd5nOTIzlBTAK+BAANVq4jPAAS/HJgJyCTATAEACC/B4S/IJgIlCYAgAPiS/Kn5yEYANTEyPc5niOQxMB/LlCOapyJJgbpBYAZzROQK/Gl0ATIWfEoZzBc6IlB6SYGgBJBJgpzSlhyH8EAh5MBTIjnCuIlOjjlHTAJzC/LmDTSSYIEoTABOYIlETSKYHXwIABOYM0yYmETSCYHEobnDOYqaBExu8TAwlEc4U5EoiaCmK+NTAolFEwX0TQzBMXwXiEpTBCAAomNEoS+EEo4mIYIImKEoS+EEpDoBEyUbEo3gEo4mJdAImIJY4lJEycdEoPOOBYmPuIlE+HcJYhKKTZ1fhYkB2EAhnNcYMuEhomMr8A3YABEoJyB5gjOAAYmHm9VgELEoJMBEoXAEyXzE45YBJgXwEqx1I+ByDOYJyVJw5yCgEB3cQGgJMWJwQnCu6/CgFBigDB13S/glVAAf1qomCglEoADB1QDBADEPEoNVqEAolEgEKolKErJMDYAJMD0lE0AmaEoNaAgJMCFIYAahV/IgIiDOTgABNYJMEOToiCIoJMCOTzfCN4RMBOTxsDJIRyfIwZMBKQZzfJgRyfOYZMBOUBzCJgNKOT5zDJgLoCADxKBOAIABOT6aCAARyfOYRyjOYRyjOYlKEsBzEEsBzEOUJzDOUIABOUiaDOURzCOUZzCEscKCiY"));
+ var im = g.imageMetrics(img);
+ g.reset();
+ g.setBgColor("#ff00ff");
+ var y = 176, speed = 5;
+ function balloon(callback) {
+ y-=speed;
+ var x = (176-im.width)/2;
+ g.drawImage(img,x,y);
+ g.clearRect(x,y+81,x+77,y+81+speed);
+ if (y>30) setTimeout(balloon,0,callback);
+ else callback();
+ }
+ fade("#ff00ff", function() {
+ balloon(function() {
+ g.setColor(-1).setFont("6x15:2").setFontAlign(0,0);
+ g.drawString("Welcome.",88,130);
+ });
+ });
+ setTimeout(function() {
+ var n=0;
+ var i = setInterval(function() {
+ n+=4;
+ g.scroll(0,-4);
+ if (n>150)
+ clearInterval(i);
+ },20);
+ },3500);
+
+ };
+ if (n==3) return function() {
+ g.reset();
+ g.setBgColor("#ffff00").setColor(0).clear();
+ g.setFont("12x20").setFontAlign(0,0);
+ var x = 70, y = 25, h=25;
+ animate([
+ ()=>g.drawString("Your",x,y+=h),
+ ()=>g.drawString("Bangle.js",x,y+=h),
+ ()=>g.drawString("has one",x,y+=h),
+ ()=>g.drawString("button",x,y+=h),
+ ()=>{g.setFont("12x20:2").setFontAlign(0,0,1).drawString("HERE!",150,88);}
+ ],200);
+ };
+ if (n==4) return function() {
+ g.reset();
+ g.setBgColor("#00ffff").setColor(0).clear();
+ g.setFontAlign(0,0).setFont("6x15:2");
+ g.drawString("Press",88,40).setFontAlign(0,-1);
+ g.setFont("12x20");
+ g.drawString("To wake the\nscreen up, or to\nselect", 88,60);
+ };
+ if (n==5) return function() {
+ g.reset();
+ g.setBgColor("#00ffff").setColor(0).clear();
+ g.setFontAlign(0,0).setFont("6x15:2");
+ g.drawString("Long Press",88,40).setFontAlign(0,-1);
+ g.setFont("12x20");
+ g.drawString("To go back to\nthe clock", 88,60);
+ };
+ if (n==6) return function() {
+ g.reset();
+ g.setBgColor("#ff0000").setColor(0).clear();
+ g.setFontAlign(0,0).setFont("12x20");
+ g.drawString("If Bangle.js ever\nstops, hold the\nbutton for\nten seconds.\n\nBangle.js will\nthen reboot.", 88,78);
+ };
+ if (n==7) return function() {
+ g.reset();
+ g.setBgColor("#0000ff").setColor(-1).clear();
+ g.setFont("12x20").setFontAlign(0,0);
+ var x = 88, y = -20, h=60;
+ animate([
+ ()=>{g.drawString("Bangle.js has a\nfull touchscreen",x,y+=h);},
+ 0,0,
+ ()=>{g.drawString("Drag up and down\nto scroll and\ntap to select",x,y+=h);},
+ ],300);
+ };
+ if (n==8) return function() {
+ g.reset();
+ g.setBgColor("#00ff00").setColor(0).clear();
+ g.setFont("12x20").setFontAlign(0,0);
+ var x = 88, y = -35, h=80;
+ animate([
+ ()=>{g.drawString("Bangle.js comes\nwith a few\napps installed",x,y+=h);},
+ 0,0,
+ ()=>{g.drawString("To add more, visit\nbanglejs.com/apps",x,y+=h);},
+ ],400);
+ };
+ if (n==9) return function() {
+ g.reset();
+ g.setBgColor("#ff0000").setColor(0).clear();
+ g.setFont("12x20").setFontAlign(0,0);
+ var x = 88;
+ g.drawString("You can also make\nyour own apps!",x,30);
+ g.drawString("Check out\nbanglejs.com",x,130);
+
+ var rx = 0, ry = 0;
+ // draw a cube
+ function draw() {
+ // rotate
+ rx += 0.1;
+ ry += 0.11;
+ var rcx=Math.cos(rx),
+ rsx=Math.sin(rx),
+ rcy=Math.cos(ry),
+ rsy=Math.sin(ry);
+ // Project 3D coordinates into 2D
+ function p(x,y,z) {
+ var t;
+ t = x*rcy + z*rsy;
+ z = z*rcy - x*rsy;
+ x=t;
+ t = y*rcx + z*rsx;
+ z = z*rcx - y*rsx;
+ y=t;
+ z += 4;
+ return [88 + 60*x/z, 78+ 60*y/z];
+ }
+
+ var a;
+ // draw a series of lines to make up our cube
+ var s = 30;
+ g.clearRect(88-s,78-s,88+s,78+s);
+ a = p(-1,-1,-1); g.moveTo(a[0],a[1]);
+ a = p(1,-1,-1); g.lineTo(a[0],a[1]);
+ a = p(1,1,-1); g.lineTo(a[0],a[1]);
+ a = p(-1,1,-1); g.lineTo(a[0],a[1]);
+ a = p(-1,-1,-1); g.lineTo(a[0],a[1]);
+ a = p(-1,-1,1); g.moveTo(a[0],a[1]);
+ a = p(1,-1,1); g.lineTo(a[0],a[1]);
+ a = p(1,1,1); g.lineTo(a[0],a[1]);
+ a = p(-1,1,1); g.lineTo(a[0],a[1]);
+ a = p(-1,-1,1); g.lineTo(a[0],a[1]);
+ a = p(-1,-1,-1); g.moveTo(a[0],a[1]);
+ a = p(-1,-1,1); g.lineTo(a[0],a[1]);
+ a = p(1,-1,-1); g.moveTo(a[0],a[1]);
+ a = p(1,-1,1); g.lineTo(a[0],a[1]);
+ a = p(1,1,-1); g.moveTo(a[0],a[1]);
+ a = p(1,1,1); g.lineTo(a[0],a[1]);
+ a = p(-1,1,-1); g.moveTo(a[0],a[1]);
+ a = p(-1,1,1); g.lineTo(a[0],a[1]);
+ }
+
+ setInterval(draw,50);
+ };
+ if (n==10) return function() {
+ g.reset();
+ g.setBgColor("#ffffff");g.clear();
+ g.setFontAlign(0,0);
+ g.setFont("12x20");
+
+ var x = 88, y = 10, h=21;
+ animate([
+ ()=>g.drawString("That's it!",x,y+=h),
+ ()=>{g.drawString("Press",x,y+=h*2);
+ g.drawString("the button",x,y+=h);
+ g.drawString("to start",x,y+=h);
+ g.drawString("Bangle.js",x,y+=h);}
+ ],400);
+ }
+}
+
+var sceneNumber = 0;
+
+function move(dir) {
+ if (dir>0 && sceneNumber+1 == SCENE_COUNT) return; // at the end
+ sceneNumber = (sceneNumber+dir)%SCENE_COUNT;
+ if (sceneNumber<0) sceneNumber=0;
+ clearInterval();
+ getScene(sceneNumber)();
+ if (sceneNumber>1) {
+ var l = SCENE_COUNT;
+ for (var i=0;i move(dir));
+setWatch(()=>{
+ if (sceneNumber == SCENE_COUNT-1)
+ load();
+ else
+ move(1);
+}, BTN1, {repeat:true});
+
+Bangle.setLCDTimeout(0);
+Bangle.setLocked(0);
+Bangle.setLCDPower(1);
+move(0);
diff --git a/apps/mywelcome/custom.html b/apps/mywelcome/custom.html
index c4c721765..340f178e8 100644
--- a/apps/mywelcome/custom.html
+++ b/apps/mywelcome/custom.html
@@ -28,13 +28,15 @@ function getApp() {
var line3 = document.getElementById("line3").value;
var line4 = document.getElementById("line4").value;
var style = document.getElementById("style").value;
+
// build the app's text using a templated String
if (style=="Birthday") return `(function() {
var ib = require("heatshrink").decompress(atob("jk0ggGDhOZAAWQCYwMEBxAMFAAIaHyc/+c5DgwMC/84Dg4aCBgwcDBoOf+Y4GBoQEBn4zCI44DBDQ4NEyf4BpgoIBoefxINMBhApEBrQAKBrrrGWpANZHBT7FBpYqIFAYcJBggNOFQwoFDgwMHBwoMIBwYMKBrkykANLmcwBu0zBrMDBv4AFN5gA/ADY"));
var ir = require("heatshrink").decompress(atob("jk0ggGDhvdAAXQCYwMEBxAMFAAIaH6c/+c9DgwMC/8zDg4aC/4YCHIwNB7/zHAwNCAgM/DQwqDAYIaHBonT/oNMFBAND74NNBhApEBrQAKBrrrGWpANZHBT7FBpYqIFAYcJBgkA5oMF7gNFFQwoFDgwMHHIoMIAAPM5gMKBrk0oANLmcwBu0zBrMDBv4AFN5gA/ADYA="));
var ig = require("heatshrink").decompress(atob("jk0ggGDg93AAVwCYwMEBxAMFAAIaHuc/+c3DgwMC/8yDg4aC/4YCHIwNBv/zHAwNCAgM/DQwqDAYIaHBolz+4NMFBANDv8nBpgMIFIgNaABQNddYy1IBrI4KfYoNLFRAoDDhIMEgHnBgt+BooqGFAoqGBg4OFBhAODBhQNcmUgBpczmAN2mYNZgYN/AApvMAH4Ab"));
var igift = require("heatshrink").decompress(atob("q1QxH+ADOi0QbZ5nMHDQAbKgIACKa4ACKnJWVKghW0KgxWTKgxWyKhBWRKhBWwKhRWPKhRWuKhhWNKhhWtKpxWKKhys8KxBU8Ky5U+KypU/KyhU/KyhU/KynGKn5WTKn5WUKmHCADpJJE7uYABZUfKuuYKv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/AAv+Kv5VT/wADyIAaKpIlbABZSEKv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/ADNtKv6rdKzZVwKhAABy5V/Khw"));
- var W=240,H=240;
+ var W=g.getWidth(),H=g.getHeight();
+ var titleFont = g.getFonts().includes("12x20") ? "12x20" : "6x8:2";
var blns = [];
function updateFlake(f) {
f.im = [ir,ig,ib][Math.round(Math.random()*100)%3];
@@ -60,7 +62,7 @@ var ig = require("heatshrink").decompress(atob("jk0ggGDg93AAVwCYwMEBxAMFAAIaHuc/
});
var x = W/2, y = H/2;
g.drawImage(igift,x-43,y-80);
- g.setFont("6x8",2).setFontAlign(0,0);
+ g.setFont(titleFont).setFontAlign(0,0);
g.drawString(${JSON.stringify(line1)},x,y+=20);
g.drawString(${JSON.stringify(line2)},x,y+=20);
g.setFont("6x8");
@@ -68,7 +70,7 @@ var ig = require("heatshrink").decompress(atob("jk0ggGDg93AAVwCYwMEBxAMFAAIaHuc/
g.drawString(${JSON.stringify(line4)},x,y+=10);
g.flip();
}
- g.clear();
+ g.clear(1).setBgColor(0).setColor(-1).clearRect(0,0,W,H);
setInterval(draw,50);
})()`;
// if (style=="Christmas")
@@ -76,6 +78,7 @@ var ig = require("heatshrink").decompress(atob("jk0ggGDg93AAVwCYwMEBxAMFAAIaHuc/
var isnow = require("heatshrink").decompress(atob("jEagQWTgfAAocf+gFDh4FDiARBggVB3AFBl3Agf8jfkn/AgX/v/9/+Agfv/2//YrBgfwh4wCgfghYFJCIYdFFIw1EIIpNFL44FFOIoAP"));
var itree = require("heatshrink").decompress(atob("mtWxH+ADHHDTI0aGuXH5vNGmhqvTYIzBGtoxF6fTG4g4oGgQyBAAZssGoI0Ga1g1FGdo01ZgIAEGmHHNoLSuAAN/rdb0YFBGlgCBGYIABA4YArGYY1CGn4znAAM6GeVd5PQ5Iyurc/vQ0oGZFAn+d4XC3d5GddiGYIEBy+7zoEBGlFhoEcsQ9GT08+oFk1mkGdaVBMgNArnJ6/KzswGs/J6GlrlbqtbvPC5PCy8wGohniMIPJvIpCqmX3e7vI0BqhqlMIY0DqhtBqoEBa0xgBMIIoEqoABGQwzfsIhBv4qHABM50vQGjg1CGaN66DoBGt1ioGd5LoBGjo1PGYNhvLoCa7wnBqgvGA4YzCAgN5GUAsCqoDBmAHCAYU/wPQ0oSDGcBiDqkwAYcxoFd5P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];
for (var i=0;i<10;i++) {
var f = {
@@ -97,7 +100,7 @@ var ig = require("heatshrink").decompress(atob("jk0ggGDg93AAVwCYwMEBxAMFAAIaHuc/
});
var x = W/2, y = H/2;
g.drawImage(itree,x-27,y-80);
- g.setFont("6x8",2).setFontAlign(0,0);
+ g.setFont(titleFont).setFontAlign(0,0);
g.drawString(${JSON.stringify(line1)},x,y+=20);
g.drawString(${JSON.stringify(line2)},x,y+=20);
g.setFont("6x8");
@@ -105,7 +108,7 @@ var ig = require("heatshrink").decompress(atob("jk0ggGDg93AAVwCYwMEBxAMFAAIaHuc/
g.drawString(${JSON.stringify(line4)},x,y+=10);
g.flip();
}
- g.clear();
+ g.clear(1).setBgColor(0).setColor(-1).clearRect(0,0,W,H);
setInterval(draw,50);
})();
`;
diff --git a/apps/numerals/ChangeLog b/apps/numerals/ChangeLog
index f94d719f4..57818c180 100644
--- a/apps/numerals/ChangeLog
+++ b/apps/numerals/ChangeLog
@@ -7,3 +7,4 @@
0.07: Add date on touch and some improvements (see settings and readme)
0.08: Add new draw styles, tidy up draw functionality
0.09: Tweak for faster rendering
+0.10: Enhance for use with Bangle2, insert new draw mode 'thickfill'
\ No newline at end of file
diff --git a/apps/numerals/README.md b/apps/numerals/README.md
index ebf4c10fe..7a8c25212 100644
--- a/apps/numerals/README.md
+++ b/apps/numerals/README.md
@@ -7,14 +7,20 @@ Settings can be accessed through the app/widget settings menu of the Bangle.js
### Color:
* rnd - shows numerals in different color combinations every time the watches wakes
-* r/g - red/green
-* y/w - yellow/white
-* o/c - orange/cyan
-* b/y - blue/yellow'ish
+* r/g - red/green (Bangle1/Bangle2)
+* y/w - yellow/white (Bangle1 only)
+* o/c - orange/cyan (Bangle1 only)
+* b/y - blue/yellow'ish (Bangle1 only)
+* r/g - red/green (Bangle2 only)
+* g/b - green/blue (Bangle2 only)
+* r/c - red/cyan (Bangle2 only)
+* m/g - magenta/green (Bangle2 only)
### Draw mode
* fill - fill numerals
* frame - only shows outline of numerals
+* framefill - frame with lighter color fill
+* thickfill - thick frame in theme foreground color
### Menu button
* choose button to start launcher menu with
diff --git a/apps/numerals/numerals.app.js b/apps/numerals/numerals.app.js
index 3c7607eb1..baf859915 100644
--- a/apps/numerals/numerals.app.js
+++ b/apps/numerals/numerals.app.js
@@ -6,7 +6,7 @@
* + see README.md for details
*/
-var numerals = {
+ var numerals = {
0:[[9,1,82,1,90,9,90,92,82,100,9,100,1,92,1,9],[30,25,61,25,69,33,69,67,61,75,30,75,22,67,22,33]],
1:[[50,1,82,1,90,9,90,92,82,100,73,100,65,92,65,27,50,27,42,19,42,9]],
2:[[9,1,82,1,90,9,90,53,82,61,21,61,21,74,82,74,90,82,90,92,82,100,9,100,1,92,1,48,9,40,70,40,70,27,9,27,1,19,1,9]],
@@ -19,8 +19,8 @@ var numerals = {
9:[[9,1,82,1,90,9,90,92,82,100,9,100,1,92,1,82,9,74,69,74,69,61,9,61,1,53,1,9],[22,27,69,27,69,41,22,41]],
};
var _12hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"]||false;
-var _hCol = ["#ff5555","#ffff00","#FF9901","#2F00FF"];
-var _mCol = ["#55ff55","#ffffff","#00EFEF","#FFBF00"];
+var _hCol = [];
+var _mCol = [];
var _rCol = 0;
var scale = g.getWidth()/240;
var interval = 0;
@@ -42,15 +42,23 @@ var drawFuncs = {
},
thickframe : function(poly,isHole){
g.drawPoly(poly,true);
- g.drawPoly(translate(1,0,poly),true);
- g.drawPoly(translate(1,1,poly),true);
- g.drawPoly(translate(0,1,poly),true);
+ g.drawPoly(translate(1,0,poly,1),true);
+ g.drawPoly(translate(1,1,poly,1),true);
+ g.drawPoly(translate(0,1,poly,1),true);
+ },
+ thickfill : function(poly,isHole){
+ if (isHole) g.setColor(g.theme.bg);
+ g.fillPoly(poly,true);
+ g.setColor(g.theme.fg);
+ g.drawPoly(translate(1,0,poly,1),true);
+ g.drawPoly(translate(1,1,poly,1),true);
+ g.drawPoly(translate(0,1,poly,1),true);
}
};
-function translate(tx, ty, p){
+function translate(tx, ty, p, ascale){
//return p.map((x, i)=> x+((i&1)?ty:tx));
- return g.transformVertices(p, {x:tx,y:ty,scale:scale});
+ return g.transformVertices(p, {x:tx,y:ty,scale:ascale==undefined?scale:ascale});
}
@@ -99,6 +107,18 @@ function setUpdateInt(set){
if (set) interval=setInterval(draw, REFRESH_RATE);
}
+function setUp(){
+ if (process.env.HWVERSION==1){
+ _hCol = ["#ff5555","#ffff00","#FF9901","#2F00FF"];
+ _mCol = ["#55ff55","#ffffff","#00EFEF","#FFBF00"];
+ } else {
+ _hCol = ["#ff0000","#00ff00","#ff0000","#ff00ff"];
+ _mCol = ["#00ff00","#0000ff","#00ffff","#00ff00"];
+ }
+ if (settings.color==0) _rCol = Math.floor(Math.random()*_hCol.length);
+}
+
+setUp();
g.clear(1);
// Show launcher when button pressed
Bangle.setUI("clock");
@@ -111,11 +131,12 @@ if (settings.showDate) {
}
Bangle.on('lcdPower', function(on){
if (on){
- if (settings.color==0) _rCol = Math.floor(Math.random()*_hCol.length);
+ setUp();
draw();
setUpdateInt(1);
} else setUpdateInt(0);
});
+Bangle.on('lock', () => setUp());
Bangle.loadWidgets();
-Bangle.drawWidgets();
+Bangle.drawWidgets();
\ No newline at end of file
diff --git a/apps/numerals/numerals.settings.js b/apps/numerals/numerals.settings.js
index 70f6e0d98..ae321322a 100644
--- a/apps/numerals/numerals.settings.js
+++ b/apps/numerals/numerals.settings.js
@@ -12,8 +12,8 @@
}
let numeralsSettings = storage.readJSON('numerals.json',1);
if (!numeralsSettings) resetSettings();
- let dm = ["fill","frame","framefill","thickframe"];
- let col = ["rnd","r/g","y/w","o/c","b/y"];
+ let dm = ["fill","frame","framefill","thickframe","thickfill"];
+ let col = process.env.HWVERSION==1?["rnd","r/g","y/w","o/c","b/y"]:["rnd","r/g","g/b","r/c","m/g"];
let btn = [[24,"BTN1"],[22,"BTN2"],[23,"BTN3"],[11,"BTN4"],[16,"BTN5"]];
var menu={
"" : { "title":"Numerals"},
diff --git a/apps/openstmap/ChangeLog b/apps/openstmap/ChangeLog
index 60b9d9ae3..6cb9d061e 100644
--- a/apps/openstmap/ChangeLog
+++ b/apps/openstmap/ChangeLog
@@ -7,3 +7,6 @@
0.07: Move to 96px tiles - less files (64 -> 25) and speed up rendering
0.08: Update for drag event refactor
0.09: Use current theme cols when drawing GPS info
+0.10: Improve scale factor calculation to fix scaling issues (#984)
+0.11: Add slight offset to OSM data to align it properly (fix #984)
+ Fix alignment of satellite info text
diff --git a/apps/openstmap/app.js b/apps/openstmap/app.js
index c33acd8ad..62597ca20 100644
--- a/apps/openstmap/app.js
+++ b/apps/openstmap/app.js
@@ -25,11 +25,11 @@ function drawMarker() {
var fix;
Bangle.on('GPS',function(f) {
fix=f;
- g.reset().clearRect(0,y1,240,y1+8).setFont("6x8").setFontAlign(0,0);
+ g.reset().clearRect(0,y1,g.getWidth()-1,y1+8).setFont("6x8").setFontAlign(0,0);
var txt = fix.satellites+" satellites";
if (!fix.fix)
txt += " - NO FIX";
- g.drawString(txt,120,y1 + 4);
+ g.drawString(txt,g.getWidth()/2,y1 + 4);
drawMarker();
});
Bangle.setGPSPower(1, "app");
diff --git a/apps/openstmap/custom.html b/apps/openstmap/custom.html
index 88d94ed37..56dea1188 100644
--- a/apps/openstmap/custom.html
+++ b/apps/openstmap/custom.html
@@ -63,10 +63,17 @@ TODO:
/* Can see possible tiles on http://leaflet-extras.github.io/leaflet-providers/preview/
However some don't allow cross-origin use */
var TILELAYER = 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png'; // simple, high contrast
- //var TILELAYER = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
+ var PREVIEWTILELAYER = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
//var TILELAYER = 'http://a.tile.stamen.com/toner/{z}/{x}/{y}.png'; // black and white
+
var map = L.map('map').locate({setView: true, maxZoom: 16});
- var tileLayer = L.tileLayer(TILELAYER, {
+ // Tiles used for Bangle.js itself
+ var bangleTileLayer = L.tileLayer(TILELAYER, {
+ maxZoom: 18,
+ attribution: 'Map data © OpenStreetMap contributors'
+ });
+ // Tiles used for the may the user sees (faster)
+ var previewTileLayer = L.tileLayer(PREVIEWTILELAYER, {
maxZoom: 18,
attribution: 'Map data © OpenStreetMap contributors'
});
@@ -83,7 +90,7 @@ TODO:
}
var mapFiles = [];
- tileLayer.addTo(map);
+ previewTileLayer.addTo(map);
function tilesLoaded(ctx, width, height) {
var options = {
@@ -122,16 +129,44 @@ TODO:
}
document.getElementById("getmap").addEventListener("click", function() {
- var bounds = map.getBounds();
var zoom = map.getZoom();
- var centerlatlon = bounds.getCenter();
- var center = map.project(centerlatlon, zoom).divideBy(256);
- var ox = Math.round((center.x - Math.floor(center.x)) * OSMTILESIZE);
- var oy = Math.round((center.y - Math.floor(center.y)) * OSMTILESIZE);
- center = center.floor();
- var tileGetters = [];
+ var centerlatlon = map.getBounds().getCenter();
+ var center = map.project(centerlatlon, zoom).divideBy(OSMTILESIZE);
+ // Reason for 16px adjustment below not 100% known, but it seems to
+ // align everything perfectly: https://github.com/espruino/BangleApps/issues/984
+ var ox = Math.round((center.x - Math.floor(center.x)) * OSMTILESIZE) + 16;
+ var oy = Math.round((center.y - Math.floor(center.y)) * OSMTILESIZE) + 16;
+ center = center.floor(); // make sure we're in the middle of a tile
+ // JS version of Bangle.js's projection
+ function bproject(lat, lon) {
+ const degToRad = Math.PI / 180; // degree to radian conversion
+ const latMax = 85.0511287798; // clip latitude to sane values
+ const R = 6378137; // earth radius in m
+ if (lat > latMax) lat=latMax;
+ if (lat < -latMax) lat=-latMax;
+ var s = Math.sin(lat * degToRad);
+ return new L.Point(
+ (R * lon * degToRad),
+ (R * Math.log((1 + s) / (1 - s)) / 2)
+ );
+ }
+ // Work out scale factors (how much from Bangle.project does one pixel equate to?)
+ var pc = map.unproject(center.multiplyBy(OSMTILESIZE), zoom);
+ var pd = map.unproject(center.multiplyBy(OSMTILESIZE).add({x:1,y:0}), zoom);
+ var bc = bproject(pc.lat, pc.lng)
+ var bd = bproject(pd.lat, pd.lng)
+ var scale = bc.distanceTo(bd);
- // Render everything to a canvas - 512 x 512 px
+ // test
+ /*var p = bproject(centerlatlon.lat, centerlatlon.lng);
+ var q = bproject(mylat, mylon);
+ var testPt = {
+ x : (q.x-p.x)/scale + (MAPSIZE/2),
+ y : (MAPSIZE/2) - (q.y-p.y)/scale
+ };*/
+
+ var tileGetters = [];
+ // Render everything to a canvas...
var canvas = document.getElementById("maptiles");
canvas.style.display="";
var ctx = canvas.getContext('2d');
@@ -147,10 +182,16 @@ TODO:
tileGetters.push(new Promise(function(resolve,reject) {
img.onload = function(){
ctx.drawImage(img,i*OSMTILESIZE - ox, j*OSMTILESIZE - oy);
+ /*if (testPt) {
+ ctx.fillStyle="green";
+ ctx.fillRect(testPt.x-1, testPt.y-5, 3,10);
+ ctx.fillRect(testPt.x-5, testPt.y-1, 10,3);
+ }*/
resolve();
};
}));
- img.src = tileLayer.getTileUrl(coords);
+ bangleTileLayer._tileZoom = previewTileLayer._tileZoom;
+ img.src = bangleTileLayer.getTileUrl(coords);
})(i,j);
}
}
@@ -163,7 +204,7 @@ TODO:
imgx : canvas.width,
imgy : canvas.height,
tilesize : TILESIZE,
- scale : 10000*Math.pow(2,16-zoom), // FIXME - this is probably wrong
+ scale : scale, // how much of Bangle.project(latlon) does one pixel equate to?
lat : centerlatlon.lat,
lon : centerlatlon.lng
})});
diff --git a/apps/openstmap/openstmap.js b/apps/openstmap/openstmap.js
index 554a71ca3..d995aca25 100644
--- a/apps/openstmap/openstmap.js
+++ b/apps/openstmap/openstmap.js
@@ -34,8 +34,8 @@ exports.draw = function() {
var cx = g.getWidth()/2;
var cy = g.getHeight()/2;
var p = Bangle.project({lat:m.lat,lon:m.lon});
- var ix = (p.x-map.center.x)*4096/map.scale + (map.imgx/2) - cx;
- var iy = (map.center.y-p.y)*4096/map.scale + (map.imgy/2) - cy;
+ var ix = (p.x-map.center.x)/map.scale + (map.imgx/2) - cx;
+ var iy = (map.center.y-p.y)/map.scale + (map.imgy/2) - cy;
//console.log(ix,iy);
var tx = 0|(ix/map.tilesize);
var ty = 0|(iy/map.tilesize);
@@ -57,8 +57,8 @@ exports.latLonToXY = function(lat, lon) {
var cx = g.getWidth()/2;
var cy = g.getHeight()/2;
return {
- x : (q.x-p.x)*4096/map.scale + cx,
- y : cy - (q.y-p.y)*4096/map.scale
+ x : (q.x-p.x)/map.scale + cx,
+ y : cy - (q.y-p.y)/map.scale
};
};
@@ -66,6 +66,6 @@ exports.latLonToXY = function(lat, lon) {
exports.scroll = function(x,y) {
var a = Bangle.project({lat:this.lat,lon:this.lon});
var b = Bangle.project({lat:this.lat+1,lon:this.lon+1});
- this.lon += x * this.map.scale / ((a.x-b.x) * 4096);
- this.lat -= y * this.map.scale / ((a.y-b.y) * 4096);
+ this.lon += x * this.map.scale / (a.x-b.x);
+ this.lat -= y * this.map.scale / (a.y-b.y);
};
diff --git a/apps/openstmap/screenshot.png b/apps/openstmap/screenshot.png
new file mode 100644
index 000000000..2895b562e
Binary files /dev/null and b/apps/openstmap/screenshot.png differ
diff --git a/apps/pastel/ChangeLog b/apps/pastel/ChangeLog
index 6bfd2ce59..2ede0e161 100644
--- a/apps/pastel/ChangeLog
+++ b/apps/pastel/ChangeLog
@@ -3,5 +3,6 @@
0.03: Make it work with Gadgetbridge, Notifications fullscreen on a Bangle 2
0.04: Leave space at the bottom for Chrono widget, set back option at first option
0.05: Added 2 new fonts
-0.06: COnverted fonts to font modules
+0.06: Converted fonts to font modules
0.07: Added info line that cycles on BTN1/BTN3 (or vitual buttons on a bangle 2)
+0.08: Added dependancy on MyLocation
diff --git a/apps/pastel/README.md b/apps/pastel/README.md
index f183005a9..66ae0e189 100644
--- a/apps/pastel/README.md
+++ b/apps/pastel/README.md
@@ -1,6 +1,6 @@
# Pastel Clock
- *a configurable clock with custom fonts and background*
+ *a configurable clock with custom fonts and background. Has a cyclic information line that includes, day, date, battery, sunrise and sunset times*
* Designed specifically for Bangle 1 and Bangle 2
* A choice of 7 different custom fonts
@@ -8,12 +8,13 @@
* Has a settings menu, change font, enable/disable the grid
* On Bangle 1 use BTN1,BTN3 to cycle through the info display (Date, ID, Batt %, Ram % etc)
* On Bangle 2 touch the top right/top left to cycle through the info display (Date, ID, Batt %, Ram % etc)
-
+* Uses mylocation.json from MyLocation app to calculate sunrise and sunset times for your location
+* Uses pedometer widget to get latest step count
+* Dependant apps are installed when Pastel installs
I came up with the name Pastel due to the shade of the grid background.
-## Creator
-[Hugh Barney](https://github.com/hughbarney)
+Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)
## Lato

diff --git a/apps/pastel/pastel.app.js b/apps/pastel/pastel.app.js
index 013a010cf..aa4f6abf8 100644
--- a/apps/pastel/pastel.app.js
+++ b/apps/pastel/pastel.app.js
@@ -1,6 +1,9 @@
+var SunCalc = require("https://raw.githubusercontent.com/mourner/suncalc/master/suncalc.js");
require("f_latosmall").add(Graphics);
const SETTINGS_FILE = "pastel.json";
+const LOCATION_FILE = "mylocation.json";
let settings;
+let location;
function loadSettings() {
settings = require("Storage").readJSON(SETTINGS_FILE,1)||{};
@@ -8,6 +11,29 @@ function loadSettings() {
settings.font = settings.font||"Lato";
}
+// requires the myLocation app
+function loadLocation() {
+ location = require("Storage").readJSON(LOCATION_FILE,1)||{"lat":51.5072,"lon":0.1276,"location":"London"};
+}
+
+function extractTime(d){
+ var h = d.getHours(), m = d.getMinutes();
+ return(("0"+h).substr(-2) + ":" + ("0"+m).substr(-2));
+}
+
+var sunRise = "00:00";
+var sunSet = "00:00";
+var drawCount = 0;
+
+function updateSunRiseSunSet(now, lat, lon, line){
+ // get today's sunlight times for lat/lon
+ var times = SunCalc.getTimes(new Date(), lat, lon);
+
+ // format sunrise time from the Date object
+ sunRise = extractTime(times.sunrise);
+ sunSet = extractTime(times.sunset);
+}
+
function loadFonts() {
// load font files based on settings.font
if (settings.font == "Architect")
@@ -39,6 +65,8 @@ const infoData = {
ID_BLANK: { calc: () => '' },
ID_DATE: { calc: () => {var d = (new Date).toString().split(" "); return d[2] + ' ' + d[1] + ' ' + d[3];} },
ID_DAY: { calc: () => {var d = require("locale").dow(new Date).toLowerCase(); return d[0].toUpperCase() + d.substring(1);} },
+ ID_SR: { calc: () => 'Sunrise: ' + sunRise },
+ ID_SS: { calc: () => 'Sunset: ' + sunSet },
ID_STEP: { calc: () => 'Steps: ' + stepsWidget().getSteps() },
ID_BATT: { calc: () => 'Battery: ' + E.getBattery() + '%' },
ID_MEM: { calc: () => {var val = process.memory(); return 'Ram: ' + Math.round(val.usage*100/val.total) + '%';} },
@@ -148,6 +176,10 @@ function draw() {
g.setFontLatoSmall();
g.setFontAlign(0, -1);
g.drawString((infoData[infoMode].calc()), w/2, h - 24 - 24);
+
+ if (drawCount % 3600 == 0)
+ updateSunRiseSunSet(new Date(), location.lat, location.lon);
+ drawCount++;
}
// Only update when display turns on
@@ -169,6 +201,8 @@ Bangle.setUI("clockupdown", btn=> {
loadSettings();
loadFonts();
+loadLocation();
+
g.clear();
var secondInterval = setInterval(draw, 1000);
draw();
diff --git a/apps/pebble/ChangeLog b/apps/pebble/ChangeLog
new file mode 100644
index 000000000..b3d37f841
--- /dev/null
+++ b/apps/pebble/ChangeLog
@@ -0,0 +1,5 @@
+0.01: first release
+0.02: included deployment of pebble.settings.js in apps.json
+0.03: Changed time+calendar font to LECO1976Regular, changed to slanting boot
+0.04: Fix widget hiding code (fix #1046)
+0.05: Fix typo in settings - Purple
diff --git a/apps/pebble/LECO 1976-Regular.otf b/apps/pebble/LECO 1976-Regular.otf
new file mode 100644
index 000000000..05a318224
Binary files /dev/null and b/apps/pebble/LECO 1976-Regular.otf differ
diff --git a/apps/pebble/README.md b/apps/pebble/README.md
new file mode 100644
index 000000000..4b0233781
--- /dev/null
+++ b/apps/pebble/README.md
@@ -0,0 +1,17 @@
+# Pebble
+
+ *a Pebble style clock with configurable background color, to keep the revolution going*
+
+* Designed specifically for Bangle 2
+* A choice of 6 different background colous through its setting menu. Goto Settings, App/Widget settings, Pebble.
+* Supports the Light and Dark themes
+* Uses pedometer widget to get latest step count
+* Dependant apps are installed when Pebble installs
+* Uses the whole screen, widgets are made invisible but still run in the background
+* When battery is less than 30% main screen goes Red
+
+
+
+
+
+Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)
diff --git a/apps/pebble/pebble.app.js b/apps/pebble/pebble.app.js
new file mode 100644
index 000000000..106e09b82
--- /dev/null
+++ b/apps/pebble/pebble.app.js
@@ -0,0 +1,121 @@
+Graphics.prototype.setFontLECO1976Regular42 = function(scale) {
+ // Actual height 42 (41 - 0)
+ g.setFontCustom(atob("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/AAAAAAAAH/AAAAAAAAH/AAAAAAAAH/AAAAAAAAH/AAAAAAAAH/AAAAAAAAH/AAAAAAAAH/AAAAAAAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAA/AAAAAAAAH/AAAAAAAA//AAAAAAAP//AAAAAAB///AAAAAAP///AAAAAB////AAAAAf////AAAAD////4AAAAf////AAAAH////4AAAA////+AAAAA////wAAAAA///+AAAAAA///gAAAAAA//8AAAAAAA//gAAAAAAA/4AAAAAAAA/AAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAAAAAAAH/AAAAAAAAH/AAAAAAAAH/AAAAAAAAH/AAAAAAAAH/AAAAAAAAH/AAAAAAAAH/AAAAAAAAH/AAAAAAAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//h////AAA//h////AAA//h////AAA//h////AAA//h////AAA//h////AAA//h////AAA//h////AAA//h////AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA////wH/AAA////wH/AAA////wH/AAA////wH/AAA////wH/AAA////wH/AAA////wH/AAA////wH/AAA////gD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4AAAH/AAA/4B/gH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////wAAAAA////wAAAAA////wAAAAA////wAAAAA////wAAAAA////wAAAAA////wAAAAA////wAAAAA////wAAAAAAAB/wAAAAAAAB/wAAAAAAAB/wAAAAAAAB/wAAAAAAAB/wAAAAAAAB/wAAAAAAAB/wAAAAAAAB/wAAAAAAAB/wAAAAAAAB/wAAAAAAAB/wAAAAAAAB/wAAAAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////x//AAA////x//AAA////x//AAA////x//AAA////x//AAA////x//AAA////x//AAA////x//AAA////x//AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B////AAA/4B////AAA/4B////AAA/4B////AAA/4B////AAA/4B////AAA/4B////AAA/4B////AAA/wB////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B////AAA/4B////AAA/4B////AAA/4B////AAA/4B////AAA/4B////AAA/4B////AAA/4B////AAA/wB////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//gAAAAAAA//gAAAAAAA//gAAAAAAA//gAAAAAAA//gAAAAAAA//gAAAAAAA//gAAAAAAA//gAAAAAAA//gAAAAAAA/4AAAAAAAA/4AAAAAAAA/4AAAAAAAA/4AAAAAAAA/4AAAAAAAA/4AAAAAAAA/4AAAAAAAA/4AAAAAAAA/4AAAAAAAA/4AAAAAAAA/4AAAAAAAA/4AAAAAAAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////wH/AAA////wH/AAA////wH/AAA////wH/AAA////wH/AAA////wH/AAA////wH/AAA////wH/AAA////wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA/4B/wH/AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAA///////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP+AAH/AAAAP+AAH/AAAAP+AAH/AAAAP+AAH/AAAAP+AAH/AAAAP+AAH/AAAAP+AAH/AAAAP+AAH/AAAAH+AAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"), 46, atob("ERkmHyYmJiYmJCYmEQ=="), 60+(scale<<8)+(1<<16));
+}
+
+Graphics.prototype.setFontLECO1976Regular22 = function(scale) {
+ // Actual height 22 (21 - 0)
+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OHHA//8D//wP//A//8AAAAAAAAOA4A4DgDgOAOA4AAAAAAAAOA/A4H8DgfwOA/AAAAAAAAB4AAPwAA/AAD8AAf4ABzgAPPAA8cAHh4AAAAAAAAAAAAHHAAccABxwAHHAAccABxwAHHAAccABxwAHHAAAAAAAAAOHAA4cADzwAPPAAf4AB/gAD8AAPwAAeAAB4AAAAAAAAA+AAD4AAPgAA+ecDh9wOH3A4fcDhwAP/AA/8AD/wAP/AAAAAAAAAP//4///j//+P//44ADjn/OOf845/zjnHOP8c4//zj//OP/84AAAAAAAP//A//8D//wP//A4cADhwAOHAA4cAD//wP//A//8D//wAAAAAAAD//wP//A//8D//wOHHA4ccDhxwOHHA//8D//wP9/A/j8AAAAAAAA//8D//wP//A//8DgBwOAHA4AcDgBwOAHA4AcDgBwOAHAAAAAAAAP//A//8D//wP//A4AcDgBwOAHA8A8D//wH/+AP/wAf+AAAAAAAAD//wP//A//8D//wOHHA4ccDhxwOHHA4ccDhxwOAHA4AcAAAAAAAA//8D//wP//A//8DhwAOHAA4cADhwAOHAA4cADgAAOAAAAAAD//wP//A//8D//wOAHA4ccDhxwOHHA4f8Dh/wOH/A4f8AAAAAAAA//8D//wP//A//8ABwAAHAAAcAABwAP//A//8D//wP//AAAAAAAAP//A//8D//wP//AAAAAAAAOAHA4AcDgBwOAHA4AcDgBwOAHA//8D//wP//A//8AAAAAAAA//8D//wP//A//8AHwAA/AAP8AB/wAPn/A8f8DB/wIH/AAAAAAAAP//A//8D//wP//AAAcAABwAAHAAAcAABwAAHAAAAAAAAP//A//8D//wP//Af8AAP+AAH/AAD8AAHwAD/AB/wAf8AP+AA//8D//wP//AAAAAAAAP//A//8D//wP//AfwAAfwAAfwAAfwAAfwP//A//8D//wAAAAAAAAAAAP//A//8D//wP//A4AcDgBwOAHA4AcD//wP//A//8D//wAAAAAAAD//wP//A//8D//wOHAA4cADhwAOHAA/8AD/wAP/AA/8AAAAAP//A//8D//wP//A4AcDgBwOAHA4AcD//+P//4///j//+AAA4AADgAAAP//A//8D//wP//A4eADh+AOH8A4f4D/3wP/HA/8MD/wQAAAAAAAD/xwP/HA/8cD/xwOHHA4ccDhxwOHHA4f8Dh/wOH/A4f8AAAAAAAA4AADgAAOAAA//8D//wP//A//8DgAAOAAA4AADgAAAAAA//8D//wP//A//8AABwAAHAAAcAABwP//A//8D//wP//AAAADAAAPgAA/wAD/4AB/8AA/8AAfwAB/AA/8Af+AP/AA/wAD4AAMAAA4AAD+AAP/gA//8AH/wAB/AAf8Af/wP/4A/4AD/gAP/4AH/8AB/wAB/AB/8D//wP/gA/gADgAAIABA4AcDwDwPw/Afn4Af+AA/wAD/AA//AH5+A/D8DwDwOAHAgAEAAAAP/AA/8AD/wAP/AAAf8AB/wAH/AAf8D/wAP/AA/8AD/wAAAAAAAADh/wOH/A4f8Dh/wOHHA4ccDhxwOHHA/8cD/xwP/HA/8cAAAAAAAAf//9///3///f//9wAA3AADcAAMAAAOAAA/gAD/wAH/8AB/8AA/wAAPAAAEAAAAHAADcAANwAB3///f//9///wAA"), 32, atob("BwYLDg4UDwYJCQwMBgkGCQ4MDg4ODg4NDg4GBgwMDA4PDg4ODg4NDg4GDQ4MEg8ODQ8ODgwODhQODg4ICQg="), 22+(scale<<8)+(1<<16));
+}
+
+const SETTINGS_FILE = "pebble.json";
+let settings;
+
+function loadSettings() {
+ settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#0f0', 'color': 'Green'};
+}
+
+var img = require("heatshrink").decompress(atob("oFAwkEogA/AH4A/AH4A/AH4A/AE8AAAoeXoAfeDQUBmcyD7A+Dh///8QD649CiAfaHwUvD4sEHy0DDYIfEICg+Cn4fHICY+DD4nxcgojOHwgfEIAYfRCIQaDD4ZAFD5r7DH4//kAfRCIZ/GAAnwD5p9DX44fTHgYSBf4ofVDAQEBl4fFUAgfOXoQzBgIfFBAIfPP4RAEAoYAB+cRiK/SG4h/WIBAfXIA7CBAAswD55AHn6fUIBMCD65AHl4gCmcziAfQQJqfQQJpiDgk0IDXxQLRAEECaBM+QgRYRYgUIA0CD4ggSQJiDCiAKBICszAAswD55AHABKBVD7BAFABIqBD5pAFABPxD55AOD6BADiIAJQAyxLABwf/gaAPAH4A/AH4ARA=="));
+
+const h = g.getHeight();
+const w = g.getWidth();
+const ha = 2*h/5 - 4;
+const h2 = 3*h/5 - 10;
+const h3 = 7*h/8;
+
+let batteryWarning = false;
+
+function draw() {
+ let date = new Date();
+ let da = date.toString().split(" ");
+ let timeStr = da[4].substr(0,5);
+ const t = 6;
+
+ // turn the warning on once we have dipped below 30%
+ if (E.getBattery() < 30)
+ batteryWarning = true;
+
+ // turn the warning off once we have dipped above 40%
+ if (E.getBattery() > 40)
+ batteryWarning = false;
+
+ g.reset();
+ g.setColor(settings.bg);
+ g.fillRect(0, 0, w, h2 - t);
+
+ // contrast bar
+ g.setColor(g.theme.fg);
+ g.fillRect(0, h2 - t, w, h2);
+
+ // day and steps
+ if (settings.color == 'Blue' || settings.color == 'Red')
+ g.setColor('#fff'); // white on blue or red best contrast
+ else
+ g.setColor('#000'); // otherwise black regardless of theme
+
+ g.setFontLECO1976Regular22();
+ g.setFontAlign(0, -1);
+ g.drawString(da[0].toUpperCase(), w/4, ha); // day of week
+ g.drawString(getSteps(), 3*w/4, ha);
+
+ // time
+ // white on red for battery warning
+ g.setColor(!batteryWarning ? g.theme.bg : '#f00');
+ g.fillRect(0, h2, w, h3);
+
+ g.setFontLECO1976Regular42();
+ g.setFontAlign(0, -1);
+ g.setColor(!batteryWarning ? g.theme.fg : '#fff');
+ g.drawString(timeStr, w/2, h2 + 8);
+
+ // contrast bar
+ g.setColor(g.theme.fg);
+ g.fillRect(0, h3, w, h3 + t);
+
+ // the bottom
+ g.setColor(settings.bg);
+ g.fillRect(0, h3 + t, w, h);
+
+ g.setColor(settings.bg);
+ g.drawImage(img, w/2 + ((w/2) - 64)/2, 1, { scale: 1 });
+ drawCalendar(((w/2) - 42)/2, 14, 42, 4, da[2]);
+}
+
+// at x,y width:wi thicknes:th
+function drawCalendar(x,y,wi,th,str) {
+ g.setColor(g.theme.fg);
+ g.fillRect(x, y, x + wi, y + wi);
+ g.setColor(g.theme.bg);
+ g.fillRect(x + th, y + th, x + wi - th, y + wi - th);
+ g.setColor(g.theme.fg);
+
+ let hook_t = 6;
+ // first calendar hook, one third in
+ g.fillRect(x + (wi/3) - (th/2), y - hook_t, x + wi/3 + th - (th/2), y + hook_t);
+ // second calendar hook, two thirds in
+ g.fillRect(x + (2*wi/3) -(th/2), y - hook_t, x + 2*wi/3 + th - (th/2), y + hook_t);
+
+ g.setFontLECO1976Regular22();
+ g.setFontAlign(0, 0);
+ g.drawString(str, x + wi/2, y + wi/2 + th);
+}
+
+function getSteps() {
+ if (WIDGETS.wpedom !== undefined) {
+ return WIDGETS.wpedom.getSteps();
+ }
+ return '????';
+}
+
+g.clear();
+Bangle.loadWidgets();
+/*
+ * we are not drawing the widgets as we are taking over the whole screen
+ * so we will blank out the draw() functions of each widget and change the
+ * area to the top bar doesn't get cleared.
+ */
+for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";}
+loadSettings();
+setInterval(draw, 15000); // refresh every 15s
+draw();
+Bangle.setUI("clock");
diff --git a/apps/pebble/pebble.icon.js b/apps/pebble/pebble.icon.js
new file mode 100644
index 000000000..ecd7feb7f
--- /dev/null
+++ b/apps/pebble/pebble.icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("oFAwgNKiIAIFqofegIf/DAUzAAMyAwUQD60T/4ACD7Q/cPxIf/YCofcDhYiSXYYfuUZgf/D/4f/D6USkUgD/4fuogAID6vtDw/UD6vu6geF73kb6vuEAtN9wfYMIneD7JADDwIfaIAJdBD7YgBHwQfbAAgfkf6Qf/D/4feogAID6oAND/4f/iAdJD/4f/D/4fUDxYABD74iODiAftTZgfnYYczAAMyD7UT/4ACH/S+bD8DAKD9Y="))
diff --git a/apps/pebble/pebble.png b/apps/pebble/pebble.png
new file mode 100644
index 000000000..10f5adb56
Binary files /dev/null and b/apps/pebble/pebble.png differ
diff --git a/apps/pebble/pebble.settings.js b/apps/pebble/pebble.settings.js
new file mode 100644
index 000000000..ff408907d
--- /dev/null
+++ b/apps/pebble/pebble.settings.js
@@ -0,0 +1,38 @@
+(function(back) {
+ const SETTINGS_FILE = "pebble.json";
+
+ // initialize with default settings...
+ let s = {'bg': '#0f0', 'color': 'Green'}
+
+ // ...and overwrite them with any saved values
+ // This way saved values are preserved if a new version adds more settings
+ const storage = require('Storage')
+ let settings = storage.readJSON(SETTINGS_FILE, 1) || s;
+ const saved = settings || {}
+ for (const key in saved) {
+ s[key] = saved[key]
+ }
+
+ function save() {
+ settings = s
+ storage.write(SETTINGS_FILE, settings)
+ }
+
+ var color_options = ['Green','Orange','Cyan','Purple','Red','Blue'];
+ var bg_code = ['#0f0','#ff0','#0ff','#f0f','#f00','#00f'];
+
+ E.showMenu({
+ '': { 'title': 'Pebble Clock' },
+ '< Back': back,
+ 'Colour': {
+ value: 0 | color_options.indexOf(s.color),
+ min: 0, max: 5,
+ format: v => color_options[v],
+ onchange: v => {
+ s.color = color_options[v];
+ s.bg = bg_code[v];
+ save();
+ },
+ }
+ });
+})
diff --git a/apps/pebble/pebble_screenshot.png b/apps/pebble/pebble_screenshot.png
new file mode 100644
index 000000000..169df2d22
Binary files /dev/null and b/apps/pebble/pebble_screenshot.png differ
diff --git a/apps/pebble/pebble_screenshot2.png b/apps/pebble/pebble_screenshot2.png
new file mode 100644
index 000000000..cd09e1c2f
Binary files /dev/null and b/apps/pebble/pebble_screenshot2.png differ
diff --git a/apps/pebble/pebble_screenshot3.png b/apps/pebble/pebble_screenshot3.png
new file mode 100644
index 000000000..0de8df516
Binary files /dev/null and b/apps/pebble/pebble_screenshot3.png differ
diff --git a/apps/pooqroman/ChangeLog b/apps/pooqroman/ChangeLog
new file mode 100644
index 000000000..c4f3171d3
--- /dev/null
+++ b/apps/pooqroman/ChangeLog
@@ -0,0 +1,3 @@
+0.01: Initial check-in.
+0.02: Make internal menu time out + small fixes.
+0.03: Autolight feature.
diff --git a/apps/pooqroman/README.md b/apps/pooqroman/README.md
new file mode 100644
index 000000000..87acea9ca
--- /dev/null
+++ b/apps/pooqroman/README.md
@@ -0,0 +1,45 @@
+# pooq Roman: a classic watch face with amusing dynamicity
+
+This is a normal watch face for telling the time.
+It is unusual in that it supports the 24 hour clock by dynamically updating the labels on the face
+(so, if you enable 24 hour mode, you will get to see a hand pointing to XXIII o'clock each evening).
+
+The date and day of the week can also be displayed, and they choose their own spelling depending on the available screen space. It's fun!
+
+## Options
+
+Because sometimes I don't want to burn what I'm cooking and other times I'm lazy and just want to know if it's afternoon yet,
+you can alter the number of hands on the display. When the watch is unlocked, slide up to add minute and second hands, or down to remove the distraction.
+There's also a setting that displays the second hand, but only if the watch is perfectly face-to-the-sky, in case you want
+the ability to check the _exact_ time, hands free, without the impact on battery life this usually entails.
+
+Although we generally obey the system-wide theming, you can long press on the display for a menu of additional options specific to the face.
+You can also override the system 12/24 hour setting just for this face here, since it's, well, a rather different experience than with numeric displays.
+
+By default, there is a backlight that comes on when you twist your wrist. This, of course, somewhat increases power draw and could be
+annoying in an intentionally dark environment, so there is an option to disable it.
+
+One other thing: there's some integration with system timers and alarms; they will show as small pips at the appropriate places
+in the day around the display. When they come within an hour, the pips turn to crosses relating to the minute hand, and the minute
+hand turns itself on. When timers are mere seconds away, the display changes again and the second hand activates itself, so you
+can watch as your doom approaches.
+
+## Limitations
+
+Since this is intended as a design exercise, it does not and will probably never support the Bangle's standard widgets.
+Sorry about that, but control of all the pixels was just too important to me.
+
+There's also no support for internationalisation at present. This irks me, but... well, talk to me about it if there's a language you'd like.
+
+## The future
+
+The design is begging for integration with host-device calendars, and proper time zone/DST support. We'll see what the future holds.
+
+## Feedback
+
+[I'd be happy to hear your feedback](https://www.github.com/stephenPspackman) if you have comments or find any bugs, or (most especially)
+if you find this work interesting.
+
+## By
+
+Made by [Stephen P Spackman](https://www.github.com/stephenPspackman).
diff --git a/apps/pooqroman/app-icon.js b/apps/pooqroman/app-icon.js
new file mode 100644
index 000000000..20a9c8b0a
--- /dev/null
+++ b/apps/pooqroman/app-icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("mEwwkBiIAWiEAgIpKEwgrFgAaBgIcBAAwREC4oVBBoQoCAQoXJBogXqI653DC6SnEC9RHXX/6/kSgIAGU5wAICQhfGACAX/C/4AOXIIX/C/4X/C/4XUgEBF6wYHI6AYGL6MACIgXRCIISDR6QYEU6YYDX6gYCAAKxHDB4XTDAYXUL6oAgA=="))
diff --git a/apps/pooqroman/app.js b/apps/pooqroman/app.js
new file mode 100644
index 000000000..bed8ef3d2
--- /dev/null
+++ b/apps/pooqroman/app.js
@@ -0,0 +1,782 @@
+/* -*- mode: Javascript; c-basic-offset: 2; indent-tabs-mode: nil; coding: latin-1 -*- */
+// pooqRoman
+//
+// Copyright (c) 2021 Stephen P Spackman
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+//
+// Notes:
+//
+// This only works for Bangle 2.
+
+//////////////////////////////////////////////////////////////////////////////
+/* System integration */
+
+const storage = require('Storage');
+
+const settings = storage.readJSON("setting.json", true) || {};
+
+const alarms = storage.readJSON('alarm.json', true) || [];
+
+/*
+ { on : true,
+ hr : 6.5, // hours + minutes/60
+ msg : "Eat chocolate",
+ last : 0, // last day of the month we alarmed on - so we don't alarm twice in one day!
+ rp : true, // repeat
+ as : false, // auto snooze
+ timer : 5, // OPTIONAL - if set, this is a timer and it's the time in minutes
+ }
+*/
+
+//////////////////////////////////////////////////////////////////////////////
+/* Face-specific options */
+
+class Options {
+ // Protocol: subclasses must have static id and defaults fields.
+ // Only fields named in the defaults will be saved.
+ constructor() {
+ this.id = this.constructor.id;
+ this.file = `${this.id}.json`;
+ this.backing = storage.readJSON(this.file, true) || {};
+ Object.setPrototypeOf(this.backing, this.constructor.defaults);
+ this.reactivator = _ => this.active();
+ Object.keys(this.constructor.defaults).forEach(k => this.bless(k));
+ }
+
+ writeBack(delay) {
+ if (this.timeout) clearTimeout(this.timeout);
+ this.timeout = setTimeout(
+ () => {
+ this.timeout = null;
+ storage.writeJSON(this.file, this.backing);
+ },
+ delay
+ );
+ }
+
+ bless(k) {
+ Object.defineProperty(this, k, {
+ get: () => this.backing[k],
+ set: v => {
+ this.backing[k] = v;
+ // Ten second writeback delay, since the user will roll values up and down.
+ this.writeBack(10000);
+ }
+ });
+ }
+
+ showMenu(m) {
+ if (m instanceof Function) m = m();
+ if (m) {
+ for (const k in m) if ('init' in m[k]) m[k].value = m[k].init();
+ m[''].selected = -1; // Workaround for self-selection bug.
+ Bangle.on('drag', this.reactivator);
+ this.active();
+ } else {
+ if (this.bored) clearTimeout(this.bored);
+ this.bored = null;
+ Bangle.removeListener('drag', this.reactivator);
+ this.emit('done');
+ }
+ g.clear(true);
+ E.showMenu(m);
+ }
+
+ active() {
+ if (this.bored) clearTimeout(this.bored);
+ this.bored = setTimeout(_ => this.showMenu(), 15000);
+ }
+
+ reset() {
+ this.backing = {__proto__: this.constructor.defaults};
+ this.writeBack(0);
+ }
+}
+
+class RomanOptions extends Options {
+ constructor() {
+ super();
+ this.menu = {
+ '': {title: '* face options *'},
+ '< Back': _ => this.showMenu(),
+ Ticks: {
+ init: _ => this.resolution,
+ min: 0, max: 3,
+ onchange: x => this.resolution = x,
+ format: x => ['seconds', 'seconds (up)', 'minutes', 'hours'][x]
+ },
+ 'Display': {
+ init: _ => this.o24h == null ? 0 : 1 + this.o24h,
+ min: 0, max: 2,
+ onchange: x => this.o24h = [null, 0, 1][x],
+ format: x => ['system', '12h', '24h'][x]
+ },
+ 'Day of Week': {
+ init: _ => this.dow,
+ onchange: x => this.dow = x
+ },
+ Calendar: {
+ init: _ => this.calendric,
+ min: 0, max: 2,
+ onchange: x => this.calendric = x,
+ format: x => ['none', 'day', 'date'][x]
+ },
+ 'Auto-Illum.': {
+ init: _ => this.autolight,
+ onchange: x => this.autolight = x
+ },
+ Defaults: _ => {this.reset(); this.interact();}
+ };
+ }
+
+ interact() {this.showMenu(this.menu);}
+}
+
+RomanOptions.id = 'pooqroman';
+
+RomanOptions.defaults = {
+ resolution: 1,
+ dow: true,
+ calendric: 2,
+ o24h: !settings["12hour"],
+ bg: g.theme.bg,
+ fg: g.theme.fg,
+ barBg: g.theme.fg,
+ barFg: g.theme.bg,
+ hourFg: g.theme.fg,
+ minuteFg: g.theme.fg,
+ secondFg: g.theme.fg2,
+ rectFg: g.theme.fg,
+ hubFg: g.theme.fg,
+ alarmFg: '#f00',
+ timerFg: '#0f0',
+ activeFg: g.theme.fg2,
+ autolight: true,
+};
+
+//////////////////////////////////////////////////////////////////////////////
+/* Assets (generated by resourcer.js, in this directory) */
+
+const heatshrink = require('heatshrink');
+const dec = x => E.toString(heatshrink.decompress(atob(x)));
+const romanPartsF = [
+ dec(
+ 'wEBsEB3//7//9//+0AjUAguAg3AgYQJjfAgv+gH/8Fg/0gh/AgP4gf2h/j/+BCAP' +
+ 'wgFggEggEQgEMgEHwEDEIIyDuED3kD7+H9vn2k/hEPgMP4Xevd+j4QB7kA9kAmkA'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ryI = dec('h8SwMAgPggfAv/4//x//j//H/+P/8f/0//gOOA==');
+const chargeI = dec('h0MwIEBkEBwEMgFwgeAj/w/+AjkA8EDgEYgFAA==');
+const GPSI = dec('iUQwMAhEAgsAgUggFEgEKvEBn0Aj+AgfgglygsJosgxNGiNIgWJ4FBEoM4gA');
+const HRMI = dec('iMRwMAnken8fzfd7v+/3/v9/38/z+b5tiiM3/eP/+D/+AAIM/wEPwEDwEAAIIA==');
+const compassI = dec('iMRwMAgfgg/8g8ng0Q40ImcOjcHg+DwfB4Ph2Hw7FsolmkUxwEwuFwj/wEIMAA==');
+
+//////////////////////////////////////////////////////////////////////////////
+/* Squeezable strings */
+
+class Formattable {
+ width(g) {return this.w != null ? this.w : (this.w = g.stringWidth(this.text));}
+ print(g, x, y) {g.drawString(this.text, x, y); return this.width();}
+}
+
+class Fixed extends Formattable {
+ constructor(text) {
+ super();
+ this.text = text;
+ }
+ squeeze() {return false;}
+}
+
+class Squeezable extends Formattable {
+ constructor(named, index) {
+ super();
+ this.named = named;
+ this.index = index;
+ this.end = index + named.forms;
+ }
+ squeeze() {
+ if (this.index >= this.end) return false;
+ this.index++;
+ this.w = null;
+ return true;
+ }
+ get text() {return this.named.table[this.index];}
+}
+
+class Named {
+ constructor(forms, table) {
+ this.forms = forms;
+ this.table = table;
+ }
+ on(index) {return new Squeezable(this, this.forms * index);}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/* Face */
+
+// Static geometry
+const barW = 26, barH = g.getHeight(), barX = g.getWidth() - barW, barY = 0;
+const faceW = g.getWidth() - barW, faceH = g.getHeight();
+const faceX = 0, faceY = 0, faceCX = faceW / 2, faceCY = faceH / 2;
+const rectX = faceX + 35, rectY = faceY + 24, rectW = 80, rectH = 128;
+
+// Extended-Roman-numeral labels
+const layout = E.toUint8Array(
+ 75, 23, // XII
+ 132, 24, // I
+ 132, 61, // II
+ 132, 97, // III
+ 132, 133, // IV
+ 132, 170, // V
+ 75, 171, // VI
+ 18, 170, // VII
+ 18, 133, // VIII
+ 18, 97, // IX
+ 18, 61, // X
+ 18, 24 // XI
+);
+
+const numeral = (n, options) => [
+ 'n', // 0
+ 'abc', // I
+ 'abdc', // II
+ 'abddc', // III
+ 'abefg', // IV
+ 'hfg', // V
+ 'hfibc', // VI
+ 'hfibdc', // VII
+ 'hfibddc', // VIII
+ 'abjk', // IX
+ 'kjk', // X
+ 'kjbc', // XI
+ 'kjbdc', // XII
+ 'kjbddc', // XIII
+ 'kjbefg', // XIV
+ 'kjefg', // XV
+ 'labc', // XVI
+ 'labdc', // XVII
+ 'labddc', // XVIII
+ 'kjbjk', // XIX
+ 'kjjk', // XX
+ 'mabc', // XXI
+ 'mabdc', // XXII
+ 'mabddc', // XXIII
+][options.o24h ? n % 24 : (n + 11) % 12 + 1];
+
+const formatMonth = new Named(4, [
+ 'January', 'Jan.', 'Jan', 'I',
+ 'February', 'Feb.', 'Feb', 'II',
+ 'March', 'Mar.', 'Mar', 'III',
+ 'April', 'Apr.', 'Apr', 'IV',
+ 'May', 'May', 'May', 'V',
+ 'June', 'June', 'Jun', 'VI',
+ 'July', 'July', 'Jul', 'VII',
+ 'August', 'Aug.', 'Aug', 'VIII', // VIII *is* narrower than Aug, our I is thin.
+ 'September', 'Sept.', 'Sep', 'IX',
+ 'October', 'Oct.', 'Oct', 'X',
+ 'November', 'Nov.', 'Nov', 'XI',
+ 'December', 'Dec.', 'Dec', 'XII'
+]);
+const formatDom = {
+ on: d => new Fixed(d.toString())
+};
+const formatDow = new Named(4, [
+ 'Sunday', 'Sun.', 'Sun', 'Su',
+ 'Monday', 'Mon.', 'Mon', 'M',
+ 'Tuesday', 'Tues.', 'Tue', 'Tu',
+ 'Wednesday', 'Weds.', 'Wed', 'W',
+ 'Thursday', 'Thurs.', 'Thu', 'Th',
+ 'Friday', 'Fri.', 'Fri', 'F',
+ 'Saturday', 'Sat.', 'Sat', 'Sa'
+]);
+
+const hceil = x => Math.ceil(x / 3600000) * 3600000;
+const hfloor = x => Math.floor(x / 3600000) * 3600000;
+const isString = x => typeof x == 'string';
+const imageWidth = i => isString(i) ? i.charCodeAt(0) : i.width;
+const imageHeight = i => isString(i) ? i.charCodeAt(1) : i.height;
+
+const events = {
+ // Items are {time: number, wall: boolean, priority: number,
+ // past: bool, future: bool, precision: number,
+ // colour: colour, dramatic?: bool, event?: any}
+ fixed: [{time: Number.POSITIVE_INFINITY}], // indexed by ms absolute
+ wall: [{time: Number.POSITIVE_INFINITY}], // indexed by nominal ms + TZ ms
+
+ clean: function(now, l) {
+ let o = now.getTimezoneOffset() * 60000;
+ let tf = now.getTime() + l, tw = tf - o;
+ // Discard stale events:
+ while (this.wall[0].time <= tw) this.wall.shift();
+ while (this.fixed[0].time <= tf) this.fixed.shift();
+ },
+
+ scan: function(now, from, to, f) {
+ result = Infinity;
+ let o = now.getTimezoneOffset() * 60000;
+ let t = now.getTime() - o;
+ let c, p, i, l = from - o, h = to - o;
+ for (i = 0; (c = this.wall[i]).time < l; i++) ;
+ for (; (c = this.wall[i]).time < h; i++) {
+ if ((p = c.time < t) ? c.past : c.future)
+ result = Math.min(result, f(c, new Date(c.time + o), p));
+ }
+ l += o; h += o; t += o;
+ for (i = 0; (c = this.fixed[i]).time < l; i++) ;
+ for (; (c = this.fixed[i]).time < h; i++) {
+ if ((p = c.time < t) ? c.past : c.future)
+ result = Math.min(f(c, new Date(c.time), p));
+ }
+ return result;
+ },
+
+ span: function(now, from, to, width) {
+ let o = now.getTimezoneOffset() * 60000;
+ let t = now.getTime() - o;
+ let lfence = [], rfence = [];
+ this.scan(now, from, to, (e, d, p) => {
+ if (p) {
+ for (let j = 0; j <= e.priority; j++) {
+ if (d < (lfence[e.priority] || t)) lfence[e.priority] = d;
+ }
+ } else {
+ for (let j = 0; j <= e.priority; j++) {
+ if (d > (rfence[e.priority] || t)) rfence[e.priority] = d;
+ }
+ }
+ });
+ for (let j = 0; ; j += 0.5) {
+ if ((rfence[Math.ceil(j)] - lfence[Math.floor(j)] || 0) <= width) {
+ return [lfence[Math.floor(j)] || now, rfence[Math.ceil(j)] || now];
+ }
+ }
+ },
+
+ insert: function(t, wall, e) {
+ let v = wall ? this.wall : this.fixed;
+ e.time = t = t - (wall ? t.getTimezoneOffset() * 60000 : 0);
+ v.splice(v.findIndex(x => x.time > t), 0, e);
+ },
+
+ loadFromSystem: function(options) {
+ alarms.forEach(x => {
+ if (x.on) {
+ const t = new Date();
+ let h = x.hr;
+ let m = h % 1 * 60;
+ let s = m % 1 * 60;
+ let ms = s % 1 * 1000;
+ t.setHours(h - h % 1, m - m % 1, s - s % 1, ms);
+ // There's a race condition here, but I'm not sure what we can do about it.
+ if (t < Date.now() || x.last === t.getDate()) t.setDate(t.getDate() + 1);
+ this.insert(t, true, {
+ priority: 0,
+ past: false, // System alarms seem uninteresting if past?
+ future: true,
+ precision: x.timer ? 1000 : 60000,
+ colour: x.timer ? options.timerFg : options.alarmFg,
+ event: x
+ });
+ }
+ });
+ return this;
+ },
+};
+
+//////////////////////////////////////////////////////////////////////////////
+/* The main face logic */
+
+class Sidebar {
+ constructor(g, x, y, w, h, options) {
+ this.g = g;
+ this.options = options;
+ this.x = x;
+ this.y = this.initY = y;
+ this.h = h;
+ this.rate = Infinity;
+ this.doLocked = Sidebar.status(_ => Bangle.isLocked(), lockI);
+ this.doHRM = Sidebar.status(_ => Bangle.isHRMOn(), HRMI);
+ this.doGPS = Sidebar.status(_ => Bangle.isGPSOn(), GPSI, Sidebar.gpsColour(options));
+ }
+ reset(rate) {this.y = this.initY; this.rate = rate; return this;}
+ print(t) {
+ this.y += 4 + t.print(
+ this.g.setColor(this.options.barFg).setFontAlign(-1, 1, 1),
+ this.x + 3, this.y + 4
+ );
+ return this;
+ }
+ pad(n) {this.y += n; return this;}
+ free() {return this.h - this.y;}
+ static status(p, i, c) {
+ return function() {
+ if (p()) {
+ this.g.setColor(c ? c() : this.options.barFg)
+ .drawImage(i, this.x + 4, this.y += 4);
+ this.y += imageHeight(i);
+ }
+ return this;
+ };
+ }
+ static gpsColour(o) {
+ const fix = Bangle.getGPSFix();
+ return fix && fix.fix ? o.activeFg : o.barFg;
+ }
+ doPower() {
+ const c = Bangle.isCharging();
+ const b = E.getBattery();
+ if (c || b < 50) {
+ let g = this.g, x = this.x, y = this.y, options = this.options;
+ g.setColor(options.barFg).drawImage(batteryI, x + 4, y + 4);
+ g.setColor(b <= 10 ? '#f00' : b <= 30 ? '#ff0' : '#0f0');
+ const h = 13 * (100 - b) / 100;
+ g.fillRect(x + 8, y + 7 + h, x + 17, y + 20);
+ // Espruino disallows blank leading rows in icons, for some reason.
+ if (c) g.setColor(options.barBg).drawImage(chargeI, x + 4, y + 8);
+ this.y = y + imageHeight(batteryI) + 4;
+ }
+ return this;
+ }
+ doCompass() {
+ if (Bangle.isCompassOn()) {
+ const c = Bangle.getCompass();
+ const a = c && this.rate <= 1000;
+ this.g.setColor(a ? this.options.activeFg : this.options.barFg).drawImage(
+ compassI,
+ this.x + 4 + imageWidth(compassI) / 2,
+ this.y + 4 + imageHeight(compassI) / 2,
+ a ? {rotate: c.heading / 180 * Math.PI} : undefined
+ );
+ this.y += 4 + imageHeight(compassI);
+ }
+ return this;
+ }
+}
+
+class Roman {
+ constructor(g, events) {
+ this.g = g;
+ this.state = null;
+ const options = this.options = new RomanOptions();
+ this.events = events.loadFromSystem(this.options);
+ this.timescales = [1000, [1000, 60000], 60000, 3600000];
+ this.sidebar = new Sidebar(g, barX, barY, barW, barH, options);
+ this.hours = Roman.hand(g, 3, 0.5, 12, _ => options.hourFg);
+ this.minutes = Roman.hand(g, 2, 0.9, 60, _ => options.minuteFg);
+ this.seconds = Roman.hand(g, 1, 0.9, 60, _ => options.secondFg);
+ }
+
+ reset() {this.state = null;}
+
+ doIcons(which) {this.state.iconsOk = null;}
+
+ // Watch hands. These could be improved, graphically.
+ // If we restricted them to 60 positions, we could feasibly hand-draw them?
+ static hand(g, w, l, d, c) {
+ return p => {
+ g.setColor(c());
+ p = ((12 * p / d) + 1) % 12;
+ let h = l * rectW / 2;
+ let v = l * rectH / 2;
+ let poly =
+ p <= 2 ? [faceCX + w, faceCY, faceCX - w, faceCY,
+ faceCX + h * (p - 1), faceCY - v,
+ faceCX + h * (p - 1) + 1, faceCY - v]
+ : p < 6 ? [faceCX + 1, faceCY + w, faceCX + 1, faceCY - w,
+ faceCX + h, faceCY + v / 2 * (p - 4),
+ faceCX + h, faceCY + v / 2 * (p - 4) + 1]
+ : p <= 8 ? [faceCX - w, faceCY + 1, faceCX + w, faceCY + 1,
+ faceCX - h * (p - 7), faceCY + v,
+ faceCX - h * (p - 7) - 1, faceCY + v]
+ : [faceCX, faceCY - w, faceCX, faceCY + w,
+ faceCX - h, faceCY - v / 2 * (p - 10),
+ faceCX - h, faceCY - v / 2 * (p - 10) - 1];
+ g.fillPoly(poly);
+ };
+ }
+
+ static pos(p, r) {
+ let h = r * rectW / 2;
+ let v = r * rectH / 2;
+ p = (p + 1) % 12;
+ return p <= 2 ? [faceCX + h * (p - 1), faceCY - v]
+ : p < 6 ? [faceCX + h, faceCY + v / 2 * (p - 4)]
+ : p <= 8 ? [faceCX - h * (p - 7), faceCY + v]
+ : [faceCX - h, faceCY - v / 2 * (p - 10)];
+ }
+
+ alert(e, date, now, past) {
+ const g = this.g;
+ g.setColor(e.colour);
+ const dt = date - now;
+ if (e.precision < 60000 && dt >= 0 && e.future && dt <= 59000) { // Seconds away
+ const p = Roman.pos(date.getSeconds() / 5, 0.95);
+ g.drawLine(faceCX, faceCY, p[0], p[1]);
+ return 1000;
+ } else if (e.precision < 3600000 && dt >= 0 && e.future && dt <= 3540000) { // Minutes away
+ const p = Roman.pos(date.getMinutes() / 5 + date.getSeconds() / 300, 0.8);
+ g.drawLine(p[0] - 5, p[1], p[0] + 5, p[1]);
+ g.drawLine(p[0], p[1] - 5, p[0], p[1] + 5);
+ return dt < 119000 ? 1000 : 60000; // Turn on second hand two minutes up.
+ } else if (e.precision < 43200000 && dt >= 0 ? e.future : e.past) { // Hours away
+ const p = Roman.pos(date.getHours() + date.getMinutes() / 60, 0.6);
+ const poly = [p[0] - 4, p[1], p[0], p[1] - 4, p[0] + 4, p[1], p[0], p[1] + 4];
+ if (date >= now) g.fillPoly(poly);
+ else g.drawPoly(poly, true);
+ return 3600000;
+ }
+ return Infinity;
+ }
+
+ render(d, rate) {
+ const g = this.g;
+ const state = this.state || (g.clear(true), this.state = {});
+ const options = this.options;
+ const events = this.events;
+ events.clean(d, -39600000); // 11h
+
+ // Sidebar: icons and date
+ if (d.getDate() !== state.date || !state.iconsOk) {
+ const sidebar = this.sidebar;
+ state.date = d.getDate();
+ state.iconsOk = true;
+ g.setColor(options.barBg).fillRect(barX, barY, barX + barW, barY + barH);
+
+ sidebar.reset(rate).doLocked().doPower().doGPS().doHRM().doCompass();
+ g.setFontCustom.apply(g, fontF);
+ let formatters = [];
+ let month, dom, dow;
+ if (options.calendric > 1) {
+ formatters.push(month = formatMonth.on(d.getMonth()));
+ }
+ if (options.calendric > 0) {
+ formatters.push(dom = formatDom.on(d.getDate()));
+ }
+ if (options.dow) {
+ formatters.push(dow = formatDow.on(d.getDay()));
+ }
+ // Obnoxiously inefficient iterative method :(
+ let ava = sidebar.free() - 3, use, i = 0, j = 0;
+ while ((use = formatters.reduce((l, f) => l + f.width(g) + 4, 0)) > ava &&
+ j < formatters.length)
+ for (j = 0;
+ !formatters[i++ % formatters.length].squeeze() &&
+ j < formatters.length;
+ j++) ;
+ if (dow) sidebar.print(dow);
+ sidebar.pad(ava - use);
+ if (month) sidebar.print(month);
+ if (dom) sidebar.print(dom);
+ }
+
+ // Hour labels and (purely aesthetic) box; clear inner face.
+ let keyHour = d.getHours() < 12 ? 1 : 13;
+ let alertSpan = events.span(d, hceil(d) - 39600000, hfloor(d) + 39600000, 39600000);
+ let l = alertSpan[0].getHours(), h = alertSpan[1].getHours();
+ if ((l - keyHour + 24) % 24 >= 12 || (h - keyHour + 24) % 24 >= 12) keyHour = l;
+ if (keyHour !== state.keyHour) {
+ state.keyHour = keyHour;
+ g.setColor(options.bg)
+ .fillRect(faceX, faceY, faceX + faceW, faceY + faceH)
+ .setFontCustom.apply(g, romanPartsF)
+ .setFontAlign(0, 1)
+ .setColor(options.fg);
+ // In order to deal with timezone changes more logic will be required,
+ // since the labels may be in unusual locations (even offset when
+ // a non-integral zone is involved). The value of keyHour can be
+ // anything in [hr-12, hr] mod 24.
+ for (let h = keyHour; h < keyHour + 12; h++) {
+ g.drawString(
+ numeral(h % 24, options),
+ faceX + layout[h % 12 * 2],
+ faceY + layout[h % 12 * 2 + 1]
+ );
+ }
+ g.setColor(options.rectFg)
+ .drawRect(rectX, rectY, rectX + rectW - 1, rectY + rectH - 1);
+ } else {
+ g.setColor(options.bg)
+ .fillRect(rectX + 1, rectY + 1, rectX + rectW - 2, rectY + rectH - 2)
+ .setColor(options.fg);
+ }
+
+ // Alerts
+ let requestedRate = events.scan(
+ d, hfloor(alertSpan[0] + 0), hceil(alertSpan[1] + 0) + 1,
+ (e, t, p) => this.alert(e, t, d, p)
+ );
+ if (rate > requestedRate) rate = requestedRate;
+
+ // Hands
+ // Here we are using incremental hands for hours and minutes.
+ // If we quantised, we could use hand-crafted bitmaps, though.
+ this.hours(d.getHours() + d.getMinutes() / 60);
+ if (rate < 3600000) {
+ this.minutes(d.getMinutes() + d.getSeconds() / 60);
+ }
+ if (rate < 60000) this.seconds(d.getSeconds());
+ g.setColor(options.hubFg).fillCircle(faceCX, faceCY, 3);
+ return requestedRate;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/* Master clock */
+
+class Clock {
+ constructor(face) {
+ this.face = face;
+ this.timescales = face.timescales;
+ this.options = face.options;
+ this.rates = {};
+
+ this.options.on('done', () => this.start());
+
+ this.listeners = {
+ charging: _ => {face.doIcons('charging'); this.active();},
+ lock: _ => {face.doIcons('locked'); this.active();},
+ faceUp: up => {this.conservative = !up; this.active();},
+ twist: _ => this.options.autolight && Bangle.setLCDPower(true),
+ drag: e => {
+ if (this.t0) {
+ if (e.b) {
+ e.x < this.xN && (this.xN = e.x) || e.x > this.xX && (this.xX = e.x);
+ e.y < this.yN && (this.yN = e.y) || e.y > this.yX && (this.yX = e.y);
+ } else if (this.xX - this.xN < 20) {
+ if (e.y - this.e0.y < -50) {
+ this.options.resolution > 0 && this.options.resolution--;
+ this.rates.clock = this.timescales[this.options.resolution];
+ this.active();
+ } else if (e.y - this.e0.y > 50) {
+ this.options.resolution < this.timescales.length - 1 &&
+ this.options.resolution++;
+ this.rates.clock = this.timescales[this.options.resolution];
+ this.active();
+ } else if (this.yX - this.yN < 20 && Date.now() - this.t0 > 500) {
+ this.stop();
+ this.options.interact();
+ }
+ this.t0 = null;
+ }
+ } else if (e.b) {
+ this.t0 = Date.now(); this.e0 = e;
+ this.xN = this.xX = e.x; this.yN = this.yX = e.y;
+ }
+ }
+ };
+ }
+
+ redraw(rate) {
+ const now = this.updated = new Date();
+ if (this.refresh) this.face.reset();
+ this.refresh = false;
+ rate = this.face.render(now, rate);
+ if (rate !== this.rates.face) {
+ this.rates.face = rate;
+ this.active();
+ }
+ return this;
+ }
+
+ inactive() {
+ this.timeout && clearTimeout(this.timeout);
+ this.exception && clearTimeout(this.exception);
+ this.interval && clearInterval(this.interval);
+ this.timeout = this.exception = this.interval = this.rate = null;
+ this.face.reset(); // Cancel any ongoing background rendering
+ return this;
+ }
+
+ active() {
+ const prev = this.rate;
+ const now = Date.now();
+ let rate = Infinity;
+ for (const k in this.rates) {
+ let r = this.rates[k];
+ r === +r || (r = r[+this.conservative])
+ r < rate && (rate = r);
+ }
+ const delay = rate - now % rate + 1;
+ this.refresh = true;
+ if (rate !== prev) {
+ this.inactive();
+ this.redraw(rate);
+ if (rate < 31622400000) { // A year!
+ this.timeout = setTimeout(
+ () => {
+ this.inactive();
+ this.interval = setInterval(() => this.redraw(rate), rate);
+ if (delay > 1000) this.redraw(rate);
+ this.rate = rate;
+ }, delay
+ );
+ }
+ } else if (rate > 1000) {
+ if (!this.exception) this.exception = setTimeout(() => {
+ this.redraw(rate);
+ this.exception = null;
+ }, this.updated + 1000 - Date.now());
+ }
+ return this;
+ }
+
+ stop() {
+ this.inactive();
+ for (const l in this.listeners) {
+ Bangle.removeListener(l, this.listeners[l]);
+ }
+ return this;
+ }
+
+ start() {
+ this.inactive(); // Reset to known state.
+ this.conservative = false;
+ this.rates.clock = this.timescales[this.options.resolution];
+ this.active();
+ for (const l in this.listeners) {
+ Bangle.on(l, this.listeners[l]);
+ }
+ Bangle.setUI('clock');
+ return this;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/* Main */
+
+const clock = new Clock(new Roman(g, events)).start();
diff --git a/apps/pooqroman/app.png b/apps/pooqroman/app.png
new file mode 100644
index 000000000..bd27186e0
Binary files /dev/null and b/apps/pooqroman/app.png differ
diff --git a/apps/pooqroman/resourcer.js b/apps/pooqroman/resourcer.js
new file mode 100644
index 000000000..69365018e
--- /dev/null
+++ b/apps/pooqroman/resourcer.js
@@ -0,0 +1,721 @@
+// pooqRoman resource maker
+//
+// Copyright (c) 2021 Stephen P Spackman
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+//
+// Notes:
+//
+//////////////////////////////////////////////////////////////////////////////
+/* ==ASSETS== */
+
+const heatshrink = require('heatshrink');
+
+const enc = x => {
+ const d = btoa(require("heatshrink").compress(x));
+ var r = "'" + d.substr(0, 64);
+ for (let i = 64; i < d.length; i += 64) r += "' +\n '" + d.substr(i, 64);
+ return r + "'";
+};
+
+const prepBitmap = (name, data) => {
+ const image = Graphics.createImage(data);
+ const raw = String.fromCharCode(image.width, image.height, 0x81, 0) + image.buffer;
+ const x = `
+const ${name}I = dec(${enc(raw)});
+`;
+ return x;
+};
+
+const prepFont = (name, data) => {
+ const image = Graphics.createImage(data);
+ const lengths = Uint8Array(256);
+ const offsets = Uint16Array(256);
+ const adjustments = Uint16Array(256);
+ let min = Infinity, max = -Infinity;
+ const lines = data.split('\n');
+ let m;
+ // This regexp is clearly suboptimal, but Espruino's regexp engine is really wonky
+ // and doesn't process nested parentheses or alternation correctly.
+ for (let i = 0; i < 5 && !(m = /^(<*)=([*\d]+)(=*)(>*)$/.exec(lines[i])); i++);
+ if (!m) throw new Error('Missing or incorrect header');
+ const desc = m[1].length, body = 1 + m[2].length + m[3].length, asc = m[4].length;
+ const h = desc + body + asc;
+ let width = m[2] == '*' ? null : +m[2];
+ let c = null, o = 0;
+ lines.forEach((line, l) => {
+ if (m = /^(<*)(=)([*\d]*)(=*)(>*)$/.exec(line) || /^(<*)(-)(.)(-*)(>*)$/.exec(line)) {
+ const h = m[2] == '=';
+ if (m[1].length > desc || h && m[1].length != desc)
+ throw new Error('Invalid descender height at ' + l);
+ if (m[2].length + m[3].length + m[4].length != body)
+ throw new Error('Invalid body height at ' + l);
+ if (m[5].length > asc || h && m[5].length != asc)
+ throw new Error('Invalid ascender height at ' + l);
+ if (c != null) {
+ lengths[c] = l - o;
+ if (width !== null && width !== lengths[c])
+ throw new Error(
+ `Character has width ${lengths[c]} != ${width} at ${offsets[c]}`
+ );
+ c = null
+ }
+ if (!h) {
+ c = m[3].charCodeAt(0);
+ if (c < min) min = c;
+ if (c > max) max = c;
+ o = l + 1;
+ offsets[c] = l;
+ adjustments[c] = m[1].length
+ }
+ }
+ });
+ const xoffs = Uint8Array(lines.length);
+ const ypos = Uint16Array(lines.length);
+ ypos.fill(0xffff);
+ const w0 = lengths[min];
+ let widths = '';
+ for (c = min, o = 0; c <= max; c++) {
+ for (i = 0, j = offsets[c]; i < lengths[c]; i++) {
+ xoffs[j] = asc + body + adjustments[c] - 1;
+ ypos[j++] = o++;
+ }
+ widths += String.fromCharCode(lengths[c]);
+ }
+ const raster = Graphics.createArrayBuffer(h, o, 1, {msb: true});
+ const writer = Graphics.createCallback(
+ image.width, image.height, 1,
+ (x, y, col) => raster.setPixel(xoffs[y] - x, ypos[y], col)
+ );
+ writer.drawImage(image);
+ if (width === null) width = `dec(${enc(widths)})`;
+ const x = `const ${name}F = [
+ dec(
+ ${enc(raster.buffer)}
+ ), ${min}, ${width}, ${h}
+];`;
+ return x;
+};
+
+res = `
+const heatshrink = require('heatshrink');
+const dec = x => E.toString(heatshrink.decompress(atob(x)));
+`;
+
+res += prepFont('romanParts', `
+<=*==============
+-a--------------
+x x
+xx xx
+-b--------------
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+-c--------------
+xx xx
+x x
+-d--------------
+xx xx
+xx xx
+xx xx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+-e--------------
+xx xx
+x xxxx
+<-f--------------
+ xxxxxxxx
+ xxxxxxxxxxx
+ xxxxxxx xx
+ xxxxxx x
+xxxxx
+ xxxxxx x
+ xxxxxxx xx
+ xxxxxxxxxxx
+ xxxxxxxx
+-g--------------
+ xxxx
+ xx
+ x
+-h--------------
+ x
+ xx
+ xxxx
+-i--------------
+x xxxx
+xx xx
+-j--------------
+xx xx
+xxx xxx
+xxxx xxxx
+xxxxxx xxxxxx
+xx xxxx xxxx xx
+x xxxxxx x
+ xxxx
+x xxxxxx x
+xx xxxx xxxx xx
+xxxxxx xxxxxx
+xxxx xxxx
+xxx xxx
+xx xx
+-k--------------
+x x
+<-l--------------
+ xx x
+ xxxxxx xx
+ xxxx xxxx xxx
+ xxxx xx xxxx x
+xxx xx
+ xxxx xx xxxx x
+ xxxx xxxx xxx
+ xxxxxx xx
+ xx x
+-m--------------
+x xx x
+xx xxxx xx
+xxx xxxxxx xxx
+x xxxx xx xxxx x
+ xx xx
+x xxxx xx xxxx x
+xxx xxxxxx xxx
+xx xxxx xx
+x xx x
+-n--------------
+ xxxxxxxx
+ xxxxxxxxxxxx
+ xxxx xxxx
+xxxx xxxx
+xxx xxx
+xx xxxx xx
+xx xxxx xx
+xxx xxx
+xxxx xxxx
+ xxxx xxxx
+ xxxxxxxxxxxx
+ xxxxxxxx
+<=*==============
+`);
+
+res += prepFont('font', `
+<<<<=*======>>>>
+- ------
+
+-.------
+xx
+xx
+-0------>>>>
+ xxxxxxxx
+ xxxxxxxxxx
+xxx xxx
+xx xx
+xx xx
+xxx xxx
+ xxxxxxxxxx
+ xxxxxxxx
+
+-1------>>>>
+xx x
+xx xx
+xxxxxxxxxxxx
+xxxxxxxxxxxx
+xx
+xx
+
+-2------>>>>
+x x
+xx xx
+xxx xxx
+xxxx xx
+xxxxx xx
+xx xxx xxx
+xx xxxxxxx
+xx xxxxx
+
+-3------>>>>
+ x xx
+ xx x xx
+xxx xx xx
+xx xxx xx
+xx xxxxxx
+xxx xxx xxx
+ xxxxxx xx
+ xxx x
+
+-4------>>>>
+ x
+ xx
+ xxxx
+ xxxxxxxxx
+xxxxx xxxxx
+xxxxx
+ xx
+ xx
+
+-5------>>>>
+ x xxxxxx
+ xx xxxxxx
+xxx xx xx
+xx xx xx
+xx xx xx
+xxx xxx xx
+ xxxxxx xx
+ xxxx
+
+-6------>>>>
+ xxxx
+ xxxxxxx
+xxx xxxxx
+xx xxxxx
+xx xx xxx
+xxx xxx xx
+ xxxxxx x
+ xxxx
+
+-7------>>>>
+ xx
+ xx
+xxxx xx
+xxxxxx xx
+ xxxx xx
+ xxxxxx
+ xxxx
+ x
+
+-8------>>>>
+ xxx xxx
+ xxxxxxxxxx
+xxx xxxx xxx
+xx xx xx
+xx xx xx
+xxx xxxx xxx
+ xxxxxxxxxx
+ xxx xxx
+
+-9------>>>>
+ xxxx
+x xxxxxx
+xx xxx xxx
+xxx xx xx
+ xxxxx xx
+ xxxxx xxx
+ xxxxxxx
+ xxx
+
+-A------>>>>
+xx
+xxxxx
+ xxxxxxx
+ xxxxxxx
+ xx xxxx
+ xxxxxxx
+ xxxxxxx
+xxxxx
+xx
+
+-D------>>>>
+xx xx
+xxxxxxxxxxxx
+xxxxxxxxxxxx
+xx xx
+xx xx
+xxx xxx
+ xxxxxxxxxx
+ xxxxxxxx
+
+-F------>>>>
+xxxxxxxxxxxx
+xxxxxxxxxxxx
+ xx xx
+ xx xx
+ xx xx
+ xx
+-I------>>>>
+xxxxxxxxxxxx
+xxxxxxxxxxxx
+
+-J------>>>>
+ xx
+ xxx xx
+xxx xx
+xx xx
+xxx xx
+ xxxxxxxxxxx
+ xxxxxxxxxx
+ xx
+-M------>>>>
+xxxxxxxxxxxx
+xxxxxxxxxxx
+ xxx
+ xxxx
+ xxxx
+ xxx
+xxxxxxxxxxx
+xxxxxxxxxxxx
+
+-N------>>>>
+xxxxxxxxxxxx
+xxxxxxxxxxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxxxxxxxxxx
+xxxxxxxxxxxx
+
+-O------>>>>
+ xxxxxxxx
+ xxxxxxxxxx
+xxx xxx
+xx xx
+xx xx
+xxx xxx
+ xxxxxxxxxx
+ xxxxxxxx
+
+-S------>>>>
+ x xxx
+ xx xxxxx
+xxx xx xxx
+xx xx xx
+xx xx xx
+xxx xx xxx
+ xxxxx xx
+ xxx x
+
+-T------>>>>
+ xx
+ xx
+ xx
+xxxxxxxxxxxx
+xxxxxxxxxxxx
+ xx
+ xx
+ xx
+-V------>>>>
+ xxx
+ xxxxxx
+ xxxxx
+xxxxx
+ xxxxx
+ xxxxxx
+ xxx
+
+-W------>>>>
+ xxxx
+ xxxxxxxx
+xxxxxxxx
+ xxxx
+ xxxx
+ xxxx
+xxxxxxxx
+ xxxxxxxx
+ xxxx
+-X------>>>>
+xx xx
+xxx xxx
+ xxx xxx
+ xxxx
+ xxxx
+ xxx xxx
+xxx xxx
+xx xx
+
+-a------
+ xxx
+xxxxx x
+xx xx xx
+xx xx xx
+xx xx xx
+ xxxxxx
+xxxxxx
+
+-b------>>>>
+xxxxxxxxxxxx
+ xxxxxxxxxxx
+xx xx
+xx xx
+xxx xxx
+ xxxxxx
+ xxxx
+
+-c------
+ xxxx
+ xxxxxx
+xxx xxx
+xx xx
+xx xx
+ xx xx
+ x x
+
+-d------>>>>
+ xxxx
+ xxxxxx
+xxx xxx
+xx xx
+xx xx
+ xxxxxxxxxxx
+xxxxxxxxxxxx
+
+-e------
+ xxxx
+ xxxxxx
+xx xx xx
+xx xx xx
+xx xx xx
+ x xxxx
+ xxx
+
+<<<<-g------
+ x xxxx
+ xx xxxxxx
+xx xxx xxx
+xx xx xx
+xxx xx xxx
+ xxxxxxxxxx
+ xxxxxxxxx
+
+-h------>>>>
+xxxxxxxxxxxx
+xxxxxxxxxxxx
+ xx
+ xx
+ xxx
+xxxxxxx
+xxxxxx
+
+-i------>>>>
+xxxxxxxx xx
+xxxxxxxx xx
+
+-l------>>>>
+xxxxxxxxxxxx
+xxxxxxxxxxxx
+
+-m------
+xxxxxxxx
+xxxxxxx
+ xxx
+ xxx
+xxxxxxx
+xxxxxxx
+ xxx
+ xxx
+xxxxxxx
+xxxxxx
+
+-n------
+xxxxxxxx
+xxxxxxx
+ xxx
+ xx
+ xxx
+xxxxxxx
+xxxxxx
+
+-o------
+ xxxx
+ xxxxxx
+xxx xxx
+xx xx
+xxx xxx
+ xxxxxx
+ xxxx
+
+<<<<-p------
+xxxxxxxxxxxx
+xxxxxxxxxxx
+ xx xx
+ xx xx
+ xxx xxx
+ xxxxxx
+ xxxx
+
+-r------
+xxxxxxxx
+xxxxxxx
+ xxx
+ xx
+ xx
+ xx
+
+-s------
+ x xxx
+xx xxxxx
+xx xx xx
+xx xx xx
+xxxxx xx
+ xxx x
+
+-t------>>>>
+ xx
+ xxxxxxxxx
+ xxxxxxxxxx
+xxx xx
+xx xx
+xx xx
+ xx
+
+-u------
+ xxxxxx
+ xxxxxxx
+xxx
+xx
+xxx
+ xxxxxxx
+xxxxxxxx
+
+-v------
+ xx
+ xxxx
+ xxxx
+xxxx
+ xxxx
+ xxxx
+ xx
+
+<<<<-y------
+ x xxxxxx
+ xx xxxxxxx
+xx xxx
+xx xx
+xxx xxx
+ xxxxxxxxxxx
+ xxxxxxxxx
+
+<<<<=*======>>>>
+`);
+
+res += prepBitmap('lock', `
+ xxxxxx
+ xxxxxxxx
+ xxx xxx
+ xxx xxx
+ xxx xxx
+ xxx xxx
+ xxx xxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxx xxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxx xxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxx xxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+`);
+
+res += prepBitmap('battery', `
+ xxxx
+ xxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxx
+`);
+
+res += prepBitmap('charge', `
+ x
+ xx
+ xx
+ xxx
+ xxx
+ xxxxxxxxx
+ xxxxxxxxx
+ xxx
+ xxx
+ xx
+ xx
+ x
+`);
+
+res += prepBitmap('GPS', `
+ x
+ x x
+ x x
+ x x
+ x x xxxx
+ x xxxxx
+ xxxxxx
+ xxxxx
+ x xxx x
+ x x x x x
+ x x x x x
+ x x xx x x
+ x x x x
+ x xxx x
+ x
+ xxx
+`);
+
+res += prepBitmap('HRM', `
+ xxxx xxxx
+ xxxxxx xxxxxx
+ xx xxxx xxx xxx
+xxx xxxxxxxx xxxx
+xxx xxxxxxxx xxxx
+xxx xxxxxxxx xxxx
+xx xxxxxxx xxxx
+xx xx xxxx xx x
+ xx x x x
+ xx xxxxxxxx xxx
+ xxxxxxxxxxxxx
+ xxxxxxxxxxx
+ xxxxxxxxx
+ xxxxxxx
+ xxxxx
+ xxx
+ x
+`);
+
+res += prepBitmap('compass', `
+ xxxxx
+ xxxxxxxxx
+ xxx x xxx
+ xx x xx
+ xx x xx
+ xx xxx xx
+xx xxx xx
+xx xxx xx
+xx xxx xx
+xx xx xx xx
+xx xx xx xx
+ xx x x xx
+ xx x x xx
+ xx xx
+ xxx xxx
+ xxxxxxxxx
+ xxxxx
+`);
+
+print(res);
diff --git a/apps/pooqround/ChangeLog b/apps/pooqround/ChangeLog
new file mode 100644
index 000000000..12876f71a
--- /dev/null
+++ b/apps/pooqround/ChangeLog
@@ -0,0 +1 @@
+0.00: Initial check-in.
diff --git a/apps/pooqround/README.md b/apps/pooqround/README.md
new file mode 100644
index 000000000..3c651ed67
--- /dev/null
+++ b/apps/pooqround/README.md
@@ -0,0 +1,39 @@
+# pooq Round: a maximally readable, naturally 24hr, analogue watch face
+
+This is a normal watch face for telling the time.
+It is unusual in that it uses a pie chart for the hour hand. This is much easier and
+more precise to read at a glance than a conventional hand, and as a bonus can distinguish
+midnight (all black) from noon (all white).
+
+The day and date are optionally displayed, typographically smooshed into the corners.
+Either you'll like that, or you won't.
+
+## Options
+
+Because sometimes I don't want to burn what I'm cooking and others I'm lazy and just want to know if it's afternoon yet,
+you can alter the number of ‘hands’ on the display. When the watch is unlocked, slide up to add dots representing the minute and second,
+or down to remove the distraction. There's also a setting that displays the second hand, but only if the watch is perfectly face-to-the-sky,
+in case you want the ability to check the _exact_ time, hands free, without the impact on battery life this usually entails.
+
+Although we generally obey the system-wide theming, you can long press on the display for a menu of additional options specific to the face.
+We don't observe the system 12/24 setting, since it the design of the face is equally good in either interpretation.
+
+By default, there is a backlight that comes on when you twist your wrist. This, of course, somewhat increases power draw and could be
+annoying in an intentionally dark environment, so there is an option to disable it.
+
+## Limitations
+
+Since this is intended as a design exercise, it does not and will probably never support the Bangle's standard widgets.
+Sorry about that, but control of all the pixels was just too important to me.
+
+There's also no support for internationalisation at present. This irks me, but since every month and day name is hand-drawn,
+there's no fix other than hard work. Talk to me about it if there's a language you'd like.
+
+## Feedback
+
+[I'd be happy to hear your feedback](https://www.github.com/stephenPspackman) if you have comments or find any bugs, or (most especially)
+if you find this work interesting.
+
+## By
+
+Made by [Stephen P Spackman](https://www.github.com/stephenPspackman).
diff --git a/apps/pooqround/app-icon.js b/apps/pooqround/app-icon.js
new file mode 100644
index 000000000..f3db61936
--- /dev/null
+++ b/apps/pooqround/app-icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("mEwwkB/4AW+ABCgAJEE4IXMh8ADAMPCoYXUK4gXMAAJHCN4oSG+I+CC4gEBC5gNBO4wuGC44IBGASPEC5ovHIox3JL4hdIR5xdIC54uIC5wWIC5hGKC5pGJC5QKCC6YKDCxIXIBQTCBC6IKDC6QKEC6IKFh52KC4gLHC5wLIC5oLJC5gLKC5YALC/4XfQZYAKh4X/C5B4V/4XYJChGBC7JIT/4wVh/wGCouBC6vwI4hIQagQWDDB5dBC45JNEwIXHGBhFDLwgYNCQQXKDBCgEC5QZFB4oGBA4IA="))
diff --git a/apps/pooqround/app.js b/apps/pooqround/app.js
new file mode 100644
index 000000000..29fae6ee6
--- /dev/null
+++ b/apps/pooqround/app.js
@@ -0,0 +1,600 @@
+/* -*- mode: Javascript; c-basic-offset: 2; indent-tabs-mode: nil; coding: latin-1 -*- */
+// pooqRound
+
+// Copyright (c) 2021 Stephen P Spackman
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+//
+// Notes:
+//
+// This only works for Bangle 2.
+
+const isString = x => typeof x === 'string';
+const imageWidth = i => isString(i) ? i.charCodeAt(0) : i.width;
+
+//////////////////////////////////////////////////////////////////////////////
+/* System integration */
+
+const storage = require('Storage');
+
+//////////////////////////////////////////////////////////////////////////////
+/* Face-specific options */
+
+class Options {
+ // Protocol: subclasses must have static id and defaults fields.
+ // Only fields named in the defaults will be saved.
+ constructor() {
+ this.id = this.constructor.id;
+ this.file = `${this.id}.json`;
+ this.backing = storage.readJSON(this.file, true) || {};
+ Object.setPrototypeOf(this.backing, this.constructor.defaults);
+ this.reactivator = _ => this.active();
+ Object.keys(this.constructor.defaults).forEach(k => this.bless(k));
+ }
+
+ writeBack(delay) {
+ if (this.timeout) clearTimeout(this.timeout);
+ this.timeout = setTimeout(
+ () => {
+ this.timeout = null;
+ storage.writeJSON(this.file, this.backing);
+ },
+ delay
+ );
+ }
+
+ bless(k) {
+ Object.defineProperty(this, k, {
+ get: () => this.backing[k],
+ set: v => {
+ this.backing[k] = v;
+ // Ten second writeback delay, since the user will roll values up and down.
+ this.writeBack(10000);
+ }
+ });
+ }
+
+ showMenu(m) {
+ if (m instanceof Function) m = m();
+ if (m) {
+ for (const k in m) if ('init' in m[k]) m[k].value = m[k].init();
+ m[''].selected = -1; // Workaround for self-selection bug.
+ Bangle.on('drag', this.reactivator);
+ this.active();
+ } else {
+ if (this.bored) clearTimeout(this.bored);
+ this.bored = null;
+ Bangle.removeListener('drag', this.reactivator);
+ this.emit('done');
+ }
+ g.clear(true);
+ E.showMenu(m);
+ }
+
+ active() {
+ if (this.bored) clearTimeout(this.bored);
+ this.bored = setTimeout(_ => this.showMenu(), 15000);
+ }
+
+ reset() {
+ this.backing = {__proto__: this.constructor.defaults};
+ this.writeBack(0);
+ }
+}
+
+class RoundOptions extends Options {
+ constructor() {
+ super();
+ this.menu = () => ({
+ '': {title: '* face options *'},
+ '< Back': _ => this.showMenu(),
+ Ticks: {
+ init: _ => this.resolution,
+ min: 0, max: 3,
+ onchange: x => this.resolution = x,
+ format: x => ['seconds', 'seconds (up)', 'minutes', 'hours'][x]
+ },
+ Calendar: {
+ init: _ => this.calendric,
+ min: 0, max: 5,
+ onchange: x => this.calendric = x,
+ format: x => ['none', 'day', 'date', 'both', 'month', 'full'][x],
+ },
+ 'Auto-Illum.': {
+ init: _ => this.autolight,
+ onchange: x => this.autolight = x
+ },
+ Defaults: _ => {this.reset(); this.interact();}
+ });
+ }
+
+ interact() {this.showMenu(this.menu);}
+}
+
+RoundOptions.id = 'pooqround';
+
+RoundOptions.defaults = {
+ resolution: 1,
+ calendric: 5,
+ dayFg: '#fff',
+ nightFg: '#000',
+ autolight: true,
+};
+
+//////////////////////////////////////////////////////////////////////////////
+/* Assets (generated by resourcer.js, in this directory) */
+
+const heatshrink = require('heatshrink');
+const dec = x => E.toString(heatshrink.decompress(atob(x)));
+const y10F = [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4mcbgk544ME7jcF5wmKh/cI' +
+ 'Ak5LUvhGYk4VAIfDwBaEBgsB4AZEjkOGYnA4AA=='
+ ), 49, dec('k0jk0kksmj0lk8lAwIA='), 52
+];
+const lockI = dec('hURwMAj0P485w1h3/4g15wFgjPmgOAs+Yg0B//AA');
+const lockSI = dec('hMNwMAjkfjHMt/8g1zgOc4FnmEf/AA==');
+const batteryI = dec('hERwMAjH/ABw');
+const chargeI = dec('g8NwMAgkYsHDh0fw8MmFhwUA');
+const HRMI = dec('iERwMAjk4l10t/29/3AIfn+ek6VTlPX9d3/U3/Ef/EP+EH8ED4EBwAA=');
+const compassI = dec('hMJwMAhEEg8Dwfh2Pc43BwA=');
+const y100I = dec('h8RwMAvk5/n6nOwm9w9lnzH+mO4sc4405xk7jE2mEssEd4EbgE+gE4A=');
+const y100sI = dec('hcKwMAsOWvHZ+c2s1s4uYmcD4EwA');
+
+//////////////////////////////////////////////////////////////////////////////
+/* Status */
+
+const status = (p, i) => function (g, x, y, rl) { // Nested arrows are currently broken!
+ if (!p()) return x;
+ if (rl) x -= imageWidth(i);
+ g.setColor(g.theme.fg).drawImage(i, x, y);
+ return rl ? x - 1 : x + imageWidth(i) + 1;
+};
+
+const doLocked = status(_ => Bangle.isLocked(), lockI);
+const doPower = (g, x, y, rl) => {
+ const c = Bangle.isCharging();
+ const b = E.getBattery();
+ if (!c && b > 50) return x;
+ if (rl) x -= imageWidth(batteryI);
+ g.setColor(g.theme.fg).drawImage(batteryI, x, y);
+ g.setColor(b <= 10 ? '#f00' : b <= 30 ? '#ff0' : '#0f0');
+ let h = 13 * (100 - b) / 100;
+ g.fillRect(x + 1, y + 2 + h, x + 6, y + 15);
+ if (c) g.setColor(g.theme.bg).drawImage(chargeI, x, y + 2);
+ return rl ? x - 1 : x + imageWidth(batteryI) + 1;
+};
+
+const doHRM = status(_ => Bangle.isHRMOn(), HRMI); // Might show Bangle.getHRM().bpm if confident?
+
+//////////////////////////////////////////////////////////////////////////////
+/* Watch face */
+
+class Round {
+ constructor(g) {
+ this.g = g;
+ this.b = Graphics.createArrayBuffer(g.getWidth(), g.getHeight(), 1, {msb: true});
+ this.bI = {
+ width: this.b.getWidth(), height: this.b.getHeight(), bpp: this.b.getBPP(),
+ buffer: this.b.buffer, transparent: 0
+ };
+ this.c = Graphics.createArrayBuffer(g.getWidth(), g.getHeight(), 1, {msb: true});
+ this.cI = {
+ width: this.c.getWidth(), height: this.c.getHeight(), bpp: this.c.getBPP(),
+ buffer: this.c.buffer, transparent: 0
+ };
+ this.options = new RoundOptions();
+ this.timescales = [1000, 0, 60000, 900000];
+ this.state = {};
+ // Precomputed polygons for the border areas.
+ this.tl = [0, 0, 58, 0, 0, 58];
+ this.tr = [176, 0, 176, 58, 119, 0];
+ this.bl = [0, 176, 0, 119, 58, 176];
+ this.br = [176, 176, 119, 176, 176, 119];
+ this.xc = g.getWidth() / 2;
+ this.yc = g.getHeight() / 2;
+ this.minR = 5;
+ this.secR = 3;
+ this.r = this.xc - this.minR;
+ }
+
+ reset() {this.state = {}; this.g.clear(true);}
+
+ doIcons(which) {
+ this.state[which] = null;
+ this.render(new Date()); // Not quite right, I think.
+ }
+
+ pie(f, a0, a1, invert) {
+ if (!invert) return this.pie(f, a1, a0 + 1, true);
+ let t0 = Math.tan(a0 * 2 * Math.PI), t1 = Math.tan(a1 * 2 * Math.PI);
+ let i0 = Math.floor(a0 * 4 + 0.5), i1 = Math.floor(a1 * 4 + 0.5);
+ let x = f.getWidth() / 2, y = f.getHeight() / 2;
+ let poly = [
+ x + (i1 & 2 ? -x : x) * (i1 & 1 ? 1 : t1),
+ y + (i1 & 2 ? y : -y) / (i1 & 1 ? t1 : 1),
+ x,
+ y,
+ x + (i0 & 2 ? -x : x) * (i0 & 1 ? 1 : t0),
+ y + (i0 & 2 ? y : -y) / (i0 & 1 ? t0 : 1),
+ ];
+ if (i1 - i0 > 4) i1 = i0 + 4;
+ for (i0++; i0 <= i1; i0++) poly.push(
+ 3 * i0 & 2 ? f.getWidth() : 0, i0 & 2 ? f.getHeight() : 0
+ );
+ f.setColor(0).fillPoly(poly);
+ }
+
+ hand(t, d, c0, r0, c1, r1) {
+ t *= Math.PI / 30;
+ const r = this.r;
+ const z = 2 * r0 + 1;
+ const x = this.xc + r * Math.sin(t), y = this.yc - r * Math.cos(t);
+ const x0 = x - r0, y0 = y - r0;
+ d = d ? d[0] : Graphics.createArrayBuffer(z, z, 16, {msb: true});
+ for (let i = 0; i < z; i++) for (let j = 0; j < z; j++) {
+ d.setPixel(i, j, g.getPixel(x0 + i, y0 + j));
+ }
+ g.setColor(c0).fillCircle(x, y, r0);
+ if (c1 !== undefined) g.setColor(c1).fillCircle(x, y, r1);
+ return [d, x0, y0];
+ }
+
+ render(d) {
+ const g = this.g;
+ const b = this.b, bI = this.bI;
+ const c = this.c, cI = this.cI;
+ const state = this.state;
+ const options = this.options;
+ const cal = options.calendric;
+ const res = options.resolution;
+ const dow = (cal == 1 || cal > 2) && d.getDay();
+ const ts = res < 2 && d.getSeconds();
+ const tm = res < 3 && d.getMinutes() + ts / 60;
+ const th = d.getHours() + d.getMinutes() / 60;
+ const dd = cal > 1 && d.getDate();
+ const dm = cal > 3 && d.getMonth();
+ const dy = cal > 4 && d.getFullYear();
+ const xc = this.xc, yc = this.yc, r = this.r;
+ const dlr = xc * 3/4, dlw = 8, dlhw = 4;
+
+ // Restore saveunders for fast-moving, overdrawing indicators.
+ if (state.sd) g.drawImage.apply(g, state.sd);
+ if (state.md) g.drawImage.apply(g, state.md);
+
+ if (dow !== state.dow) {
+ g.setColor(g.theme.bg).fillPoly(this.tl);
+ if (dow === +dow) {
+ g.setColor(g.theme.fg).setFontCustom.apply(g, dowF).drawString(dow, 5, 5);
+ }
+ state.dow = dow;
+ }
+
+ const locked = Bangle.isLocked();
+ const charging = Bangle.isCharging();
+ const battery = E.getBattery();
+ const HRMOn = Bangle.isHRMOn();
+ if (dy !== state.dy ||
+ locked !== state.locked ||
+ charging !== state.charging ||
+ Math.abs(battery - state.battery) > 2 ||
+ HRMOn !== state.HRMOn
+ ) {
+ g.setColor(g.theme.bg).fillPoly(this.tr);
+ const u = dy % 10;
+ if (charging || battery < 50 || HRMOn || locked && dy !== +dy) {
+ let x = 172, y = 5;
+ x = doLocked(g, x, y, true);
+ x = doPower(g, x, y, true);
+ x = doHRM(g, x, y, true);
+ if (dy === +dy) {
+ g.setColor(g.theme.fg).drawImage(y100sI, 145, 23);
+ g.setFontCustom.apply(g, y10sF).drawString((dy - u) / 10 % 10, 157, 23);
+ g.setFontCustom.apply(g, y1sF).drawString(u, 165, 23);
+ }
+ } else if (dy === +dy) {
+ g.setColor(g.theme.fg);
+ if (locked) g.drawImage(lockSI, 136, 5);
+ else g.drawImage(y100I, 130, 5);
+ g.setFontCustom.apply(g, y10F).drawString((dy - u) / 10 % 10, 146, 5);
+ g.setFontCustom.apply(g, y1F).drawString(u, 160, 5);
+ }
+ state.dy = dy;
+ state.locked = Bangle.isLocked();
+ state.charging = Bangle.isCharging();
+ state.battery = E.getBattery() - E.getBattery() % 2;
+ state.HRMOn = Bangle.isHRMOn();
+ }
+ if (dm !== state.dm) {
+ g.setColor(g.theme.bg).fillPoly(this.bl);
+ if (dm === +dm) {
+ g.setColor(g.theme.fg).setFontCustom.apply(g, mF);
+ g.drawString(String.fromCharCode(49 + dm), 5, 124);
+ }
+ state.dm = dm;
+ }
+ if (dd !== state.dd) {
+ g.setColor(g.theme.bg).fillPoly(this.br);
+ if (dd === +dd) {
+ let u = dd % 10;
+ g.setColor(g.theme.fg).setFontAlign(1, 1);
+ g.setFontCustom.apply(g, d10F).drawString((dd - u) / 10, 152, 172);
+ g.setFontAlign(-1, 1);
+ g.setFontCustom.apply(g, d1F).drawString(u, 152, 172);
+ g.setFontAlign(-1, -1);
+ }
+ }
+ if (th !== state.th) {
+ state.th = th;
+ b.clear(true).fillCircle(88, 88, r - 1);
+ g.setColor(options.nightFg).drawImage(bI);
+ if (th < 12) this.pie(b, th / 12, 1, true);
+ else this.pie(b, 1, th / 12, true);
+ g.setColor(options.dayFg).drawImage(bI);
+ }
+ state.md = tm === +tm ?
+ this.hand(tm, state.md, g.theme.bg, this.minR, g.theme.fg, this.minR - 1) :
+ null;
+ state.sd = ts === +ts ?
+ this.hand(ts, state.sd, g.theme.fg2, this.secR) :
+ null;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/* Master clock */
+
+class Clock {
+ constructor(face) {
+ this.face = face;
+ this.timescales = face.timescales;
+ this.options = face.options;
+ this.rates = {};
+ this.faceUp = null;
+
+ this.options.on('done', () => this.start());
+
+ this.listeners = {
+ lcdPower: on => on ? this.active() : this.inactive(),
+ charging: () => {face.doIcons('charging'); this.active();},
+ lock: () => {face.doIcons('locked'); this.active();},
+ faceUp: up => {
+ this.conservative = !up;
+ this.faceUp = up;
+ this.active();
+ },
+ twist: _ => this.options.autolight && Bangle.setLCDPower(true),
+ drag: e => {
+ if (this.t0) {
+ if (e.b) {
+ e.x < this.xN && (this.xN = e.x) || e.x > this.xX && (this.xX = e.x);
+ e.y < this.yN && (this.yN = e.y) || e.y > this.yX && (this.yX = e.y);
+ } else if (this.xX - this.xN < 20) {
+ if (e.y - this.e0.y < -50) {
+ this.options.resolution > 0 && this.options.resolution--;
+ this.rates.clock = this.timescales[this.options.resolution];
+ this.active();
+ } else if (e.y - this.e0.y > 50) {
+ this.options.resolution < this.timescales.length - 1 &&
+ this.options.resolution++;
+ this.rates.clock = this.timescales[this.options.resolution];
+ this.active();
+ } else if (this.yX - this.yN < 20 && Date.now() - this.t0 > 500) {
+ this.stop();
+ this.options.interact();
+ }
+ this.t0 = null;
+ }
+ } else if (e.b) {
+ this.t0 = Date.now(); this.e0 = e;
+ this.xN = this.xX = e.x; this.yN = this.yX = e.y;
+ }
+ }
+ };
+ }
+
+ redraw(rate) {
+ const now = this.updated = new Date();
+ if (this.refresh) this.face.reset();
+ this.refresh = false;
+ rate = this.face.render(now, rate);
+ if (rate !== this.rates.face) {
+ this.rates.face = rate;
+ this.active();
+ }
+ return this;
+ }
+
+ inactive() {
+ this.timeout && clearTimeout(this.timeout);
+ this.exception && clearTimeout(this.exception);
+ this.interval && clearInterval(this.interval);
+ this.timeout = this.exception = this.interval = this.rate = null;
+ this.face.reset(); // Cancel any ongoing background rendering
+ return this;
+ }
+
+ active() {
+ const prev = this.rate;
+ const now = Date.now();
+ let rate = Infinity;
+ for (const k in this.rates) {
+ let r = this.rates[k];
+ r === +r || (r = r[+this.conservative])
+ r < rate && (rate = r);
+ }
+ const delay = rate - now % rate + 1;
+ this.refresh = true;
+
+ if (rate !== prev) {
+ this.inactive();
+ this.redraw(rate);
+ if (rate < 31622400000) { // A year!
+ this.timeout = setTimeout(
+ () => {
+ this.inactive();
+ this.interval = setInterval(() => this.redraw(rate), rate);
+ if (delay > 1000) this.redraw(rate);
+ this.rate = rate;
+ }, delay
+ );
+ }
+ } else if (rate > 1000) {
+ if (!this.exception) this.exception = setTimeout(() => {
+ this.redraw(rate);
+ this.exception = null;
+ }, this.updated + 1000 - Date.now());
+ }
+ return this;
+ }
+
+ stop() {
+ this.inactive();
+ for (const l in this.listeners) {
+ Bangle.removeListener(l, this.listeners[l]);
+ }
+ return this;
+ }
+
+ start() {
+ this.inactive(); // Reset to known state.
+ this.conservative = false;
+ this.rates.clock = this.timescales[this.options.resolution];
+ this.active();
+ for (const l in this.listeners) {
+ Bangle.on(l, this.listeners[l]);
+ }
+ Bangle.setUI('clock');
+ return this;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/* Main */
+
+const clock = new Clock(new Round(g)).start();
diff --git a/apps/pooqround/app.png b/apps/pooqround/app.png
new file mode 100644
index 000000000..b7ea36fb8
Binary files /dev/null and b/apps/pooqround/app.png differ
diff --git a/apps/pooqround/resourcer.js b/apps/pooqround/resourcer.js
new file mode 100644
index 000000000..44186e658
--- /dev/null
+++ b/apps/pooqround/resourcer.js
@@ -0,0 +1,1671 @@
+// pooqRoman resource maker
+//
+// Copyright (c) 2021 Stephen P Spackman
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+//
+// Notes:
+//
+//////////////////////////////////////////////////////////////////////////////
+/* ==ASSETS== */
+
+const heatshrink = require('heatshrink');
+
+const enc = x => {
+ const d = btoa(require("heatshrink").compress(x));
+ var r = "'" + d.substr(0, 64);
+ for (let i = 64; i < d.length; i += 64) r += "' +\n '" + d.substr(i, 64);
+ return r + "'";
+};
+
+const prepBitmap = (name, data) => {
+ const image = Graphics.createImage(data);
+ const raw = String.fromCharCode(image.width, image.height, 0x81, 0) + image.buffer;
+ const x = `
+const ${name}I = dec(${enc(raw)});
+`;
+ return x;
+};
+
+const prepFont = (name, data) => {
+ const image = Graphics.createImage(data);
+ const lengths = Uint8Array(256);
+ const offsets = Uint16Array(256);
+ const adjustments = Uint16Array(256);
+ let min = Infinity, max = -Infinity;
+ const lines = data.split('\n');
+ let m;
+ // This regexp is clearly suboptimal, but Espruino's regexp engine is really wonky
+ // and doesn't process nested parentheses or alternation correctly.
+ for (let i = 0; i < 5 && !(m = /^(<*)=([*\d]+)(=*)(>*)$/.exec(lines[i])); i++);
+ if (!m) throw new Error('Missing or incorrect header');
+ const desc = m[1].length, body = 1 + m[2].length + m[3].length, asc = m[4].length;
+ const h = desc + body + asc;
+ let width = m[2] == '*' ? null : +m[2];
+ let c = null, o = 0;
+ lines.forEach((line, l) => {
+ if (m = /^(<*)(=)([*\d]*)(=*)(>*)$/.exec(line) || /^(<*)(-)(.)(-*)(>*)$/.exec(line)) {
+ const h = m[2] == '=';
+ if (m[1].length > desc || h && m[1].length != desc)
+ throw new Error('Invalid descender height at ' + l);
+ if (m[2].length + m[3].length + m[4].length != body)
+ throw new Error('Invalid body height at ' + l);
+ if (m[5].length > asc || h && m[5].length != asc)
+ throw new Error('Invalid ascender height at ' + l);
+ if (c != null) {
+ lengths[c] = l - o;
+ if (width !== null && width !== lengths[c])
+ throw new Error(
+ `Character has width ${lengths[c]} != ${width} at ${offsets[c]}`
+ );
+ c = null
+ }
+ if (!h) {
+ c = m[3].charCodeAt(0);
+ if (c < min) min = c;
+ if (c > max) max = c;
+ o = l + 1;
+ offsets[c] = l;
+ adjustments[c] = m[1].length
+ }
+ }
+ });
+ const xoffs = Uint8Array(lines.length);
+ const ypos = Uint16Array(lines.length);
+ ypos.fill(0xffff);
+ const w0 = lengths[min];
+ let widths = '';
+ for (c = min, o = 0; c <= max; c++) {
+ for (i = 0, j = offsets[c]; i < lengths[c]; i++) {
+ xoffs[j] = asc + body + adjustments[c] - 1;
+ ypos[j++] = o++;
+ }
+ widths += String.fromCharCode(lengths[c]);
+ }
+ const raster = Graphics.createArrayBuffer(h, o, 1, {msb: true});
+ const writer = Graphics.createCallback(
+ image.width, image.height, 1,
+ (x, y, col) => raster.setPixel(xoffs[y] - x, ypos[y], col)
+ );
+ writer.drawImage(image);
+ if (width === null) width = `dec(${enc(widths)})`;
+ const x = `const ${name}F = [
+ dec(
+ ${enc(raster.buffer)}
+ ), ${min}, ${width}, ${h}
+];`;
+ return x;
+};
+
+res = `
+const heatshrink = require('heatshrink');
+const dec = x => E.toString(heatshrink.decompress(atob(x)));
+`;
+
+res += prepFont('y10', `
+=*================================
+-0--------------------------------
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxx xxxxx
+ xxxxx xxxxx
+ xxxx xxxx
+ xxxx xxxx
+ xxxxx xxxxx
+ xxxxx xxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+-1--------------------------------
+ xxx
+ xxx
+ xxx
+ xxx x
+ xxx x
+ xxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxx
+ xxx
+ xxx
+xxx
+-2--------------------------------
+ x xx
+ xx xxx
+ xxxx xxx
+ xxxxx xxx
+ xxxxxxx xxx
+ xxxx xxx xxx
+ xxxx xxxx xxx
+ xxxx xxxx xxx
+ xxxx xxxxxxxx xxxxxxx
+ xxxx xxxxxxxxxxxxxxxxxxx
+ xxxx xxxxxxxxxxxxxx
+xxxx xxxxxxxxxx
+-3--------------------------------
+ xxx x xxx
+ xxx xx xxx
+ xxxx xxx xxx
+ xxxx xxxx xxx
+ xxxx xxxxx xxx
+ xxxx xxxxxx xxx
+ xxx xxxx xxxxxx
+ xxxx xxxxx xxxxx
+ xxxxxxx xxxxxxx xxxx
+ xxxxxxxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxxxxxx xx
+ xxxxxxxxxxx x
+-4--------------------------------
+ xxxx
+ xxxxxx
+ xxxxxxxx
+ xxxx xxxx
+ xxxx xxxxxx
+ xxxx xxxxxxxx
+ xxxxxxxxxxxx xxxxxxxxx
+ xxxxxxxxxxxx xxxxxxxxxx
+ xxxxxxxxxxxx xxxxxxx
+ xxxx xxx
+ xxxx
+ xxxx
+-5--------------------------------
+ xxx xxxxxxxxxxxxx
+ xxx xxxxxxxxxxxx
+ xxxx xxxxxxxxxxxx
+ xxxx xxx xxx
+ xxxx xxx xxx
+ xxxx xxx xxx
+ xxx xxxx xxx
+ xxxx xxxxx xxx
+ xxxxxx xxxxxx xxx
+ xxxxxxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxx xxx
+-6--------------------------------
+ xxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxx
+ xxxxxx xxxxxxxxxxxxxx
+ xxxx xxxx xxxxx
+ xxxx xxxx xxxx
+ xxx xxx xxx
+ xxxx xxxx xxxx
+ xxxxxx xxxxxx xxx
+ xxxxxxxxxxxxxxxx xxxx
+ xxxxxxxxxxxxxx xxx
+ xxxxxxxxxx xx
+-7--------------------------------
+ xxx
+ xxx
+ xxxxxxx xxx
+ xxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxx
+ xxxxxxxxx
+ xxxxxx
+ xxxx
+ xx
+ x
+-8--------------------------------
+ xxxxxxx
+ xxxxxxxxxxxx xxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxx xxxxxxxxxxxxxxx
+ xxxx xxxxx xxxx
+ xxxx xxx xxx
+ xxx xxx xxx
+ xxxx xxxxx xxxx
+ xxxxxx xxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxx xxxxxx
+ xxxxxxxxxx
+-9--------------------------------
+ xxxxxxxx
+ xxxxxxxxxxxx
+ x xxxxxxxxxxxxxx
+ xx xxxxx xxxxxx
+ xxx xxxx xxxx
+ xxx xxx xxx
+ xxxx xxxx xxx
+ xxxxx xxxx xxxx
+ xxxxxxx xxxxx xxxxxx
+ xxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxx
+=*================================
+`);
+
+res += prepFont('y1', `
+=*==============================================
+-0----------------------------------------------
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxx xxxxx
+ xxxx xxxx
+ xxx xxx
+ xxx xxx
+ xxxx xxxx
+ xxxxx xxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+-1----------------------------------------------
+ xxx
+ xxx
+ xxx
+ xxx x
+ xxx x
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxx
+ xxx
+ xxx
+xxx
+-2----------------------------------------------
+ x xx
+ xx xxx
+ xxxx xxx
+ xxxxx xxx
+ xxxxxxx xxx
+ xxxx xxxx xxx
+ xxxx xxxxx xxx
+ xxxx xxxxxxx xxxx
+ xxxx xxxxxxxxxxxxx xxxxxxxxxxx
+ xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxx xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxx xxxxxxxxxxxxxx
+-3----------------------------------------------
+ xxx x xxx
+ xxx xx xxx
+ xxxx xxxx xxx
+ xxxx xxxxx xxx
+ xxxx xxxxxxx xxx
+ xxxx xxxxxxxx xxx
+ xxx xxxx xxxxx xxx
+ xxxxx xxxxxxx xxxxxxxx
+ xxxxxxxxxx xxxxxxxxxx xxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxxxx xx
+-4----------------------------------------------
+ xxxx
+ xxxxxxx
+ xxxxxxxxxxx
+ xxxx xxxxxxxx
+ xxxx xxxxxxxxx
+ xxxx xxxxxxxxxxxxx
+ xxxxxxxxxxxx xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxx xxxxxxxxxxxx
+ xxxx xxxxxx
+ xxxx
+ xxxx
+-5----------------------------------------------
+ xxx xxxxxxxxxxxxxxxxxxxx
+ xxx xxxxxxxxxxxxxxxxxxx
+ xxxx xxxxxxxxxxxxxxxxxxx
+ xxxx xxx xxx
+ xxxx xxx xxx
+ xxxx xxx xxx
+ xxx xxxx xxx
+ xxxx xxxxxx xxx
+ xxxxxxxxx xxxxxxxx xxx
+ xxxxxxxxxxxxxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxxx xxx
+-6----------------------------------------------
+ xxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxx xxxxxxxxxxxxxxxxxxxxx
+ xxxxxx xxxx xxxxxxxx
+ xxxx xxxx xxxxx
+ xxx xxx xxxx
+ xxxx xxxx xxx
+ xxxxxxxx xxxxxxxx xxxx
+ xxxxxxxxxxxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxxxx xx
+-7----------------------------------------------
+ xxx
+ xxx
+ xxxxxxxxxx xxx
+ xxxxxxxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxxxxxxxxxxxx xxx
+ xxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxx
+ xxxxxxxx
+ xxxx
+ xx
+ x
+-8----------------------------------------------
+ xxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxx xxxxxxxxxxxxxxxxxxxxxxx
+ xxxx xxxxxx xxxx
+ xxxx xxx xxx
+ xxx xxx xxx
+ xxxx xxxxxx xxxx
+ xxxxxx xxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+-9----------------------------------------------
+ xxxxxxxxxx
+ x xxxxxxxxxxxxxxxx
+ xx xxxxxxxxxxxxxxxxxxx
+ xxxx xxxxxxx xxxxxxxx
+ xxxx xxxxx xxxxx
+ xxxxx xxx xxx
+ xxxxxx xxxx xxx
+ xxxxxxx xxxx xxxxx
+ xxxxxxxxxxx xxxxxx xxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxx
+=*==============================================
+`);
+
+res += prepFont('y10s', `
+=*====================
+-0--------------------
+ xxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxxx xxxx
+ xx xx
+ xxxx xxxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxx
+
+-1--------------------
+ xx
+ xx x
+ xx xx
+ xxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxx
+ xx
+xx
+
+-2--------------------
+ xxx x
+ xxxxx xx
+ xx xxx xx
+ xx xxx xx
+ xx xxxx xxxx
+ xx xxxxxxxxxxx
+xx xxxxx
+
+-3--------------------
+ x xx
+ xx x xx
+ xx xxx xx
+ xx xxxxx xx
+ xxx xxx xxxxxx
+ xxxxxxxxx xxxx
+ xxxxxx xx
+
+-4--------------------
+ xxxxx
+ xxxxxxx
+ xxx xxxxxx
+ xxxxxxxx xxxxxx
+ xxxxxxxxxx xxxxxx
+ xxx
+ xxx
+
+-5--------------------
+ x xxxxxxxxxx
+ xx xxxxxxxxx
+ xx xx xx
+ xx xx xx
+ xxxx xxx xx
+ xxxxxxxxxxx xx
+ xxxxxxxx
+
+-6--------------------
+ xxxxxxxxx
+ xxxxxxxxxxxxx
+ xxxx xxxxxxxxx
+ xx xx xxxx
+ xxxx xxxx xxx
+ xxxxxxxxx xx
+ xxxxxxx x
+
+-7--------------------
+ xx
+ xxxxx xx
+ xxxxxxxxx xx
+ xxxxxxx xx
+ xxxxx xx
+ xxxxxx
+ xxx
+
+-8--------------------
+ xxxxxx xxxxx
+ xxxxxxxx xxxxxxx
+ xxx xxxxx xxx
+ xx xxx xx
+ xxx xxxxx xxx
+ xxxxxxxxxxxxxxxx
+ xxxxxx xxxxx
+
+-9--------------------
+ xxxx
+ x xxxxxxxx
+ xxx xxxx xxxx
+ xxxx xx xx
+ xxxxx xxxx xxxx
+ xxxxxxxxxxxxxx
+ xxxxxxxxxx
+
+=*====================
+`);
+
+res += prepFont('y1s', `
+=*=============================
+-0-----------------------------
+ xxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxx
+ xxxx xxxx
+ xx xx
+ xx xx
+ xxxx xxxx
+ xxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxx
+-1-----------------------------
+ xx
+ xx x
+ xx xx
+ xxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xx
+ xx
+-2-----------------------------
+ xxx x
+ xxxxx xx
+ xx xxx xx
+ xx xxx xx
+ xx xxxx xxxxx
+ xx xxxxxx xxxxxx
+ xx xxxxxxxxxxxxxx
+xx xxxxxxxx
+-3-----------------------------
+ x xx
+ xx x xx
+ xx xxx xx
+ xx xxxxx xx
+ xx xx xxxx xx
+ xxxx xxxx xxxx xx
+ xxxxxxxxxxxxxx xxxxx
+ xxxxxxxxxx xxx
+-4-----------------------------
+ xxxx
+ xxxxxxxx
+ xxx xxxxxxxxx
+ xxx xxxxxxxxxx
+ xxxxxxxx xxxxxxxxxxx
+ xxxxxxxxxx
+ xxx
+ xxx
+-5-----------------------------
+ x xxxxxxxxxxxxx
+ xx xxxxxxxxxxxx
+ xx xx xx
+ xx xx xx
+ xxx xx xx
+ xxxx xxxx xx
+ xxxxxxxxxxxxxx xx
+ xxxxxxxxxx
+-6-----------------------------
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxx
+ xxxx xxxx xxxxxxxx
+ xx xx xxxxx
+ xx xx xxxx
+ xxxx xxxx xx
+ xxxxxxxxxxxx x
+ xxxxxxxx
+-7-----------------------------
+ xx
+ xxxxxxx xx
+ xxxxxxxxxxxxxxx xx
+ xxxxxxxxxxxx xx
+ xxxxxxxxx xx
+ xxxxxxxxx
+ xxxxxx
+ xxx
+-8-----------------------------
+ xxxxxxx xxxxxxx
+ xxxxxxxxxxx xxxxxxxxxx
+ xxxx xxxx xxxx xxx
+ xx xxxxx xx
+ xx xxxxx xx
+ xxxx xxxx xxxx xxx
+ xxxxxxxxxxx xxxxxxxxxx
+ xxxxxxx xxxxxxx
+-9-----------------------------
+ xxxxxxx
+ x xxxxxxxxxxx
+ xxx xxxx xxxx
+ xxxx xx xx
+ xxxxxx xx xx
+ xxxxxxxx xxxx xxxx
+ xxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxx
+=*=============================
+`);
+
+res += prepFont('d10', `
+=*=========================
+-1-------------------------
+xxx
+xxx xx
+xxx xxx
+xxx xxx
+xxx xxxx
+xxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxx
+xxx
+xxx
+-2-------------------------
+xxx xx
+xxxx xxx
+xxxxx xxx
+xxxxxx xx
+xxxxxxx xxx
+xxx xxxx xxx
+xxx xxxx xxx
+xxx xxxx xxx
+xxx xxxxx xxxx
+xxx xxxxxxxxxxx
+xxx xxxxxxxxx
+xxx xxxx
+-3-------------------------
+ xx xxxx
+ xxx xxxx
+ xxx xxxx
+xxxx xx xxxx
+xxx xxxx xxxx
+xxx xxxxxx xxxx
+xxx xxxxxxxxx xxxx
+xxxx xxxx xxxxxxxxx
+ xxxxxxxxxx xxxxxxx
+ xxxxxxxx xxxxx
+ xxxxxx xxx
+=*=========================
+`);
+
+res += prepFont('d1', `
+=*==============================================
+-0----------------------------------------------
+
+
+ xxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxx xxxxxxxxxxxx
+ xxxxxxxx xxxxxxxx
+ xxxxx xxxxx
+ xxx xxx
+xxxx xxxx
+xxx xxx
+xxx xxx
+xxxx xxxx
+ xxx xxx
+ xxxxx xxxxx
+ xxxxxxxx xxxxxxxx
+ xxxxxxxxxxxx xxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxx
+-1----------------------------------------------
+
+
+xxx x
+xxx xx
+xxx xxx
+xxx xxx
+xxx xxxx
+xxx xxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxx
+xxx
+xxx
+xxx
+-2----------------------------------------------
+
+
+xxxxxx xx
+xxxxxxx xxxxx
+xxxxxxxx xxxxxxx
+xxx xxxxx xxxxxx
+xxx xxxxx xxxx
+xxx xxxxx xxx
+xxx xxxxx xxx
+xxx xxxxx xxx
+xxx xxxxx xxx
+xxx xxxxx xxx
+xxx xxxxx xxx
+xxx xxxxx xxxx
+xxx xxxxx xxxx
+xxx xxxxxx xxxxxx
+xxx xxxxxxxx xxxxxxx
+xxx xxxxxxxxxxxxxxxx
+xxx xxxxxxxxxxxx
+xxx xxxxxx
+-3----------------------------------------------
+
+
+ xxx xxxx
+ xxxxx xxxx
+ xxxxxxx xxxx
+ xxxxx x xxxx
+ xxxx xxx xxxx
+ xxx xxxx xxxx
+xxxx xxxxxx xxxx
+xxx xxxxxxx xxxx
+xxx xxxxxxxxx xxxx
+xxx xxx xxxxxxx xxxx
+xxx xxx xxxxxx xxxx
+xxxx xxxx xxxxxxxxxx
+ xxx xxx xxxxxxxxx
+ xxxx xxxx xxxxxxxx
+ xxxxx xxxxx xxxxxxx
+ xxxxxxxxxxxxxxxxxxxxx xxxxxx
+ xxxxxxxxxxxxxxxxx xxxxx
+ xxxxxxxxxxxxx xxxx
+-4----------------------------------------------
+
+
+ xxxxx
+ xxxxxxx
+ xxxxxxxxx
+ xxx xxxxxxx
+ xxx xxxxxxxx
+ xxx xxxxxxxxx
+ xxx xxxxxxxxxx
+ xxx xxxxxxxxxx
+ xxx xxxxxxxxxx
+ xxx xxxxxxxxxxx
+xxxxxxxxxxxxxxx xxxxxxxxx
+xxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+-5----------------------------------------------
+
+
+ xxx xxxxxxxxxxxxxx
+ xxx xxxxxxxxxxxxxx
+ xxxx xxxxxxxxxxxxxxx
+ xxx xxx xxxx
+xxxx xxxx xxxx
+xxx xxx xxxx
+xxx xxx xxxx
+xxx xxx xxxx
+xxx xxx xxxx
+xxxx xxxx xxxx
+ xxx xxx xxxx
+ xxxx xxxx xxxx
+ xxxx xxxx xxxx
+ xxxx xxxx xxxx
+ xxxxx xxxxx xxxx
+ xxxxxxxxxxxxx xxxx
+ xxxxxxxxx xxxx
+ xxxxxxx xxxx
+-6----------------------------------------------
+
+
+ xxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxx
+ xxxxxx xxxxxxxxxxxxx
+ xxxx xxxxxxxxxxxxx
+ xxx xxxx xxxxxxxxxxx
+xxxx xxxx xxxxxxxxx
+xxx xxx xxxxxxxx
+xxx xxx xxxxxxx
+xxx xxx xxxxxxx
+xxx xxx xxxxxx
+xxxx xxxx xxxxx
+ xxx xxx xxxx
+ xxxx xxxx
+ xxxxxx xxxxxx
+ xxxxxxxxxxxxxxx
+ xxxxxxxxxxxxx
+ xxxxxxx
+-7----------------------------------------------
+ xxxx
+ xxxx
+ xxxx
+ xxxx
+ xxxx
+ xxxx
+ xxxx
+ xxxx
+xxxxxxxxxxxxx xxxx
+xxxxxxxxxxxxxxxxxxxxx xxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxx
+ xxxxxxxxxxxxxxxx xxxx
+ xxxxxxxxxxxx xxxx
+ xxxxxxxxxxxxx
+ xxxxxxxxxx
+ xxxxxxxx
+ xxxxxx
+ xxxxx
+ xxxx
+-8----------------------------------------------
+
+
+ xxxxxxx
+ xxxxxxxxxxxxx xxxxxxx
+ xxxxxxxxxxxxxxx xxxxxxxxxxx
+ xxxxxx xxxxxx xxxxxxxxxxxxx
+ xxxx xxx xxxxx xxxx
+ xxx xxxxxxx xxxx
+xxxx xxxxx xxx
+xxx xxxx xxxx
+xxx xxx xxx
+xxx xxx xxx
+xxx xxxx xxxx
+xxxx xxxxx xxx
+ xxx xxxxxxx xxxx
+ xxxx xxx xxxxx xxxx
+ xxxxxx xxxxxx xxxxxxxxxxxxx
+ xxxxxxxxxxxxxxx xxxxxxxxxxx
+ xxxxxxxxxxxxx xxxxxxx
+ xxxxxxx
+-9----------------------------------------------
+
+ xxxx
+xxx xxxxxxxx
+xxx xxxxxxxxxxxx
+xxx xxxxxx xxxxxx
+xxx xxxxx xxxxx
+xxxx xxx xxx
+xxxx xxxx xxxx
+ xxxx xxx xxx
+ xxxx xxxx xxxx
+ xxxx xxx xxx
+ xxxxx xxxx xxxx
+ xxxxx xxx xxx
+ xxxxx xxxx xxxx
+ xxxxx xxx xxx
+ xxxxxx xxxxx xxxxx
+ xxxxxxxx xxxxxx xxxxxx
+ xxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxx
+=*==============================================
+`);
+
+res += prepFont('dow', `
+=*==============================================
+-1----------------------------------------------
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxx
+ xxxxxx
+ xxxxxx
+ xxxxxx
+ xxxxxx
+ xxxxxx
+ xxxxxx
+ xxxxxx
+ xxxxxx
+ xxxxxx
+ xxxxxx
+ xxxxxx
+ xxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+
+
+ xxxxxx
+ xxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxx xxxxx
+ xxx xxx
+ xxxx xxxx
+ xxx xxx
+ xxx xxx
+ xxx xxx
+ xxx xxx
+ xxxx xxxx
+ xxx xxx
+ xxxxx xxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxx
+ xxxxxx
+-2----------------------------------------------
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+
+ xxxxxxxxxxx
+ xxxxxxxxxxxxx
+ xxxxxxxxxxxxxx
+ xxxx
+ xxxx
+ xxx
+ xxx
+ xxx
+ xxxx
+ xxxx
+ xxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+-3----------------------------------------------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xx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxx xxx
+ xxxx xxx
+ xxx xxx
+ xxxx xxx
+ xxx xxx
+ xxxx xxx
+ xxx xxx
+ xxxx xxx
+ xxx xxx
+ xxx xxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+
+
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxx
+ xxxx
+ xxxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxx
+ xxxx
+ xxx
+ xxxx
+ xxx
+ x
+-6----------------------------------------------
+ xxx xxxxxxxx
+ xxxx xxxxxxxxxxxx
+ xxxx xxxxxxxxxxxxxx
+ xxxx xxxxx xxxxx
+ xxxx xxxx xxxx
+ xxx xxx xxx
+ xxx xxx xxxx
+ xxx xxxx xxx
+ xxx xxx xxx
+ xxxx xxx xxx
+ xxxx xxxx xxx
+ xxxx xxx xxx
+ xxxx xxx xxxx
+ xxxx xxxx xxx
+ xxxxx xxx xxx
+ xxxxxx xxxxx xxx
+ xxxxxxxxxxxxxxx xx
+ xxxxxxxxxxxx xxxx
+ xxxxxx xxxxxxxx
+ xxxxxxxxxx xx
+ xxxx xxxx xxx
+ xxxx xxxx xxx
+ xxx xxx xxx
+ xxx xxx xxx
+ xxx xxx xxx
+ xxxx xxxx xxxx
+ xxxx xxxx xxxxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxx
+-0----------------------------------------------
+ xxx xxxxxxxx
+ xxxx xxxxxxxxxxxx
+ xxxx xxxxxxxxxxxxxx
+ xxxx xxxxx xxxxx
+ xxxx xxxx xxxx
+ xxx xxx xxx
+ xxx xxx xxxx
+ xxx xxxx xxx
+ xxx xxx xxx
+ xxxx xxx xxx
+ xxxx xxxx xxx
+ xxxx xxx xxx
+ xxxx xxx xxxx
+ xxxx xxxx xxx
+ xxxxx xxx xxx
+ xxxxxx xxxxx xxx
+ xxxxxxxxxxxxxxx xx
+ xxxxxxxxxxxx
+ xxxxxx
+ xxxxxxxxxxx
+ xxxxxxxxxxxxx
+ xxxxxxxxxxxxxx
+ xxxx
+ xxxx
+ xxx
+ xxx
+ xxx
+ xxxx
+ xxxx
+ xxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+=*==============================================
+`);
+
+res += prepFont('m', `
+<<<<=*==============================================
+-1----------------------------------------------
+ xxxx xxxxx
+ xxx xxxxx
+ xxx xxxxx
+ xxx xxxxx
+xxx xxxxx
+xxx xxxxx
+xxx xxxxx
+xxxx xxxxx
+ xxx xxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxx
+ xxxxx
+ xxx xxxxx
+ xxxxx xx xxxxx
+ xxxxxxx xxx xxxxx
+ xxx xxx xxxx xxxxx
+xxx xxx xxx xxxxx
+xxx xxx xxx
+xxx xxx xxx
+ xx xxx xxxx
+ xxxxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxx
+
+
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxx
+ xxxx
+ xxx
+ xxx
+ xxx
+ xxxx
+xxxxxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxx
+-2----------------------------------------------
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxx xxxx
+ xxxx xxxx
+ xxx xxxx
+ xxxx xxxx
+ xxx xxxx
+ xxxxxx xxxx xxxx
+ xxxxxxxxxx xxx xxxx
+ xxxxxxxxxxxx xxxx xxxx
+ xxxx xxxxxxx xxx xxxx
+xxxx xxx xxxx xxxx xxxx
+xxx xxx xxx xxxx
+xxx xxx xxx xxxx
+xxx xxx xxx xxxx
+xxxx xxx xxxx xxxx
+ xxx xxxxxxx xxxx
+ xxxx xxxxxxx
+ xxx xxxxxx
+ x xxx
+
+
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxx
+ xxx xxx
+xxxx xxxx
+xxx xxx
+xxxx xxxx
+ xxx xxx
+ xxxxx xxxxx
+ xxxxxxxxxx
+ xxxxxxxx
+ xxxx
+-3----------------------------------------------
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxx
+ xxxxxxxxxxx
+ xxxxxxxxxxx
+ xxxxxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxx
+ xxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+
+
+ xxx
+ xxxxx xx
+ xxxxxxx xxx
+ xxx xxx xxx
+xxx xxx xxx
+xxx xxx xxx
+xxx xxx xxx
+ xx xxx xxxx
+ xxxxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxx
+
+
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxx
+ xxxx
+ xxxx
+ xxx
+ xxxx
+ xxxx
+ xxx
+ xx
+<<<<-4----------------------------------------------
+ xxxxxx
+ xxxxxxxxxxxx
+ xxxx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xxxxxxxxx
+xx xxxxxxxxxxxxx
+xxx xxxxx
+xxx xxx
+xxxxxxxxx
+ xxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxx
+ xxxxxxxxxxx
+-6----------------------------------------------
+ xxxx xxxxx
+ xxx xxxxx
+ xxx xxxxx
+ xxx xxxxx
+xxx xxxxx
+xxx xxxxx
+xxx xxxxx
+xxxx xxxxx
+ xxx xxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxx
+ xxxxx
+ xxxxxxxxxxx xxxxx
+ xxxxxxxxxxxx xxxxx
+ xxxxxxxxxxxxx xxxxx
+ xxxx xxxxx
+xxx xxxxx
+xxx
+xxx
+xxxx
+ xxxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxx
+
+
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxx
+ xxxx
+ xxx
+ xxx
+ xxx
+ xxxx
+xxxxxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxx
+-7----------------------------------------------
+ xxxx xxxxx
+ xxx xxxxx
+ xxx xxxxx
+ xxx xxxxx
+xxx xxxxx
+xxx xxxxx
+xxx xxxxx
+xxxx xxxxx
+ xxx xxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxx
+ xxxxx
+ xxxxxxxxxxx xxxxx
+ xxxxxxxxxxxx xxxxx
+ xxxxxxxxxxxxx xxxxx
+ xxxx xxxxx
+xxx xxxxx
+xxx
+xxx
+ xxxx
+ xxxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxx
+
+
+xxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxx
+<<<<-8----------------------------------------------
+ xxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxx
+ xxx xxxxxxxxxxxxxxxxxx
+ xxx xxxxxxxxxxxxxxxxx
+ xxx xxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxx
+x xxxxxxxxxxxx
+x xxxxxx
+xx
+xx
+xx xxxxxxxxxxx
+ x xxxxxxxxxxxx
+ x xxxxxxxxxxxxx
+ x xxxx
+ xx xxx
+ xx xxx
+ xx xxxx
+ xx xxxxxxxxxxxxx
+ xx xxxxxxxxxxxxxx
+ xx xxxxxxxxxxxxxx
+ x
+ x
+xx xxxxxxxx
+xx xxxxxxxxxxxx
+xx xxxxxxxxxxxx
+xx xxxxx xxxxx
+xxx xxx xxx
+xxx xxx xxx
+xxxxxxxxx xxxxx
+ xxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxx
+<<<<-9----------------------------------------------
+ xxxxx xxxxxxxxxxxx
+ xxxxx xxxxxxxxxxxxxxxxxx
+ xxxx xxxxxxxxxxxxxxxxxxxxxx
+ xxx xxxxxxxxx xxxxxxx
+ xxxx xxxxxx xxxxx
+ xxx xxxx xxxx
+ xxxx xxxx xxxx
+ xxxxx xxxxxx xxxx
+ xxxxxxxxxxxxxxxxxxxx xxxx
+ xxxxxxxxxxxxxxxxxx xxxxx
+ xxxxxxxxxxxxxx xxxxxx
+ xxxxxxx
+
+ xxxxxx
+ xxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxx xxxxxxx
+ xxxx xxx xxxx
+ xxx xxx xxx
+ xxx xxx xxx
+ xxxx xxx xxxx
+ xxx xxxxxxx
+ xxxx xxxxxxx
+ xxx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xxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+
+
+ xxxxxx
+ xxxxxxxxxx
+ xxxxxxxxxxxx
+xxxxx xxxxx
+xxx xxx
+xxx xxx
+xxxxx xxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxx
+ xxxxxx
+ x
+ xxxx
+ xxxxxxx
+ xxxxxxxx
+ xxxxxxxx
+xxxxxxxx
+ xxxxxxxx
+ xxxxxxxx
+ xxxxxxx
+ xxx
+-<----------------------------------------------
+xxx xxxx
+xxx xxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxx xxxxx
+xxxx xxxxxxx
+ xxxxx xxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxx
+
+
+ xxxxxx
+ xxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxx xxxxxxx
+xxxx xxx xxxx
+xxx xxx xxx
+xxx xxx xxx
+xxxx xxx xxxx
+ xxx xxxxxxx
+ xxxx xxxxxxx
+ xxx xxxxxx
+ x xxx
+
+
+ xxxxxx
+ xxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxx xxxx
+xxx xxx
+xxx xxx
+xxx xxx
+ xxx xxx
+ xxx xxx
+ xx xx
+<<<<=*==============================================
+`);
+
+res += prepBitmap('lock', `
+ xxxx
+ xxxxxx
+ xxx xxx
+ xx xx
+ xx xx
+xxxxxxxxxx
+x x
+x xxxx x
+x x
+x x
+x xxxx x
+x x
+x x
+x xxxx x
+x x
+x x
+xxxxxxxxxx
+`);
+
+res += prepBitmap('lockS', `
+ xxx
+ xxxxx
+ xx xx
+ xx xx
+xxxxxxxxx
+x x
+x xxx x
+x x
+x xxx x
+x x
+x xxx x
+x x
+xxxxxxxxx
+`);
+
+res += prepBitmap('battery', `
+ xx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+xxxxxxxx
+`);
+
+res += prepBitmap('charge', `
+ x
+ xx
+ xx
+ xx
+ xx
+ xxx
+ xxxxxx
+ xxx
+ xx
+ xx
+ xx
+ xx
+ x
+`);
+
+res += prepBitmap('HRM', `
+ xxx xxx
+ x xxx xxx x
+ xx xxxxxxxx xx
+xxx xxxxxxxx xxx
+xxx xxxxxxxx xxx
+xxx xxxxxxxx xxx
+xxx xxxxxxx xx
+x x x xx x x
+ x x xx x x x
+xx x xxxxxx x xx
+ xxx xxxxxxxx x
+ xx xxxxxxxx
+ xxxxxxxxxx
+ xxxxxxxx
+ xxxxxx
+ xxxx
+ xx
+`);
+
+res += prepBitmap('compass', `
+ x
+ x
+ xxx
+ xxx
+ xxxxx
+ xx xx
+ xxx xxx
+ xx xx
+xx xx
+`);
+
+res += prepBitmap('y100', `
+ xxxxx xxx
+xxxxxxx xxxxx
+x xxx xx xx
+ xx xxx xxx
+ xxx xx xx
+ xxxx xx xx
+xxxxx xx xx
+ xxx xx xx
+ xxx xx xx
+ xxx xx xx
+ xxx xx xx
+ xx xx xx
+ x xx xx
+ xxx xxx
+ xx xx
+ xxxxx
+ xxx
+`);
+
+res += prepBitmap('y100s', `
+ xx xx
+x xx xxxx
+ xx xx xx
+xxx xx xx
+ xx xx xx
+ xx xx xx
+ x xx xx
+ xx xx
+ xxxx
+ xx
+`);
+
+print(res);
diff --git a/apps/poweroff/README.md b/apps/poweroff/README.md
index 3aeff5e8d..d9d7a8dbc 100644
--- a/apps/poweroff/README.md
+++ b/apps/poweroff/README.md
@@ -4,10 +4,10 @@ Simple app to power off your Bangle.js
## Usage
-Start the app shutdowns your Bangle.js watch after a short delay.
+Start the app to shutdown your Bangle.js watch after a short delay.
## Creator
-Marco (@myxor)
+Marco ([myxor](https://github.com/myxor))
## Icon
-Icon taken from https://materialdesignicons.com/ Apache License 2.0
+Icon taken from [materialdesignicons](https://materialdesignicons.com) under Apache License 2.0
diff --git a/apps/poweroff/app-icon.js b/apps/poweroff/app-icon.js
index 7caf256a2..81a2527b5 100644
--- a/apps/poweroff/app-icon.js
+++ b/apps/poweroff/app-icon.js
@@ -1 +1 @@
-require("heatshrink").decompress(atob("mEwwMB/4Ak/k/ArX8AoIGC/F8n0fAoPwAoMPAoPgAoMHAoPAC4MDAoPBAoODAoODAoPBAoOHAoPhAo8HAoPgAoMPAoPwArRQCFIRQCGoQCBHYYFEKARNCAQQIC4ACBMoXgv/+EwXwn/8GQX4g/gRIX8b4KVC/wFBv6iCwDnE+AcCAF4="))
+require("heatshrink").decompress(atob("mEwgIolgfAAqkCAoNAAoMHAoPgAoMPwfB+AFBj/D4f4AoM/AoP8AoQRBAoV/DoP+AoN+AoN+AoP8AoM/Ao/4AoMfAsBQCAo5QDAo5KCAQV/AQJZCn+AgIUD4EDAoUf+EPFgUP///RIUHAoKVCgYFBVAYFBWYc/EQQAvA"))
diff --git a/apps/poweroff/app.png b/apps/poweroff/app.png
index 5c199c3ba..aa186ab20 100644
Binary files a/apps/poweroff/app.png and b/apps/poweroff/app.png differ
diff --git a/apps/ptlaunch/ChangeLog b/apps/ptlaunch/ChangeLog
new file mode 100644
index 000000000..de38d715a
--- /dev/null
+++ b/apps/ptlaunch/ChangeLog
@@ -0,0 +1,4 @@
+0.01: Initial creation of the pattern launch app
+0.02: Turn on lcd when launching an app if the lock screen was disabled in the settings
+0.03: Make tap to confirm new pattern more reliable. Also allow for easier creation of single circle patterns.
+0.10: Improve the management of existing patterns: Draw the linked pattern on the left hand side of the app name within a scroller, similar to the default launcher. Slighlty clean up the code to make it less horrible.
\ No newline at end of file
diff --git a/apps/ptlaunch/README.md b/apps/ptlaunch/README.md
new file mode 100644
index 000000000..8d61afece
--- /dev/null
+++ b/apps/ptlaunch/README.md
@@ -0,0 +1,53 @@
+# Pattern Launcher
+
+Directly launch apps from the clock screen with custom patterns.
+
+## Usage
+
+Create patterns and link them to apps in the Pattern Launcher app.
+
+Then launch the linked apps directly from the clock screen by simply drawing the desired pattern.
+
+## Add Pattern Screenshots
+
+
+
+
+
+## Manage Pattern Screenshots
+
+
+
+
+## Detailed Steps
+
+From the main menu you can:
+- Add a new pattern and link it to an app (first entry)
+ - To create a new pattern first select "Add Pattern"
+ - Now draw any pattern you like, this will later launch the linked app from the clock screen
+ - You can also draw a single-circle pattern (meaning a single tap on one circle) instead of drawing a 'complex' pattern
+ - If you don't like the pattern, simply re-draw it. The previous pattern will be discarded.
+ - If you are happy with the pattern tap on screen or press the button to continue
+ - Now select the app you want to launch with the pattern.
+ - Note, you can bind multiple patterns to the same app.
+- Manage created patterns (second entry)
+ - To manage your patterns first select "Manage Patterns"
+ - You will now see a scrollabe list of patterns + linked apps
+ - If you want to deletion a pattern (and unlink the app) simply tap on it, and confirm the deletion
+- Disable the lock screen on the clock screen from the settings (third entry)
+ - To launch the app from the pattern on the clock screen the watch must be unlocked.
+ - If this annoys you, you can disable the lock on the clock screen from the setting here
+
+## FAQ
+
+1) Nothing happens when I draw on the clock screen!
+
+Please double-check if you actually have a pattern linked to an app.
+
+2) I have a pattern linked to an app and still nothing happens when I draw on the clock screen!
+
+Make sure the watch is unlocked before you start drawing. If this bothers you, you can permanently disable the watch-lock from within the Pattern Launcher app (via the Settings).
+
+3) I have done all that and still nothing happens!
+
+Please note that drawing on the clock screen will not visually show the pattern you drew. It will start the app as soon as the pattern was recognized - this might take 1 or 2 seconds! If still nothing happens, that might be a bug, sorry!
diff --git a/apps/ptlaunch/add_pattern.png b/apps/ptlaunch/add_pattern.png
new file mode 100644
index 000000000..c7cc38e82
Binary files /dev/null and b/apps/ptlaunch/add_pattern.png differ
diff --git a/apps/ptlaunch/app-icon.js b/apps/ptlaunch/app-icon.js
new file mode 100644
index 000000000..07f025d71
--- /dev/null
+++ b/apps/ptlaunch/app-icon.js
@@ -0,0 +1 @@
+require("heatshrink").decompress(atob("mEwwkE//ziEAiM//4ACmMAgMvA4fziIIBCAUgEAUCBwXxFIYYDCAvyHIgPCGwIgFCA0wAYIRCh49BLQoXB+AHEgYUBgQaCE4JGEHAZGDAAMBAQMjC4UBEw0Aj5PFDIchC4Q/BC5CtIgIXUGwIXDI6EBiCaCCYJ3RIganTa5AnEgbXIewwPGn4ICCA8hgESAoQABmUQgI2CCBQA/AAvzbIRuD/8xNwMTCBTfDPwbYEPAaPDf4LnFB4T/EEAS/Fj7vFZ4LvBgMiFIQXBCAwmEE4Q3BiUikTnHJAQFEJ4XwgERHgI/CJ4oAIC4QYBiYXDCxgXDgUzLQQXIGwpHDLoRHJgJmFO4arCO5MCK4QACh6nCJ4poDCAbGFe4QnEY4IgGG4oOCc4ofCbAj3C/8hiMSAoQYCiMRMQQQKAH4AGkMAJwsyiEBL4wQER4Z+DR5AQFX4ooCX44QGVobvOgMREAUQBwg3B+IXFc4cTmYUBgIXFgImCAAkf/59BkERIgMBBwo/BC5AkDCgwXOAAIMGI5xFBBgR3SJYinXa5A4EfAQQHewoABJAgfCCA/zFAMRn4OC/8xIAIWDCAJGBgIQBA=="))
\ No newline at end of file
diff --git a/apps/ptlaunch/app.js b/apps/ptlaunch/app.js
new file mode 100644
index 000000000..b5a3bf610
--- /dev/null
+++ b/apps/ptlaunch/app.js
@@ -0,0 +1,608 @@
+var DEBUG = false;
+
+var storage = require("Storage");
+
+var showMainMenu = () => {
+ log("loading patterns");
+ var storedPatterns = storage.readJSON("ptlaunch.patterns.json", 1) || {};
+
+ var mainmenu = {
+ "": {
+ title: "Pattern Launcher",
+ },
+ "< Back": () => {
+ log("cancel");
+ load();
+ },
+ "Add Pattern": () => {
+ log("creating pattern");
+ recognizeAndDrawPattern().then((pattern) => {
+ log("got pattern");
+ log(pattern);
+ log(pattern.length);
+
+ var confirmPromise = new Promise((resolve) => resolve(true));
+
+ if (storedPatterns[pattern]) {
+ log("pattern already exists. show confirmation prompt");
+ confirmPromise = E.showPrompt("Pattern already exists\nOverwrite?", {
+ title: "Confirm",
+ buttons: { Yes: true, No: false },
+ });
+ }
+
+ confirmPromise.then((confirm) => {
+ log("confirmPromise resolved: " + confirm);
+ if (!confirm) {
+ showMainMenu();
+ return;
+ }
+
+ log("selecting app");
+ getSelectedApp().then((app) => {
+ E.showMessage("Saving...");
+ log("got app");
+ log("saving pattern");
+
+ storedPatterns[pattern] = {
+ app: { name: app.name, src: app.src },
+ };
+ storage.writeJSON("ptlaunch.patterns.json", storedPatterns);
+ showMainMenu();
+ });
+ });
+ });
+ },
+ "Manage Patterns": () => {
+ log("selecting pattern through app");
+ showScrollerContainingAppsWithPatterns().then((selected) => {
+ var pattern = selected.pattern;
+ var appName = selected.appName;
+ if (pattern === "back") {
+ showMainMenu();
+ } else {
+ E.showPrompt(appName + "\n\npattern:\n" + pattern, {
+ title: "Delete?",
+ buttons: { Yes: true, No: false },
+ }).then((confirm) => {
+ if (confirm) {
+ E.showMessage("Deleting...");
+ delete storedPatterns[pattern];
+ storage.writeJSON("ptlaunch.patterns.json", storedPatterns);
+ showMainMenu();
+ } else {
+ showMainMenu();
+ }
+ });
+ }
+ });
+ },
+ Settings: () => {
+ var settings = storedPatterns.settings || {};
+
+ var settingsmenu = {
+ "": {
+ title: "Pattern Settings",
+ },
+ "< Back": () => {
+ log("cancel");
+ load();
+ },
+ };
+
+ if (settings.lockDisabled) {
+ settingsmenu["Enable lock"] = () => {
+ settings.lockDisabled = false;
+ storedPatterns.settings = settings;
+ Bangle.setOptions({ lockTimeout: 1000 * 30 });
+ storage.writeJSON("ptlaunch.patterns.json", storedPatterns);
+ showMainMenu();
+ };
+ } else {
+ settingsmenu["Disable lock"] = () => {
+ settings.lockDisabled = true;
+ storedPatterns.settings = settings;
+ storage.writeJSON("ptlaunch.patterns.json", storedPatterns);
+ Bangle.setOptions({ lockTimeout: 1000 * 60 * 60 * 24 * 365 });
+ showMainMenu();
+ };
+ }
+
+ E.showMenu(settingsmenu);
+ },
+ };
+ E.showMenu(mainmenu);
+};
+
+var positions = [];
+var recognizeAndDrawPattern = () => {
+ return new Promise((resolve) => {
+ E.showMenu();
+ g.clear();
+ g.setColor(0, 0, 0);
+ CIRCLES.forEach((circle) => drawCircle(circle));
+
+ var pattern = [];
+
+ var isFinished = false;
+ var finishHandler = () => {
+ if (pattern.length === 0 || isFinished) {
+ return;
+ }
+ log("Pattern is finished.");
+ isFinished = true;
+ Bangle.removeListener("drag", dragHandler);
+ Bangle.removeListener("tap", finishHandler);
+ resolve(pattern.join(""));
+ };
+ setWatch(() => finishHandler(), BTN);
+ setTimeout(() => Bangle.on("tap", finishHandler), 250);
+
+ positions = [];
+ var dragHandler = (position) => {
+ log(position);
+ positions.push(position);
+
+ debounce().then(() => {
+ if (isFinished) {
+ return;
+ }
+
+ // This might actually be a 'tap' event.
+ // Use this check in addition to the actual tap handler to make it more reliable
+ if (pattern.length > 0 && positions.length === 2) {
+ if (
+ positions[0].x === positions[1].x &&
+ positions[0].y === positions[1].y
+ ) {
+ finishHandler();
+ positions = [];
+ return;
+ }
+ }
+
+ E.showMessage("Calculating...");
+ var t0 = Date.now();
+
+ log(positions.length);
+
+ var circlesClone = cloneCirclesArray();
+ pattern = [];
+
+ var step = Math.floor(positions.length / 100) + 1;
+
+ var p, a, b, circle;
+
+ for (var i = 0; i < positions.length; i += step) {
+ p = positions[i];
+
+ circle = circlesClone[0];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circlesClone.splice(0, 1);
+ }
+ }
+
+ circle = circlesClone[1];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circlesClone.splice(1, 1);
+ }
+ }
+
+ circle = circlesClone[2];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circlesClone.splice(2, 1);
+ }
+ }
+
+ circle = circlesClone[3];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circlesClone.splice(3, 1);
+ }
+ }
+
+ circle = circlesClone[4];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circlesClone.splice(4, 1);
+ }
+ }
+
+ circle = circlesClone[5];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circlesClone.splice(5, 1);
+ }
+ }
+
+ circle = circlesClone[6];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circlesClone.splice(6, 1);
+ }
+ }
+ circle = circlesClone[7];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circlesClone.splice(7, 1);
+ }
+ }
+
+ circle = circlesClone[8];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circlesClone.splice(8, 1);
+ }
+ }
+ }
+ var tx = Date.now();
+ log(tx - t0);
+ positions = [];
+ var t1 = Date.now();
+ log(t1 - t0);
+
+ log("pattern:");
+ log(pattern);
+
+ log("redrawing");
+ g.clear();
+ drawCirclesWithPattern(pattern);
+ });
+ };
+
+ Bangle.on("drag", dragHandler);
+ });
+};
+
+var getAppList = () => {
+ var appList = storage
+ .list(/\.info$/)
+ .map((appInfoFileName) => {
+ var appInfo = storage.readJSON(appInfoFileName, 1);
+ return (
+ appInfo && {
+ name: appInfo.name,
+ // type: appInfo.type,
+ // icon: appInfo.icon,
+ sortorder: appInfo.sortorder,
+ src: appInfo.src,
+ }
+ );
+ })
+ .filter((app) => app && !!app.src);
+ appList.sort((a, b) => {
+ var n = (0 | a.sortorder) - (0 | b.sortorder);
+ if (n) return n; // do sortorder first
+ if (a.name < b.name) return -1;
+ if (a.name > b.name) return 1;
+ return 0;
+ });
+
+ return appList;
+};
+
+var getSelectedApp = () => {
+ E.showMessage("Loading apps...");
+ return new Promise((resolve) => {
+ var selectAppMenu = {
+ "": {
+ title: "Select App",
+ },
+ "< Cancel": () => {
+ log("cancel");
+ showMainMenu();
+ },
+ };
+
+ var appList = getAppList();
+ appList.forEach((app) => {
+ selectAppMenu[app.name] = () => {
+ log("app selected");
+ log(app);
+ resolve(app);
+ };
+ });
+
+ E.showMenu(selectAppMenu);
+ });
+};
+
+//////
+// manage pattern related variables and functions
+// - draws all saved patterns and their linked app names
+// - uses the scroller to allow the user to browse through them
+//////
+
+var scrollerFont = g.getFonts().includes("12x20") ? "12x20" : "6x8:2";
+
+var drawBackButton = (r) => {
+ g.clearRect(r.x, r.y, r.x + r.w - 1, r.y + r.h - 1);
+ g.setFont(scrollerFont)
+ .setFontAlign(-1, 0)
+ .drawString("< Back", 64, r.y + 32);
+};
+
+var drawAppWithPattern = (i, r, storedPatterns) => {
+ log("draw app with pattern");
+ log({ i: i, r: r, storedPatterns: storedPatterns });
+ var storedPattern = storedPatterns[i];
+ var pattern = storedPattern.pattern;
+ var app = storedPattern.app;
+
+ g.clearRect(r.x, r.y, r.x + r.w - 1, r.y + r.h - 1);
+
+ g.drawLine(r.x, r.y, 176, r.y);
+
+ drawCirclesWithPattern(pattern, {
+ enableCaching: true,
+ scale: 0.33,
+ offset: { x: 1, y: 3 + r.y },
+ });
+
+ g.setColor(0, 0, 0);
+ if (!storedPattern.wrappedAppName) {
+ storedPattern.wrappedAppName = g
+ .wrapString(app.name, g.getWidth() - 64)
+ .join("\n");
+ }
+ log(g.getWidth());
+ log(storedPattern.wrappedAppName);
+ g.setFont(scrollerFont)
+ .setFontAlign(-1, 0)
+ .drawString(storedPattern.wrappedAppName, 64, r.y + 32);
+};
+
+var showScrollerContainingAppsWithPatterns = () => {
+ var storedPatternsArray = getStoredPatternsArray();
+ log("drawing scroller for stored patterns");
+ log(storedPatternsArray);
+ log(storedPatternsArray.length);
+
+ g.clear();
+
+ var c = Math.max(storedPatternsArray.length + 1, 3);
+
+ return new Promise((resolve) => {
+ E.showScroller({
+ h: 64,
+ c: c,
+ draw: (i, r) => {
+ log("draw");
+ log({ i: i, r: r });
+ if (i <= 0) {
+ drawBackButton(r);
+ } else if (i <= storedPatternsArray.length) {
+ drawAppWithPattern(i - 1, r, storedPatternsArray);
+ }
+ },
+ select: (i) => {
+ log("selected: " + i);
+ var pattern = "back";
+ var appName = "";
+ if (i > 0) {
+ var storedPattern = storedPatternsArray[i - 1];
+ pattern = storedPattern.pattern.join("");
+ appName = storedPattern.app.name;
+ }
+ clearCircleDrawingCache();
+ resolve({ pattern: pattern, appName: appName });
+ },
+ });
+ });
+};
+
+//////
+// storage related functions:
+// - stored patterns
+// - stored settings
+//////
+
+var getStoredPatternsMap = () => {
+ log("loading stored patterns map");
+ var storedPatternsMap = storage.readJSON("ptlaunch.patterns.json", 1) || {};
+ delete storedPatternsMap.settings;
+ log(storedPatternsMap);
+ return storedPatternsMap;
+};
+
+var getStoredPatternsArray = () => {
+ var storedPatternsMap = getStoredPatternsMap();
+ log("converting stored patterns map to array");
+ var patterns = Object.keys(storedPatternsMap);
+ var storedPatternsArray = [];
+ for (var i = 0; i < patterns.length; i++) {
+ var pattern = "" + patterns[i];
+ storedPatternsArray.push({
+ pattern: pattern
+ .split("")
+ .map((circleIndex) => parseInt(circleIndex, 10)),
+ app: storedPatternsMap[pattern].app,
+ });
+ }
+ log(storedPatternsArray);
+ return storedPatternsArray;
+};
+
+//////
+// circle related variables and functions:
+// - the circle array itself
+// - the radius and the squared radius of the circles
+// - circle draw function
+//////
+
+var CIRCLE_RADIUS = 25;
+var CIRCLE_RADIUS_2 = CIRCLE_RADIUS * CIRCLE_RADIUS;
+
+var CIRCLES = [
+ { x: 25, y: 25, i: 0 },
+ { x: 87, y: 25, i: 1 },
+ { x: 150, y: 25, i: 2 },
+ { x: 25, y: 87, i: 3 },
+ { x: 87, y: 87, i: 4 },
+ { x: 150, y: 87, i: 5 },
+ { x: 25, y: 150, i: 6 },
+ { x: 87, y: 150, i: 7 },
+ { x: 150, y: 150, i: 8 },
+];
+
+var drawCircle = (circle, drawBuffer, scale) => {
+ if (!drawBuffer) {
+ drawBuffer = g;
+ }
+ if (!scale) {
+ scale = 1;
+ }
+
+ var x = circle.x * scale;
+ var y = circle.y * scale;
+ var r = CIRCLE_RADIUS * scale;
+
+ log("drawing circle");
+ log({ x: x, y: y, r: r });
+
+ drawBuffer.fillCircle(x, y, r);
+};
+
+var cachedCirclesDrawings = {};
+
+var clearCircleDrawingCache = () => {
+ cachedCirclesDrawings = {};
+};
+
+var drawCirclesWithPattern = (pattern, options) => {
+ if (!pattern || pattern.length === 0) {
+ pattern = [];
+ }
+ if (!options) {
+ options = {};
+ }
+ var enableCaching = options.enableCaching;
+ var scale = options.scale;
+ var offset = options.offset;
+ if (!enableCaching) {
+ enableCaching = false;
+ }
+ if (!scale) {
+ scale = 1;
+ }
+ if (!offset) {
+ offset = { x: 0, y: 0 };
+ }
+
+ log("drawing circles with pattern, scale and offset");
+ log(pattern);
+ log(scale);
+ log(offset);
+
+ // cache drawn patterns. especially useful for the manage pattern menu
+ var image = cachedCirclesDrawings[pattern.join("")];
+ if (!image) {
+ log("circle image not cached");
+ var drawBuffer = Graphics.createArrayBuffer(
+ g.getWidth() * scale,
+ g.getHeight() * scale,
+ 1,
+ { msb: true }
+ );
+
+ drawBuffer.setColor(1);
+ CIRCLES.forEach((circle) => drawCircle(circle, drawBuffer, scale));
+
+ drawBuffer.setColor(0);
+ drawBuffer.setFontAlign(0, 0);
+ drawBuffer.setFont("6x8", 4 * scale);
+ pattern.forEach((circleIndex, patternIndex) => {
+ var circle = CIRCLES[circleIndex];
+ drawBuffer.drawString(
+ patternIndex + 1,
+ circle.x * scale,
+ circle.y * scale
+ );
+ });
+
+ image = {
+ width: drawBuffer.getWidth(),
+ height: drawBuffer.getHeight(),
+ bpp: 1,
+ buffer: drawBuffer.buffer,
+ };
+
+ if (enableCaching) {
+ cachedCirclesDrawings[pattern.join("")] = image;
+ }
+ } else {
+ log("using cached circle image");
+ }
+
+ g.drawImage(image, offset.x, offset.y);
+};
+
+var cloneCirclesArray = () => {
+ var circlesClone = Array(CIRCLES.length);
+
+ for (var i = 0; i < CIRCLES.length; i++) {
+ circlesClone[i] = CIRCLES[i];
+ }
+
+ return circlesClone;
+};
+
+//////
+// misc lib functions
+//////
+
+var log = (message) => {
+ if (DEBUG) {
+ console.log(JSON.stringify(message));
+ }
+};
+
+var debounceTimeoutId;
+var debounce = (delay) => {
+ if (debounceTimeoutId) {
+ clearTimeout(debounceTimeoutId);
+ }
+
+ return new Promise((resolve) => {
+ debounceTimeoutId = setTimeout(() => {
+ debounceTimeoutId = undefined;
+ resolve();
+ }, delay || 500);
+ });
+};
+
+//////
+// run main function
+//////
+
+showMainMenu();
diff --git a/apps/ptlaunch/app.png b/apps/ptlaunch/app.png
new file mode 100644
index 000000000..14ed77f1d
Binary files /dev/null and b/apps/ptlaunch/app.png differ
diff --git a/apps/ptlaunch/boot.js b/apps/ptlaunch/boot.js
new file mode 100644
index 000000000..a23607768
--- /dev/null
+++ b/apps/ptlaunch/boot.js
@@ -0,0 +1,190 @@
+var DEBUG = true;
+var log = (message) => {
+ if (DEBUG) {
+ console.log(JSON.stringify(message));
+ }
+};
+
+var storedPatterns;
+var positions = [];
+var dragHandler = (position) => {
+ positions.push(position);
+
+ debounce().then(() => {
+ log(positions.length);
+
+ var CIRCLE_RADIUS = 25;
+ var CIRCLE_RADIUS_2 = CIRCLE_RADIUS * CIRCLE_RADIUS;
+
+ var circles = [
+ { x: 25, y: 25, i: 0 },
+ { x: 87, y: 25, i: 1 },
+ { x: 150, y: 25, i: 2 },
+ { x: 25, y: 87, i: 3 },
+ { x: 87, y: 87, i: 4 },
+ { x: 150, y: 87, i: 5 },
+ { x: 25, y: 150, i: 6 },
+ { x: 87, y: 150, i: 7 },
+ { x: 150, y: 150, i: 8 },
+ ];
+ var pattern = [];
+
+ var step = Math.floor(positions.length / 100) + 1;
+
+ var p, a, b, circle;
+
+ for (var i = 0; i < positions.length; i += step) {
+ p = positions[i];
+
+ circle = circles[0];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circles.splice(0, 1);
+ }
+ }
+
+ circle = circles[1];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circles.splice(1, 1);
+ }
+ }
+
+ circle = circles[2];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circles.splice(2, 1);
+ }
+ }
+
+ circle = circles[3];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circles.splice(3, 1);
+ }
+ }
+
+ circle = circles[4];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circles.splice(4, 1);
+ }
+ }
+
+ circle = circles[5];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circles.splice(5, 1);
+ }
+ }
+
+ circle = circles[6];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circles.splice(6, 1);
+ }
+ }
+ circle = circles[7];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circles.splice(7, 1);
+ }
+ }
+
+ circle = circles[8];
+ if (circle) {
+ a = p.x - circle.x;
+ b = p.y - circle.y;
+ if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) {
+ pattern.push(circle.i);
+ circles.splice(8, 1);
+ }
+ }
+ }
+ positions = [];
+
+ pattern = pattern.join("");
+
+ if (pattern) {
+ if (storedPatterns[pattern]) {
+ var app = storedPatterns[pattern].app;
+ if (!!app && !!app.src) {
+ if (storedPatterns.settings) {
+ if (storedPatterns.settings.lockDisabled) {
+ Bangle.setLCDPower(true);
+ }
+ }
+
+ Bangle.removeListener("drag", dragHandler);
+ load(app.src);
+ }
+ }
+ }
+ });
+};
+
+var debounceTimeoutId;
+var debounce = (delay) => {
+ if (debounceTimeoutId) {
+ clearTimeout(debounceTimeoutId);
+ }
+
+ return new Promise((resolve) => {
+ debounceTimeoutId = setTimeout(() => {
+ debounceTimeoutId = undefined;
+ resolve();
+ }, delay || 500);
+ });
+};
+
+(function () {
+ var sui = Bangle.setUI;
+ Bangle.setUI = function (mode, cb) {
+ sui(mode, cb);
+ if (!mode) {
+ Bangle.removeListener("drag", dragHandler);
+ storedPatterns = {};
+ return;
+ }
+ if (!mode.startsWith("clock")) {
+ storedPatterns = {};
+ Bangle.removeListener("drag", dragHandler);
+ return;
+ }
+
+ var storage = require("Storage");
+ storedPatterns = storage.readJSON("ptlaunch.patterns.json", 1) || {};
+ if (Object.keys(storedPatterns).length > 0) {
+ Bangle.on("drag", dragHandler);
+ if (storedPatterns.settings) {
+ if (storedPatterns.settings.lockDisabled) {
+ Bangle.setOptions({ lockTimeout: 1000 * 60 * 60 * 24 * 365 });
+ }
+ }
+ }
+ };
+})();
diff --git a/apps/ptlaunch/main_menu_add.png b/apps/ptlaunch/main_menu_add.png
new file mode 100644
index 000000000..e9a5c52a9
Binary files /dev/null and b/apps/ptlaunch/main_menu_add.png differ
diff --git a/apps/ptlaunch/main_menu_manage.png b/apps/ptlaunch/main_menu_manage.png
new file mode 100644
index 000000000..a6aee1427
Binary files /dev/null and b/apps/ptlaunch/main_menu_manage.png differ
diff --git a/apps/ptlaunch/manage_patterns.png b/apps/ptlaunch/manage_patterns.png
new file mode 100644
index 000000000..82b10ad43
Binary files /dev/null and b/apps/ptlaunch/manage_patterns.png differ
diff --git a/apps/ptlaunch/select_app.png b/apps/ptlaunch/select_app.png
new file mode 100644
index 000000000..56f0dfc83
Binary files /dev/null and b/apps/ptlaunch/select_app.png differ
diff --git a/apps/qalarm/ChangeLog b/apps/qalarm/ChangeLog
index 135e69d23..fb6c751bb 100644
--- a/apps/qalarm/ChangeLog
+++ b/apps/qalarm/ChangeLog
@@ -1,2 +1,5 @@
0.01: First version!
-0.02: Fixed alarms not working and localised days of week.
\ No newline at end of file
+0.02: Fixed alarms not working and localised days of week.
+0.03: Fix unfreed memory, and clearInterval that disabled all clocks at midnight
+ Fix app icon
+ Change menu order so 'back' is at the top
diff --git a/apps/qalarm/app-icon.js b/apps/qalarm/app-icon.js
index 1a014b796..12d2c103f 100644
--- a/apps/qalarm/app-icon.js
+++ b/apps/qalarm/app-icon.js
@@ -1 +1 @@
-require("heatshrink").decompress(atob("/wA/AH4A/AH4AF0WiF1wwtF73GB53MAAgkY4wABFqIxPEhQuXGB4vUFxYwMEpBpGBwouNGAwfFF5I1KF6ZQHGAwNLFx4wHF/4v/F/4v/AoYGDF6gaFF5AwHL7QuMBJQvWEpwvxBQ4uRGBAkJT4wuWGBIuIRjKRNF8wwXFy4wWFzIwU53NFzPN5wuR5/PGK4tBDYSNQ5wVCCwIzBAAQoIAAQWGSJ5HFDYYAQIYTCRKRIeBAAYmDAAZsJMCQAbeCAybFiQ0XFTQAIzgAGFcYvz0QAGF84wGF1AwFF1QA/AH4A/ADQ="))
+require("heatshrink").decompress(atob("mEw4UA///gH+93+oH9Jf8AgfABZMP+ALRmADCitUAgUMAQP8AQMBqtVoAFBn4CBDwUFBYNQFAQLEioLBEgQLBgfwE4IKBAAI3BBYXAE4ILE/gJBAIM8HQQ8CngL/n4LFKYR3BhgLFNYSDCBYqPFBZKzBUwSoDWYTLBUwSoDZYQABBQa0DBZCoBAAY6EcojhEHgoACkoLFrALD1WVBQdW1QLDtQMDBQOpHQmqAAg8DIwQKEJAg6FMApfLDIoJFAAX//4KIBbE/aAIAIh7oBAH4A=="))
diff --git a/apps/qalarm/app.js b/apps/qalarm/app.js
index 64f601bf6..ad071adf0 100644
--- a/apps/qalarm/app.js
+++ b/apps/qalarm/app.js
@@ -41,6 +41,7 @@ function getCurrentTime() {
function showMainMenu() {
const menu = {
"": { title: "Alarms" },
+ "< Back" : () => load(),
"New Alarm": () => showEditAlarmMenu(-1),
"New Timer": () => showEditTimerMenu(-1),
};
@@ -54,9 +55,7 @@ function showMainMenu() {
else showEditAlarmMenu(idx);
};
});
- menu["< Back"] = () => {
- load();
- };
+ menu
if (WIDGETS["qalarm"]) WIDGETS["qalarm"].reload();
return E.showMenu(menu);
@@ -86,6 +85,7 @@ function showEditAlarmMenu(alarmIndex, alarm) {
const menu = {
"": { title: alarm.msg ? alarm.msg : "Alarms" },
+ "< Back" : showMainMenu,
Hours: {
value: hrs,
onchange: function (v) {
@@ -162,7 +162,6 @@ function showEditAlarmMenu(alarmIndex, alarm) {
showMainMenu();
};
}
- menu["< Back"] = showMainMenu;
return E.showMenu(menu);
}
@@ -206,6 +205,7 @@ function showEditTimerMenu(timerIndex) {
const menu = {
"": { title: "Timer" },
+ "< Back" : showMainMenu,
Hours: {
value: hrs,
onchange: function (v) {
@@ -264,7 +264,7 @@ function showEditTimerMenu(timerIndex) {
showMainMenu();
};
}
- menu["< Back"] = showMainMenu;
+
return E.showMenu(menu);
}
diff --git a/apps/qalarm/boot.js b/apps/qalarm/boot.js
index 6713ad9e1..5e9560ee2 100644
--- a/apps/qalarm/boot.js
+++ b/apps/qalarm/boot.js
@@ -1 +1 @@
-eval(require("Storage").read("qalarmcheck.js"));
+(function() { eval(require("Storage").read("qalarmcheck.js")); })()
diff --git a/apps/qalarm/qalarmcheck.js b/apps/qalarm/qalarmcheck.js
index 9a3f10d5e..8dac43800 100644
--- a/apps/qalarm/qalarmcheck.js
+++ b/apps/qalarm/qalarmcheck.js
@@ -4,7 +4,10 @@
print("Checking for alarms...");
-clearInterval();
+if (Bangle.QALARM) {
+ clearInterval(Bangle.QALARM);
+ Bangle.QALARM = undefined;
+}
function getCurrentTime() {
let time = new Date();
@@ -29,13 +32,13 @@ let nextAlarms = (require("Storage").readJSON("qalarm.json", 1) || [])
.sort((a, b) => a.t - b.t);
if (nextAlarms[0]) {
- setTimeout(() => {
+ Bangle.QALARM = setTimeout(() => {
eval(require("Storage").read("qalarmcheck.js"));
load("qalarm.js");
}, nextAlarms[0].t - t);
} else {
// No alarms found: will re-check at midnight
- setTimeout(() => {
+ Bangle.QALARM = setTimeout(() => {
eval(require("Storage").read("qalarmcheck.js"));
}, 86400000 - t);
}
diff --git a/apps/qmsched/ChangeLog b/apps/qmsched/ChangeLog
index 27b5421e8..f41fe3416 100644
--- a/apps/qmsched/ChangeLog
+++ b/apps/qmsched/ChangeLog
@@ -1,3 +1,5 @@
0.01: First version
0.02: Add widget
0.03: Bangle.js 2 support
+0.04: Move Quiet Mode LCD options from global settings to this app
+0.05: Avoid immediately redrawing widgets on load
\ No newline at end of file
diff --git a/apps/qmsched/README.md b/apps/qmsched/README.md
index 033014789..535ae56e4 100644
--- a/apps/qmsched/README.md
+++ b/apps/qmsched/README.md
@@ -1,9 +1,14 @@
# Quiet Mode Schedule and Widget
-Automatically turn Quiet Mode on or off at set times, and display a widget when enabled.
+Automatically turn Quiet Mode on or off at set times, and display a widget when Quiet Mode is active.
-### Edit Schedule:
- 
+| Bangle.js 1 | Bangle.js 2 |
+|:---------------------------------------------:|:---------------------------------------------:|
+| (widget: Silent mode) | (widget: Alarms mode) |
+|  |  |
+|  |  |
+|  |  |
-### Widget:
- 
+### LCD Settings:
+
+If set, these override the default LCD settings while Quiet Mode is active.
\ No newline at end of file
diff --git a/apps/qmsched/app.js b/apps/qmsched/app.js
index c6377d4ba..7be3339fb 100644
--- a/apps/qmsched/app.js
+++ b/apps/qmsched/app.js
@@ -2,27 +2,74 @@ Bangle.loadWidgets();
Bangle.drawWidgets();
const modeNames = ["Off", "Alarms", "Silent"];
-let scheds = require("Storage").readJSON("qmsched.json", 1);
-/*scheds = [
- { hr : 6.5, // hours + minutes/60
- mode : 1, // quiet mode (0/1/2)
- }
-];*/
-if (!scheds) {
- // set default schedule on first load of app
- scheds = [
- {"hr": 8, "mode": 0},
- {"hr": 22, "mode": 1},
- ];
- require("Storage").writeJSON("qmsched.json", scheds);
+
+// load global brightness setting
+let bSettings = require('Storage').readJSON('setting.json',true)||{};
+let current = 0|bSettings.quiet;
+delete bSettings; // we don't need any other global settings
+
+
+
+
+
+
+/**
+ * Save settings to qmsched.json
+ */
+function save() {
+ require('Storage').writeJSON('qmsched.json', settings);
}
-if (scheds.length && scheds.some(s => "last" in s)) {
- // cleanup: remove "last" values (used by old versions)
- scheds = scheds.map(s => {
- delete s.last;
- return s;
- });
- require("Storage").writeJSON("qmsched.json", scheds);
+function get(key, def) {
+ return (key in settings) ? settings[key] : def;
+}
+function set(key, val) {
+ settings[key] = val; save();
+ scheds = settings.scheds; options = settings.options; // update references
+}
+function unset(key) {
+ delete settings[key]; save();
+}
+
+let settings,
+ scheds, options; // references for convenience
+/**
+ * Load settings file, check if we need to migrate old setting formats to new
+ */
+function loadSettings() {
+ settings = require('Storage').readJSON("qmsched.json", true) || {};
+
+ if (Array.isArray(settings)) {
+ // migrate old file (plain array of schedules, qmOptions stored in global settings file)
+ require("Storage").erase("qmsched.json"); // need to erase old file, or Things Break, somehow...
+ let bOptions = require('Storage').readJSON('setting.json',true)||{};
+ settings = {
+ options: bOptions.qmOptions || {},
+ scheds: settings,
+ };
+ // store new format
+ save();
+ // and clean up qmOptions from global settings file
+ delete bOptions.qmOptions;
+ require('Storage').writeJSON('setting.json',bOptions);
+ }
+ // apply defaults
+ settings = Object.assign({
+ options: {}, // Bangle options to override during quiet mode, default = none
+ scheds: [
+ // default schedule:
+ {"hr": 8, "mode": 0},
+ {"hr": 22, "mode": 1},
+ ],
+ }, settings);
+ scheds = settings.scheds; options = settings.options;
+
+ if (scheds.length && scheds.some(s => "last" in s)) {
+ // cleanup: remove "last" values (used by older versions)
+ set('scheds', scheds.map(s => {
+ delete s.last;
+ return s;
+ }));
+ }
}
function formatTime(t) {
@@ -32,29 +79,35 @@ function formatTime(t) {
}
function showMainMenu() {
- let menu = {"": {"title": "Quiet Mode"}};
+ let _m, menu = {
+ "": {"title": "Quiet Mode"},
+ "< Exit": () => load()
+ };
// "Current Mode""Silent" won't fit on Bangle.js 2
- menu["Current" + ((process.env.HWVERSION===2)?"":" Mode")]= {
- value: (require("Storage").readJSON("setting.json", 1) || {}).quiet|0,
+ menu["Current"+((process.env.HWVERSION===2) ? "" : " Mode")] = {
+ value: current,
format: v => modeNames[v],
onchange: function(v) {
if (v<0) {v = 2;}
if (v>2) {v = 0;}
require("qmsched").setMode(v);
+ current = v;
this.value = v;
},
};
scheds.sort((a, b) => (a.hr-b.hr));
scheds.forEach((sched, idx) => {
- const name = modeNames[sched.mode];
- const txt = formatTime(sched.hr)+" ".repeat(14-name.length)+name;
- menu[txt] = function() {
- showEditMenu(idx);
+ menu[formatTime(sched.hr)] = {
+ format: () => modeNames[sched.mode], // abuse format to right-align text
+ onchange: function() {
+ _m.draw = ()=> {}; // prevent redraw of main menu over edit menu
+ showEditMenu(idx);
+ }
};
});
menu["Add Schedule"] = () => showEditMenu(-1);
- menu["< Back"] = () => {load();};
- return E.showMenu(menu);
+ menu["LCD Settings"] = () => showOptionsMenu();
+ _m = E.showMenu(menu);
}
function showEditMenu(index) {
@@ -69,6 +122,7 @@ function showEditMenu(index) {
}
const menu = {
"": {"title": (isNew ? "Add" : "Edit")+" Schedule"},
+ "< Cancel": () => showMainMenu(),
"Hours": {
value: hrs,
onchange: function(v) {
@@ -110,18 +164,88 @@ function showEditMenu(index) {
} else {
scheds[index] = getSched();
}
- require("Storage").writeJSON("qmsched.json", scheds);
+ save();
showMainMenu();
};
if (!isNew) {
menu["> Delete"] = function() {
scheds.splice(index, 1);
- require("Storage").writeJSON("qmsched.json", scheds);
+ save();
showMainMenu();
};
}
- menu["< Cancel"] = showMainMenu;
return E.showMenu(menu);
}
+function showOptionsMenu() {
+ const disabledFormat = v => v ? "Off" : "-";
+ function toggle(option) {
+ // we disable wakeOn* events by setting them to `false` in options
+ // not disabled = not present in options at all
+ if (option in options) {
+ delete options[option];
+ } else {
+ options[option] = false;
+ }
+ save();
+ }
+ let resetTimeout;
+ const oMenu = {
+ "": {"title": "LCD Settings"},
+ "< Back": () => showMainMenu(),
+ "LCD Brightness": {
+ value: get("brightness", 0),
+ min: 0, // 0 = use default
+ max: 1,
+ step: 0.1,
+ format: v => (v>0.05) ? v : "-",
+ onchange: v => {
+ if (v>0.05) { // prevent v=0.000000000000001 bugs
+ set("brightness", v);
+ Bangle.setLCDBrightness(v); // show result, even if not quiet right now
+ // restore brightness after half a second
+ if (resetTimeout) clearTimeout(resetTimeout);
+ resetTimeout = setTimeout(() => {
+ resetTimeout = undefined;
+ require("qmsched").setMode(current);
+ }, 500);
+ } else {
+ unset("brightness");
+ require("qmsched").setMode(current);
+ }
+ },
+ },
+ "LCD Timeout": {
+ value: get("timeout", 0),
+ min: 0, // 0 = use default (no constant on for quiet mode)
+ max: 60,
+ step: 5,
+ format: v => v>1 ? v : "-",
+ onchange: v => {
+ if (v>1) set("timeout", v);
+ else unset("timeout");
+ },
+ },
+ // we disable wakeOn* events by overwriting them as false in options
+ // not disabled = not present in options at all
+ "Wake on FaceUp": {
+ value: "wakeOnFaceUp" in options,
+ format: disabledFormat,
+ onchange: () => {toggle("wakeOnFaceUp");},
+ },
+ "Wake on Touch": {
+ value: "wakeOnTouch" in options,
+ format: disabledFormat,
+ onchange: () => {toggle("wakeOnTouch");},
+ },
+ "Wake on Twist": {
+ value: "wakeOnTwist" in options,
+ format: disabledFormat,
+ onchange: () => {toggle("wakeOnTwist");},
+ },
+ };
+ return E.showMenu(oMenu);
+}
+
+loadSettings();
showMainMenu();
diff --git a/apps/qmsched/boot.js b/apps/qmsched/boot.js
index 2712cab30..c3bc49b58 100644
--- a/apps/qmsched/boot.js
+++ b/apps/qmsched/boot.js
@@ -1,7 +1,13 @@
// apply Quiet Mode schedules
(function qm() {
- let scheds = require("Storage").readJSON("qmsched.json", 1) || [];
- if (!scheds.length) { return;}
+ let bSettings = require('Storage').readJSON('setting.json',true)||{};
+ const curr = 0|bSettings.quiet;
+ delete bSettings;
+ if (curr) require("qmsched").applyOptions(curr); // no need to re-apply default options
+
+ let settings = require('Storage').readJSON('qmsched.json',true)||{};
+ let scheds = settings.scheds||[];
+ if (!scheds.length) {return;}
const now = new Date(),
hr = now.getHours()+(now.getMinutes()/60)+(now.getSeconds()/3600); // current (decimal) hour
scheds.sort((a, b) => a.hr-b.hr);
diff --git a/apps/qmsched/lib.js b/apps/qmsched/lib.js
index a3d36ed34..9b307769a 100644
--- a/apps/qmsched/lib.js
+++ b/apps/qmsched/lib.js
@@ -1,18 +1,23 @@
+/**
+ * Apply LCD options for given mode
+ * @param {int} mode Quiet Mode
+ */
+exports.applyOptions = function(mode) {
+ const s = require("Storage").readJSON(mode ? "qmsched.json" : "setting.json", 1) || {};
+ const get = (k, d) => k in s ? s[k] : d;
+ Bangle.setOptions(get("options", {}));
+ Bangle.setLCDBrightness(get("brightness", 1));
+ Bangle.setLCDTimeout(get("timeout", 10));
+};
/**
* Set new Quiet Mode and apply Bangle options
* @param {int} mode Quiet Mode
*/
exports.setMode = function(mode) {
- let s = require("Storage").readJSON("setting.json", 1) || {};
- s.quiet = mode;
- require("Storage").writeJSON("setting.json", s);
- if (s.options) Bangle.setOptions(s.options);
- if (mode && s.qmOptions) Bangle.setOptions(s.qmOptions);
- if (mode && s.qmBrightness) {
- if (s.qmBrightness!=1) Bangle.setLCDBrightness(s.qmBrightness);
- } else {
- if (s.brightness && s.brightness!=1) Bangle.setLCDBrightness(s.brightness);
- }
- if (mode && s.qmTimeout) Bangle.setLCDTimeout(s.qmTimeout);
- if (typeof (WIDGETS)!=="undefined" && "qmsched" in WIDGETS) {WIDGETS["qmsched"].draw();}
-};
\ No newline at end of file
+ require("Storage").writeJSON("setting.json", Object.assign(
+ require("Storage").readJSON("setting.json", 1) || {},
+ {quiet:mode}
+ ));
+ exports.applyOptions(mode);
+ if (WIDGETS && "qmsched" in WIDGETS) WIDGETS["qmsched"].draw();
+};
diff --git a/apps/qmsched/screenshot_b1_edit.png b/apps/qmsched/screenshot_b1_edit.png
new file mode 100644
index 000000000..ec82e92e6
Binary files /dev/null and b/apps/qmsched/screenshot_b1_edit.png differ
diff --git a/apps/qmsched/screenshot_b1_lcd.png b/apps/qmsched/screenshot_b1_lcd.png
new file mode 100644
index 000000000..16f9356b8
Binary files /dev/null and b/apps/qmsched/screenshot_b1_lcd.png differ
diff --git a/apps/qmsched/screenshot_b1_main.png b/apps/qmsched/screenshot_b1_main.png
new file mode 100644
index 000000000..803ca69d5
Binary files /dev/null and b/apps/qmsched/screenshot_b1_main.png differ
diff --git a/apps/qmsched/screenshot_b2_edit.png b/apps/qmsched/screenshot_b2_edit.png
new file mode 100644
index 000000000..d26ff02cb
Binary files /dev/null and b/apps/qmsched/screenshot_b2_edit.png differ
diff --git a/apps/qmsched/screenshot_b2_lcd.png b/apps/qmsched/screenshot_b2_lcd.png
new file mode 100644
index 000000000..3f06488c3
Binary files /dev/null and b/apps/qmsched/screenshot_b2_lcd.png differ
diff --git a/apps/qmsched/screenshot_b2_main.png b/apps/qmsched/screenshot_b2_main.png
new file mode 100644
index 000000000..f6d22a8b8
Binary files /dev/null and b/apps/qmsched/screenshot_b2_main.png differ
diff --git a/apps/qmsched/screenshot_edit.png b/apps/qmsched/screenshot_edit.png
deleted file mode 100644
index 88b7fcad4..000000000
Binary files a/apps/qmsched/screenshot_edit.png and /dev/null differ
diff --git a/apps/qmsched/screenshot_main.png b/apps/qmsched/screenshot_main.png
deleted file mode 100644
index 634abd633..000000000
Binary files a/apps/qmsched/screenshot_main.png and /dev/null differ
diff --git a/apps/qmsched/screenshot_widget_alarms.png b/apps/qmsched/screenshot_widget_alarms.png
deleted file mode 100644
index 52dbe2464..000000000
Binary files a/apps/qmsched/screenshot_widget_alarms.png and /dev/null differ
diff --git a/apps/qmsched/screenshot_widget_silent.png b/apps/qmsched/screenshot_widget_silent.png
deleted file mode 100644
index 38b133650..000000000
Binary files a/apps/qmsched/screenshot_widget_silent.png and /dev/null differ
diff --git a/apps/qmsched/widget.js b/apps/qmsched/widget.js
index c602288ad..b25192b06 100644
--- a/apps/qmsched/widget.js
+++ b/apps/qmsched/widget.js
@@ -1,32 +1,36 @@
-WIDGETS["qmsched"] = {
- area: "tl", width: 24, draw: function() {
- const mode = (require("Storage").readJSON("setting.json", 1) || {}).quiet|0;
- if (mode===0) { // Off
- if (this.width!==0) {
- this.width = 0;
- Bangle.drawWidgets();
+(function() {
+ WIDGETS["qmsched"] = {
+ area: "tl",
+ width: ((require("Storage").readJSON("setting.json", 1) || {}).quiet|0) ? 24 : 0,
+ draw: function() {
+ const mode = (require("Storage").readJSON("setting.json", 1) || {}).quiet|0;
+ if (mode===0) { // Off
+ if (this.width!==0) {
+ this.width = 0;
+ Bangle.drawWidgets();
+ }
+ return;
}
- return;
- }
- // not Off: make sure width is correct
- if (this.width!==24) {
- this.width = 24;
- Bangle.drawWidgets();
- return; // drawWidgets will call draw again
- }
- let x = this.x, y = this.y;
- g.clearRect(x, y, x+23, y+23);
- // quiet mode: draw dim red one-way-street sign
- x = this.x+11;y = this.y+11; // center of widget
- g.setColor(0.8, 0, 0).fillCircle(x, y, 8);
- g.setColor(g.theme.bg).fillRect(x-6, y-2, x+6, y+2);
- if (mode>1) {return;} // no alarms
- // alarms still on: draw alarm icon in bottom-right corner
- x = this.x+18;y = this.y+17; // center of alarm
- g.setColor(1, 1, 0)
- .fillCircle(x, y, 3) // alarm body
- .fillRect(x-5, y+2, x+5, y+3) // bottom ridge
- .fillRect(x-1, y-5, x+1, y+5).drawLine(x, y-6, x, y+6) // top+bottom
- .drawLine(x+5, y-3, x+3, y-5).drawLine(x-5, y-3, x-3, y-5); // wriggles
- },
-};
\ No newline at end of file
+ // not Off: make sure width is correct
+ if (this.width!==24) {
+ this.width = 24;
+ Bangle.drawWidgets();
+ return; // drawWidgets will call draw again
+ }
+ let x = this.x, y = this.y;
+ g.clearRect(x, y, x+23, y+23);
+ // quiet mode: draw red one-way-street sign (dim red on Bangle.js 1)
+ x = this.x+11;y = this.y+11; // center of widget
+ g.setColor(process.env.HWVERSION===2 ? 1 : 0.8, 0, 0).fillCircle(x, y, 8);
+ g.setColor(g.theme.bg).fillRect(x-6, y-2, x+6, y+2);
+ if (mode>1) {return;} // no alarms
+ // alarms still on: draw alarm icon in bottom-right corner
+ x = this.x+18;y = this.y+17; // center of alarm
+ g.setColor(1, 1, 0)
+ .fillCircle(x, y, 3) // alarm body
+ .fillRect(x-5, y+2, x+5, y+3) // bottom ridge
+ .fillRect(x-1, y-5, x+1, y+5).drawLine(x, y-6, x, y+6) // top+bottom
+ .drawLine(x+5, y-3, x+3, y-5).drawLine(x-5, y-3, x-3, y-5); // wriggles
+ },
+ };
+})();
\ No newline at end of file
diff --git a/apps/qrcode/ChangeLog b/apps/qrcode/ChangeLog
index e2ae6b02a..edcc41cfd 100644
--- a/apps/qrcode/ChangeLog
+++ b/apps/qrcode/ChangeLog
@@ -1,2 +1,4 @@
0.01: New App!
0.02: Add posibillity to generate Wifi code.
+0.03: Forces integer scaling and adds more configuration (error correction, description, display)
+0.04: Allow scanning of QR codes from camera or file
diff --git a/apps/qrcode/custom.html b/apps/qrcode/custom.html
index 618840da9..4920be655 100644
--- a/apps/qrcode/custom.html
+++ b/apps/qrcode/custom.html
@@ -3,56 +3,168 @@
-
- Use URL:
-
-
+ Datasource:
+
+ Text
- Use Wifi Credentials:
-
- Wifi password:
-