Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SSD1306 example to display all text on small (32px) screens #527

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

kaycebasques
Copy link
Contributor

The last 4 lines of text are never displayed on the 32px-tall versions of SSD1306. This PR makes sure all of text is always displayed (at the cost of making the logic a bit more complex).

@peterharperuk peterharperuk self-assigned this Aug 23, 2024
@kaycebasques kaycebasques deleted the ssd1306-fix branch August 24, 2024 16:52
@kaycebasques kaycebasques restored the ssd1306-fix branch August 24, 2024 16:52
@kaycebasques
Copy link
Contributor Author

accidentally closed the pr by deleting my local branch, re-opening

@kaycebasques kaycebasques reopened this Aug 24, 2024
@lurch
Copy link
Contributor

lurch commented Aug 24, 2024

Also, can you change the base branch to develop please?

@kaycebasques kaycebasques changed the base branch from master to develop September 1, 2024 02:27
// Height limit reached. Show some lines.
if (y == SSD1306_HEIGHT) {
render(buf, &frame_area);
sleep_ms(3000);
Copy link
Contributor Author

@kaycebasques kaycebasques Sep 2, 2024

Choose a reason for hiding this comment

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

So what happens when you run this app is:

  1. Lines 0 to 3 get printed ("a long time ago on an oled display far far away")
  2. Wait 3s (this the sleep on 398)
  3. Lines 4 to 7 get printed ("live a small red raspberry by the name of PICO")
  4. Wait 3s (again the sleep on 398)
  5. The extra check on lines 404 to 407 doesn't run with the default text because y is reset to 0
  6. Wait another 3s (this is the extra sleep on line 409 we should remove)

Leaving the sleep on line 398 and 406 ensures that text always displays for exactly 3s

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good!

@lurch
Copy link
Contributor

lurch commented Sep 2, 2024

I don't have a SSD1306 with which to test, but the code looks fairly plausible. Thanks for incorporating all my feedback @kaycebasques !

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.

3 participants