forked from FOSS/BangleApps
commit
d5b42abd89
|
@ -107,3 +107,11 @@
|
|||
* Bugfix for negative remaining distance when going backwards
|
||||
* New settings for powersaving
|
||||
* Adjustments to powersaving algorithm
|
||||
|
||||
0.22:
|
||||
* Powersaving disabled by default
|
||||
* Default choice for powersaving in the settings
|
||||
* Better position in elevation profiles
|
||||
* Integrating fixes in upstream rust heatshrink crate
|
||||
* Small path optimisations with brouter (removing looplets)
|
||||
* Bugfix in nearest segment detection
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
@ -635,7 +639,7 @@ class Status {
|
|||
constructor(path, maps, interests, heights) {
|
||||
this.path = path;
|
||||
this.default_options = true; // do we still have default options ?
|
||||
this.active = false; // should we have screen on
|
||||
this.active = true; // should we have screen on
|
||||
this.last_activity = getTime();
|
||||
this.maps = maps;
|
||||
this.interests = interests;
|
||||
|
@ -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({
|
||||
|
@ -821,28 +822,24 @@ class Status {
|
|||
|
||||
if (this.path !== null) {
|
||||
// detect segment we are on now
|
||||
let res = this.path.nearest_segment(
|
||||
let next_segment = this.path.nearest_segment(
|
||||
this.displayed_position,
|
||||
Math.max(0, this.current_segment - 1),
|
||||
Math.min(this.current_segment + 2, this.path.len - 1),
|
||||
cos_direction,
|
||||
sin_direction
|
||||
);
|
||||
let orientation = res[0];
|
||||
let next_segment = res[1];
|
||||
|
||||
if (this.is_lost(next_segment)) {
|
||||
// start_profiling();
|
||||
// it did not work, try anywhere
|
||||
res = this.path.nearest_segment(
|
||||
next_segment = this.path.nearest_segment(
|
||||
this.displayed_position,
|
||||
0,
|
||||
this.path.len - 1,
|
||||
cos_direction,
|
||||
sin_direction
|
||||
);
|
||||
orientation = res[0];
|
||||
next_segment = res[1];
|
||||
// end_profiling("repositioning");
|
||||
}
|
||||
// now check if we strayed away from path or back to it
|
||||
|
@ -864,7 +861,7 @@ class Status {
|
|||
this.current_segment = next_segment;
|
||||
|
||||
// check if we are nearing the next point on our path and alert the user
|
||||
let next_point = this.current_segment + (1 - orientation);
|
||||
let next_point = this.current_segment + (go_backwards ? 0 : 1);
|
||||
this.distance_to_next_point = Math.ceil(
|
||||
this.position.distance(this.path.point(next_point))
|
||||
);
|
||||
|
@ -965,11 +962,16 @@ class Status {
|
|||
}
|
||||
remaining_distance() {
|
||||
if (go_backwards) {
|
||||
return this.remaining_distances[0] - this.remaining_distances[this.current_segment] +
|
||||
this.position.distance(this.path.point(this.current_segment));
|
||||
return (
|
||||
this.remaining_distances[0] -
|
||||
this.remaining_distances[this.current_segment] +
|
||||
this.position.distance(this.path.point(this.current_segment))
|
||||
);
|
||||
} else {
|
||||
return this.remaining_distances[this.current_segment + 1] +
|
||||
this.position.distance(this.path.point(this.current_segment + 1));
|
||||
return (
|
||||
this.remaining_distances[this.current_segment + 1] +
|
||||
this.position.distance(this.path.point(this.current_segment + 1))
|
||||
);
|
||||
}
|
||||
}
|
||||
// check if we are lost (too far from segment we think we are on)
|
||||
|
@ -999,12 +1001,12 @@ class Status {
|
|||
} else {
|
||||
let current_position = 0;
|
||||
if (this.current_segment !== null) {
|
||||
if (go_backwards) {
|
||||
current_position = this.remaining_distance();
|
||||
} else {
|
||||
current_position =
|
||||
this.remaining_distances[0] - this.remaining_distance();
|
||||
}
|
||||
this.remaining_distances[0] -
|
||||
(this.remaining_distances[this.current_segment + 1] +
|
||||
this.projected_point.distance(
|
||||
this.path.point(this.current_segment + 1)
|
||||
));
|
||||
}
|
||||
if (this.screen == HEIGHTS_FULL) {
|
||||
this.display_heights(0, current_position, this.remaining_distances[0]);
|
||||
|
@ -1043,7 +1045,7 @@ class Status {
|
|||
break;
|
||||
}
|
||||
}
|
||||
end_point_index = Math.min(end_point_index+1, this.path.len -1);
|
||||
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++) {
|
||||
|
@ -1454,7 +1456,7 @@ class Path {
|
|||
}
|
||||
|
||||
// return index of segment which is nearest from point.
|
||||
// we need a direction because we need there is an ambiguity
|
||||
// we need a direction because there is an ambiguity
|
||||
// for overlapping segments which are taken once to go and once to come back.
|
||||
// (in the other direction).
|
||||
nearest_segment(point, start, end, cos_direction, sin_direction) {
|
||||
|
@ -1471,7 +1473,7 @@ class Path {
|
|||
|
||||
let dot =
|
||||
cos_direction * (p2.lon - p1.lon) + sin_direction * (p2.lat - p1.lat);
|
||||
let orientation = +(dot < 0); // index 0 is good orientation
|
||||
let orientation = +(dot < 0); // index 0 is good orientation (if you go forward)
|
||||
if (distance <= mins[orientation]) {
|
||||
mins[orientation] = distance;
|
||||
indices[orientation] = i - 1;
|
||||
|
@ -1480,12 +1482,13 @@ class Path {
|
|||
p1 = p2;
|
||||
}
|
||||
|
||||
// by default correct orientation (0) wins
|
||||
// by default correct orientation (0 forward, 1 backward) wins
|
||||
// but if other one is really closer, return other one
|
||||
if (mins[1] < mins[0] / 100.0) {
|
||||
return [1, indices[1]];
|
||||
let good_orientation = go_backwards ? 1 : 0;
|
||||
if (mins[1 - good_orientation] < mins[good_orientation] / 100.0) {
|
||||
return indices[1 - good_orientation];
|
||||
} else {
|
||||
return [0, indices[0]];
|
||||
return indices[good_orientation];
|
||||
}
|
||||
}
|
||||
get len() {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "gipy",
|
||||
"name": "Gipy",
|
||||
"shortName": "Gipy",
|
||||
"version": "0.21",
|
||||
"version": "0.22",
|
||||
"description": "Follow gpx files using the gps. Don't get lost in your bike trips and hikes.",
|
||||
"allow_emulator":false,
|
||||
"icon": "gipy.png",
|
||||
|
|
|
@ -73,11 +73,11 @@ export interface InitOutput {
|
|||
readonly __wbindgen_malloc: (a: number) => number;
|
||||
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
||||
readonly __wbindgen_export_2: WebAssembly.Table;
|
||||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb15c13006e54cdd7: (a: number, b: number, c: number) => void;
|
||||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9f56e5d7ebbfdb61: (a: number, b: number, c: number) => void;
|
||||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
||||
readonly __wbindgen_free: (a: number, b: number) => void;
|
||||
readonly __wbindgen_exn_store: (a: number) => void;
|
||||
readonly wasm_bindgen__convert__closures__invoke2_mut__h4d77bafb1e69a027: (a: number, b: number, c: number, d: number) => void;
|
||||
readonly wasm_bindgen__convert__closures__invoke2_mut__h193105c6f054446a: (a: number, b: number, c: number, d: number) => void;
|
||||
}
|
||||
|
||||
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
||||
|
|
|
@ -205,7 +205,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|||
return real;
|
||||
}
|
||||
function __wbg_adapter_24(arg0, arg1, arg2) {
|
||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb15c13006e54cdd7(arg0, arg1, addHeapObject(arg2));
|
||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9f56e5d7ebbfdb61(arg0, arg1, addHeapObject(arg2));
|
||||
}
|
||||
|
||||
function _assertClass(instance, klass) {
|
||||
|
@ -379,7 +379,7 @@ function handleError(f, args) {
|
|||
}
|
||||
}
|
||||
function __wbg_adapter_85(arg0, arg1, arg2, arg3) {
|
||||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h4d77bafb1e69a027(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
||||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h193105c6f054446a(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -440,6 +440,9 @@ async function load(module, imports) {
|
|||
function getImports() {
|
||||
const imports = {};
|
||||
imports.wbg = {};
|
||||
imports.wbg.__wbg_log_d04343b58be82b0f = function(arg0, arg1) {
|
||||
console.log(getStringFromWasm0(arg0, arg1));
|
||||
};
|
||||
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
||||
const obj = getObject(arg1);
|
||||
const ret = typeof(obj) === 'string' ? obj : undefined;
|
||||
|
@ -448,9 +451,6 @@ function getImports() {
|
|||
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
||||
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
||||
};
|
||||
imports.wbg.__wbg_log_d04343b58be82b0f = function(arg0, arg1) {
|
||||
console.log(getStringFromWasm0(arg0, arg1));
|
||||
};
|
||||
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
||||
takeObject(arg0);
|
||||
};
|
||||
|
@ -685,8 +685,8 @@ function getImports() {
|
|||
const ret = wasm.memory;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper2214 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 268, __wbg_adapter_24);
|
||||
imports.wbg.__wbindgen_closure_wrapper2230 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 264, __wbg_adapter_24);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
|
||||
|
|
Binary file not shown.
|
@ -13,8 +13,8 @@ export function gps_from_area(a: number, b: number, c: number, d: number): numbe
|
|||
export function __wbindgen_malloc(a: number): number;
|
||||
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
||||
export const __wbindgen_export_2: WebAssembly.Table;
|
||||
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb15c13006e54cdd7(a: number, b: number, c: number): void;
|
||||
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9f56e5d7ebbfdb61(a: number, b: number, c: number): void;
|
||||
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
||||
export function __wbindgen_free(a: number, b: number): void;
|
||||
export function __wbindgen_exn_store(a: number): void;
|
||||
export function wasm_bindgen__convert__closures__invoke2_mut__h4d77bafb1e69a027(a: number, b: number, c: number, d: number): void;
|
||||
export function wasm_bindgen__convert__closures__invoke2_mut__h193105c6f054446a(a: number, b: number, c: number, d: number): void;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue