Fix for negative coordinates

master
frederic wagner 2023-07-05 15:42:47 +02:00
parent dd692187f7
commit 1c40c44d7e
7 changed files with 90 additions and 81 deletions

View File

@ -87,3 +87,8 @@
* Reduce framerate if locked
* Stroke to move around in the map
* Fix for missing paths in display
0.20:
* Large display for instant speed
* Bugfix for negative coordinates
* Disable menu while the map is not loaded

View File

@ -1,19 +1,15 @@
+ disable backlight during day ?
+ put back foot only ways
+ disable bluetooth
+ disable lcd completely
+ try fiddling with jit
+ put back street names
+ put back shortest paths but with points cache this time and jit
+ how to display paths from shortest path ?
misc:
+ use Bangle.project(latlong)
* additional features
- config screen
- are we on foot (and should use compass)
- we need to buzz 200m before sharp turns (or even better, 30seconds)
(and look at more than next point)
- display distance to next water/toilet ?
- display scale (100m)
- compress path ?
* misc
- code is becoming messy

View File

@ -152,7 +152,7 @@ class Map {
color_array[2] / 255,
];
offset += 3;
this.first_tile = Uint32Array(buffer, offset, 2); // absolute tile id of first tile
this.first_tile = Int32Array(buffer, offset, 2); // absolute tile id of first tile
offset += 2 * 4;
this.grid_size = Uint32Array(buffer, offset, 2); // tiles width and height
offset += 2 * 4;
@ -471,7 +471,7 @@ class Map {
class Interests {
constructor(buffer, offset) {
this.first_tile = Uint32Array(buffer, offset, 2); // absolute tile id of first tile
this.first_tile = Int32Array(buffer, offset, 2); // absolute tile id of first tile
offset += 2 * 4;
this.grid_size = Uint32Array(buffer, offset, 2); // tiles width and height
offset += 2 * 4;
@ -971,12 +971,18 @@ class Status {
.drawString(
"" +
approximate_speed +
"km/h (in." +
approximate_instant_speed +
")",
"km/h",
0,
g.getHeight() - 15
);
g.setFont("6x8:3")
.setFontAlign(1, -1, 0)
.drawString(
""+approximate_instant_speed,
g.getWidth(),
g.getHeight() - 22
);
}
if (this.path === null || this.position === null) {
@ -1374,6 +1380,46 @@ function start_gipy(path, maps, interests) {
console.log("starting");
status = new Status(path, maps, interests);
setWatch(
function () {
if (in_menu) {
return;
}
in_menu = true;
const menu = {
"": { title: "choose action" },
"Go Backward": {
value: go_backwards,
format: (v) => (v ? "On" : "Off"),
onchange: (v) => {
go_backwards = v;
},
},
Zoom: {
value: zoomed,
format: (v) => (v ? "In" : "Out"),
onchange: (v) => {
status.invalidate_caches();
zoomed = v;
},
},
"back to map": function () {
in_menu = false;
E.showMenu();
g.clear();
g.flip();
if (status !== null) {
status.display();
}
},
};
E.showMenu(menu);
},
BTN1,
{ repeat: true }
);
if (status.path !== null) {
let start = status.path.point(0);
status.displayed_position = start;
@ -1455,44 +1501,6 @@ function start_gipy(path, maps, interests) {
}
}
setWatch(
function () {
if (in_menu) {
return;
}
in_menu = true;
const menu = {
"": { title: "choose action" },
"Go Backward": {
value: go_backwards,
format: (v) => (v ? "On" : "Off"),
onchange: (v) => {
go_backwards = v;
},
},
Zoom: {
value: zoomed,
format: (v) => (v ? "In" : "Out"),
onchange: (v) => {
status.invalidate_caches();
zoomed = v;
},
},
"back to map": function () {
in_menu = false;
E.showMenu();
g.clear();
g.flip();
if (status !== null) {
status.display();
}
},
};
E.showMenu(menu);
},
BTN1,
{ repeat: true }
);
let files = s.list(".gps");
if (files.length <= 1) {

View File

@ -67,11 +67,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__hab13c10d53cd1c5a: (a: number, b: number, c: number) => void;
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb2f4d39a212d7d1: (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__h26ce002f44a5439b: (a: number, b: number, c: number, d: number) => void;
readonly wasm_bindgen__convert__closures__invoke2_mut__h362f82c7669db137: (a: number, b: number, c: number, d: number) => void;
}
export type SyncInitInput = BufferSource | WebAssembly.Module;

View File

@ -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__hab13c10d53cd1c5a(arg0, arg1, addHeapObject(arg2));
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb2f4d39a212d7d1(arg0, arg1, addHeapObject(arg2));
}
function _assertClass(instance, klass) {
@ -369,7 +369,7 @@ function handleError(f, args) {
}
}
function __wbg_adapter_84(arg0, arg1, arg2, arg3) {
wasm.wasm_bindgen__convert__closures__invoke2_mut__h26ce002f44a5439b(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
wasm.wasm_bindgen__convert__closures__invoke2_mut__h362f82c7669db137(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
}
/**
@ -460,6 +460,21 @@ function getImports() {
const ret = getObject(arg0).fetch(getObject(arg1));
return addHeapObject(ret);
};
imports.wbg.__wbg_signal_31753ac644b25fbb = function(arg0) {
const ret = getObject(arg0).signal;
return addHeapObject(ret);
};
imports.wbg.__wbg_new_6396e586b56e1dff = function() { return handleError(function () {
const ret = new AbortController();
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_abort_064ae59cda5cd244 = function(arg0) {
getObject(arg0).abort();
};
imports.wbg.__wbg_newwithstrandinit_05d7180788420c40 = function() { return handleError(function (arg0, arg1, arg2) {
const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_new_2d0053ee81e4dd2a = function() { return handleError(function () {
const ret = new Headers();
return addHeapObject(ret);
@ -496,21 +511,6 @@ function getImports() {
const ret = getObject(arg0).text();
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_signal_31753ac644b25fbb = function(arg0) {
const ret = getObject(arg0).signal;
return addHeapObject(ret);
};
imports.wbg.__wbg_new_6396e586b56e1dff = function() { return handleError(function () {
const ret = new AbortController();
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_abort_064ae59cda5cd244 = function(arg0) {
getObject(arg0).abort();
};
imports.wbg.__wbg_newwithstrandinit_05d7180788420c40 = function() { return handleError(function (arg0, arg1, arg2) {
const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
const ret = new Error();
return addHeapObject(ret);
@ -675,8 +675,8 @@ function getImports() {
const ret = wasm.memory;
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper2298 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 260, __wbg_adapter_24);
imports.wbg.__wbindgen_closure_wrapper2245 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 267, __wbg_adapter_24);
return addHeapObject(ret);
};

Binary file not shown.

View File

@ -12,8 +12,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__hab13c10d53cd1c5a(a: number, b: number, c: number): void;
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb2f4d39a212d7d1(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__h26ce002f44a5439b(a: number, b: number, c: number, d: number): void;
export function wasm_bindgen__convert__closures__invoke2_mut__h362f82c7669db137(a: number, b: number, c: number, d: number): void;