Fix stuck placeholder by adding sample count fallback for GPS warmup#74
Conversation
Introduced a sample count fallback (`speedSampleCount`) for the GPS warmup logic. The application now displays speed if either the GPS timestamp advances by 1000ms OR 5 valid speed samples are received. This prevents the "stuck placeholder" issue when the GPS device reports valid speed data but timestamps are stagnant or update slowly, while still primarily relying on `pos.timestamp` as requested. `lastUpdateTimestamp` remains strictly tied to `pos.timestamp` for accurate data age calculations.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Deploying speedometer with
|
| Latest commit: |
010f35e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c4029c4f.speedometer-f1o.pages.dev |
| Branch Preview URL: | https://bugfix-stuck-placeholder-tim.speedometer-f1o.pages.dev |
This change fixes a bug where the speedometer would remain stuck on the placeholder (
———) indefinitely if the GPS timestamps received from the device did not advance by at least 1000ms (the warmup period), even if valid speed data was being received.This could happen if the device sends cached fixes or if the timestamp resolution/update frequency is quirky.
Per the user's constraints to "care about the timestamp field" and "not make up our own timestamp" (i.e., not blindly use
Date.now()), the fix implements a fallback mechanism based on the count of valid samples received.Changes:
speedSampleCounttosrc/app.ts.handlePositionto incrementspeedSampleCount.pos.timestamp - firstSpeedTimestamp >= GPS_WARMUP_MSORspeedSampleCount >= 5.resetStateto clear the counter.PR created automatically by Jules for task 12631748451433477638 started by @samuel-skean