Skip to content

Commit

Permalink
skip short distance information when vehicle is car
Browse files Browse the repository at this point in the history
  • Loading branch information
Karry committed May 26, 2023
1 parent 7aebbc7 commit f8f36e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class OSMSCOUT_API VoiceInstructionAgent CLASS_FINAL : public NavigationAgent

private:
DistanceUnitSystem units{DistanceUnitSystem::Metrics};
Vehicle vehicle{vehicleCar};

// state used for triggering GpsFound / GpsLost messages
bool prevGpsSignal{true};
Expand Down
7 changes: 5 additions & 2 deletions libosmscout/src/osmscout/navigation/VoiceInstructionAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ std::vector<VoiceInstructionMessage::VoiceSample> VoiceInstructionAgent::toSampl
return samples;
}

if (distanceInUnits > 50){
if (bool skipDistanceInformation = (distanceInUnits < 80 && vehicle == vehicleCar);
!skipDistanceInformation){

samples.push_back(VoiceSample::After);
if (distanceInUnits > 800){
samples.push_back(VoiceSample::Distance800);
Expand Down Expand Up @@ -299,7 +301,7 @@ std::vector<VoiceInstructionMessage::VoiceSample> VoiceInstructionAgent::toSampl
toSamples(samples, message.type);
if (then){
auto thenDistance = then.distance - message.distance;
if (thenDistance <= Meters(200)) { // ignore then messsage otherwise
if (thenDistance <= Meters(200)) { // ignore then message otherwise
samples.push_back(VoiceSample::Then);
toSamples(samples, then.type);
}
Expand All @@ -316,6 +318,7 @@ std::list<NavigationMessageRef> VoiceInstructionAgent::Process(const NavigationM
// reset state
lastMessage.type=MessageType::NoMessage;
lastMessagePosition=Distance::Zero();
vehicle=routeUpdateMessage->vehicle;
return result;
}

Expand Down

0 comments on commit f8f36e1

Please sign in to comment.