From 9d2e28e90190c4202a20e08ebac12df79ee95afd Mon Sep 17 00:00:00 2001 From: Chumva Date: Thu, 24 Oct 2019 17:02:02 +0300 Subject: [PATCH] Fix #7671 --- .../src/net/osmand/plus/helpers/WaypointHelper.java | 12 ++++++------ .../views/mapwidgets/RouteInfoWidgetsFactory.java | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java index a7a450c91a..2b806e2d6f 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java @@ -170,11 +170,11 @@ public class WaypointHelper { return found; } - public AlarmInfo getMostImportantAlarm(MetricsConstants mc, OsmandSettings.SpeedConstants sc, boolean showCameras) { + public AlarmInfo getMostImportantAlarm(OsmandSettings.SpeedConstants sc, boolean showCameras) { Location lastProjection = app.getRoutingHelper().getLastProjection(); float mxspeed = route.getCurrentMaxSpeed(); float delta = app.getSettings().SPEED_LIMIT_EXCEED.get() / 3.6f; - AlarmInfo speedAlarm = createSpeedAlarm(mc, sc, mxspeed, lastProjection, delta); + AlarmInfo speedAlarm = createSpeedAlarm(sc, mxspeed, lastProjection, delta); if (speedAlarm != null) { getVoiceRouter().announceSpeedAlarm(speedAlarm.getIntValue(), lastProjection.getSpeed()); } @@ -271,7 +271,7 @@ public class WaypointHelper { OsmandSettings.SpeedConstants sc, boolean showCameras) { float mxspeed = ro.getMaximumSpeed(ro.bearingVsRouteDirection(loc)); float delta = app.getSettings().SPEED_LIMIT_EXCEED.get() / 3.6f; - AlarmInfo speedAlarm = createSpeedAlarm(mc, sc, mxspeed, loc, delta); + AlarmInfo speedAlarm = createSpeedAlarm(sc, mxspeed, loc, delta); if (speedAlarm != null) { getVoiceRouter().announceSpeedAlarm(speedAlarm.getIntValue(), loc.getSpeed()); return speedAlarm; @@ -308,15 +308,15 @@ public class WaypointHelper { return null; } - private static AlarmInfo createSpeedAlarm(MetricsConstants mc, OsmandSettings.SpeedConstants sc, float mxspeed, Location loc, float delta) { + private static AlarmInfo createSpeedAlarm(OsmandSettings.SpeedConstants sc, float mxspeed, Location loc, float delta) { AlarmInfo speedAlarm = null; if (mxspeed != 0 && loc != null && loc.hasSpeed() && mxspeed != RouteDataObject.NONE_MAX_SPEED) { if (loc.getSpeed() > mxspeed + delta) { int speed; if (sc.imperial) { - speed = Math.round(mxspeed * 3.6f); - } else { speed = Math.round(mxspeed * 3.6f / 1.6f); + } else { + speed = Math.round(mxspeed * 3.6f); } speedAlarm = AlarmInfo.createSpeedLimit(speed, loc); } diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java index 14f7822aac..21615c55cb 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java @@ -1258,8 +1258,7 @@ public class RouteInfoWidgetsFactory { && showRoutingAlarms && (trafficWarnings || cams)) { AlarmInfo alarm; if(rh.isFollowingMode() && !rh.isDeviatedFromRoute() && rh.getCurrentGPXRoute() == null) { - alarm = wh.getMostImportantAlarm(settings.METRIC_SYSTEM.get(), - settings.SPEED_SYSTEM.get(), cams); + alarm = wh.getMostImportantAlarm(settings.SPEED_SYSTEM.get(), cams); } else { RouteDataObject ro = locationProvider.getLastKnownRouteSegment(); Location loc = locationProvider.getLastKnownLocation();