1
0
Fork 0

Pebble: added README, battery warning if below 30%

master
hughbarney 2021-11-30 13:30:13 +00:00
parent 4cf5d86083
commit 5b7bbd83db
3 changed files with 24 additions and 8 deletions

View File

@ -4581,6 +4581,7 @@
"shortName": "Pebble",
"version": "0.01",
"description": "A pebble style clock to keep the rebellion going",
"readme": "README.md",
"icon": "pebble.png",
"dependencies": {"widpedom":"app"},
"screenshots": [{"url":"screenshot_pebble.png"}],

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/)

View File

@ -19,7 +19,7 @@ const ha = 2*h/5 - 8;
const h2 = 3*h/5 - 10;
const h3 = 7*h/8;
let batterWarning = false;
let batteryWarning = false;
function draw() {
let date = new Date();
@ -30,14 +30,11 @@ function draw() {
// turn the warning on once we have dipped below 30%
if (E.getBattery() < 30)
batterWarning = true;
batteryWarning = true;
// turn the warning off once we have dipped above 40%
if (E.getBattery() > 40)
batterWarning = false;
// for testing only
batterWarning = true;
batteryWarning = false;
g.reset();
g.setColor(settings.bg);
@ -59,11 +56,12 @@ function draw() {
g.drawString(getSteps(), 3*w/4, ha);
// time
g.setColor(!batteryWarning ? g.theme.bg ? '#f00');
// 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(g.theme.fg);
g.setColor(!batteryWarning ? g.theme.fg : '#fff');
g.drawString(timeStr, w/2, h2 - 8);
// contrast bar