[Fix]优化下绿灯通行提示的策略

This commit is contained in:
chenfufeng
2021-11-30 16:07:32 +08:00
parent 7defc7e6f7
commit 5b1735534b

View File

@@ -117,7 +117,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
} else if (arriveTime > remainTime + trafficLightResult.flashYellow + 2) {// 到达时红、黄灯都走完
// 单位Km/h当前为红灯推荐速度越慢越容易绿灯通过且要满足[10,50]
val originRemainSpeed =
floor(distance / (remainTime + trafficLightResult.flashYellow) * 3.6).toInt()
floor(distance / (remainTime + trafficLightResult.flashYellow + 2) * 3.6).toInt()
when {
originRemainSpeed > 50 -> greenLightWarning("10到50")
originRemainSpeed in 10..50 -> greenLightWarning("10到$originRemainSpeed")
@@ -131,7 +131,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
redLightWarning()
} else if (arriveTime > remainTime + 2) {
// 单位Km/h当前为黄灯推荐速度越慢越容易绿灯通过且要满足[10,50]
val originRemainSpeed = floor(distance / remainTime * 3.6).toInt()
val originRemainSpeed = floor(distance / (remainTime + 2) * 3.6).toInt()
when {
originRemainSpeed > 50 -> greenLightWarning("10到50")
originRemainSpeed in 10..50 -> greenLightWarning("10到$originRemainSpeed")
@@ -145,7 +145,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
redLightWarning()
} else if (arriveTime < remainTime - 2) {
// 单位Km/h当前为绿灯推荐速度越快越容易绿灯通过且要满足[10,50]
val originRemainSpeed = ceil(distance / remainTime * 3.6).toInt()
val originRemainSpeed = ceil(distance / (remainTime - 2) * 3.6).toInt()
when {
originRemainSpeed < 10 -> greenLightWarning("10到50")
originRemainSpeed in 10..50 -> greenLightWarning("${originRemainSpeed}到50")