simplify voice router code

This commit is contained in:
sonora 2016-07-18 22:20:09 +02:00
parent fa774ae68d
commit 6c2e1bf5a9

View file

@ -800,33 +800,17 @@ public class VoiceRouter {
public void newRouteIsCalculated(boolean newRoute) { public void newRouteIsCalculated(boolean newRoute) {
CommandBuilder play = getNewCommandPlayerToPlay(); CommandBuilder play = getNewCommandPlayerToPlay();
if (play != null) { if (play != null) {
if (!newRoute) {
// Suppress "route recalculated" prompt for 60sec (this workaround now outdated after more intelligent route recalculation and directional voice prompt suppression)
//if (router.getCurrentGPXRoute() == null && (System.currentTimeMillis() - lastTimeRouteRecalcAnnounced > 60000)) {
// Suppress "route recalculated" prompt for GPX-routing, it makes no sense
//if (router.getCurrentGPXRoute() == null) {
notifyOnVoiceMessage(); notifyOnVoiceMessage();
play.routeRecalculated(router.getLeftDistance(), router.getLeftTime()).play(); play.routeRecalculated(router.getLeftDistance(), router.getLeftTime()).play();
currentStatus = STATUS_UNKNOWN;
suppressDest = false;
//lastTimeRouteRecalcAnnounced = System.currentTimeMillis();
//}
} else {
notifyOnVoiceMessage();
play.newRouteCalculated(router.getLeftDistance(), router.getLeftTime()).play();
playGoAheadDist = -1;
currentStatus = STATUS_UNKNOWN;
suppressDest = false;
}
} else if (player == null) { } else if (player == null) {
pendingCommand = new VoiceCommandPending(!newRoute ? VoiceCommandPending.ROUTE_RECALCULATED pendingCommand = new VoiceCommandPending(!newRoute ? VoiceCommandPending.ROUTE_RECALCULATED
: VoiceCommandPending.ROUTE_CALCULATED, this); : VoiceCommandPending.ROUTE_CALCULATED, this);
}
if (newRoute) { if (newRoute) {
playGoAheadDist = -1; playGoAheadDist = -1;
} }
currentStatus = STATUS_UNKNOWN; currentStatus = STATUS_UNKNOWN;
suppressDest = false; suppressDest = false;
}
nextRouteDirection = null; nextRouteDirection = null;
} }