Merge branch 'espruino:master' into master

master
awkirk71 2022-09-29 23:45:15 +01:00 committed by GitHub
commit f13be33ffb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 28 additions and 22 deletions

View File

@ -1,2 +1,4 @@
0.01: First, proof of concept
0.02: Load AGPS data on app start and automatically in background
0.03: Do not load AGPS data on boot
Increase minimum interval to 6 hours

View File

@ -16,13 +16,6 @@
}
if (settings.enabled) {
let lastUpdate = settings.lastUpdate;
if (!lastUpdate || lastUpdate + settings.refresh * 1000 * 60 < Date.now()){
if (!waiting){
waiting = true;
require("agpsdata").pull(successCallback, errorCallback);
}
}
setInterval(() => {
if (!waiting && NRF.getSecurityStatus().connected){
waiting = true;

View File

@ -2,7 +2,7 @@
"name": "A-GPS Data Downloader App",
"shortName":"A-GPS Data",
"icon": "agpsdata.png",
"version":"0.02",
"version":"0.03",
"description": "Once installed, this app allows you to download assisted GPS (A-GPS) data directly to your Bangle.js **via Gadgetbridge on an Android phone** when you run the app. If you just want to upload the latest AGPS data from this app loader, please use the `Assisted GPS Update (AGPS)` app.",
"tags": "boot,tool,assisted,gps,agps,http",
"allow_emulator":true,

View File

@ -35,7 +35,7 @@ function buildMainMenu() {
},
"Refresh every" : {
value : settings.refresh / 60,
min : 1,
min : 6,
max : 168,
step : 1,
format : v => v + "h",

View File

@ -13,3 +13,4 @@
0.13: Added Bangle.http function (see Readme file for more info)
0.14: Fix timeout of http function not being cleaned up
0.15: Allow method/body/headers to be specified for `http` (needs Gadgetbridge 0.68.0b or later)
0.16: Bangle.http now fails immediately if there is no Bluetooth connection (fix #2152)

View File

@ -139,6 +139,8 @@
// options = {id,timeout,xpath}
Bangle.http = (url,options)=>{
options = options||{};
if (!NRF.getSecurityStatus().connected)
return Promise.reject("Not connected to Bluetooth");
if (Bangle.httpRequest === undefined)
Bangle.httpRequest={};
if (options.id === undefined) {

View File

@ -2,7 +2,7 @@
"id": "android",
"name": "Android Integration",
"shortName": "Android",
"version": "0.15",
"version": "0.16",
"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",

2
apps/powersave/ChangeLog Normal file
View File

@ -0,0 +1,2 @@
0.01: Initial release
0.02: Removed accelerometer poll interval adjustment, fixed a few issues with detecting the current app

View File

@ -6,7 +6,6 @@ Save your watch's battery power by halting foreground app execution while the sc
- Stops foreground app processes
- Background processes still run
- Clears screen
- Decreases accelerometer polls
- Foreground app is returned to when screen is turned back on (app state is not preserved)
## Controls
@ -14,7 +13,6 @@ Save your watch's battery power by halting foreground app execution while the sc
- Deactivates when screen is turned back on
## Warnings
- Due to an Espruino bug, this does not take affect immediately when installed. Switch apps for these features to take affect.
- This is not compatible with apps that need to run in the foreground even while the screen is off, such as most stopwatch apps and some health trackers.
- If you check your watch super often (like multiple times per minute), this may end of costing you more power than it saves since the app you are using will have to restart everytime you check it.

View File

@ -1,15 +1,20 @@
var Storage = Storage || require("Storage");
Bangle.on("lock", locked => {
if(locked){
g.clear().reset();
Bangle.setLCDBrightness(0);
Bangle.setPollInterval(1000);
load("powersave.screen.js");
}else{
load(Storage.read("resumeaftersleep") || JSON.parse(Storage.read("setting.json")).clock);
const data = JSON.parse(Storage.read("powersave.json") || Storage.read("setting.json"));
load(data.app || data.clock);
}
});
E.on("init", () => {
if(__FILE__ && __FILE__ !== "powersave.screen.js")
Storage.write("resumeaftersleep", __FILE__);
if("__FILE__" in global && __FILE__ !== "powersave.screen.js"){
Storage.write("powersave.json", {
app: __FILE__
});
}else{
Storage.write("powersave.json", {
app: null
});
}
});

View File

@ -1,7 +1,7 @@
{
"id": "powersave",
"name": "Power Save",
"version": "0.01",
"version": "0.02",
"description": "Halts foreground app execution while screen is off while still allowing background processes.",
"readme": "README.md",
"icon": "powersave.png",
@ -11,5 +11,8 @@
"storage": [
{"name":"powersave.boot.js","url":"boot.js"},
{"name":"powersave.screen.js","url":"boot.js"}
],
"data": [
{"name": "powersave.json"}
]
}

View File

@ -1,7 +1,7 @@
var Storage = Storage || require("Storage");
g.clear();
Bangle.setLCDBrightness(0);
Bangle.setPollInterval(1000);
if(!Bangle.isLocked()){
load(Storage.read("resumeaftersleep") || JSON.parse(Storage.read("setting.json")).clock);
var Storage = Storage || require("Storage");
const data = JSON.parse(Storage.read("powersave.json") || Storage.read("setting.json"));
load(data.app || data.clock);
}