Fix #7671
This commit is contained in:
parent
2a8ca3e519
commit
9d2e28e901
2 changed files with 7 additions and 8 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue