1
0
Fork 0

merged upstream

master
hughbarney 2021-11-30 13:18:27 +00:00
commit 4cf5d86083
11 changed files with 262 additions and 2 deletions

View File

@ -4529,6 +4529,37 @@
{"name":"93dub.img","url":"app-icon.js","evaluate":true}
]
},
{ "id": "poweroff",
"name": "Poweroff",
"shortName":"Poweroff",
"version":"0.01",
"description": "Simple app to power off your Bangle.js",
"icon": "app.png",
"tags": "poweroff, shutdown",
"supports" : ["BANGLEJS", "BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name":"poweroff.app.js","url":"app.js"},
{"name":"poweroff.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",
@ -4558,6 +4589,7 @@
"supports": ["BANGLEJS2"],
"storage": [
{"name":"pebble.app.js","url":"pebble.app.js"},
{"name":"pebble.img","url":"pebble.icon.js","evaluate":true},
}
{"name":"pebble.img","url":"pebble.icon.js","evaluate":true}
]
}
]

1
apps/poweroff/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: New app!

13
apps/poweroff/README.md Normal file
View File

@ -0,0 +1,13 @@
# Poweroff
Simple app to power off your Bangle.js
## Usage
Start the app shutdowns your Bangle.js watch after a short delay.
## Creator
Marco (@myxor)
## Icon
Icon taken from https://materialdesignicons.com/ Apache License 2.0

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwMB/4Ak/k/ArX8AoIGC/F8n0fAoPwAoMPAoPgAoMHAoPAC4MDAoPBAoODAoODAoPBAoOHAoPhAo8HAoPgAoMPAoPwArRQCFIRQCGoQCBHYYFEKARNCAQQIC4ACBMoXgv/+EwXwn/8GQX4g/gRIX8b4KVC/wFBv6iCwDnE+AcCAF4="))

13
apps/poweroff/app.js Normal file
View File

@ -0,0 +1,13 @@
g.clear();
g.setFont("6x8",2).setFontAlign(0,0);
var x = g.getWidth()/2;
var y = g.getHeight()/2 + 10;
g.drawString("Powering off...", x, y);
setTimeout(function() {
if (Bangle.softOff) Bangle.softOff(); else Bangle.off();
}, 1000);
Bangle.loadWidgets();
Bangle.drawWidgets();

BIN
apps/poweroff/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

2
apps/sensible/ChangeLog Normal file
View File

@ -0,0 +1,2 @@
0.01: New App!
0.02: Corrected variable initialisation

35
apps/sensible/README.md Normal file
View File

@ -0,0 +1,35 @@
# Sensible
Collect all the sensor data from the Bangle.js 2, display the live readings in menu pages, and broadcast in Bluetooth Low Energy (BLE) advertising packets to any listening devices in range.
## Usage
The advertising packets will be recognised by [Pareto Anywhere](https://www.reelyactive.com/pareto/anywhere/) open source middleware and any other program which observes the standard packet types. Also convenient for testing individual sensors of the Bangle.js 2 via the menu interface.
## Features
Currently implements:
- Accelerometer
- Barometer
- GPS
- Heart Rate Monitor
- Magnetometer
in the menu display but NOT YET in Bluetooth Low Energy advertising (which will be implemented in a subsequent version).
## Controls
Browse and control sensors using the standard Espruino menu interface.
## 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)

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwkG/4AG+cilGIxGCkU/B44AGmQUBAAsjCyoYN+QWJAAMvCxsjLQXzG4gYIOIZwG+YLDCw34BRIkFx4JFHQRDElGCJYgOCFw5RCPQwJFGAg4BIoSRIDAQQEG4YLBHgYAGJQIjCJ4RGBDoU4SIqNDwYwDJAQEDFwSRGDAQfBFQgIDFwQtDRoowBAgQDEDYQzC7oACTogrEA4IfF/4WDDAY/Fx4CCEYQbB/oXF74TDCAYGBUoIDDCwowCUoIkBAYSABGwIDCLogADBIKMCAYRODLwRGGJAaMFPwghBnoXJHoJ8DF4Q5DC5HTKogVBgAAFpoXH6oQGAA1dC7/UC5sNC4/dCA0QAwsEC50BC40AC5FQC4sgMB4XFgUwC40FC4/QBwkD+B5HDA6oFh/xSREFqtVbogMEj/yVxkFMwRgEl//Y5sAqhgF///SA4AHghgDgQXBPBAAHrpICh4XBMBoADC4ReBAALxHABUBCwX/bI4AKgYXD+YXRn4XDSKCNDAAZ5QOoZhSLohhESRkBLopJQIo4YOCxYYCJQ0BCxoACmURCoMRkYOI"))

162
apps/sensible/sensible.js Normal file
View File

@ -0,0 +1,162 @@
/**
* Copyright reelyActive 2021
* We believe in an open Internet of Things
*/
// Non-user-configurable constants
const APP_ID = 'sensible';
// Global variables
let acc, bar, hrm, mag;
let isAccMenu = false;
let isBarMenu = false;
let isGpsMenu = false;
let isHrmMenu = false;
let isMagMenu = false;
let isBarEnabled = true;
let isGpsEnabled = true;
let isHrmEnabled = true;
let isMagEnabled = true;
// Menus
let mainMenu = {
"": { "title": "-- SensiBLE --" },
"Acceleration": function() { E.showMenu(accMenu); isAccMenu = true; },
"Barometer": function() { E.showMenu(barMenu); isBarMenu = true; },
"GPS": function() { E.showMenu(gpsMenu); isGpsMenu = true; },
"Heart Rate": function() { E.showMenu(hrmMenu); isHrmMenu = true; },
"Magnetometer": function() { E.showMenu(magMenu); isMagMenu = true; }
};
let accMenu = {
"": { "title" : "- Acceleration -" },
"State": { value: "On" },
"x": { value: null },
"y": { value: null },
"z": { value: null },
"<-": function() { E.showMenu(mainMenu); isAccMenu = false; },
};
let barMenu = {
"": { "title" : "- Barometer -" },
"State": {
value: isBarEnabled,
format: v => v ? "On" : "Off",
onchange: v => { isBarEnabled = v; Bangle.setBarometerPower(v, APP_ID); }
},
"Altitude": { value: null },
"Press": { value: null },
"Temp": { value: null },
"<-": function() { E.showMenu(mainMenu); isBarMenu = false; },
};
let gpsMenu = {
"": { "title" : "- GPS -" },
"State": {
value: isGpsEnabled,
format: v => v ? "On" : "Off",
onchange: v => { isGpsEnabled = v; Bangle.setGPSPower(v, APP_ID); }
},
"Lat": { value: null },
"Lon": { value: null },
"Altitude": { value: null },
"Satellites": { value: null },
"HDOP": { value: null },
"<-": function() { E.showMenu(mainMenu); isGpsMenu = false; },
};
let hrmMenu = {
"": { "title" : "- Heart Rate -" },
"State": {
value: isHrmEnabled,
format: v => v ? "On" : "Off",
onchange: v => { isHrmEnabled = v; Bangle.setHRMPower(v, APP_ID); }
},
"BPM": { value: null },
"Confidence": { value: null },
"<-": function() { E.showMenu(mainMenu); isHrmMenu = false; },
};
let magMenu = {
"": { "title" : "- Magnetometer -" },
"State": {
value: isMagEnabled,
format: v => v ? "On" : "Off",
onchange: v => { isMagEnabled = v; Bangle.setCompassPower(v, APP_ID); }
},
"x": { value: null },
"y": { value: null },
"z": { value: null },
"Heading": { value: null },
"<-": function() { E.showMenu(mainMenu); isMagMenu = false; },
};
// Update acceleration
Bangle.on('accel', function(newAcc) {
acc = newAcc;
if(isAccMenu) {
accMenu.x.value = acc.x.toFixed(2);
accMenu.y.value = acc.y.toFixed(2);
accMenu.z.value = acc.z.toFixed(2);
E.showMenu(accMenu);
}
});
// Update barometer
Bangle.on('pressure', function(newBar) {
bar = newBar;
if(isBarMenu) {
barMenu.Altitude.value = bar.altitude.toFixed(1) + 'm';
barMenu.Press.value = bar.pressure.toFixed(1) + 'mbar';
barMenu.Temp.value = bar.temperature.toFixed(1) + 'C';
E.showMenu(barMenu);
}
});
// Update GPS
Bangle.on('GPS', function(newGps) {
gps = newGps;
if(isGpsMenu) {
gpsMenu.Lat.value = gps.lat.toFixed(4);
gpsMenu.Lon.value = gps.lon.toFixed(4);
gpsMenu.Altitude.value = gps.alt + 'm';
gpsMenu.Satellites.value = gps.satellites;
gpsMenu.HDOP.value = (gps.hdop * 5).toFixed(1) + 'm';
E.showMenu(gpsMenu);
}
});
// Update heart rate monitor
Bangle.on('HRM', function(newHrm) {
hrm = newHrm;
if(isHrmMenu) {
hrmMenu.BPM.value = hrm.bpm;
hrmMenu.Confidence.value = hrm.confidence + '%';
E.showMenu(hrmMenu);
}
});
// Update magnetometer
Bangle.on('mag', function(newMag) {
mag = newMag;
if(isMagMenu) {
magMenu.x.value = mag.x;
magMenu.y.value = mag.y;
magMenu.z.value = mag.z;
magMenu.Heading.value = mag.heading.toFixed(1);
E.showMenu(magMenu);
}
});
// On start: enable sensors and display main menu
g.clear();
Bangle.setBarometerPower(isBarEnabled, APP_ID);
Bangle.setGPSPower(isGpsEnabled, APP_ID);
Bangle.setHRMPower(isHrmEnabled, APP_ID);
Bangle.setCompassPower(isMagEnabled, APP_ID);
E.showMenu(mainMenu);

BIN
apps/sensible/sensible.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB