Skip to content

fix(ui): clamp deltaTime to 1ms in pose-renderer FPS calc (#519 Bug 2)#610

Merged
ruvnet merged 1 commit into
mainfrom
fix/issue-519-fps-infinity
May 17, 2026
Merged

fix(ui): clamp deltaTime to 1ms in pose-renderer FPS calc (#519 Bug 2)#610
ruvnet merged 1 commit into
mainfrom
fix/issue-519-fps-infinity

Conversation

@ruvnet
Copy link
Copy Markdown
Owner

@ruvnet ruvnet commented May 17, 2026

Closes #519 Bug 2 (FPS shows Infinity).

Root cause

ui/utils/pose-renderer.js:655 did fps = 1000 / deltaTime without a floor. When two render frames land in the same performance.now() tick (common when an animation frame batches multiple renders), deltaTime === 0 and the EMA averageFps = averageFps * 0.9 + Infinity * 0.1 poisons itself permanently. The HUD then reads Infinity FPS until page reload.

Fix

- const deltaTime = currentTime - this.performanceMetrics.lastFrameTime;
+ const deltaTime = Math.max(currentTime - this.performanceMetrics.lastFrameTime, 1);
  const fps = 1000 / deltaTime;

The 1 ms floor caps displayed FPS at 1000 — far above any real render rate (a 240 Hz monitor renders every ~4 ms), so the cap is never observed in practice. Keeps the EMA finite.

Test plan

  • Code inspection: only call site touched; rest of updatePerformanceMetrics unchanged
  • (Reviewer, optional) Reproduce in browser by rapid-firing render frames; confirm the old build shows Infinity FPS and the new build doesn't

Related

Issue #519 has three other multi-node bugs documented separately:

This PR closes only Bug 2 cleanly. The other three are tracked in their own threads.

🤖 Generated with claude-flow

…Bug 2)

When two render frames land in the same performance.now() tick,
`currentTime - lastFrameTime === 0`, so `fps = 1000 / 0 = Infinity`,
and `averageFps = averageFps * 0.9 + Infinity * 0.1 = Infinity` poisons
the EMA forever after a single zero-dt tick. The UI then displays
"Infinity FPS" until reload.

Floor deltaTime at 1 ms before the division. That caps displayed FPS at
1000 (far above any real render rate so the cap is never observed in
practice) but keeps the EMA finite.

Reported in #519 ("Bug 2 — FPS shows Infinity") by @kapilsoni2013 on a
3-node ESP32-S3-WROOM multi-node setup with edge-tier 1 + 2.

Co-Authored-By: claude-flow <ruv@ruv.net>
@ruvnet ruvnet merged commit 6f5ac3a into main May 17, 2026
13 checks passed
@ruvnet ruvnet deleted the fix/issue-519-fps-infinity branch May 17, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ghost person detection, FPS infinity, skeleton flickering and jumpy vitals with ESP32-S3 multi-node setup (edge-tier 1 & 2)

1 participant