From 8b7b87d45021f9194d6458fff1985b700e3c3796 Mon Sep 17 00:00:00 2001 From: ElementalAlchemist Date: Thu, 14 Nov 2024 22:36:33 -0600 Subject: [PATCH] Fix bus stops disappearing early The existing code tried to avoid infinite loops due to floating point math. It turns out the +1 was overzealous and caused bus stop signs to disappear before expected at high scale numbers. --- thrimbletrimmer/driveclock/drive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thrimbletrimmer/driveclock/drive.js b/thrimbletrimmer/driveclock/drive.js index 66a22cb..a53a7c5 100644 --- a/thrimbletrimmer/driveclock/drive.js +++ b/thrimbletrimmer/driveclock/drive.js @@ -187,7 +187,7 @@ async function drawRoad() { const distanceTrackedOnRoute = distanceTracked % 360; let nextBusStopPosition = null; for (const busStopPosition of BUS_STOP_POSITIONS) { - if (busStopPosition >= distanceTrackedOnRoute + 1) { + if (busStopPosition >= distanceTrackedOnRoute + 0.05) { nextBusStopPosition = busStopPosition; break; }