gipy: powersaving disabled by default + setting

you can enable it by default in the settings
master
frederic wagner 2023-09-21 11:32:39 +02:00
parent e1f57fca92
commit 88f45b6714
3 changed files with 23 additions and 9 deletions

View File

@ -121,11 +121,15 @@ Few settings for now (feel free to suggest me more) :
- brightness : how bright should screen be ? (by default 0.5, again saving power)
- power lcd off (disabled by default): turn lcd off when inactive to save power. the watch will wake up when reaching points,
when you touch the screen and when speed is below 13km/h.
- powersave by default: when gipy starts is powersaving activated ? (see below)
### Powersaving
Starting with release 0.20 we experiment with power saving.
By default, powersaving is **disabled**. You can turn it on in the menu by checking the powersaving box.
You can also change the default choice in the app settings (*powersave by default* setting).
There are now two display modes :
- active : the screen is lit back (default at 50% light but can be configured with the *brightness* setting)
@ -140,6 +144,7 @@ Activation events are the following :
- you are near (< 100m) the next point on path
- you are slow (< *wake-up speed* setting (13 km/h by default))
- you are lost
- you press the button / touch the screen

View File

@ -3,9 +3,10 @@ let displaying = false;
let in_menu = false;
let go_backwards = false;
let zoomed = true;
let powersaving = true;
let status;
let initial_options = Bangle.getOptions();
let interests_colors = [
0xffff, // Waypoints, white
0xf800, // Bakery, red
@ -32,10 +33,13 @@ var settings = Object.assign(
buzz_on_turns: false,
disable_bluetooth: true,
power_lcd_off: false,
powersave_by_default: false,
},
s.readJSON("gipy.json", true) || {}
);
let powersaving = settings.powersave_by_default;
// let profile_start_times = [];
// function start_profiling() {
@ -678,6 +682,9 @@ class Status {
this.old_times = []; // the corresponding times
}
activate() {
if (!powersaving) {
return;
}
this.last_activity = getTime();
if (this.active) {
return;
@ -778,16 +785,10 @@ class Status {
this.activate(); // if we go too slow turn on, we might be looking for the direction to follow
if (!this.default_options) {
this.default_options = true;
Bangle.setOptions({
lockTimeout: 0,
backlightTimeout: 10000,
wakeOnTwist: true,
powerSave: true,
});
Bangle.setOptions(initial_options);
}
} else {
if (this.default_options) {
if (this.default_options && powersaving) {
this.default_options = false;
Bangle.setOptions({

View File

@ -9,6 +9,7 @@
disable_bluetooth: true,
brightness: 0.5,
power_lcd_off: false,
powersave_by_default: false,
},
require("Storage").readJSON(FILE, true) || {}
);
@ -82,5 +83,12 @@
writeSettings();
}
},
"powersave by default": {
value: settings.powersave_by_default == true,
onchange: (v) => {
settings.powersave_by_default = v;
writeSettings();
}
}
});
});