Merge pull request #359 from msdeibel/master

Enable bluetooth logging and graphing
pull/361/head
Gordon Williams 2020-04-28 10:40:56 +01:00 committed by GitHub
commit 23c5ea3829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 20 deletions

View File

@ -1254,7 +1254,7 @@
"name": "Battery Chart", "name": "Battery Chart",
"shortName":"Battery Chart", "shortName":"Battery Chart",
"icon": "app.png", "icon": "app.png",
"version":"0.08", "version":"0.09",
"readme": "README.md", "readme": "README.md",
"description": "A widget and an app for recording and visualizing battery percentage over time.", "description": "A widget and an app for recording and visualizing battery percentage over time.",
"tags": "app,widget,battery,time,record,chart,tool", "tags": "app,widget,battery,time,record,chart,tool",

View File

@ -6,3 +6,4 @@
0.06: Fixes widget events and charting of component states 0.06: Fixes widget events and charting of component states
0.07: Improve logging and charting of component states and add widget icon 0.07: Improve logging and charting of component states and add widget icon
0.08: Fix for Home button in the app and README added. 0.08: Fix for Home button in the app and README added.
0.09: Fix failing dismissal of Gadgetbridge notifications, record (coarse) bluetooth state

View File

@ -8,7 +8,7 @@ const GraphXMax = GraphXZero + MaxValueCount;
const GraphLcdY = GraphYZero + 10; const GraphLcdY = GraphYZero + 10;
const GraphCompassY = GraphYZero + 16; const GraphCompassY = GraphYZero + 16;
// const GraphBluetoothY = GraphYZero + 22; const GraphBluetoothY = GraphYZero + 22;
const GraphGpsY = GraphYZero + 28; const GraphGpsY = GraphYZero + 28;
const GraphHrmY = GraphYZero + 34; const GraphHrmY = GraphYZero + 34;
@ -175,13 +175,13 @@ function renderData(dataArray) {
g.drawLine(GraphXZero + i, GraphCompassY, GraphXZero + i, GraphCompassY + 1); g.drawLine(GraphXZero + i, GraphCompassY, GraphXZero + i, GraphCompassY + 1);
} }
// // Bluetooth state // Bluetooth state
// if (switchables & switchableConsumers.lcd == switchableConsumers.lcd) { if (parseInt(dataInfo[switchabelsIndex]) & switchableConsumers.bluetooth) {
// g.setColor(0, 0, 1); g.setColor(0, 0, 1);
// g.setFontAlign(1, -1, 0); g.setFontAlign(1, -1, 0);
// g.drawString("BLE", GraphXZero - GraphMarkerOffset, GraphBluetoothY - 2, true); g.drawString("BLE", GraphXZero - GraphMarkerOffset, GraphBluetoothY - 2, true);
// g.drawLine(GraphXZero + i, GraphBluetoothY, GraphXZero + i, GraphBluetoothY + 1); g.drawLine(GraphXZero + i, GraphBluetoothY, GraphXZero + i, GraphBluetoothY + 1);
// } }
// Gps state // Gps state
if (parseInt(dataInfo[switchabelsIndex]) & switchableConsumers.gps) { if (parseInt(dataInfo[switchabelsIndex]) & switchableConsumers.gps) {

View File

@ -71,8 +71,10 @@
enabledConsumers = enabledConsumers | switchableConsumers.gps; enabledConsumers = enabledConsumers | switchableConsumers.gps;
if (hrmEventReceived) if (hrmEventReceived)
enabledConsumers = enabledConsumers | switchableConsumers.hrm; enabledConsumers = enabledConsumers | switchableConsumers.hrm;
//if (Bangle.isBluetoothOn())
// enabledConsumers = enabledConsumers | switchableConsumers.bluetooth; // Very coarse first approach to check if the BLE device is on.
if (NRF.getSecurityStatus().connected)
enabledConsumers = enabledConsumers | switchableConsumers.bluetooth;
// Reset the event registration vars // Reset the event registration vars
compassEventReceived = false; compassEventReceived = false;
@ -110,19 +112,14 @@
} }
function reload() { function reload() {
WIDGETS.batchart.width = 24; WIDGETS["batchart"].width = 24;
recordingInterval = setInterval(logBatteryData, recordingInterval10Min); recordingInterval = setInterval(logBatteryData, recordingInterval10Min);
logBatteryData();
} }
// add the widget // add the widget
WIDGETS.batchart = { WIDGETS["batchart"] = {
area: "tl", width: 24, draw: draw, reload: function () { area: "tl", width: 24, draw: draw, reload: reload
reload();
Bangle.drawWidgets();
}
}; };
reload(); reload();