forked from FOSS/BangleApps
minor changes
parent
b28f8fdeed
commit
5147008f00
|
@ -48,5 +48,5 @@
|
|||
|
||||
0.13:
|
||||
* Bugfix in lost direction.
|
||||
* Trying buzzing on all turns (when locked only).
|
||||
* Buzzing 100m ahead instead of 50m.
|
||||
* Detect sharp turns.
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
- figure starting point
|
||||
|
||||
- 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 ?
|
||||
- dynamic map rescale
|
||||
|
|
|
@ -119,6 +119,8 @@ class Status {
|
|||
if (lost) {
|
||||
Bangle.buzz(); // we lost path
|
||||
setTimeout(() => Bangle.buzz(), 500);
|
||||
setTimeout(() => Bangle.buzz(), 1000);
|
||||
setTimeout(() => Bangle.buzz(), 1500);
|
||||
}
|
||||
this.on_path = !lost;
|
||||
}
|
||||
|
@ -143,8 +145,11 @@ class Status {
|
|||
if (this.reaching != next_point && this.distance_to_next_point <= 100) {
|
||||
this.reaching = next_point;
|
||||
let reaching_waypoint = this.path.is_waypoint(next_point);
|
||||
Bangle.buzz();
|
||||
if (reaching_waypoint) {
|
||||
Bangle.buzz();
|
||||
setTimeout(() => Bangle.buzz(), 500);
|
||||
setTimeout(() => Bangle.buzz(), 1000);
|
||||
setTimeout(() => Bangle.buzz(), 1500);
|
||||
if (Bangle.isLocked()) {
|
||||
Bangle.setLocked(false);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ use gpx::Gpx;
|
|||
mod osm;
|
||||
use osm::{parse_osm_data, InterestPoint};
|
||||
|
||||
const LOWER_SHARP_TURN: f64 = 45.0 * std::f64::consts::PI / 180.0;
|
||||
const UPPER_SHARP_TURN: f64 = std::f64::consts::PI * 2.0 - LOWER_SHARP_TURN;
|
||||
|
||||
const KEY: u16 = 47490;
|
||||
const FILE_VERSION: u16 = 3;
|
||||
|
||||
|
@ -633,8 +636,7 @@ fn detect_sharp_turns(path: &[Point], waypoints: &mut HashSet<Point>) {
|
|||
(adiff % std::f64::consts::PI, b)
|
||||
})
|
||||
.filter_map(|(adiff, b)| {
|
||||
let allowed = 4.0f64;
|
||||
if adiff > (90.0 - allowed).to_radians() && adiff < (90.0 + allowed).to_radians() {
|
||||
if adiff > LOWER_SHARP_TURN && adiff < UPPER_SHARP_TURN {
|
||||
Some(b)
|
||||
} else {
|
||||
None
|
||||
|
@ -694,5 +696,11 @@ async fn main() {
|
|||
)
|
||||
.unwrap();
|
||||
|
||||
save_gpc("test.gpc", &rp, &waypoints, &buckets).unwrap();
|
||||
save_gpc(
|
||||
Path::new(&input_file).with_extension("gpc"),
|
||||
&rp,
|
||||
&waypoints,
|
||||
&buckets,
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue