Skip to content

Commit 4980933

Browse files
author
thyttan
committed
Merge remote-tracking branch 'upstream/master' into app-loader
2 parents 91f7a85 + b5a15f6 commit 4980933

32 files changed

+3951
-224
lines changed

apps/coretemp/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
0.03: Move code for recording to this app
44
0.04: Use default Bangle formatter for booleans
55
0.05: Minor code improvements
6+
0.06: Added advanced settings, adapted code to mirror bthrm funcitonality, and will work with latest firmware CORE Sensor Firmware (V0.87)

apps/coretemp/README.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,43 @@
11
# CoreTemp display
22

3-
Basic example of connecting to a bluetooth [CoreTemp](https://corebodytemp.com/) device and displaying the current skin and body core temperature readings.
3+
Application to connect to the [CORE](https://corebodytemp.com/) or [calera](https://info.greenteg.com/calera-research) devices from greenteg and display the current skin and body core temperature readings.
4+
5+
This also includes a module (heavily influenced by the BTHRM app) so you can integrate the core sensor into your own apps/widgets. You can also pair an ANT+ heart rate strap to the CORE/calera sensor as well in the App Settings so that you can leverage the exertional algorthim for estimating core temperature.
46

57
## Usage
68

7-
Background task connects to any CoreTemp device (2100/2101) and emits a CoreTemp signal value for each reading.
8-
Application contains three components, one is a background task that monitors the sensor and emits a 'CoreTemp' signal on activity if activated in settings.
9-
The widget shows when the sensor is enabled with a mini value and blinks on use.
10-
The app listens for 'CoreTemp' signals and shows the current skin and core temperatures in large numbers.
9+
Background task connects to a paired and emits a CORESensor signal value for each reading.
10+
Application contains three components, one is a background task that monitors the sensor and emits a 'CORESensor' signal on activity if activated in settings.
11+
The widget shows when the sensor is enabled and connected (green) or disconnected (grey).
12+
The app listens for 'CORESensor' signals and shows the current data.
13+
14+
## CORESensor Module
15+
16+
With the module, you can add the CORE Sensor to your own app. Simply power on the module and listen to CORESensor:
17+
18+
```
19+
Bangle.setCORESensorPower(1,appName);
20+
Bangle.on('CORESensor', (x) =>{ ... });
21+
```
22+
23+
The CORESensor emits an object with following keys:
24+
25+
* **core**: Estimated/Predicted core temperature
26+
* **skin**: Measured skin temperature
27+
* **unit**: "F" or "C"
28+
* **hr**: Heart Rate (only when ANT+ heart rate monitor is paired)
29+
* **heatflux**: (calera device only - needs encryption level b released by greenteg)
30+
* **hsi**: Heat Strain Index ([read more here](https://help.corebodytemp.com/en/articles/10447107-heat-strain-index), exertional algorithm only)
31+
* **battery**: battery level
32+
* **quality**: Used to indicate the quality or trust level of the current measurement values
1133

1234
## TODO
1335

1436
* Integrate with other tracking/sports apps to log data.
15-
* Add specific device selection
37+
* Emit Bangle.js heart rate to device as a heart rate for internal algorthim
1638

17-
## Creator
39+
## Creators/Contributors
1840

1941
Ivor Hewitt
42+
43+
[Nicholas Ravanelli](https://github.com/nravanelli)

apps/coretemp/app-settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"enabled":false
2+
"enabled":false,
3+
"debuglog": false
34
}

apps/coretemp/boot.js

Lines changed: 1 addition & 114 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/coretemp/coretemp.js

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
var settings = require("Storage").readJSON("coretemp.json", 1) || {};
12
// Simply listen for core events and show data
2-
33
//var btm = g.getHeight() - 1;
44
var px = g.getWidth() / 2;
55

@@ -21,25 +21,14 @@ var corelogo = {
2121
function onCore(c) {
2222
// Large or small font
2323
var sz = ((process.env.HWVERSION == 1) ? 3 : 2);
24-
2524
g.setFontAlign(0, 0);
2625
g.clearRect(0, 32 + 48, g.getWidth(), 32 + 48 + 24 * 4);
2726
g.setColor(g.theme.dark ? "#CCC" : "#333"); // gray
28-
g.setFont("6x8", sz).drawString(
29-
"Core: " + ((c.core < 327) ? (c.core + c.unit) : 'n/a'), px, 48 + 48);
30-
g.setFont("6x8", sz).drawString("Skin: " + c.skin + c.unit, px, 48 + 48 + 24);
31-
}
32-
33-
// Background task will activate once settings are enabled.
34-
function enableSensor() {
35-
settings = require("Storage").readJSON("coretemp.json", 1) || {};
36-
37-
if (!settings.enabled) {
38-
settings.enabled = true;
39-
require("Storage").write("coretemp.json", settings);
40-
41-
drawBackground("Waiting for\ndata...");
42-
}
27+
g.setFont("6x8", sz).drawString("Core: " + ((c.core < 327) ? (c.core + c.unit) : 'n/a'), px, 48 + 48);
28+
g.setFont("6x8", sz).drawString("Skin: " + c.skin + c.unit, px, 48 + 48 + 14);
29+
g.setFont("6x8", sz).drawString("HR: " + c.hr + " BPM", px, 48 + 48 + 28);
30+
g.setFont("6x8", sz).drawString("HSI: " + c.hsi+ "/10", px, 48 + 48 + 42);
31+
g.setFont("6x8", sz).drawString("BATT: " + c.battery+ "%", px, 48 + 48 + 56);
4332
}
4433

4534
function drawBackground(message) {
@@ -51,16 +40,11 @@ function drawBackground(message) {
5140
g.drawString(message, g.getWidth() / 2, g.getHeight() / 2 + 16);
5241
}
5342

54-
Bangle.on('CoreTemp', onCore);
55-
56-
settings = require("Storage").readJSON("coretemp.json", 1) || {};
5743

5844
if (!settings.enabled) {
59-
drawBackground("Sensor off\nBTN" +
60-
((process.env.HWVERSION == 1) ? '2' : '1') + " to enable");
45+
drawBackground("Sensor off\nEnable in Settings");
6146
} else {
47+
Bangle.setCORESensorPower(1,"COREAPP");
48+
Bangle.on('CORESensor', onCore);
6249
drawBackground("Waiting for\ndata...");
6350
}
64-
65-
setWatch(() => { enableSensor(); }, (process.env.HWVERSION == 1) ? BTN2 : BTN1,
66-
{repeat : false});

0 commit comments

Comments
 (0)