Skip to content

Fixed Possible division through 0#108

Open
hackepeter101 wants to merge 4 commits into
bitluni:masterfrom
hackepeter101:patch-1
Open

Fixed Possible division through 0#108
hackepeter101 wants to merge 4 commits into
bitluni:masterfrom
hackepeter101:patch-1

Conversation

@hackepeter101
Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings May 19, 2026 11:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Guards the FPS calculation in the 14-bit VGA demo against a division-by-zero when millis() returns 0, addressing issue #107.

Changes:

  • Caches millis() into a local unsigned long t.
  • Only performs the (f++ * 1000) / t division when t > 0; otherwise resets the frame counter.
Comments suppressed due to low confidence (1)

examples/VGADemo14Bit/VGADemo14Bit.ino:46

  • When t == 0 (the only moment millis() returns 0, which is essentially just at boot), this branch prints the "fps: " label without any following number, leaving the display in an inconsistent state. Consider printing a placeholder (e.g. 0) in the else branch so the output always has the same structure.
	else{
		f = 0; //starting FPS calculation again from frame 0
	}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/VGADemo14Bit/VGADemo14Bit.ino Outdated
@hackepeter101 hackepeter101 marked this pull request as draft May 19, 2026 11:56
calculations are similar to VGA3DEngine.ino now
@hackepeter101 hackepeter101 marked this pull request as ready for review May 19, 2026 12:05
@hackepeter101 hackepeter101 requested a review from Copilot May 19, 2026 12:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread examples/VGADemo14Bit/VGADemo14Bit.ino Outdated
Comment thread examples/VGADemo14Bit/VGADemo14Bit.ino Outdated
hackepeter101 and others added 2 commits May 19, 2026 14:11
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

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.

2 participants