gipy: powersaving changes + fix for heights
parent
cf0695c3eb
commit
1aa7a4d7b5
|
|
@ -105,3 +105,5 @@
|
|||
* Removed 'lost' indicator (we now change position to purple when lost)
|
||||
* Powersaving fix : don't powersave when lost
|
||||
* Bugfix for negative remaining distance when going backwards
|
||||
* New settings for powersaving
|
||||
* Adjustments to powersaving algorithm
|
||||
|
|
|
|||
|
|
@ -109,9 +109,11 @@ Colors correspond to slopes.
|
|||
|
||||
Few settings for now (feel free to suggest me more) :
|
||||
|
||||
- lost distance : at which distance from path are you considered to be lost ?
|
||||
- buzz on turns : should the watch buzz when reaching a waypoint ?
|
||||
- disable bluetooth : turn bluetooth off completely to try to save some power.
|
||||
- lost distance : at which distance from path are you considered to be lost ?
|
||||
- wake-up speed : if you drive below this speed powersaving will disable itself
|
||||
- active-time : how long (in seconds) the screen should be turned on if activated before going back to sleep.
|
||||
- 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.
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ let s = require("Storage");
|
|||
var settings = Object.assign(
|
||||
{
|
||||
lost_distance: 50,
|
||||
wake_up_speed: 13,
|
||||
active_time: 10,
|
||||
brightness: 0.5,
|
||||
buzz_on_turns: false,
|
||||
disable_bluetooth: true,
|
||||
|
|
@ -692,7 +694,7 @@ class Status {
|
|||
if (!this.active || !powersaving) {
|
||||
return;
|
||||
}
|
||||
if (getTime() - this.last_activity > 30) {
|
||||
if (getTime() - this.last_activity > settings.active_time) {
|
||||
this.active = false;
|
||||
Bangle.setLCDBrightness(0);
|
||||
if (settings.power_lcd_off) {
|
||||
|
|
@ -772,13 +774,13 @@ class Status {
|
|||
if (in_menu) {
|
||||
return;
|
||||
}
|
||||
if (this.instant_speed * 3.6 < 13) {
|
||||
if (this.instant_speed * 3.6 < settings.wake_up_speed) {
|
||||
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: 10000,
|
||||
lockTimeout: 0,
|
||||
backlightTimeout: 10000,
|
||||
wakeOnTwist: true,
|
||||
powerSave: true,
|
||||
|
|
@ -798,7 +800,6 @@ class Status {
|
|||
wakeOnTouch: true,
|
||||
powerSave: false,
|
||||
});
|
||||
Bangle.setPollInterval(2000); // disable accelerometer as much as we can (a value of 4000 seem to cause hard reboot crashes (segfaults ?) so keep 2000)
|
||||
}
|
||||
}
|
||||
this.check_activity(); // if we don't move or are in menu we should stay on
|
||||
|
|
@ -879,8 +880,10 @@ class Status {
|
|||
// }, time_to_next_point);
|
||||
// }
|
||||
// }
|
||||
if (this.reaching != next_point && this.distance_to_next_point <= 100) {
|
||||
if (this.distance_to_next_point <= 100) {
|
||||
this.activate();
|
||||
}
|
||||
if (this.reaching != next_point && this.distance_to_next_point <= 100) {
|
||||
this.reaching = next_point;
|
||||
let reaching_waypoint = this.path.is_waypoint(next_point);
|
||||
if (reaching_waypoint) {
|
||||
|
|
@ -1029,8 +1032,8 @@ class Status {
|
|||
let distance_per_pixel = displayed_length / graph_width;
|
||||
|
||||
let start_point_index = 0;
|
||||
let end_point_index = this.remaining_distances.length - 1;
|
||||
for (let i = 0; i < this.remaining_distances.length; i++) {
|
||||
let end_point_index = this.path.len - 1;
|
||||
for (let i = 0; i < this.path.len; i++) {
|
||||
let point_distance = path_length - this.remaining_distances[i];
|
||||
if (point_distance <= display_start) {
|
||||
start_point_index = i;
|
||||
|
|
@ -1040,6 +1043,7 @@ class Status {
|
|||
break;
|
||||
}
|
||||
}
|
||||
end_point_index = Math.min(end_point_index+1, this.path.len -1);
|
||||
let max_height = Number.NEGATIVE_INFINITY;
|
||||
let min_height = Number.POSITIVE_INFINITY;
|
||||
for (let i = start_point_index; i <= end_point_index; i++) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
// Load settings
|
||||
var settings = Object.assign({
|
||||
lost_distance: 50,
|
||||
wake_up_speed: 13,
|
||||
active_time: 10,
|
||||
buzz_on_turns: false,
|
||||
disable_bluetooth: true,
|
||||
brightness: 0.5,
|
||||
|
|
@ -44,6 +46,24 @@
|
|||
writeSettings();
|
||||
},
|
||||
},
|
||||
"wake-up speed": {
|
||||
value: settings.wake_up_speed,
|
||||
min: 0,
|
||||
max: 30,
|
||||
onchange: (v) => {
|
||||
settings.wake_up_speed = v;
|
||||
writeSettings();
|
||||
},
|
||||
},
|
||||
"active time": {
|
||||
value: settings.active_time,
|
||||
min: 5,
|
||||
max: 60,
|
||||
onchange: (v) => {
|
||||
settings.active_time = v;
|
||||
writeSettings();
|
||||
},
|
||||
},
|
||||
"brightness": {
|
||||
value: settings.brightness,
|
||||
min: 0,
|
||||
|
|
|
|||
Loading…
Reference in New Issue