Merge pull request #429 from nebbishhacker/gbridge-battery

Report battery status to Gadgetbridge more often
master
Gordon Williams 2020-05-18 13:06:51 +01:00 committed by GitHub
commit 0df077db55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -95,7 +95,7 @@
{ "id": "gbridge",
"name": "Gadgetbridge",
"icon": "app.png",
"version":"0.10",
"version":"0.11",
"description": "The default notification handler for Gadgetbridge notifications from Android",
"tags": "tool,system,android,widget",
"type":"widget",

View File

@ -9,3 +9,4 @@
0.08: Don't turn on LCD at start of every song
0.09: Update Bluetooth connection state automatically
0.10: Make widget play well with other Gadgetbridge widgets/apps
0.11: Report battery status on connect and at regular intervals

View File

@ -13,6 +13,7 @@
};
function gbSend(message) {
Bluetooth.println("");
Bluetooth.println(JSON.stringify(message));
}
@ -196,5 +197,11 @@
WIDGETS["gbridgew"] = { area: "tl", width: 24, draw: draw };
gbSend({ t: "status", bat: E.getBattery() });
function sendBattery() {
gbSend({ t: "status", bat: E.getBattery() });
}
NRF.on("connect", () => setTimeout(sendBattery, 2000));
setInterval(sendBattery, 10*60*1000);
sendBattery();
})();