android 0.36: Move from wrapper function to {} and let - faster execution at boot

pull/3436/head
Gordon Williams 2024-05-24 09:02:32 +01:00
parent f29ae079d7
commit f6289804d6
3 changed files with 12 additions and 11 deletions

View File

@ -35,3 +35,4 @@
0.33: Fix alarms created in Gadgetbridge not repeating
0.34: Implement API for activity tracks fetching (Recorder app logs).
0.35: Implement API to enable/disable acceleration data tracking.
0.36: Move from wrapper function to {} and let - faster execution at boot

View File

@ -1,22 +1,22 @@
/* global GB */
(function() {
function gbSend(message) {
{
let gbSend = function(message) {
Bluetooth.println("");
Bluetooth.println(JSON.stringify(message));
}
var lastMsg; // for music messages - may not be needed now...
var actInterval; // Realtime activity reporting interval when `act` is true
var actHRMHandler; // For Realtime activity reporting
var gpsState = {}; // keep information on GPS via Gadgetbridge
let lastMsg; // for music messages - may not be needed now...
let actInterval; // Realtime activity reporting interval when `act` is true
let actHRMHandler; // For Realtime activity reporting
let gpsState = {}; // keep information on GPS via Gadgetbridge
// 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
if (settings.rp == undefined) settings.rp = true;
if (settings.as == undefined) settings.as = true;
if (settings.vibrate == undefined) settings.vibrate = "..";
require('Storage').writeJSON("android.settings.json", settings);
var _GB = global.GB;
let _GB = global.GB;
let fetchRecInterval;
global.GB = (event) => {
// feed a copy to other handlers if there were any
@ -337,7 +337,7 @@
};
// 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);
NRF.on("connect", () => setTimeout(function() {
sendBattery();
@ -432,4 +432,4 @@
// remove settings object so it's not taking up RAM
delete settings;
})();
}

View File

@ -2,7 +2,7 @@
"id": "android",
"name": "Android Integration",
"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.",
"icon": "app.png",
"tags": "tool,system,messages,notifications,gadgetbridge",