replace 60sec timer for "Make U-turn when possible" by mechanism to announced only once until situation significantly changed

This commit is contained in:
sonora 2012-03-03 14:15:23 +01:00
parent 90ea40e96c
commit b10919364f
2 changed files with 11 additions and 8 deletions

View file

@ -268,8 +268,6 @@ public class RoutingHelper {
proccesed = true; proccesed = true;
} }
} }
} }
} }
if(proccesed){ if(proccesed){

View file

@ -12,6 +12,7 @@ import android.location.Location;
public class VoiceRouter { public class VoiceRouter {
private final int STATUS_UTWP-TOLD = -1;
private final int STATUS_UNKNOWN = 0; private final int STATUS_UNKNOWN = 0;
private final int STATUS_LONG_PREPARE = 1; private final int STATUS_LONG_PREPARE = 1;
private final int STATUS_PREPARE = 2; private final int STATUS_PREPARE = 2;
@ -28,7 +29,7 @@ public class VoiceRouter {
private int currentStatus = STATUS_UNKNOWN; private int currentStatus = STATUS_UNKNOWN;
private long lastTimeRouteRecalcAnnounced = 0; private long lastTimeRouteRecalcAnnounced = 0;
private long lastTimeMakeUTwpAnnounced = 0; //private long lastTimeMakeUTwpAnnounced = 0;
// default speed to have comfortable announcements (if actual speed is higher than it would be problem) // default speed to have comfortable announcements (if actual speed is higher than it would be problem)
// Speed in m/s // Speed in m/s
@ -153,14 +154,16 @@ public class VoiceRouter {
// for Issue 863 // for Issue 863
if (makeUturnWhenPossible == true) { if (makeUturnWhenPossible == true) {
//suppress "make UT when possible" message for 60sec //suppress "make UT when possible" message for 60sec
if (System.currentTimeMillis() - lastTimeMakeUTwpAnnounced > 60000) { //try now replace by better mechanism via STATUS_UTWP-TOLD: Until turn in the right direction, or route is re-calculated in forward direction
//if (System.currentTimeMillis() - lastTimeMakeUTwpAnnounced > 60000) {
if (currentStatus != STATUS_UTWP-TOLD) {
CommandBuilder play = getNewCommandPlayerToPlay(); CommandBuilder play = getNewCommandPlayerToPlay();
if(play != null){ if(play != null){
play.makeUTwp().play(); play.makeUTwp().play();
lastTimeMakeUTwpAnnounced = System.currentTimeMillis(); // lastTimeMakeUTwpAnnounced = System.currentTimeMillis();
currentStatus = STATUS_UTWP-TOLD;
} }
} }
currentStatus = STATUS_UNKNOWN;
return; return;
} }
@ -176,7 +179,7 @@ public class VoiceRouter {
// the last turn say // the last turn say
if(next == null || next.distance == 0) { if(next == null || next.distance == 0) {
if(currentStatus == STATUS_UNKNOWN && currentDirection > 0){ if(currentStatus <= STATUS_UNKNOWN && currentDirection > 0){
CommandBuilder play = getNewCommandPlayerToPlay(); CommandBuilder play = getNewCommandPlayerToPlay();
if(play != null){ if(play != null){
play.goAhead(router.getLeftDistance()).andArriveAtDestination().play(); play.goAhead(router.getLeftDistance()).andArriveAtDestination().play();
@ -359,19 +362,21 @@ public class VoiceRouter {
//suppress "route recalculated" prompt for GPX-routing, it makes no sense //suppress "route recalculated" prompt for GPX-routing, it makes no sense
if (router.getCurrentGPXRoute() == null) { if (router.getCurrentGPXRoute() == null) {
play.routeRecalculated(router.getLeftDistance()).play(); play.routeRecalculated(router.getLeftDistance()).play();
currentStatus = STATUS_UNKNOWN;
lastTimeRouteRecalcAnnounced = System.currentTimeMillis(); lastTimeRouteRecalcAnnounced = System.currentTimeMillis();
} }
} }
} }
} else { } else {
play.newRouteCalculated(router.getLeftDistance()).play(); play.newRouteCalculated(router.getLeftDistance()).play();
currentStatus = STATUS_UNKNOWN;
} }
} else if(player == null){ } else if(player == null){
pendingCommand = new VoiceCommandPending(updateRoute ? pendingCommand = new VoiceCommandPending(updateRoute ?
VoiceCommandPending.ROUTE_RECALCULATED : VoiceCommandPending.ROUTE_CALCULATED, this); VoiceCommandPending.ROUTE_RECALCULATED : VoiceCommandPending.ROUTE_CALCULATED, this);
currentStatus = STATUS_UNKNOWN;
} }
currentDirection = router.currentDirectionInfo; currentDirection = router.currentDirectionInfo;
currentStatus = 0;
} }
public void arrivedDestinationPoint() { public void arrivedDestinationPoint() {