Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Jan 4, 2022
2 parents 7912a8e + 4946309 commit 2109a2b
Show file tree
Hide file tree
Showing 29 changed files with 1,114 additions and 242 deletions.
52 changes: 35 additions & 17 deletions apps.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
{
"id": "messages",
"name": "Messages",
"version": "0.14",
"version": "0.15",
"description": "App to display notifications from iOS and Gadgetbridge",
"icon": "app.png",
"type": "app",
Expand Down Expand Up @@ -4487,7 +4487,7 @@
"name": "LCARS Clock",
"shortName":"LCARS",
"icon": "lcars.png",
"version":"0.07",
"version":"0.08",
"readme": "README.md",
"supports": ["BANGLEJS2"],
"description": "Library Computer Access Retrieval System (LCARS) clock.",
Expand Down Expand Up @@ -4652,7 +4652,7 @@
"id": "sensible",
"name": "SensiBLE",
"shortName": "SensiBLE",
"version": "0.04",
"version": "0.05",
"description": "Collect, display and advertise real-time sensor data.",
"icon": "sensible.png",
"screenshots": [
Expand Down Expand Up @@ -5029,9 +5029,10 @@
{ "id": "circlesclock",
"name": "Circles clock",
"shortName":"Circles clock",
"version":"0.02",
"version":"0.03",
"description": "A clock with circles for different data at the bottom in a probably familiar style",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],
"dependencies": {"widpedom":"app"},
"type": "clock",
"tags": "clock",
Expand Down Expand Up @@ -5064,18 +5065,35 @@
]
},
{ "id": "andark",
"name": "Analog Dark",
"shortName":"AnDark",
"version":"0.04",
"description": "analog clock face without disturbing widgets",
"icon": "andark_icon.png",
"type": "clock",
"tags": "clock",
"supports" : ["BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name":"andark.app.js","url":"app.js"},
{"name":"andark.img","url":"app_icon.js ","evaluate":true}
]
"name": "Analog Dark",
"shortName":"AnDark",
"version":"0.04",
"description": "analog clock face without disturbing widgets",
"icon": "app_icon.png",
"type": "clock",
"tags": "clock",
"supports" : ["BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name":"andark.app.js","url":"app.js"},
{"name":"andark.img","url":"app_icon.js ","evaluate":true}
]
},
{
"id": "diract",
"name": "DirAct",
"shortName": "DirAct",
"version": "0.01",
"description": "Proximity interaction detection.",
"icon": "diract.png",
"type": "app",
"tags": "tool,sensors",
"supports" : [ "BANGLEJS2" ],
"allow_emulator": false,
"readme": "README.md",
"storage": [
{ "name": "diract.app.js", "url": "diract.js" },
{ "name": "diract.img", "url": "diract-icon.js", "evaluate": true }
]
}
]
1 change: 1 addition & 0 deletions apps/circlesclock/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
0.01: New clock
0.02: Fix icon & add battery warn functionality
0.03: Theming support & minor fixes
2 changes: 2 additions & 0 deletions apps/circlesclock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ It shows besides time, date and day of week the following information:

## TODO
* Show weather information
* Configure which information to show in each circle
* Configure visibility of widgets

## Creator
Marco ([myxor](https://github.com/myxor))
Expand Down
44 changes: 30 additions & 14 deletions apps/circlesclock/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@ const powerIcon = heatshrink.decompress(atob("h0OwYQNsAED7AEDmwEDtu2AgUbtuABwXbB
const powerIconGreen = heatshrink.decompress(atob("h0OwYQNkAEDpAEDiQEDkmSAgUJkmABwVJBIUEyVAAoYOCgEBFIgODABI"));
const powerIconRed = heatshrink.decompress(atob("h0OwYQNoAEDyAEDkgEDpIFDiVJBweSAgUJkmAAoYZDgQpEBwYAJA"));

const SETTINGS_FILE = "circlesclock.json";
let settings;

function loadSettings() {
settings = require("Storage").readJSON(SETTINGS_FILE, 1) || {
settings = require("Storage").readJSON("circlesclock.json", 1) || {
'maxHR': 200,
'stepGoal': 10000,
'batteryWarn': 30
};
// Load step goal from pedometer widget as fallback
if (settings.stepGoal == undefined) {
const d = require('Storage').readJSON("wpedom.json", 1) || {};
settings.stepGoal = d != undefined && d.settings != undefined ? d.settings.goal : 10000;
}
}

const colorFg = '#fff';
const colorBg = '#000';
const colorFg = g.theme.dark ? '#fff' : '#000';
const colorBg = g.theme.dark ? '#000' : '#fff';
const colorGrey = '#808080';
const colorRed = '#ff0000';
const colorGreen = '#00ff00';
Expand Down Expand Up @@ -73,7 +77,7 @@ function drawSteps() {
g.setColor(colorGrey);
g.fillCircle(w1, h3, radiusOuter);

const stepGoal = settings.stepGoal;
const stepGoal = settings.stepGoal || 10000;
if (stepGoal > 0) {
let percent = steps / stepGoal;
if (stepGoal < steps) percent = 1;
Expand All @@ -97,8 +101,9 @@ function drawHeartRate() {
g.setColor(colorGrey);
g.fillCircle(w2, h3, radiusOuter);

if (hrtValue != undefined) {
const percent = hrtValue / settings.maxHR;
if (hrtValue != undefined && hrtValue > 0) {
const minHR = 40;
const percent = (hrtValue - minHR) / (settings.maxHR - minHR);
drawGauge(w2, h3, percent, colorRed);
}

Expand Down Expand Up @@ -156,25 +161,26 @@ function radians(a) {
return a * Math.PI / 180;
}


function drawGauge(cx, cy, percent, color) {
let offset = 30;
let end = 300;
var i = 0;
var r = radiusInner + 3;

if (percent <= 0) return;
if (percent > 1) percent = 1;

var startrot = -offset;
var endrot = startrot - ((end - offset) * percent);
var endrot = startrot - ((end - offset) * percent) - 15;

g.setColor(color);

const size = 4;
// draw gauge
for (i = startrot; i > endrot; i -= 4) {
for (i = startrot; i > endrot - size; i -= size) {
x = cx + r * Math.sin(radians(i));
y = cy + r * Math.cos(radians(i));
g.fillCircle(x, y, 4);
g.fillCircle(x, y, size);
}
}

Expand All @@ -201,6 +207,10 @@ function getSteps() {
Bangle.on('lock', function(isLocked) {
if (!isLocked) {
Bangle.setHRMPower(1, "watch");
if (hrtValue == undefined) {
hrtValue = '...';
drawHeartRate();
}
} else {
Bangle.setHRMPower(0, "watch");
}
Expand All @@ -218,16 +228,22 @@ Bangle.on('HRM', function(hrm) {
//}
});

Bangle.on('charging', function(charging) {
drawBattery();
});

g.clear();
Bangle.loadWidgets();
/*
* we are not drawing the widgets as we are taking over the whole screen
* so we will blank out the draw() functions of each widget and change the
* area to the top bar doesn't get cleared.
*/
for (let wd of WIDGETS) {
wd.draw = () => {};
wd.area = "";
if (typeof WIDGETS === "object") {
for (let wd of WIDGETS) {
wd.draw = () => {};
wd.area = "";
}
}
loadSettings();
setInterval(draw, 60000);
Expand Down
1 change: 1 addition & 0 deletions apps/diract/ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.01: New App!
28 changes: 28 additions & 0 deletions apps/diract/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# DirAct

[DirAct](https://www.reelyactive.com/diract/) implementation for the Bangle.js.


## Usage

Real-time interactions will be recognised by [Pareto Anywhere](https://www.reelyactive.com/pareto/anywhere/) open source middleware and any other program which observes the [DirAct open standard](https://reelyactive.github.io/diract/).


## Features

Currently implements DirAct real-time functionality.


## Controls

None.


## Requests

[Contact reelyActive](https://www.reelyactive.com/contact/) for support/updates.


## Creator

Developed by [jeffyactive](https://github.com/jeffyactive) of [reelyActive](https://www.reelyactive.com). DirAct is jointly developed by reelyActive and Code Blue Consulting.
1 change: 1 addition & 0 deletions apps/diract/diract-icon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2109a2b

Please sign in to comment.