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

Optional OLED splash screen and fixed OLED i2c execution time saving #12294

Merged
merged 2 commits into from
Jun 23, 2021

Conversation

infinityis
Copy link
Contributor

@infinityis infinityis commented Mar 19, 2021

  • Enable display of QMK OLED splash screen to be optional, allowing reduction in program size
  • Fixed OLED page addressing, and corrected i2c execution time saving method

Description

#define NO_LCD_SPLASH

The OLED splash screen initialization with QMK logo is pretty but takes up program memory bytes. This change makes the splash screen conditional based on a new config.h #define. If #define NO_LCD_SPLASH is used, the OLED buffer is initialized to {0}. Testing with a 128x32 OLED shows a program size reduction about 500 bytes (128*32/8 = 512 bytes)

OLED Page Addressing fix

Also, an error was found in the OLED buffer writing function. As per SSD1306 datasheet, page 30 the options for "Set Memory Addressing Mode" are:

00b  Horizontal Addressing Mode
01b  Vertical Addressing Mode
10b  Page Addressing Mode (RESET)

However, the memory mode was being set to 0x10, which is not a valid option. Based on the code in send_buffer(), it appears that the intent was to use Page Addressing Mode, but the code to save i2c execution time was not implemented correctly. As written, the page_addr != i will always evaluate to true (because no compatible OLED has 2k vertical pixels) so the page address gets rewritten each time, even when it does not need to be updated.

This fix sets the memory addressing to page addressing mode (setting it to 10b = 0x02 instead of 0x10) and modifies the send_buffer code to actually track whether the page address needs to be re-sent.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation (adding the optional #define NO_LCD_SPLASH)
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@github-actions github-actions bot added the core label Mar 19, 2021
@infinityis
Copy link
Contributor Author

To be precise, setting memory mode to 0x10 isn't completely invalid, because the 6 high bits are "don't care". The two LSBs end up setting the memory mode to Horizontal Addressing Mode. Both the way the memory mode is being assigned and the way the code in send_buffer was written suggest that the intent was to use page addressing mode, but the approach was abandoned, resulting the pointless evaluation of page_addr != I. Correcting the page addressing mode and updating page_addr makes it a useful check.

@drashna drashna requested a review from a team April 3, 2021 01:50
@stale
Copy link

stale bot commented Jun 23, 2021

Thank you for your contribution!
This pull request has been automatically marked as stale because it has not had activity in the last 45 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, or re-open when it's ready.
For maintainers: Please label with awaiting review, breaking_change, in progress, or on hold to prevent the issue from being re-flagged.

@stale stale bot removed the awaiting changes label Jun 23, 2021
@tzarc tzarc merged commit 6e1ed1c into qmk:master Jun 23, 2021
skullydazed pushed a commit that referenced this pull request Jun 24, 2021
…12294)

* Made OLED splash screen optional to reduce memory and fixed OLED i2c execution time saving

* moved OLED address updates into their respective conditional checks
sperly pushed a commit to sperly/qmk_firmware that referenced this pull request Jul 2, 2021
…mk#12294)

* Made OLED splash screen optional to reduce memory and fixed OLED i2c execution time saving

* moved OLED address updates into their respective conditional checks
jakeprime pushed a commit to jakeprime/qmk_firmware that referenced this pull request Jul 10, 2021
…mk#12294)

* Made OLED splash screen optional to reduce memory and fixed OLED i2c execution time saving

* moved OLED address updates into their respective conditional checks
HokieGeek pushed a commit to HokieGeek/qmk_firmware that referenced this pull request Jul 11, 2021
…mk#12294)

* Made OLED splash screen optional to reduce memory and fixed OLED i2c execution time saving

* moved OLED address updates into their respective conditional checks
wox pushed a commit to wox/qmk_firmware that referenced this pull request Aug 14, 2021
…mk#12294)

* Made OLED splash screen optional to reduce memory and fixed OLED i2c execution time saving

* moved OLED address updates into their respective conditional checks
nhongooi pushed a commit to nhongooi/qmk_firmware that referenced this pull request Dec 5, 2021
…mk#12294)

* Made OLED splash screen optional to reduce memory and fixed OLED i2c execution time saving

* moved OLED address updates into their respective conditional checks
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
…mk#12294)

* Made OLED splash screen optional to reduce memory and fixed OLED i2c execution time saving

* moved OLED address updates into their respective conditional checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants