Merge branch 'master' into master

pull/977/head
Gordon Williams 2021-12-01 08:58:30 +00:00 committed by GitHub
commit 1108983cba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 389 additions and 8 deletions

View File

@ -4106,9 +4106,10 @@
"id": "pastel",
"name": "Pastel Clock",
"shortName": "Pastel",
"version": "0.07",
"description": "A Configurable clock with custom fonts and background",
"version": "0.08",
"description": "A Configurable clock with custom fonts and background. Has a cyclic information line that includes, day, date, battery, sunrise and sunset times",
"icon": "pastel.png",
"dependencies": {"mylocation":"app"},
"screenshots": [{"url":"screenshot_pastel.png"}],
"type": "clock",
"tags": "clock",
@ -4571,5 +4572,58 @@
{"name":"a_speech_timer.app.js","url":"app.js"},
{"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",
"icon": "mylocation.png",
"type": "app",
"screenshots": [{"url":"screenshot_1.png"}],
"version":"0.01",
"description": "Sets and stores the lat and long of your preferred City or it can be set from the GPS. mylocation.json can be used by other apps that need your main location lat and lon. See README",
"readme": "README.md",
"tags": "tool,utility",
"supports": ["BANGLEJS", "BANGLEJS2"],
"storage": [
{"name":"mylocation.app.js","url":"mylocation.app.js"},
{"name":"mylocation.img","url":"mylocation.icon.js","evaluate": true }
],
"data": [
{"name":"mylocation.json"}
]
},
{
"id": "pebble",
"name": "Pebble Clock",
"shortName": "Pebble",
"version": "0.01",
"description": "A pebble style clock to keep the rebellion going",
"readme": "README.md",
"icon": "pebble.png",
"screenshots": [{"url":"pebble_screenshot.png"}],
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS2"],
"storage": [
{"name":"pebble.app.js","url":"pebble.app.js"},
{"name":"pebble.img","url":"pebble.icon.js","evaluate":true}
]
}
]

View File

@ -0,0 +1 @@
0.01: First release

41
apps/mylocation/README.md Normal file
View File

@ -0,0 +1,41 @@
# My Location
*Sets and stores GPS lat and lon of your preferred city*
* Select one of the preset Cities or setup through the GPS
* Other Apps can read this information to do calculations based on location
* When the City shows ??? it means the location has been set through the GPS
## Example Code
const LOCATION_FILE = "mylocation.json";
let location;
// requires the myLocation app
function loadLocation() {
location = require("Storage").readJSON(LOCATION_FILE,1)||{"lat":51.5072,"lon":0.1276,"location":"London"};
}
## Screenshots
### Select one of the Preset Cities
* The presets are London, Newcastle, Edinbrough, Paris, New York, Tokyo
![](screenshot_1.png)
### Or select 'Set By GPS' to start the GPS
![](screenshot_2.png)
### While the GPS is running you will see:
![](screenshot_3.png)
### When a GPS fix is received you will see:
![](screenshot_4.png)
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/)

View File

@ -0,0 +1,75 @@
Bangle.loadWidgets();
Bangle.drawWidgets();
const SETTINGS_FILE = "mylocation.json";
let settings;
// initialize with default settings...
let s = {
'lat': 51.5072,
'lon': 0.1276,
'location': "London"
}
function loadSettings() {
settings = require('Storage').readJSON(SETTINGS_FILE, 1) || s;
}
function save() {
settings = s
require('Storage').write(SETTINGS_FILE, settings)
}
const locations = ["London", "Newcastle", "Edinburgh", "Paris", "New York", "Tokyo","???"];
const lats = [51.5072 ,54.9783 ,55.9533 ,48.8566 ,40.7128 ,35.6762, 0.0];
const lons = [-0.1276 ,-1.6178 ,-3.1883 ,2.3522 , -74.0060 ,139.6503, 0.0];
function setFromGPS() {
Bangle.on('GPS', (gps) => {
//console.log(".");
if (gps.fix === 0) return;
//console.log("fix from GPS");
s = {'lat': gps.lat, 'lon': gps.lon, 'location': '???' }
Bangle.buzz(1500); // buzz on first position
Bangle.setGPSPower(0);
save();
Bangle.setUI("updown", ()=>{ load() });
E.showPrompt("Location has been saved from the GPS fix",{
title:"Location Saved",
buttons : {"OK":1}
}).then(function(v) {
load(); // load default clock
});
});
Bangle.setGPSPower(1);
E.showMessage("Waiting for GPS fix. Place watch in the open. Could take 10 minutes. Long press to abort", "GPS Running");
Bangle.setUI("updown", undefined);
}
function showMainMenu() {
console.log("showMainMenu");
const mainmenu = {
'': { 'title': 'My Location' },
'<Back': ()=>{ load(); },
'City': {
value: 0 | locations.indexOf(s.location),
min: 0, max: 6,
format: v => locations[v],
onchange: v => {
if (v != 6) {
s.location = locations[v];
s.lat = lats[v];
s.lon = lons[v];
save();
}
}
},
'Set From GPS': ()=>{ setFromGPS(); }
}
return E.showMenu(mainmenu);
}
loadSettings();
showMainMenu();

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEw4UA///t/7j/P3/vB4cBqtVoAbHBQIABBQ0FBYdQBYsVBYdUERIkGHIQADHoguEGAwuEGAwKFBZg8DHQw8EBYNf/1Vq3/8oLDIwNf/Wpv//0oLG9Wq3/qBYJUCBYuqBaBqBBYW+BepHEBbybCBYP+BYSnErYLDyoLFAANq/r8Ga5T7MBZZUBAAhSCfhA6DBZhIGBQg8FHQg8GHQgwGFwowFBQwwDFwwLMlS7Bqta1AKEn2q1K1C1WgBYf/1WqBYIDB1QKCgYLC0taBYoXB/QICBY0//7vBAAQ8EEgIABCwwME9QVEA"))

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -3,5 +3,6 @@
0.03: Make it work with Gadgetbridge, Notifications fullscreen on a Bangle 2
0.04: Leave space at the bottom for Chrono widget, set back option at first option
0.05: Added 2 new fonts
0.06: COnverted fonts to font modules
0.06: Converted fonts to font modules
0.07: Added info line that cycles on BTN1/BTN3 (or vitual buttons on a bangle 2)
0.08: Added dependancy on MyLocation

View File

@ -1,6 +1,6 @@
# Pastel Clock
*a configurable clock with custom fonts and background*
*a configurable clock with custom fonts and background. Has a cyclic information line that includes, day, date, battery, sunrise and sunset times*
* Designed specifically for Bangle 1 and Bangle 2
* A choice of 7 different custom fonts
@ -8,12 +8,13 @@
* Has a settings menu, change font, enable/disable the grid
* On Bangle 1 use BTN1,BTN3 to cycle through the info display (Date, ID, Batt %, Ram % etc)
* On Bangle 2 touch the top right/top left to cycle through the info display (Date, ID, Batt %, Ram % etc)
* Uses mylocation.json from MyLocation app to calculate sunrise and sunset times for your location
* Uses pedometer widget to get latest step count
* Dependant apps are installed when Pastel installs
I came up with the name Pastel due to the shade of the grid background.
## Creator
[Hugh Barney](https://github.com/hughbarney)
Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)
## Lato
![](screenshot_lato.png)

View File

@ -1,6 +1,9 @@
var SunCalc = require("https://raw.githubusercontent.com/mourner/suncalc/master/suncalc.js");
require("f_latosmall").add(Graphics);
const SETTINGS_FILE = "pastel.json";
const LOCATION_FILE = "mylocation.json";
let settings;
let location;
function loadSettings() {
settings = require("Storage").readJSON(SETTINGS_FILE,1)||{};
@ -8,6 +11,29 @@ function loadSettings() {
settings.font = settings.font||"Lato";
}
// requires the myLocation app
function loadLocation() {
location = require("Storage").readJSON(LOCATION_FILE,1)||{"lat":51.5072,"lon":0.1276,"location":"London"};
}
function extractTime(d){
var h = d.getHours(), m = d.getMinutes();
return(("0"+h).substr(-2) + ":" + ("0"+m).substr(-2));
}
var sunRise = "00:00";
var sunSet = "00:00";
var drawCount = 0;
function updateSunRiseSunSet(now, lat, lon, line){
// get today's sunlight times for lat/lon
var times = SunCalc.getTimes(new Date(), lat, lon);
// format sunrise time from the Date object
sunRise = extractTime(times.sunrise);
sunSet = extractTime(times.sunset);
}
function loadFonts() {
// load font files based on settings.font
if (settings.font == "Architect")
@ -39,6 +65,8 @@ const infoData = {
ID_BLANK: { calc: () => '' },
ID_DATE: { calc: () => {var d = (new Date).toString().split(" "); return d[2] + ' ' + d[1] + ' ' + d[3];} },
ID_DAY: { calc: () => {var d = require("locale").dow(new Date).toLowerCase(); return d[0].toUpperCase() + d.substring(1);} },
ID_SR: { calc: () => 'Sunrise: ' + sunRise },
ID_SS: { calc: () => 'Sunset: ' + sunSet },
ID_STEP: { calc: () => 'Steps: ' + stepsWidget().getSteps() },
ID_BATT: { calc: () => 'Battery: ' + E.getBattery() + '%' },
ID_MEM: { calc: () => {var val = process.memory(); return 'Ram: ' + Math.round(val.usage*100/val.total) + '%';} },
@ -148,6 +176,10 @@ function draw() {
g.setFontLatoSmall();
g.setFontAlign(0, -1);
g.drawString((infoData[infoMode].calc()), w/2, h - 24 - 24);
if (drawCount % 3600 == 0)
updateSunRiseSunSet(new Date(), location.lat, location.lon);
drawCount++;
}
// Only update when display turns on
@ -169,6 +201,8 @@ Bangle.setUI("clockupdown", btn=> {
loadSettings();
loadFonts();
loadLocation();
g.clear();
var secondInterval = setInterval(draw, 1000);
draw();

1
apps/pebble/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: first release

17
apps/pebble/README.md Normal file
View File

@ -0,0 +1,17 @@
# Pebble
*a Pebble style clock with configurable background color, to keep the revolution going*
* Designed specifically for Bangle 2
* A choice of 6 different background colous through its setting menu
* Supports the Light and Dark themes
* Uses pedometer widget to get latest step count
* Dependant apps are installed when Pebble installs
* Uses the whole screen, widgets are made invisible but still run in the background
* When battery is less than 30% main screen goes Red
![](pebble_screenshot.png)
![](pebble_screenshot2.png)
![](pebble_screenshot3.png)
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/)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

116
apps/pebble/pebble.app.js Normal file
View File

@ -0,0 +1,116 @@
Graphics.prototype.setFontQahiri = function(scale) {
// Actual height 60 (60 - 1)
g.setFontCustom(atob("AAAAAAAAfAAAAAAAAAAAAP4AAAAAAAAAAAD/AAAAAAAAAAAB/wAAAAAAAAAAAf8AAAAAAAAAAAH/AAAAAAAAAAAA/wAAAAAAAAAAAH4AAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAAAB8AAAAAAAAAAAD/gAAAAAAAAAAH/4AAAAAAAAAAP/8AAAAAAAAAAP/4AAAAAAAAAAf/4AAAAAAAAAA//wAAAAAAAAAB//gAAAAAAAAAD//AAAAAAAAAAD//AAAAAAAAAAH/+AAAAAAAAAAP/8AAAAAAAAAAf/4AAAAAAAAAAf/4AAAAAAAAAA//wAAAAAAAAAB//gAAAAAAAAAD//AAAAAAAAAAH/+AAAAAAAAAAH/+AAAAAAAAAAP/8AAAAAAAAAAH/4AAAAAAAAAAB/wAAAAAAAAAAAPwAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD/AAAD/AAAAAAA/wAAA/wAAAAAAP8AAAP8AAAAAAD/AAAD/AAAAAAA/wAAA/wAAAAAAP8AAAP8AAAAAAD/AAAD/AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af///AAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af///AAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA///+A/wAAAAAAP///gP8AAAAAAD///4D/AAAAAAA///+A/wAAAAAAP///gP8AAAAAAD///4D/AAAAAAA///+A/wAAAAAAH///gH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAH/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///AAAAAAAAAAP//wAAAAAAAAAD//8AAAAAAAAAA///AAAAAAAAAAP//wAAAAAAAAAD//8AAAAAAAAAA///AAAAAAAAAAP//wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAH/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///+A/wAAAAAAP///gP8AAAAAAD///4D/AAAAAAA///+A/wAAAAAAP///gP8AAAAAAD///4D/AAAAAAA///+A/wAAAAAAP///gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af///AAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af///AAAAAAA/wH///wAAAAAAH8A///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af///AAAAAAA/wH///wAAAAAAP8B///8AAAAAAD/Af///AAAAAAA/wH///wAAAAAAH8A///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA/wAAAAAAAAAAAP8AAAAAAAAAAAD/AAAAAAAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAH/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAH/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///+A/wAAAAAAP///gP8AAAAAAD///4D/AAAAAAA///+A/wAAAAAAP///gP8AAAAAAD///4D/AAAAAAA///+A/wAAAAAAP///gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA/wH+A/wAAAAAAP8B/gP8AAAAAAD/Af4D/AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAP/////8AAAAAAD//////AAAAAAA//////wAAAAAAH/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+AAfAAAAAAAAAfwAP4AAAAAAAAP8AD/AAAAAAAAD/gB/wAAAAAAAA/4Af8AAAAAAAAP+AH/AAAAAAAAD/AA/wAAAAAAAAfgAH4AAAAAAAABwAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="), 46, atob("DR0bDBsbGxsbGxsbDQ=="), 80+(scale<<8)+(1<<16));
}
const SETTINGS_FILE = "pebble.json";
let settings;
function loadSettings() {
settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#0f0', 'color': 'Green'};
}
var img = require("heatshrink").decompress(atob("oFAwkGswA/AH4A/AH4A/AH4A/AFEAD74gdsAfBELlggMhD70iILsAiUAIKQRBgxAHgUiIKQQJUAMSD4JBQsBVBIAq/DEAJBCJ45VHkAxEDwKfDIIUREBq2BmcQCAQeCkczmRBEiAgND4MxSoYGBAAQgCAAohKDARhBG4IeDEAQ8BAA5fJABgpBgFDgEiQgJEHT4IeMmMBkMFAYJJDEQaYDiYfMkECiEEoEDBAX//8ykJsBD4MAWwIALiBeCqAyDn//BoYgBgAeMYAMhgE0CRIOBD58BkEEmCRKkEGD5szkUQqdASJUxD4MAgKBKmUigFEGJZgBAATODFw0CkEBmoOJAAQdB7owBOBDdCgbdED5fd6pRIgDdCeBkxD4fdeAgNEkMFmheLdgIfE6BgGmDdCoDdKDwYfD6gzGiBeBrpLHXYUQXIMgD4NND4SAFZgMRgAKBPwroBBYIeBIAL/CADESL4VmsAcWgMRkQeDAAMAkQAWMAQeCD4MSDqqdBDwgfBAC8GDwiAXDowA/AH4A/AH4A/AH4A/AEA"));
const h = g.getHeight();
const w = g.getWidth();
const ha = 2*h/5 - 8;
const h2 = 3*h/5 - 10;
const h3 = 7*h/8;
let batteryWarning = false;
function draw() {
let date = new Date();
let da = date.toString().split(" ");
//let timeStr = require("locale").time(date,1); // causes screen corruption ???
let timeStr = da[4].substr(0,5);
const t = 6;
// turn the warning on once we have dipped below 30%
if (E.getBattery() < 30)
batteryWarning = true;
// turn the warning off once we have dipped above 40%
if (E.getBattery() > 40)
batteryWarning = false;
g.reset();
g.setColor(settings.bg);
g.fillRect(0, 0, w, h2 - t);
// contrast bar
g.setColor(g.theme.fg);
g.fillRect(0, h2 - t, w, h2);
// day and steps
if (settings.color == 'Blue' || settings.color == 'Red')
g.setColor('#fff'); // white on blue or red best contrast
else
g.setColor('#000'); // otherwise black regardless of theme
g.setFont('Vector', 22);
g.setFontAlign(0, -1);
g.drawString(da[0], w/4, ha); // day of week
g.drawString(getSteps(), 3*w/4, ha);
// time
// white on red for battery warning
g.setColor(!batteryWarning ? g.theme.bg : '#f00');
g.fillRect(0, h2, w, h3);
g.setFontQahiri();
g.setFontAlign(0, -1);
g.setColor(!batteryWarning ? g.theme.fg : '#fff');
g.drawString(timeStr, w/2, h2 - 8);
// contrast bar
g.setColor(g.theme.fg);
g.fillRect(0, h3, w, h3 + t);
// the bottom
g.setColor(settings.bg);
g.fillRect(0, h3 + t, w, h);
g.setColor(settings.bg);
g.drawImage(img, w/2 + ((w/2) - 64)/2, 10, { scale: 1 });
drawCalendar(((w/2) - 48)/2, 10, 48, 4, da[2]);
}
// at x,y width:wi thicknes:th
function drawCalendar(x,y,wi,th,str) {
g.setColor(g.theme.fg);
g.fillRect(x, y, x + wi, y + wi);
g.setColor(g.theme.bg);
g.fillRect(x + th, y + th, x + wi - th, y + wi - th);
g.setColor(g.theme.fg);
let hook_t = 6;
// first calendar hook, one third in
g.fillRect(x + (wi/3) - (th/2), y - hook_t, x + wi/3 + th - (th/2), y + hook_t);
// second calendar hook, two thirds in
g.fillRect(x + (2*wi/3) -(th/2), y - hook_t, x + 2*wi/3 + th - (th/2), y + hook_t);
g.setFont('Vector', 22);
g.setFontAlign(0, 0);
g.drawString(str, x + wi/2 + th/2, y + wi/2 + th/2);
}
function getSteps() {
if (WIDGETS.wpedom !== undefined) {
return WIDGETS.wpedom.getSteps();
}
return '????';
}
g.clear();
Bangle.loadWidgets();
/*
* we are not drawing the widgets as we are taking over the whole screen
* so we will blank out the draw() functions of each widget
*/
for (let wd of WIDGETS) {wd.draw=()=>{};}
loadSettings();
setInterval(draw, 15000); // refresh every 15s
draw();
Bangle.setUI("clock");

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("oFAwgNKiIAIFqofegIf/DAUzAAMyAwUQD60T/4ACD7Q/cPxIf/YCofcDhYiSXYYfuUZgf/D/4f/D6USkUgD/4fuogAID6vtDw/UD6vu6geF73kb6vuEAtN9wfYMIneD7JADDwIfaIAJdBD7YgBHwQfbAAgfkf6Qf/D/4feogAID6oAND/4f/iAdJD/4f/D/4fUDxYABD74iODiAftTZgfnYYczAAMyD7UT/4ACH/S+bD8DAKD9Y="))

BIN
apps/pebble/pebble.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,38 @@
(function(back) {
const SETTINGS_FILE = "pebble.json";
// initialize with default settings...
let s = {'bg': '#0f0', 'color': 'Green'}
// ...and overwrite them with any saved values
// This way saved values are preserved if a new version adds more settings
const storage = require('Storage')
let settings = storage.readJSON(SETTINGS_FILE, 1) || s;
const saved = settings || {}
for (const key in saved) {
s[key] = saved[key]
}
function save() {
settings = s
storage.write(SETTINGS_FILE, settings)
}
var color_options = ['Green','Orange','Cyan','Perple','Red','Blue'];
var bg_code = ['#0f0','#ff0','#0ff','#f0f','#f00','#00f'];
E.showMenu({
'': { 'title': 'Pebble Clock' },
'< Back': back,
'Colour': {
value: 0 | color_options.indexOf(s.color),
min: 0, max: 5,
format: v => color_options[v],
onchange: v => {
s.color = color_options[v];
s.bg = bg_code[v];
save();
},
}
});
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB