Merge branch 'espruino:master' into dev
410
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.37",
|
||||
"version": "0.38",
|
||||
"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.11",
|
||||
"description": "App to display notifications from iOS and Gadgetbridge",
|
||||
"icon": "app.png",
|
||||
"type": "app",
|
||||
|
@ -54,7 +99,7 @@
|
|||
"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.",
|
||||
"description": "Display notifications/music/etc from Gadgetbridge on Android. This replaces the old Gadgetbridge widget.",
|
||||
"icon": "app.png",
|
||||
"tags": "tool,system,messages,notifications",
|
||||
"dependencies": {"messages":"app"},
|
||||
|
@ -70,8 +115,8 @@
|
|||
{
|
||||
"id": "ios",
|
||||
"name": "iOS Integration",
|
||||
"version": "0.03",
|
||||
"description": "(BETA) App to display notifications from iOS devices",
|
||||
"version": "0.06",
|
||||
"description": "Display notifications/music/etc from iOS devices",
|
||||
"icon": "app.png",
|
||||
"tags": "tool,system,ios,apple,messages,notifications",
|
||||
"dependencies": {"messages":"app"},
|
||||
|
@ -104,7 +149,7 @@
|
|||
"id": "launch",
|
||||
"name": "Launcher",
|
||||
"shortName": "Launcher",
|
||||
"version": "0.09",
|
||||
"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 +157,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.34",
|
||||
"version": "0.36",
|
||||
"description": "A menu for setting up Bangle.js",
|
||||
"icon": "settings.png",
|
||||
"tags": "tool,system",
|
||||
|
@ -170,7 +217,7 @@
|
|||
{
|
||||
"id": "locale",
|
||||
"name": "Languages",
|
||||
"version": "0.10",
|
||||
"version": "0.13",
|
||||
"description": "Translations for different countries",
|
||||
"icon": "locale.png",
|
||||
"type": "locale",
|
||||
|
@ -236,16 +283,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 +302,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) Handles Gadgetbridge notifications from Android. This is now replaced by the 'Android' app.",
|
||||
"icon": "app.png",
|
||||
"type": "widget",
|
||||
"tags": "tool,system,android,widget",
|
||||
|
@ -463,22 +511,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
|
||||
}
|
||||
]
|
||||
|
@ -510,7 +558,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": [
|
||||
|
@ -699,10 +747,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",
|
||||
|
@ -795,7 +844,7 @@
|
|||
{
|
||||
"id": "weather",
|
||||
"name": "Weather",
|
||||
"version": "0.11",
|
||||
"version": "0.13",
|
||||
"description": "Show Gadgetbridge weather report",
|
||||
"icon": "icon.png",
|
||||
"screenshots": [{"url":"screenshot.png"}],
|
||||
|
@ -1098,7 +1147,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",
|
||||
|
@ -1726,7 +1775,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"}],
|
||||
|
@ -1908,6 +1957,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",
|
||||
|
@ -1928,11 +1990,12 @@
|
|||
"id": "openstmap",
|
||||
"name": "OpenStreetMap",
|
||||
"shortName": "OpenStMap",
|
||||
"version": "0.10",
|
||||
"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": [
|
||||
|
@ -1962,11 +2025,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"},
|
||||
|
@ -2055,12 +2119,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": [
|
||||
|
@ -2100,6 +2164,19 @@
|
|||
{"name":"snake.img","url":"snake-icon.js","evaluate":true}
|
||||
]
|
||||
},
|
||||
{ "id": "snek",
|
||||
"name": "The snek game",
|
||||
"shortName":"Snek",
|
||||
"version": "0.01",
|
||||
"description": "A snek game where you control a snek to eat all the apples!",
|
||||
"icon": "snek-icon.js",
|
||||
"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",
|
||||
|
@ -2349,7 +2426,7 @@
|
|||
{
|
||||
"id": "calendar",
|
||||
"name": "Calendar",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"description": "Simple calendar",
|
||||
"icon": "calendar.png",
|
||||
"screenshots": [{"url":"screenshot_calendar.png"}],
|
||||
|
@ -2359,8 +2436,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",
|
||||
|
@ -2598,12 +2677,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"}
|
||||
]
|
||||
|
@ -3736,7 +3815,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"}],
|
||||
|
@ -3811,7 +3890,7 @@
|
|||
"id": "qmsched",
|
||||
"name": "Quiet Mode Schedule and Widget",
|
||||
"shortName": "Quiet Mode",
|
||||
"version": "0.04",
|
||||
"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_b1_main.png"},{"url":"screenshot_b1_edit.png"},{"url":"screenshot_b1_lcd.png"},
|
||||
|
@ -4036,7 +4115,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",
|
||||
|
@ -4058,14 +4137,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}
|
||||
|
@ -4296,7 +4378,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",
|
||||
|
@ -4343,7 +4425,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": [
|
||||
|
@ -4365,7 +4447,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"}],
|
||||
|
@ -4383,9 +4465,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",
|
||||
|
@ -4478,7 +4560,7 @@
|
|||
{"name":"schoolCalendar.img","url":"app-icon.js","evaluate":true}
|
||||
],
|
||||
"data": [
|
||||
{"name":"app.json"}
|
||||
{"name":"calendarItems.csv"}
|
||||
]
|
||||
},
|
||||
{ "id": "timecal",
|
||||
|
@ -4531,7 +4613,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",
|
||||
|
@ -4549,9 +4631,10 @@
|
|||
"version":"0.01",
|
||||
"description": "Simple app to power off your Bangle.js",
|
||||
"icon": "app.png",
|
||||
"tags": "poweroff, shutdown",
|
||||
"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}
|
||||
|
@ -4561,9 +4644,17 @@
|
|||
"id": "sensible",
|
||||
"name": "SensiBLE",
|
||||
"shortName": "SensiBLE",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"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" ],
|
||||
|
@ -4591,9 +4682,9 @@
|
|||
},
|
||||
{
|
||||
"id":"a_speech_timer",
|
||||
"name":"A Speech Timer",
|
||||
"name":"Speech Timer",
|
||||
"icon": "app.png",
|
||||
"version":"1.00",
|
||||
"version":"1.01",
|
||||
"description": "A timer designed to help keeping your speeches and presentations to time.",
|
||||
"tags": "tool,timer",
|
||||
"readme":"README.md",
|
||||
|
@ -4603,23 +4694,6 @@
|
|||
{"name":"a_speech_timer.img","url":"app-icon.js","evaluate":true}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "sensible",
|
||||
"name": "SensiBLE",
|
||||
"shortName": "SensiBLE",
|
||||
"version": "0.02",
|
||||
"description": "Collect, display and advertise real-time sensor data.",
|
||||
"icon": "sensible.png",
|
||||
"type": "app",
|
||||
"tags": "tool,sensors",
|
||||
"supports" : [ "BANGLEJS2" ],
|
||||
"allow_emulator": true,
|
||||
"readme": "README.md",
|
||||
"storage": [
|
||||
{ "name": "sensible.app.js", "url": "sensible.js" },
|
||||
{ "name": "sensible.img", "url": "sensible-icon.js", "evaluate": true }
|
||||
]
|
||||
},
|
||||
{ "id": "mylocation",
|
||||
"name": "My Location",
|
||||
"shortName":"My Location",
|
||||
|
@ -4643,7 +4717,7 @@
|
|||
"id": "pebble",
|
||||
"name": "Pebble Clock",
|
||||
"shortName": "Pebble",
|
||||
"version": "0.03",
|
||||
"version": "0.04",
|
||||
"description": "A pebble style clock to keep the rebellion going",
|
||||
"readme": "README.md",
|
||||
"icon": "pebble.png",
|
||||
|
@ -4660,7 +4734,7 @@
|
|||
{ "id": "pooqroman",
|
||||
"name": "pooq Roman watch face",
|
||||
"shortName":"pooq Roman",
|
||||
"version":"0.0.0",
|
||||
"version":"0.02",
|
||||
"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",
|
||||
|
@ -4675,5 +4749,187 @@
|
|||
"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.01",
|
||||
"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}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
1.00: Release (2021/12/01)
|
||||
1.01: Grey font when timer is frozen (2021/12/04)
|
||||
|
|
|
@ -63,7 +63,7 @@ function countDown() {
|
|||
|
||||
Bangle.on('touch',(touchside, touchdata)=>{
|
||||
if (!islocked && istimeron && touchdata.y > (100+10)) {
|
||||
Bangle.buzz(40);
|
||||
Bangle.buzz(40);
|
||||
istimeron = false;
|
||||
clearInterval(timerinterval);
|
||||
} else if (touchdata.y > 24 && touchdata.y < (100-10)) {
|
||||
|
@ -134,20 +134,20 @@ function draw() {
|
|||
else if (current_value >= current_from) { g.setBgColor("#8F8"); }
|
||||
g.clearRect(0,24,176,176);
|
||||
|
||||
g.reset();
|
||||
g.setFontAlign(0, 0);
|
||||
|
||||
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);
|
||||
|
@ -159,7 +159,7 @@ function draw() {
|
|||
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);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
0.01: Beta version for Bangle 2 paired with Chrome (2021/12/11)
|
|
@ -0,0 +1,20 @@
|
|||
# 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!
|
|
@ -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="))
|
|
@ -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/wAOAAAAAAAAAAAAAAAAAAAAAAAAAB8APgAD8AP4AH8AP8AP8AP8APgAB+AfAAAeAeAAAeAeAAAPAeAAAPAeAAAPAeAAAPAeAeAPAeAeAPAeAeAPAeAeAPAeAeAPAeAeAPAeAeAPAeAeAPAeAeAPAeAeAPAeAeAPAeAeAPAeAeAPAeAeAeAfAeAeAPx/h+AP///+AH///8AD///4AB/h/gAAAAAAAAAAAAAAAAAAAAAAeAAAAA/AAAAA/AAAAB/AAAAD/AAAAH/AAAAPvAAAAPPAAAAfPAAAA+PAAAB8PAAAD4PAAADwPAAAHwPAAAPgPAAAfAPAAA+APAAA8APAAB8APAAD4APAAHwAPAAPgAPAAPAAPAAfAAPAAf///+Af///+Af///+Af///+AAAAPAAAAAPAAAAAPAAAAAPAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAf/8PgAf/8P4Af/8P8Af/8P8AeB4A+AeB4AeAeDwAeAeDwAPAeDwAPAeDwAPAeDwAPAeDwAPAeDwAPAeDwAPAeDwAPAeDwAPAeDwAPAeDwAPAeDwAPAeDwAPAeDwAPAeDwAPAeDwAPAeDwAfAeDwAeAeD4A+AeD+D+AeB//8AeB//4AeA//4AAAP/AAAAAAAAAAAAAAAAAAAAAAAAAAA///AAD///wAH///4AH///8AP4fB+APAeAeAfA8AeAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAeA8APAfA8APAPA+AeAPgeAeAP8fh+AH8f/8AD8P/8AA8H/4AAAB/gAAAAAAAAAAAAAAAAAAAAAAAAAeAAAAAeAAAAAeAAAAAeAAAAAeAAAAAeAAACAeAAAGAeAAAOAeAAAeAeAAA+AeAAD+AeAAH8AeAAP4AeAAfwAeAA/gAeAB/AAeAD+AAeAP4AAeAfwAAeA/gAAeB/AAAeD+AAAeH8AAAefwAAAe/gAAAf/AAAAf+AAAAf8AAAAf4AAAAfgAAAAfAAAAAAAAAAAAAAAAAAAAAAAAAAMAAB+B/wAD/j/4AH/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();
|
After Width: | Height: | Size: 3.0 KiB |
|
@ -0,0 +1,195 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<script src="https://puck-js.com/puck.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// Don't forget to enable the Local API on your Awair before using this
|
||||
// https://support.getawair.com/hc/en-us/articles/360049221014-Awair-Local-API-Feature
|
||||
|
||||
const awair_ip_1 = "192.168.2.2"; // <- INPUT YOUR AWAIR IP ADDRESS HERE
|
||||
const awair_name_1 = "Awair";
|
||||
|
||||
var bt_connection;
|
||||
var is_connected = false;
|
||||
var reconnect_counter = 5;
|
||||
var reconnect_attempt_counter = 1;
|
||||
|
||||
window.onload = function() {
|
||||
var chart_co2;
|
||||
var chart_voc;
|
||||
var chart_pm;
|
||||
var chart_temperature;
|
||||
var chart_humidity;
|
||||
var dataPoints_1 = [];
|
||||
var posx = 0;
|
||||
|
||||
$.getJSON("http://"+awair_ip_1+"/air-data/latest", function(data) {
|
||||
$.each(data, function(key, value){
|
||||
if (dataPoints_1[key] === undefined) { dataPoints_1[key] = []; }
|
||||
if (key === "temp" || key === "humid") { dataPoints_1[key].push({x: posx, y: parseFloat(value)}); }
|
||||
else { dataPoints_1[key].push({x: posx, y: parseInt(value)}); }
|
||||
});
|
||||
|
||||
posx++;
|
||||
|
||||
chart_co2 = new CanvasJS.Chart("chartContainer_co2",{
|
||||
title:{ text:"CO2", fontFamily: "helvetica", fontColor: "#F7FAFC", fontSize: 16, horizontalAlign: "left", padding: { left: 30 } },
|
||||
axisX:{ labelFontColor: "#F7FAFC", gridColor: "#2D3748", lineColor: "#2D3748", tickColor: "#2D3748" },
|
||||
axisY:{ minimum: 0, labelFontColor: "#F7FAFC", gridColor: "#2D3748", lineColor: "#2D3748", tickColor: "#2D3748" },
|
||||
legend: { fontColor: "#F7FAFC", horizontalAlign: "center", verticalAlign: "bottom" },
|
||||
data: [ { type: "line", lineColor: "#6648FF", showInLegend: true, legendText: awair_name_1, dataPoints : dataPoints_1.co2 }]
|
||||
});
|
||||
chart_voc = new CanvasJS.Chart("chartContainer_voc",{
|
||||
title:{ text:"VOC", fontFamily: "helvetica", fontColor: "#F7FAFC", fontSize: 16, horizontalAlign: "left", padding: { left: 30 } },
|
||||
axisX:{ labelFontColor: "#F7FAFC", gridColor: "#2D3748", lineColor: "#2D3748", tickColor: "#2D3748" },
|
||||
axisY:{ minimum: 0, labelFontColor: "#F7FAFC", gridColor: "#2D3748", lineColor: "#2D3748", tickColor: "#2D3748" },
|
||||
legend: { fontColor: "#F7FAFC", horizontalAlign: "center", verticalAlign: "bottom" },
|
||||
data: [ { type: "line", lineColor: "#6648FF", showInLegend: true, legendText: awair_name_1, dataPoints : dataPoints_1.voc }]
|
||||
});
|
||||
chart_pm = new CanvasJS.Chart("chartContainer_pm",{
|
||||
title:{ text:"PM", fontFamily: "helvetica", fontColor: "#F7FAFC", fontSize: 16, horizontalAlign: "left", padding: { left: 30 } },
|
||||
axisX:{ labelFontColor: "#F7FAFC", gridColor: "#2D3748", lineColor: "#2D3748", tickColor: "#2D3748" },
|
||||
axisY:{ minimum: 0, labelFontColor: "#F7FAFC", gridColor: "#2D3748", lineColor: "#2D3748", tickColor: "#2D3748" },
|
||||
legend: { fontColor: "#F7FAFC", horizontalAlign: "center", verticalAlign: "bottom" },
|
||||
data: [ { type: "line", lineColor: "#6648FF", showInLegend: true, legendText: awair_name_1, dataPoints : dataPoints_1.pm25 }]
|
||||
});
|
||||
chart_humidity = new CanvasJS.Chart("chartContainer_humidity",{
|
||||
title:{ text:"Humidity", fontFamily: "helvetica", fontColor: "#F7FAFC", fontSize: 16, horizontalAlign: "left", padding: { left: 30 } },
|
||||
axisX:{ labelFontColor: "#F7FAFC", gridColor: "#2D3748", lineColor: "#2D3748", tickColor: "#2D3748" },
|
||||
axisY:{ labelFontColor: "#F7FAFC", gridColor: "#2D3748", lineColor: "#2D3748", tickColor: "#2D3748" },
|
||||
legend: { fontColor: "#F7FAFC", horizontalAlign: "center", verticalAlign: "bottom" },
|
||||
data: [ { type: "line", lineColor: "#6648FF", showInLegend: true, legendText: awair_name_1, dataPoints : dataPoints_1.humid }]
|
||||
});
|
||||
chart_temperature = new CanvasJS.Chart("chartContainer_temperature",{
|
||||
title:{ text:"Temperature", fontFamily: "helvetica", fontColor: "#F7FAFC", fontSize: 16, horizontalAlign: "left", padding: { left: 30 } },
|
||||
axisX:{ labelFontColor: "#F7FAFC", gridColor: "#2D3748", lineColor: "#2D3748", tickColor: "#2D3748" },
|
||||
axisY:{ labelFontColor: "#F7FAFC", gridColor: "#2D3748", lineColor: "#2D3748", tickColor: "#2D3748" },
|
||||
legend: { fontColor: "#F7FAFC", horizontalAlign: "center", verticalAlign: "bottom" },
|
||||
data: [ { type: "line", lineColor: "#6648FF", showInLegend: true, legendText: awair_name_1, dataPoints : dataPoints_1.temp }]
|
||||
});
|
||||
|
||||
chart_co2.set("backgroundColor", "#1A202C");
|
||||
chart_voc.set("backgroundColor", "#1A202C");
|
||||
chart_pm.set("backgroundColor", "#1A202C");
|
||||
chart_humidity.set("backgroundColor", "#1A202C");
|
||||
chart_temperature.set("backgroundColor", "#1A202C");
|
||||
|
||||
updateChart();
|
||||
});
|
||||
|
||||
function updateChart() {
|
||||
$.getJSON("http://"+awair_ip_1+"/air-data/latest", function(data) {
|
||||
$.each(data, function(key, value){
|
||||
if (dataPoints_1[key] === undefined) { dataPoints_1[key] = []; }
|
||||
if (key === "temp" || key === "humid") { dataPoints_1[key].push({x: posx, y: parseFloat(value)}); }
|
||||
else { dataPoints_1[key].push({x: posx, y: parseInt(value)}); }
|
||||
});
|
||||
|
||||
posx++;
|
||||
chart_co2.render();
|
||||
chart_voc.render();
|
||||
chart_pm.render();
|
||||
chart_temperature.render();
|
||||
chart_humidity.render();
|
||||
|
||||
chart_co2.title.set("text", "CO2 level (ppm)");
|
||||
chart_voc.title.set("text", "VOC level (ppb)");
|
||||
chart_pm.title.set("text", "PM2.5 level (ug/m³)");
|
||||
chart_humidity.title.set("text", "Humidity level (%)");
|
||||
chart_temperature.title.set("text", "Temperature level (°C)");
|
||||
|
||||
let current_co2 = dataPoints_1['co2'][dataPoints_1['co2'].length-1].y;
|
||||
let current_voc = dataPoints_1['voc'][dataPoints_1['voc'].length-1].y;
|
||||
let current_pm25 = dataPoints_1['pm25'][dataPoints_1['pm25'].length-1].y;
|
||||
let current_humi = dataPoints_1['humid'][dataPoints_1['humid'].length-1].y;
|
||||
let current_temp = dataPoints_1['temp'][dataPoints_1['temp'].length-1].y;
|
||||
let last_update = dataPoints_1['temp'].length-1;
|
||||
if (is_connected && bt_connection.isOpen) {
|
||||
bt_connection.write('\x10bt_current_co2='+current_co2+';bt_current_voc='+current_voc+';bt_current_pm25='+current_pm25+';bt_current_humi='+current_humi+';bt_current_temp='+current_temp+';bt_last_update='+last_update+';\n');
|
||||
|
||||
console.log("Sent data through Bluetooth");
|
||||
} else if (is_connected && !bt_connection.isOpen) {
|
||||
console.log("Disconnected - Next attempt to reconnect in " + reconnect_counter);
|
||||
reconnect_counter--;
|
||||
|
||||
if (reconnect_counter <= 0) {
|
||||
reconnect_counter = 10 * reconnect_attempt_counter;
|
||||
reconnect_attempt_counter++;
|
||||
|
||||
console.log("Trying to reconnect");
|
||||
bt_connection.reconnect(function(c) {
|
||||
console.log("Reconnect callback");
|
||||
if (!c) {
|
||||
console.log("Couldn't reconnect");
|
||||
return;
|
||||
}
|
||||
bt_connection = c;
|
||||
is_connected = true;
|
||||
reconnect_attempt_counter = 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setTimeout(function(){updateChart()}, 1000);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function connectBT() {
|
||||
console.log("Connect BT");
|
||||
Puck.connect(function(c) {
|
||||
console.log("Connect callback");
|
||||
if (!c) {
|
||||
console.log("Couldn't connect");
|
||||
return;
|
||||
}
|
||||
bt_connection = c;
|
||||
is_connected = true;
|
||||
reconnect_attempt_counter = 1;
|
||||
});
|
||||
}
|
||||
|
||||
function disconnectBT() {
|
||||
if (is_connected && bt_connection) {
|
||||
bt_connection.close();
|
||||
is_connected = false;
|
||||
console.log("Closed Bluetooth connection");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="https://canvasjs.com/assets/script/jquery-1.11.1.min.js"></script>
|
||||
<script type="text/javascript" src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
|
||||
</head>
|
||||
<body style="background-color:#1A202C;">
|
||||
|
||||
<p style="color: #F7FAFC">
|
||||
<b>How to use</b>
|
||||
<br/><br/>
|
||||
Step 1: Enable the Local API on your Awair: https://support.getawair.com/hc/en-us/articles/360049221014-Awair-Local-API-Feature
|
||||
<br/><br/>
|
||||
Step 2: Modify this HTML file to input the IP address of your Awair on top (const awair_ip_1 = "192.168.xx.xx")
|
||||
<br/><br/>
|
||||
Step 3: Launch the Awair Monitor app on your BangleJS
|
||||
<br/><br/>
|
||||
Step 4: Click "Connect BangleJS"
|
||||
<br/><br/>
|
||||
Step 5: Optionally, open the web inspector's console (Right click > Inspector > Console) to read the bluetooth logs
|
||||
</p>
|
||||
|
||||
<center>
|
||||
<button onclick="connectBT();">Connect BangleJS</button>
|
||||
<button onclick="disconnectBT();">Disconnect BangleJS</button>
|
||||
</center>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<div id="chartContainer_co2" style="height: 300px; max-width: 920px; margin: 0px auto; margin-bottom: 64px;"></div>
|
||||
<div id="chartContainer_voc" style="height: 300px; max-width: 920px; margin: 0px auto; margin-bottom: 64px;"></div>
|
||||
<div id="chartContainer_pm" style="height: 300px; max-width: 920px; margin: 0px auto; margin-bottom: 64px;"></div>
|
||||
<div id="chartContainer_humidity" style="height: 300px; max-width: 920px; margin: 0px auto; margin-bottom: 64px;"></div>
|
||||
<div id="chartContainer_temperature" style="height: 300px; max-width: 920px; margin: 0px auto; margin-bottom: 64px;"></div>
|
||||
</body>
|
||||
</html>
|
After Width: | Height: | Size: 3.9 KiB |
|
@ -41,3 +41,4 @@
|
|||
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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
0.01: Basic calendar
|
||||
0.02: Make Bangle 2 compatible
|
||||
0.03: Add setting to start week on Sunday
|
||||
|
|
|
@ -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).
|
||||
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
},
|
||||
});
|
||||
})
|
||||
|
|
@ -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
|
||||
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
|
||||
|
|
|
@ -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/
|
||||
If you have any feature requests, please write here: http://forum.espruino.com/conversations/345972/
|
||||
|
|
|
@ -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();
|
||||
showMenu();
|
||||
|
|
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 2.9 KiB |
|
@ -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();
|
||||
})();
|
||||
// set width correctly, start countdown each second
|
||||
WIDGETS["chronowid"].reload();
|
||||
})();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
0.01: New clock!
|
||||
0.02: Load steps from Health Tracking app (if installed)
|
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
require("heatshrink").decompress(atob("mEwgI/8/4ACAqYv/F/PwAqgA6A=="))
|
|
@ -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);
|
After Width: | Height: | Size: 258 B |
|
@ -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,
|
||||
});
|
||||
});
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
Bangle.loadWidgets();
|
||||
Bangle.drawWidgets();
|
||||
drawAll();
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
||||

|
||||

|
||||

|
|
@ -0,0 +1 @@
|
|||
require("heatshrink").decompress(atob("mEw4X/AwX48EHgEC1WgCQkVqoDBBfuqBQcBqoLagEqGAguBqALaGAOoAoQuEBbEAKgIMBBQNUBbgMCyoKHBbBVBBYIKGBbEBtNVrQLfOgNaT4gLagp0CPQOABbcBFwNAgEKBgILbitVqAFClWq0ALZFwTDFGAQLZFwYwDBfg"))
|
|
@ -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);
|
After Width: | Height: | Size: 323 B |
After Width: | Height: | Size: 992 B |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 1.8 KiB |
|
@ -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
|
||||
|
|
|
@ -4,28 +4,45 @@
|
|||
</head>
|
||||
<body>
|
||||
<p><b>THIS IS CURRENTLY BETA - PLEASE USE THE NORMAL FIRMWARE UPDATE
|
||||
INSTRUCTIONS FOR <a href="https://www.espruino.com/Bangle.js#firmware-updates" target="_blank">BANGLE.JS</a> 1 AND <a href="https://www.espruino.com/Bangle.js2#firmware-updates" target="_blank">BANGLE.JS 2</a></b></p>
|
||||
INSTRUCTIONS FOR <a href="https://www.espruino.com/Bangle.js#firmware-updates" target="_blank">BANGLE.JS</a> 1 AND <a href="https://www.espruino.com/Bangle.js2#firmware-updates" target="_blank">BANGLE.JS 2</a></b>. For usage on Bangle.js 2 you'll likely need to have an updated bootloader.</p>
|
||||
<div id="fw-unknown">
|
||||
<p>Firmware updates using the App Loader are only possible on
|
||||
<p><b>Firmware updates using the App Loader are only possible on
|
||||
Bangle.js 2. For firmware updates on Bangle.js 1 please
|
||||
<a href="https://www.espruino.com/Bangle.js#firmware-updates" target="_blank">see the Bangle.js 1 instructions</a></p>
|
||||
<a href="https://www.espruino.com/Bangle.js#firmware-updates" target="_blank">see the Bangle.js 1 instructions</a></b></p>
|
||||
</div>
|
||||
<p>Your current firmware version is <span id="fw-version" style="font-weight:bold">unknown</span></p>
|
||||
<div id="fw-ok" style="display:none">
|
||||
<p>Please upload a hex file here. This file should be the <code>.app_hex</code>
|
||||
<div id="latest-firmware" style="display:none">
|
||||
<p>The currently available Espruino firmware releases are:</p>
|
||||
<ul id="latest-firmware-list">
|
||||
</ul>
|
||||
<p>To update, click the link and then click the 'Upload' button that appears.</p>
|
||||
</div>
|
||||
|
||||
<p>Or you can upload a hex or zip file here. This file should be an <code>.app_hex</code>
|
||||
file, *not* the normal <code>.hex</code> (as that contains the bootloader as well).</p>
|
||||
|
||||
<input class="form-input" type="file" id="fileLoader" accept=".hex,.app_hex"/><br>
|
||||
<p><button id="upload" class="btn btn-primary">Upload</button></p>
|
||||
<input class="form-input" type="file" id="fileLoader" accept=".hex,.app_hex,.zip"/><br>
|
||||
<p><button id="upload" class="btn btn-primary" style="display:none">Upload</button></p>
|
||||
</div>
|
||||
|
||||
<p>Firmware updates via this tool work differently to the NRF Connect method mentioned on
|
||||
<a href="https://www.espruino.com/Bangle.js2#firmware-updates">the Bangle.js page</a>. Firmware
|
||||
is uploaded to a file on the Bangle. Once complete the Bangle reboots and the bootloader copies
|
||||
the new firmware into internal Storage.</p>
|
||||
|
||||
<pre id="log"></pre>
|
||||
|
||||
<script src="../../core/lib/customize.js"></script>
|
||||
<script src="../../core/lib/espruinotools.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.7.1/jszip.js"></script>
|
||||
|
||||
<script>
|
||||
var hex;
|
||||
var hexJS; // JS to upload hex
|
||||
var HEADER_LEN = 16; // size of app flash header
|
||||
var APP_START = 0x26000;
|
||||
var APP_MAX_LENGTH = 0xda000; // from linker file - the max size the app can be, for sanity check!
|
||||
var MAX_ADDRESS = 0x1000000; // discount anything in hex file above this
|
||||
var VERSION = 0x12345678; // VERSION! Use this to test firmware in JS land
|
||||
var DEBUG = false;
|
||||
|
@ -37,6 +54,8 @@ function log(t) {
|
|||
|
||||
function onInit(device) {
|
||||
console.log(device);
|
||||
if (device && device.version)
|
||||
document.getElementById("fw-version").innerText = device.version;
|
||||
if (device && device.id=="BANGLEJS2") {
|
||||
document.getElementById("fw-unknown").style = "display:none";
|
||||
document.getElementById("fw-ok").style = "";
|
||||
|
@ -44,7 +63,7 @@ function onInit(device) {
|
|||
}
|
||||
|
||||
function checkForFileOnServer() {
|
||||
/*function getURL(url, callback) {
|
||||
function getURL(url, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onload = callback;
|
||||
baseURL = url;
|
||||
|
@ -55,6 +74,7 @@ function checkForFileOnServer() {
|
|||
|
||||
function getFilesFromURL(url, regex, callback) {
|
||||
getURL(url, function() {
|
||||
console.log(this.responseXML)
|
||||
var files = [];
|
||||
var elements = this.responseXML.getElementsByTagName("a");
|
||||
for (var i=0;i<elements.length;i++) {
|
||||
|
@ -67,35 +87,78 @@ function checkForFileOnServer() {
|
|||
});
|
||||
}
|
||||
|
||||
var regex = new RegExp("_bangle2");
|
||||
var regex = new RegExp("_banglejs2.*zip$");
|
||||
|
||||
var domFirmwareList = document.getElementById("latest-firmware-list");
|
||||
var domFirmware = document.getElementById("latest-firmware");
|
||||
console.log("Checking server...");
|
||||
|
||||
var domFirmware = document.getElementById("latest-firmware");
|
||||
getFilesFromURL("https://www.espruino.com/binaries/", regex, function(releaseFiles) {
|
||||
releaseFiles.sort().reverse().forEach(function(f) {
|
||||
releaseFiles.sort().reverse().forEach(function(f) {
|
||||
var name = f.substr(f.substr(0,f.length-1).lastIndexOf('/')+1);
|
||||
domFirmware.innerHTML += 'Release: <a href="'+f+'">'+name+'</a><br/>';
|
||||
console.log("Found "+name);
|
||||
domFirmwareList.innerHTML += '<li>Release: <a href="'+f+'" class="fw-link">'+name+'</a></li>';
|
||||
domFirmware.style = "";
|
||||
});
|
||||
getFilesFromURL("https://www.espruino.com/binaries/travis/master/",regex, function(travisFiles) {
|
||||
travisFiles.forEach(function(f) {
|
||||
var name = f.substr(f.lastIndexOf('/')+1);
|
||||
domFirmware.innerHTML += 'Cutting Edge build: <a href="'+f+'">'+name+'</a><br/>';
|
||||
console.log("Found "+name);
|
||||
domFirmwareList.innerHTML += '<li>Cutting Edge build: <a href="'+f+'" class="fw-link">'+name+'</a></li>';
|
||||
domFirmware.style = "";
|
||||
});
|
||||
document.getElementById("checking-server").style = "display:none";
|
||||
document.getElementById("main-ui").style = "";
|
||||
console.log("Finished check for firmware files...");
|
||||
var fwlinks = document.querySelectorAll(".fw-link");
|
||||
for (var i=0;i<fwlinks.length;i++)
|
||||
fwlinks[i].addEventListener("click", e => {
|
||||
e.preventDefault();
|
||||
var url = e.target.href;
|
||||
downloadZipFile(url).then(info=>{
|
||||
document.getElementById("upload").style = ""; // show upload
|
||||
});
|
||||
});
|
||||
});
|
||||
});*/
|
||||
});
|
||||
}
|
||||
|
||||
function downloadFile() {
|
||||
/*response = await fetch(APP_HEX_PATH+"readlink.php?link="+APP_HEX_FILE, {
|
||||
method: 'GET',
|
||||
cache: 'no-cache',
|
||||
});
|
||||
if (response.ok) {
|
||||
blob = await response.blob();
|
||||
data = await blob.text();
|
||||
document.getElementById("latest-firmware").innerHTML="(<b>"+data.toString()+"</b>)";
|
||||
}*/
|
||||
function downloadZipFile(url) {
|
||||
return new Promise((resolve,reject) => {
|
||||
Espruino.Core.Utils.getBinaryURL(url, (err, binary) => {
|
||||
if (err) return reject("Unable to download "+url);
|
||||
resolve(binary);
|
||||
});
|
||||
}).then(convertZipFile);
|
||||
}
|
||||
|
||||
function convertZipFile(binary) {
|
||||
var info = {};
|
||||
Promise.resolve(binary).then(binary => {
|
||||
info.binary = binary;
|
||||
return JSZip.loadAsync(binary)
|
||||
}).then(function(zipFile) {
|
||||
info.zipFile = zipFile;
|
||||
return info.zipFile.file("manifest.json").async("string");
|
||||
}).then(function(content) {
|
||||
info.manifest = JSON.parse(content).manifest;
|
||||
}).then(function(content) {
|
||||
console.log(info.manifest);
|
||||
return info.zipFile.file(info.manifest.application.dat_file).async("arraybuffer");
|
||||
}).then(function(content) {
|
||||
info.dat_file = content;
|
||||
}).then(function(content) {
|
||||
console.log(info.manifest);
|
||||
return info.zipFile.file(info.manifest.application.bin_file).async("arraybuffer");
|
||||
}).then(function(content) {
|
||||
info.bin_file = content;
|
||||
if (info.bin_file.byteLength > APP_MAX_LENGTH) throw new Error("Firmware file is too big!");
|
||||
info.storageContents = new Uint8Array(info.bin_file.byteLength + HEADER_LEN)
|
||||
info.storageContents.set(new Uint8Array(info.bin_file), HEADER_LEN);
|
||||
createJS_app(info.storageContents, APP_START, APP_START+info.bin_file.byteLength);
|
||||
log("Download complete");
|
||||
console.log("Download complete",info);
|
||||
document.getElementById("upload").style = ""; // show upload
|
||||
return info;
|
||||
}).catch(err => log("ERROR:" + err));
|
||||
}
|
||||
|
||||
function handleFileSelect(event) {
|
||||
|
@ -103,13 +166,24 @@ function handleFileSelect(event) {
|
|||
log("More than one file selected!");
|
||||
return;
|
||||
}
|
||||
var file = event.target.files[0];
|
||||
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(event) {
|
||||
hex = event.target.result.split("\n");
|
||||
document.getElementById("upload").style = ""; // show upload
|
||||
fileLoaded();
|
||||
};
|
||||
reader.readAsText(event.target.files[0]);
|
||||
if (file.name.endsWith(".hex") || file.name.endsWith(".app_hex")) {
|
||||
reader.onload = function(event) {
|
||||
hex = event.target.result.split("\n");
|
||||
document.getElementById("upload").style = ""; // show upload
|
||||
fileLoaded();
|
||||
};
|
||||
reader.readAsText(event.target.files[0]);
|
||||
} else if (file.name.endsWith(".zip")) {
|
||||
reader.onload = function(event) {
|
||||
convertZipFile(event.target.result);
|
||||
};
|
||||
reader.readAsArrayBuffer(event.target.files[0]);
|
||||
} else {
|
||||
log("Unknown file extension for "+file.name);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -174,14 +248,16 @@ function btoa(input) {
|
|||
return out;
|
||||
}
|
||||
|
||||
// To upload the app, we write to external flash
|
||||
function createJS_app(binary, bin32, startAddress, endAddress, HEADER_LEN) {
|
||||
/* To upload the app, we write to external flash,
|
||||
binary = Uint8Array of data to flash. Should include HEADER_LEN header, then bytes to flash */
|
||||
function createJS_app(binary, startAddress, endAddress) {
|
||||
/* typedef struct {
|
||||
uint32_t address;
|
||||
uint32_t size;
|
||||
uint32_t CRC;
|
||||
uint32_t version;
|
||||
} FlashHeader; */
|
||||
var bin32 = new Uint32Array(binary.buffer);
|
||||
bin32[0] = startAddress;
|
||||
bin32[1] = endAddress - startAddress;
|
||||
bin32[2] = CRC32(new Uint8Array(binary.buffer, HEADER_LEN));
|
||||
|
@ -189,7 +265,8 @@ function createJS_app(binary, bin32, startAddress, endAddress, HEADER_LEN) {
|
|||
console.log("CRC 0x"+bin32[2].toString(16));
|
||||
hexJS = "";//`\x10if (E.CRC32(E.memoryArea(${startAddress},${endAddress-startAddress}))==${bin32[2]}) { print("FIRMWARE UP TO DATE!"); load();}\n`;
|
||||
hexJS += '\x10var s = require("Storage");\n';
|
||||
var CHUNKSIZE = 1024;
|
||||
hexJS += '\x10s.erase(".firmware");\n';
|
||||
var CHUNKSIZE = 2048;
|
||||
for (var i=0;i<binary.length;i+=CHUNKSIZE) {
|
||||
var l = binary.length-i;
|
||||
if (l>CHUNKSIZE) l=CHUNKSIZE;
|
||||
|
@ -243,10 +320,8 @@ function fileLoaded() {
|
|||
});
|
||||
console.log(`// Data from 0x${startAddress.toString(16)} to 0x${endAddress.toString(16)} (${endAddress-startAddress} bytes)`);
|
||||
// Work out data
|
||||
var HEADER_LEN = 16;
|
||||
var binary = new Uint8Array(HEADER_LEN + endAddress-startAddress);
|
||||
binary.fill(0); // actually seems to assume a block is filled with 0 if not complete
|
||||
var bin32 = new Uint32Array(binary.buffer);
|
||||
parseLines(function(addr, data) {
|
||||
if (addr>MAX_ADDRESS) return; // ignore data out of range
|
||||
var binAddr = HEADER_LEN + addr - startAddress;
|
||||
|
@ -260,7 +335,7 @@ function fileLoaded() {
|
|||
createJS_bootloader(new Uint8Array(binary.buffer, HEADER_LEN), startAddress, endAddress);
|
||||
} else {
|
||||
console.log("App - Writing to external flash");
|
||||
createJS_app(binary, bin32, startAddress, endAddress);
|
||||
createJS_app(binary, startAddress, endAddress);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -279,7 +354,7 @@ function handleUpload() {
|
|||
|
||||
document.getElementById('fileLoader').addEventListener('change', handleFileSelect, false);
|
||||
document.getElementById("upload").addEventListener("click", handleUpload);
|
||||
checkForFileOnServer();
|
||||
setTimeout(checkForFileOnServer, 10);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
0.01: New App!
|
||||
0.02: multiple player score support
|
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
require("heatshrink").decompress(atob("mEwwIEBgOABQcD4AFDg1wAokYDokOAokDDwkBDwkADwn4nAFD/geDgP8gYFEDwn8gFgDocA+AFCkE/A4IABg//Aoc//4RDn/+Goc/8AFJj4FLEQYFGh4FLIAYFGg4FKh5sBApEfnhTEAok+Aol8vihEAon4AocB+F4ZQYFF8AFDg/AAocPAouAKYcfXQQFHjzEEhjvDA"))
|
|
@ -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();
|
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.2 KiB |
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||

|
||||
|
|
|
@ -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);
|
||||
|
|
After Width: | Height: | Size: 2.2 KiB |
|
@ -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/)
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
Copyright (c) 2021 Michael Salaverry
|
||||
Copyright (c) 2016-20 Ionică Bizău <bizauionica@gmail.com> (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.
|
|
@ -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)
|
||||
<div>Icons made by <a href="https://www.flaticon.com/authors/smashicons" title="Smashicons">Smashicons</a> from <a href="https://www.flaticon.com/" title="Flaticon">[www.flaticon.com](https://www.flaticon.com/premium-icon/calendar_3130060?term=jewish&page=1&position=10&page=1&position=10&related_id=3130060&origin=tag)</a></div>
|
|
@ -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);
|
After Width: | Height: | Size: 32 KiB |
|
@ -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;
|
|
@ -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
|
||||
|
|
|
@ -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?
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
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
|
|
@ -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,16 +56,48 @@ 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.MobileSMS": "SMS Message",
|
||||
"com.apple.Passbook": "iOS Wallet",
|
||||
"com.apple.reminders": "Reminders",
|
||||
"com.apple.shortcuts": "Shortcuts",
|
||||
"com.atebits.Tweetie2": "Twitter",
|
||||
"com.burbn.instagram" : "Instagram",
|
||||
"com.facebook.Facebook": "Facebook",
|
||||
"com.facebook.Messenger": "FB 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.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.tinyspeck.chatlyio": "Slack",
|
||||
"com.toyopagroup.picaboo": "Snapchat",
|
||||
"com.ubercab.UberClient": "Uber",
|
||||
"com.ubercab.UberEats": "UberEats",
|
||||
"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",
|
||||
|
||||
// could also use NRF.ancsGetAppInfo(msg.appId) here
|
||||
};
|
||||
var unicodeRemap = {
|
||||
|
@ -70,6 +109,7 @@ E.on('notify',msg=>{
|
|||
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)
|
||||
|
|
|
@ -8,3 +8,4 @@
|
|||
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
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
});
|
|
@ -10,3 +10,6 @@
|
|||
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
|
||||
|
|
|
@ -40,7 +40,16 @@ const charFallbacks = {
|
|||
"č":"c",
|
||||
"ř":"r",
|
||||
"ő":"o",
|
||||
"ě":"e"
|
||||
"ě":"e",
|
||||
"ę":"e",
|
||||
"ą":"a",
|
||||
"ó":"o",
|
||||
"ż":"z",
|
||||
"ź":"z",
|
||||
"ń":"n",
|
||||
"ł":"l",
|
||||
"ś":"s",
|
||||
"ć":"c",
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -130,7 +139,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 +193,29 @@ 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" }
|
||||
},
|
||||
"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 +612,24 @@ 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" }
|
||||
},
|
||||
/*,
|
||||
"he_IL": { // This won't work until we get a font - see https://github.com/espruino/BangleApps/issues/399
|
||||
codePage : "ISO8859-8",
|
||||
|
|
|
@ -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)
|
||||
|
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 133 KiB |
|
@ -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(),
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
|
@ -0,0 +1 @@
|
|||
0.01: New menu!
|
|
@ -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.
|
|
@ -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<menuItems.length-1) g.setFont('Vector', small).drawString(lbl(idx+1), hc, vc+ih/2+5);
|
||||
if (wrap||idx<menuItems.length-2) g.setFont('Vector', small/2).drawString(lbl(idx+2), hc, vc+ih/2+small+10);
|
||||
|
||||
if (wrap) {
|
||||
// draw divider between first/last items
|
||||
var div = y => 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.value<item.min) item.value = item.wrap ? item.max : item.min;
|
||||
if (item.max!==undefined && item.value>item.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<hc && xy.y<vc-ih/2) back();
|
||||
else Bangle.touchHandler(b, xy);
|
||||
}
|
||||
} else {
|
||||
// Bangle.js 1 has no touchHandler
|
||||
Bangle.backHandler = (b) => {
|
||||
// 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;
|
||||
};
|
After Width: | Height: | Size: 880 B |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.5 KiB |
|
@ -8,3 +8,9 @@
|
|||
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)
|