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

OLED display update interval support #10388

Merged
merged 5 commits into from
Oct 19, 2020
Merged

Conversation

mtei
Copy link
Contributor

@mtei mtei commented Sep 21, 2020

Description

This PR adds support for OLED_UPDATE_INTERVAL_MS to oled_driver.c.

Use of the OLED driver has degraded matrix scan performance.
The matrix scan rate can be improved by changing the update interval of the OLED display to the length specified by OLED_UPDATE_INTERVAL.

Example.

  • OLED_DRIVER_ENABLE = no
*** yushakobo - Helix rev3 5rows connected -- 0x3265:0x3
  > matrix scan frequency: 929
  > matrix scan frequency: 1071
  > matrix scan frequency: 1073
  > matrix scan frequency: 1074
  • OLED_DRIVER_ENABLE = yes
    *** yushakobo - Helix rev3 5rows connected -- 0x3265:0x3
      > matrix scan frequency: 220
      > matrix scan frequency: 301
      > matrix scan frequency: 299
      > matrix scan frequency: 299
    
    • #define OLED_UPDATE_INTERVAL 30
      *** yushakobo - Helix rev3 5rows connected -- 0x3265:0x3
        > matrix scan frequency: 765
        > matrix scan frequency: 989
        > matrix scan frequency: 992
        > matrix scan frequency: 989
      
    • #define OLED_UPDATE_INTERVAL 50
      *** yushakobo - Helix rev3 5rows connected -- 0x3265:0x3
        > matrix scan frequency: 894
        > matrix scan frequency: 1018
        > matrix scan frequency: 1022
        > matrix scan frequency: 1024
      

Tag: @XScorpion2

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.
  • 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).

@mtei mtei added the core label Sep 21, 2020
@mtei mtei requested a review from a team September 21, 2020 16:17
@XScorpion2
Copy link
Contributor

Hmm, it's not a bad idea, but I'm wondering if there isn't more to do with the oled driver usage in this keyboard case. IE: is the keyboard wiping out the oled display and rebuilding it every loop?

@fauxpark
Copy link
Member

Yeah, the dirty flag should theoretically be preventing most pointless writes to the display.

@mtei
Copy link
Contributor Author

mtei commented Sep 21, 2020

The above test results were obtained using the following code.

https://github.com/yushakobo/qmk_firmware/blob/0383af9cc881881c9c5bce8c98a0ffee0ec463a7/keyboards/helix/rev3_5rows/oled_display.c

I think the above code is practically the same as the sample code in the OLED driver documentation.

#ifdef OLED_DRIVER_ENABLE
void oled_task_user(void) {
    // Host Keyboard Layer Status
    oled_write_P(PSTR("Layer: "), false);

    switch (get_highest_layer(layer_state)) {
        case _QWERTY:
            oled_write_P(PSTR("Default\n"), false);
            break;
        case _FN:
            oled_write_P(PSTR("FN\n"), false);
            break;
        case _ADJ:
            oled_write_P(PSTR("ADJ\n"), false);
            break;
        default:
            // Or use the write_ln shortcut over adding '\n' to the end of your string
            oled_write_ln_P(PSTR("Undefined"), false);
    }

    // Host Keyboard LED Status
    led_t led_state = host_keyboard_led_state();
    oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR("    "), false);
    oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR("    "), false);
    oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR("    "), false);
}
#endif

@XScorpion2
Copy link
Contributor

Ok, so the slowdown is caused by just working with the oled buffer and not flushing to the screen. Hmm, I didn't think that was that expensive to cause nearly a 4x drop in scan rate. Thanks for the additional details. Approved.

@drashna drashna requested a review from a team September 22, 2020 03:46
@mtei mtei marked this pull request as ready for review September 22, 2020 04:05
Copy link
Member

@zvecr zvecr left a comment

Choose a reason for hiding this comment

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

Also, while this wont break anything, https://docs.qmk.fm/#/pr_checklist?id=core-prs must now target develop branch. So the question becomes, "Is this PR exempt from that statement".

docs/feature_oled_driver.md Outdated Show resolved Hide resolved
@zvecr zvecr requested a review from a team September 23, 2020 01:02
drivers/oled/oled_driver.c Outdated Show resolved Hide resolved
drivers/oled/oled_driver.c Outdated Show resolved Hide resolved
@mtei
Copy link
Contributor Author

mtei commented Sep 23, 2020

Also, while this wont break anything, https://docs.qmk.fm/#/pr_checklist?id=core-prs must now target develop branch. So the question becomes, "Is this PR exempt from that statement".

I wasn't sure if I should set the merge destination to master or develop. I'm still on the fence.

Personally, I'm fine with merging this into master.

I'd like to hear which one you other collaborators choose.

@noroadsleft
Copy link
Member

My personal opinion on the master vs. develop for core PRs is currently:

PRs that enhance functionality (add features, extend capability) are likely safe to go into master, as they ideally aren't changing any existing behaviour. These changes, in every scenario I can think of, are invisible to the users, so there's little to no risk.

PRs that modify existing behaviour should go to develop.

@tzarc
Copy link
Member

tzarc commented Oct 3, 2020

I'd like to hear which one you other collaborators choose.

Whilst I agree that this is a non-behavioural change and is unlikely to cause any issues on master, I'd prefer to have a consistently simple way to make the decisions as to whether a PR goes to master or develop -- as described it's "core goes to develop, bugfixes can go to master".

In my mind consistency is key here, as going forward we'd have to make judgement calls about suitability, attempt to infer whether it affects any existing builds, and likely have to justify to non-collaborators as to why they're not allowed to get things into master in their "super important" case, but others can. Again, I'd prefer consistency, so I'd recommend develop.

@drashna
Copy link
Member

drashna commented Oct 4, 2020

I would definitely prefer that this target develop, first.

@mtei mtei changed the base branch from master to develop October 5, 2020 12:53
@mtei
Copy link
Contributor Author

mtei commented Oct 5, 2020

OK, I switched the merge destination to 'develop'.

@zvecr zvecr merged commit 2d468c4 into qmk:develop Oct 19, 2020
noroadsleft pushed a commit that referenced this pull request Oct 23, 2020
* add OLED_UPDATE_INTERVAL_MS support

* update docs/feature_oled_driver.md

* Update docs/feature_oled_driver.md

Co-authored-by: Joel Challis <[email protected]>

* Update drivers/oled/oled_driver.c

* Update drivers/oled/oled_driver.c

Co-authored-by: Joel Challis <[email protected]>
@XScorpion2 XScorpion2 mentioned this pull request Oct 24, 2020
14 tasks
skullydazed pushed a commit that referenced this pull request Oct 28, 2020
* add OLED_UPDATE_INTERVAL_MS support

* update docs/feature_oled_driver.md

* Update docs/feature_oled_driver.md

Co-authored-by: Joel Challis <[email protected]>

* Update drivers/oled/oled_driver.c

* Update drivers/oled/oled_driver.c

Co-authored-by: Joel Challis <[email protected]>
noroadsleft pushed a commit that referenced this pull request Oct 30, 2020
* add OLED_UPDATE_INTERVAL_MS support

* update docs/feature_oled_driver.md

* Update docs/feature_oled_driver.md

Co-authored-by: Joel Challis <[email protected]>

* Update drivers/oled/oled_driver.c

* Update drivers/oled/oled_driver.c

Co-authored-by: Joel Challis <[email protected]>
KarlK90 pushed a commit to KarlK90/qmk_firmware that referenced this pull request Nov 19, 2020
* add OLED_UPDATE_INTERVAL_MS support

* update docs/feature_oled_driver.md

* Update docs/feature_oled_driver.md

Co-authored-by: Joel Challis <[email protected]>

* Update drivers/oled/oled_driver.c

* Update drivers/oled/oled_driver.c

Co-authored-by: Joel Challis <[email protected]>
noroadsleft added a commit that referenced this pull request Nov 28, 2020
* Branch point for 2020 November 28 Breaking Change                                                

* Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183)                                           

* Add support for soft serial to ATmega32U2 (#10204)                                               

* Change MIDI velocity implementation to allow direct control of velocity value (#9940)            

* Add ability to build a subset of all keyboards based on platform.                                

* Actually use eeprom_driver_init().                                                               

* Make bootloader_jump weak for ChibiOS. (#10417)                                                  

* Joystick 16-bit support (#10439)                                                                 

* Per-encoder resolutions (#10259)                                                                 

* Share button state from mousekey to pointing_device (#10179)                                     

* Add hotfix for chibios keyboards not wake (#10088)                                               

* Add advanced/efficient RGB Matrix Indicators (#8564)                                             

* Naming change.                                                                                   

* Support for STM32 GPIOF,G,H,I,J,K (#10206)                                                       

* Add milc as a dependency and remove the installed milc (#10563)                                  

* ChibiOS upgrade: early init conversions (#10214)                                                 

* ChibiOS upgrade: configuration file migrator (#9952)                                             

* Haptic and solenoid cleanup (#9700)                                                              

* XD75 cleanup (#10524)                                                                            

* OLED display update interval support (#10388)                                                    

* Add definition based on currently-selected serial driver. (#10716)                               

* New feature: Retro Tapping per key (#10622)                                                      

* Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638)             

* Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530)

* Rescale both ChibiOS and AVR backlighting.                                                       

* Reduce Helix keyboard build variation (#8669)                                                    

* Minor change to behavior allowing display updates to continue between task ticks (#10750)        

* Some GPIO manipulations in matrix.c change to atomic. (#10491)                                   

* qmk cformat (#10767)                                                                             

* [Keyboard] Update the Speedo firmware for v3.0 (#10657)                                          

* Maartenwut/Maarten namechange to evyd13/Evy (#10274)                                             

* [quantum] combine repeated lines of code (#10837)                                                

* Add step sequencer feature (#9703)                                                               

* aeboards/ext65 refactor (#10820)                                                                 

* Refactor xelus/dawn60 for Rev2 later (#10584)                                                    

* add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824)                                 

* [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549)                                    

* update chibios os usb for the otg driver (#8893)                                                 

* Remove HD44780 References, Part 4 (#10735)                                                       

* [Keyboard] Add Valor FRL TKL (+refactor) (#10512)                                                

* Fix cursor position bug in oled_write_raw functions (#10800)                                     

* Fixup version.h writing when using SKIP_VERSION=yes (#10972)                                     

* Allow for certain code in the codebase assuming length of string. (#10974)                       

* Add AT90USB support for serial.c (#10706)                                                        

* Auto shift: support repeats and early registration (#9826)                                       

* Rename ledmatrix.h to match .c file (#7949)                                                      

* Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231)                                        

* Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840)                                        

* Merge point for 2020 Nov 28 Breaking Change
@mtei mtei deleted the oled_update_interval_dev branch December 21, 2020 20:43
xgnxs pushed a commit to xgnxs/qmk_firmware that referenced this pull request Jan 9, 2021
* Branch point for 2020 November 28 Breaking Change                                                

* Remove matrix_col_t to allow MATRIX_ROWS > 32 (qmk#10183)                                           

* Add support for soft serial to ATmega32U2 (qmk#10204)                                               

* Change MIDI velocity implementation to allow direct control of velocity value (qmk#9940)            

* Add ability to build a subset of all keyboards based on platform.                                

* Actually use eeprom_driver_init().                                                               

* Make bootloader_jump weak for ChibiOS. (qmk#10417)                                                  

* Joystick 16-bit support (qmk#10439)                                                                 

* Per-encoder resolutions (qmk#10259)                                                                 

* Share button state from mousekey to pointing_device (qmk#10179)                                     

* Add hotfix for chibios keyboards not wake (qmk#10088)                                               

* Add advanced/efficient RGB Matrix Indicators (qmk#8564)                                             

* Naming change.                                                                                   

* Support for STM32 GPIOF,G,H,I,J,K (qmk#10206)                                                       

* Add milc as a dependency and remove the installed milc (qmk#10563)                                  

* ChibiOS upgrade: early init conversions (qmk#10214)                                                 

* ChibiOS upgrade: configuration file migrator (qmk#9952)                                             

* Haptic and solenoid cleanup (qmk#9700)                                                              

* XD75 cleanup (qmk#10524)                                                                            

* OLED display update interval support (qmk#10388)                                                    

* Add definition based on currently-selected serial driver. (qmk#10716)                               

* New feature: Retro Tapping per key (qmk#10622)                                                      

* Allow for modification of output RGB values when using rgblight/rgb_matrix. (qmk#10638)             

* Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (qmk#10530)

* Rescale both ChibiOS and AVR backlighting.                                                       

* Reduce Helix keyboard build variation (qmk#8669)                                                    

* Minor change to behavior allowing display updates to continue between task ticks (qmk#10750)        

* Some GPIO manipulations in matrix.c change to atomic. (qmk#10491)                                   

* qmk cformat (qmk#10767)                                                                             

* [Keyboard] Update the Speedo firmware for v3.0 (qmk#10657)                                          

* Maartenwut/Maarten namechange to evyd13/Evy (qmk#10274)                                             

* [quantum] combine repeated lines of code (qmk#10837)                                                

* Add step sequencer feature (qmk#9703)                                                               

* aeboards/ext65 refactor (qmk#10820)                                                                 

* Refactor xelus/dawn60 for Rev2 later (qmk#10584)                                                    

* add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (qmk#10824)                                 

* [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (qmk#10549)                                    

* update chibios os usb for the otg driver (qmk#8893)                                                 

* Remove HD44780 References, Part 4 (qmk#10735)                                                       

* [Keyboard] Add Valor FRL TKL (+refactor) (qmk#10512)                                                

* Fix cursor position bug in oled_write_raw functions (qmk#10800)                                     

* Fixup version.h writing when using SKIP_VERSION=yes (qmk#10972)                                     

* Allow for certain code in the codebase assuming length of string. (qmk#10974)                       

* Add AT90USB support for serial.c (qmk#10706)                                                        

* Auto shift: support repeats and early registration (qmk#9826)                                       

* Rename ledmatrix.h to match .c file (qmk#7949)                                                      

* Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (qmk#10231)                                        

* Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (qmk#10840)                                        

* Merge point for 2020 Nov 28 Breaking Change
drashna pushed a commit to zsa/qmk_firmware that referenced this pull request Jan 13, 2021
* Branch point for 2020 November 28 Breaking Change

* Remove matrix_col_t to allow MATRIX_ROWS > 32 (qmk#10183)

* Add support for soft serial to ATmega32U2 (qmk#10204)

* Change MIDI velocity implementation to allow direct control of velocity value (qmk#9940)

* Add ability to build a subset of all keyboards based on platform.

* Actually use eeprom_driver_init().

* Make bootloader_jump weak for ChibiOS. (qmk#10417)

* Joystick 16-bit support (qmk#10439)

* Per-encoder resolutions (qmk#10259)

* Share button state from mousekey to pointing_device (qmk#10179)

* Add hotfix for chibios keyboards not wake (qmk#10088)

* Add advanced/efficient RGB Matrix Indicators (qmk#8564)

* Naming change.

* Support for STM32 GPIOF,G,H,I,J,K (qmk#10206)

* Add milc as a dependency and remove the installed milc (qmk#10563)

* ChibiOS upgrade: early init conversions (qmk#10214)

* ChibiOS upgrade: configuration file migrator (qmk#9952)

* Haptic and solenoid cleanup (qmk#9700)

* XD75 cleanup (qmk#10524)

* OLED display update interval support (qmk#10388)

* Add definition based on currently-selected serial driver. (qmk#10716)

* New feature: Retro Tapping per key (qmk#10622)

* Allow for modification of output RGB values when using rgblight/rgb_matrix. (qmk#10638)

* Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (qmk#10530)

* Rescale both ChibiOS and AVR backlighting.

* Reduce Helix keyboard build variation (qmk#8669)

* Minor change to behavior allowing display updates to continue between task ticks (qmk#10750)

* Some GPIO manipulations in matrix.c change to atomic. (qmk#10491)

* qmk cformat (qmk#10767)

* [Keyboard] Update the Speedo firmware for v3.0 (qmk#10657)

* Maartenwut/Maarten namechange to evyd13/Evy (qmk#10274)

* [quantum] combine repeated lines of code (qmk#10837)

* Add step sequencer feature (qmk#9703)

* aeboards/ext65 refactor (qmk#10820)

* Refactor xelus/dawn60 for Rev2 later (qmk#10584)

* add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (qmk#10824)

* [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (qmk#10549)

* update chibios os usb for the otg driver (qmk#8893)

* Remove HD44780 References, Part 4 (qmk#10735)

* [Keyboard] Add Valor FRL TKL (+refactor) (qmk#10512)

* Fix cursor position bug in oled_write_raw functions (qmk#10800)

* Fixup version.h writing when using SKIP_VERSION=yes (qmk#10972)

* Allow for certain code in the codebase assuming length of string. (qmk#10974)

* Add AT90USB support for serial.c (qmk#10706)

* Auto shift: support repeats and early registration (qmk#9826)

* Rename ledmatrix.h to match .c file (qmk#7949)

* Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (qmk#10231)

* Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (qmk#10840)

* Merge point for 2020 Nov 28 Breaking Change
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
* Branch point for 2020 November 28 Breaking Change                                                

* Remove matrix_col_t to allow MATRIX_ROWS > 32 (qmk#10183)                                           

* Add support for soft serial to ATmega32U2 (qmk#10204)                                               

* Change MIDI velocity implementation to allow direct control of velocity value (qmk#9940)            

* Add ability to build a subset of all keyboards based on platform.                                

* Actually use eeprom_driver_init().                                                               

* Make bootloader_jump weak for ChibiOS. (qmk#10417)                                                  

* Joystick 16-bit support (qmk#10439)                                                                 

* Per-encoder resolutions (qmk#10259)                                                                 

* Share button state from mousekey to pointing_device (qmk#10179)                                     

* Add hotfix for chibios keyboards not wake (qmk#10088)                                               

* Add advanced/efficient RGB Matrix Indicators (qmk#8564)                                             

* Naming change.                                                                                   

* Support for STM32 GPIOF,G,H,I,J,K (qmk#10206)                                                       

* Add milc as a dependency and remove the installed milc (qmk#10563)                                  

* ChibiOS upgrade: early init conversions (qmk#10214)                                                 

* ChibiOS upgrade: configuration file migrator (qmk#9952)                                             

* Haptic and solenoid cleanup (qmk#9700)                                                              

* XD75 cleanup (qmk#10524)                                                                            

* OLED display update interval support (qmk#10388)                                                    

* Add definition based on currently-selected serial driver. (qmk#10716)                               

* New feature: Retro Tapping per key (qmk#10622)                                                      

* Allow for modification of output RGB values when using rgblight/rgb_matrix. (qmk#10638)             

* Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (qmk#10530)

* Rescale both ChibiOS and AVR backlighting.                                                       

* Reduce Helix keyboard build variation (qmk#8669)                                                    

* Minor change to behavior allowing display updates to continue between task ticks (qmk#10750)        

* Some GPIO manipulations in matrix.c change to atomic. (qmk#10491)                                   

* qmk cformat (qmk#10767)                                                                             

* [Keyboard] Update the Speedo firmware for v3.0 (qmk#10657)                                          

* Maartenwut/Maarten namechange to evyd13/Evy (qmk#10274)                                             

* [quantum] combine repeated lines of code (qmk#10837)                                                

* Add step sequencer feature (qmk#9703)                                                               

* aeboards/ext65 refactor (qmk#10820)                                                                 

* Refactor xelus/dawn60 for Rev2 later (qmk#10584)                                                    

* add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (qmk#10824)                                 

* [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (qmk#10549)                                    

* update chibios os usb for the otg driver (qmk#8893)                                                 

* Remove HD44780 References, Part 4 (qmk#10735)                                                       

* [Keyboard] Add Valor FRL TKL (+refactor) (qmk#10512)                                                

* Fix cursor position bug in oled_write_raw functions (qmk#10800)                                     

* Fixup version.h writing when using SKIP_VERSION=yes (qmk#10972)                                     

* Allow for certain code in the codebase assuming length of string. (qmk#10974)                       

* Add AT90USB support for serial.c (qmk#10706)                                                        

* Auto shift: support repeats and early registration (qmk#9826)                                       

* Rename ledmatrix.h to match .c file (qmk#7949)                                                      

* Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (qmk#10231)                                        

* Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (qmk#10840)                                        

* Merge point for 2020 Nov 28 Breaking Change
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
* add OLED_UPDATE_INTERVAL_MS support

* update docs/feature_oled_driver.md

* Update docs/feature_oled_driver.md

Co-authored-by: Joel Challis <[email protected]>

* Update drivers/oled/oled_driver.c

* Update drivers/oled/oled_driver.c

Co-authored-by: Joel Challis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants