|
16 | 16 | #include <algorithm> |
17 | 17 | #include <array> |
18 | 18 | #include <chrono> |
19 | | -#include <string> |
20 | | -#include <vector> |
21 | 19 |
|
22 | 20 | namespace df |
23 | 21 | { |
24 | 22 | namespace |
25 | 23 | { |
26 | 24 | int const kPositionRoutingOffsetY = 104; |
27 | | -double const kMinSpeedThresholdMps = 2.8; // 10 km/h |
28 | | -double const kGpsBearingLifetimeSec = 5.0; |
| 25 | + |
| 26 | +// https://t.me/OrganicMapsRu/88317 |
| 27 | +double const kMinSpeedThresholdMps = 0.7; // for the pedestrian mode 2.5 km/h |
| 28 | +/// @todo Should depend on the _previous_ avg speed (say for the last 5 minutes). |
| 29 | +/// Bigger for cars (up to 30 seconds is ok, IMO) and lower for pedestrians. |
| 30 | +double const kGpsBearingLifetimeSec = 3.0; |
| 31 | + |
29 | 32 | double const kMaxTimeInBackgroundSec = 60.0 * 60 * 30; // 30 hours before starting detecting position again |
30 | 33 | double const kMaxNotFollowRoutingTimeSec = 20.0; |
31 | 34 | double const kMaxUpdateLocationInvervalSec = 30.0; |
@@ -529,16 +532,19 @@ void MyPositionController::LoseLocation() |
529 | 532 |
|
530 | 533 | void MyPositionController::OnCompassUpdate(location::CompassInfo const & info, ScreenBase const & screen) |
531 | 534 | { |
532 | | - double const oldAzimut = GetDrawableAzimut(); |
533 | 535 | m_isCompassAvailable = true; |
534 | 536 |
|
535 | | - bool const existsFreshGpsBearing = m_lastGPSBearingTimer.ElapsedSeconds() < kGpsBearingLifetimeSec; |
536 | | - if ((IsInRouting() && m_isArrowGluedInRouting) || existsFreshGpsBearing) |
| 537 | + if (m_isArrowGluedInRouting && IsInRouting()) |
537 | 538 | return; |
538 | 539 |
|
| 540 | + if (m_lastGPSBearingTimer.ElapsedSeconds() < kGpsBearingLifetimeSec) |
| 541 | + return; |
| 542 | + |
| 543 | + double const oldAzimut = GetDrawableAzimut(); |
| 544 | + |
539 | 545 | SetDirection(info.m_bearing); |
540 | 546 |
|
541 | | - if (m_isPositionAssigned && !AlmostCurrentAzimut(oldAzimut) && m_mode == location::FollowAndRotate) |
| 547 | + if (m_isPositionAssigned && m_mode == location::FollowAndRotate && !AlmostCurrentAzimut(oldAzimut)) |
542 | 548 | { |
543 | 549 | CreateAnim(GetDrawablePosition(), oldAzimut, screen); |
544 | 550 | m_isDirtyViewport = true; |
|
0 commit comments