diff --git a/apps/gipy/ChangeLog b/apps/gipy/ChangeLog index 171df3254..e832918ea 100644 --- a/apps/gipy/ChangeLog +++ b/apps/gipy/ChangeLog @@ -118,7 +118,6 @@ 0.23: * New display algorithm : way faster, larger roads - * Removed the zoom-out option (incompatible with new display) * Better path simplification * Waypoints autodetection using the map * New option: sleep between waypoints diff --git a/apps/gipy/TODO b/apps/gipy/TODO index c24eca525..736870e75 100644 --- a/apps/gipy/TODO +++ b/apps/gipy/TODO @@ -2,9 +2,6 @@ urgent TODO: - update documentation to reflect new display -- update javascript to generate tiles at different scale -- update tile compression scheme to code coordinates on 4 points - both in rust and js code *** thoughts on lcd power *** diff --git a/apps/gipy/app.js b/apps/gipy/app.js index 99db37b3e..322cf0bb3 100644 --- a/apps/gipy/app.js +++ b/apps/gipy/app.js @@ -1,4 +1,4 @@ -let simulated = true; +let simulated = false; let displaying = false; let in_menu = false; let go_backwards = false; @@ -379,8 +379,11 @@ class Status { this.screen = MAP; this.on_path = true; // are we on the path or lost ? this.position = null; // where we are - this.adjusted_cos_direction = 1; // cos of where we look at - this.adjusted_sin_direction = 0; // sin of where we look at + this.direction = 0; + this.adjusted_cos_direction = Math.cos(- Math.PI / 2.0); + this.adjusted_sin_direction = Math.sin(- Math.PI / 2.0); + this.zoomed_in = false; + this.current_segment = null; // which segment is closest this.reaching = null; // which waypoint are we reaching ? this.distance_to_next_point = null; // how far are we from next point ? @@ -714,7 +717,8 @@ class Status { if (cached_img === undefined) { console.log("loading", absolute_tile_x, absolute_tile_y); let img = this.compute_tile_image(absolute_tile_x, absolute_tile_y); - if (this.images_cache.length > 12) { + let limit = (this.zoomed_in)?12:30; + if (this.images_cache.length > limit) { this.images_cache.shift(); } this.images_cache.push({ @@ -731,8 +735,9 @@ class Status { compute_tile_image(absolute_tile_x, absolute_tile_y) { let screen_width = g.getWidth(); let screen_height = g.getHeight(); + let tiles_per_diagonals = (this.zoomed_in)?3:5; let img_side = Math.ceil( - Math.sqrt(screen_width * screen_width + screen_height * screen_height) / 3 + Math.sqrt(screen_width * screen_width + screen_height * screen_height) / tiles_per_diagonals ); let img = Graphics.createArrayBuffer(img_side, img_side, 4, { msb: true }); @@ -762,16 +767,18 @@ class Status { let absolute_tile_x = Math.floor(tile_x_coord); let absolute_tile_y = Math.floor(tile_y_coord); + let tiles_per_diagonals = (this.zoomed_in)?3:5; let diagonal = Math.ceil( Math.sqrt(g.getWidth() * g.getWidth() + g.getHeight() * g.getHeight()) / - 3 + tiles_per_diagonals ); let angle = this.direction - Math.PI / 2; let cos_direction = Math.cos(angle); let sin_direction = Math.sin(angle); + let d = Math.floor(tiles_per_diagonals/2); - for (let x = -1; x < 2; x++) { - for (let y = -1; y < 2; y++) { + for (let x = -d; x <= d; x++) { + for (let y = -d; y <= d; y++) { let img = this.tile_image(absolute_tile_x + x, absolute_tile_y + y); let screen_x = (absolute_tile_x + x + 0.5 - tile_x_coord) * diagonal; @@ -1399,6 +1406,14 @@ function start_gipy(path, maps, interests, heights) { go_backwards = v; }, }, + Zoom: { + value: status.zoomed_in, + format: (v) => (v ? "In" : "Out"), + onchange: (v) => { + status.images_cache = []; + status.zoomed_in = v; + }, + }, /*LANG*/ powersaving: { value: powersaving, diff --git a/apps/gipy/pkg/gps.d.ts b/apps/gipy/pkg/gps.d.ts index 508c1241c..11cdf371b 100644 --- a/apps/gipy/pkg/gps.d.ts +++ b/apps/gipy/pkg/gps.d.ts @@ -79,11 +79,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 wasm_bindgen__convert__closures__invoke1_mut__h5714a79bfce40603: (a: number, b: number, c: number) => void; + readonly wasm_bindgen__convert__closures__invoke1_mut__hef038f7a61abd0f6: (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__h678a030e96622358: (a: number, b: number, c: number, d: number) => void; + readonly wasm_bindgen__convert__closures__invoke2_mut__h545ed49cfafdda52: (a: number, b: number, c: number, d: number) => void; } export type SyncInitInput = BufferSource | WebAssembly.Module; diff --git a/apps/gipy/pkg/gps_bg.wasm b/apps/gipy/pkg/gps_bg.wasm index 1a6412aa9..47d190458 100644 Binary files a/apps/gipy/pkg/gps_bg.wasm and b/apps/gipy/pkg/gps_bg.wasm differ diff --git a/apps/gipy/pkg/gps_bg.wasm.d.ts b/apps/gipy/pkg/gps_bg.wasm.d.ts index a1613fa14..dbf30308b 100644 --- a/apps/gipy/pkg/gps_bg.wasm.d.ts +++ b/apps/gipy/pkg/gps_bg.wasm.d.ts @@ -14,8 +14,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 wasm_bindgen__convert__closures__invoke1_mut__h5714a79bfce40603(a: number, b: number, c: number): void; +export function wasm_bindgen__convert__closures__invoke1_mut__hef038f7a61abd0f6(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__h678a030e96622358(a: number, b: number, c: number, d: number): void; +export function wasm_bindgen__convert__closures__invoke2_mut__h545ed49cfafdda52(a: number, b: number, c: number, d: number): void;