mirror of https://github.com/espruino/BangleApps
android 0.36: Move from wrapper function to {} and let - faster execution at boot
parent
f29ae079d7
commit
f6289804d6
|
@ -35,3 +35,4 @@
|
||||||
0.33: Fix alarms created in Gadgetbridge not repeating
|
0.33: Fix alarms created in Gadgetbridge not repeating
|
||||||
0.34: Implement API for activity tracks fetching (Recorder app logs).
|
0.34: Implement API for activity tracks fetching (Recorder app logs).
|
||||||
0.35: Implement API to enable/disable acceleration data tracking.
|
0.35: Implement API to enable/disable acceleration data tracking.
|
||||||
|
0.36: Move from wrapper function to {} and let - faster execution at boot
|
|
@ -1,22 +1,22 @@
|
||||||
/* global GB */
|
/* global GB */
|
||||||
(function() {
|
{
|
||||||
function gbSend(message) {
|
let gbSend = function(message) {
|
||||||
Bluetooth.println("");
|
Bluetooth.println("");
|
||||||
Bluetooth.println(JSON.stringify(message));
|
Bluetooth.println(JSON.stringify(message));
|
||||||
}
|
}
|
||||||
var lastMsg; // for music messages - may not be needed now...
|
let lastMsg; // for music messages - may not be needed now...
|
||||||
var actInterval; // Realtime activity reporting interval when `act` is true
|
let actInterval; // Realtime activity reporting interval when `act` is true
|
||||||
var actHRMHandler; // For Realtime activity reporting
|
let actHRMHandler; // For Realtime activity reporting
|
||||||
var gpsState = {}; // keep information on GPS via Gadgetbridge
|
let gpsState = {}; // keep information on GPS via Gadgetbridge
|
||||||
|
|
||||||
// this settings var is deleted after this executes to save memory
|
// this settings var is deleted after this executes to save memory
|
||||||
var settings = require("Storage").readJSON("android.settings.json",1)||{};
|
let settings = require("Storage").readJSON("android.settings.json",1)||{};
|
||||||
//default alarm settings
|
//default alarm settings
|
||||||
if (settings.rp == undefined) settings.rp = true;
|
if (settings.rp == undefined) settings.rp = true;
|
||||||
if (settings.as == undefined) settings.as = true;
|
if (settings.as == undefined) settings.as = true;
|
||||||
if (settings.vibrate == undefined) settings.vibrate = "..";
|
if (settings.vibrate == undefined) settings.vibrate = "..";
|
||||||
require('Storage').writeJSON("android.settings.json", settings);
|
require('Storage').writeJSON("android.settings.json", settings);
|
||||||
var _GB = global.GB;
|
let _GB = global.GB;
|
||||||
let fetchRecInterval;
|
let fetchRecInterval;
|
||||||
global.GB = (event) => {
|
global.GB = (event) => {
|
||||||
// feed a copy to other handlers if there were any
|
// feed a copy to other handlers if there were any
|
||||||
|
@ -337,7 +337,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
// Battery monitor
|
// Battery monitor
|
||||||
function sendBattery() { gbSend({ t: "status", bat: E.getBattery(), chg: Bangle.isCharging()?1:0 }); }
|
let sendBattery = function() { gbSend({ t: "status", bat: E.getBattery(), chg: Bangle.isCharging()?1:0 }); }
|
||||||
Bangle.on("charging", sendBattery);
|
Bangle.on("charging", sendBattery);
|
||||||
NRF.on("connect", () => setTimeout(function() {
|
NRF.on("connect", () => setTimeout(function() {
|
||||||
sendBattery();
|
sendBattery();
|
||||||
|
@ -432,4 +432,4 @@
|
||||||
|
|
||||||
// remove settings object so it's not taking up RAM
|
// remove settings object so it's not taking up RAM
|
||||||
delete settings;
|
delete settings;
|
||||||
})();
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "android",
|
"id": "android",
|
||||||
"name": "Android Integration",
|
"name": "Android Integration",
|
||||||
"shortName": "Android",
|
"shortName": "Android",
|
||||||
"version": "0.35",
|
"version": "0.36",
|
||||||
"description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.",
|
"description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "tool,system,messages,notifications,gadgetbridge",
|
"tags": "tool,system,messages,notifications,gadgetbridge",
|
||||||
|
|
Loading…
Reference in New Issue