Driving mode ("Drive": big buttons — follow, zoom, 2D/3D, night, route overview — the sidebar hidden); palettes instead of the inversion (the UI's greys onto --ui-*, MapLibre's controls too, night → Night, new ◑ Dusk); the navigated route magenta, the driven part dimmed; route progress only forward (locate near the last position first); rerouting on the server off its own GNSS (TripStore#follow), the browser's only without the shared trip; the overview map hidden while following in 3D; the topbar's items apart
This commit is contained in:
1 parent
12b4ac6725
commit
07a4d363ec
13 files changed
+520
-219
No files matched your search
@@ -395,21 +395,29 @@ module Maptool
|
||||
# the fix COURSE_MIN_M back when the receiver sends none — following
|
||||
# heading-up from behind (followPosition, gnss.js) turns by it.
|
||||
def self.gnss_update(gnss, at: Time.now.to_f)
|
||||
GNSS_LATEST_MUTEX.synchronize do
|
||||
fix = GNSS_LATEST_MUTEX.synchronize do
|
||||
GNSS_LATEST.merge!(gnss)
|
||||
next unless gnss.key?(:lat) || gnss.key?(:lon)
|
||||
|
||||
GNSS_LATEST[:received_at] = at
|
||||
next if gnss.key?(:track)
|
||||
|
||||
position = GNSS_LATEST.values_at(:lon, :lat)
|
||||
from = GNSS_LATEST[:course_from]
|
||||
if from.nil? || (GNSS_LATEST[:speed] || 0) < COURSE_MIN_SPEED
|
||||
GNSS_LATEST[:course_from] = position
|
||||
elsif GnssSim.meters(from, position) >= COURSE_MIN_M
|
||||
GNSS_LATEST[:track] = GnssSim.bearing(from, position).round(1)
|
||||
GNSS_LATEST[:course_from] = position
|
||||
unless gnss.key?(:track)
|
||||
position = GNSS_LATEST.values_at(:lon, :lat)
|
||||
from = GNSS_LATEST[:course_from]
|
||||
if from.nil? || (GNSS_LATEST[:speed] || 0) < COURSE_MIN_SPEED
|
||||
GNSS_LATEST[:course_from] = position
|
||||
elsif GnssSim.meters(from, position) >= COURSE_MIN_M
|
||||
GNSS_LATEST[:track] = GnssSim.bearing(from, position).round(1)
|
||||
GNSS_LATEST[:course_from] = position
|
||||
end
|
||||
end
|
||||
GNSS_LATEST.dup
|
||||
end
|
||||
return unless fix && fix[:lat] && fix[:lon]
|
||||
|
||||
# off the shared trip's route: routed again from here (TripStore#follow)
|
||||
|
||||
TRIP_STORE.follow([fix[:lon], fix[:lat]], speed: fix[:speed], hdop: fix[:hdop]) do |locations, vehicle, avoid|
|
||||
Routing.route(VALHALLA_URL, locations, Routing.vehicle(DATA_DIR, vehicle), avoid.transform_keys(&:to_s))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user