Fixes for is31fl3729 LED matrix driver off-by-one errors #25902
Merged
+6
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a couple latent bugs within the is31fl3729 matrix driver since #23109 and #21944, resulting in LEDs on sink line CS1 and the last sink line defined by the user to not light up.
Description
First, within
is31fl3729_write_pwm_buffer, less or equal in the for loop causes the write to overrun the bounds ofpwm_buffer, as well as clobbering the scaling register due to the address auto-increment on concurrent bytes. Changing to less-than results in keeping in bounds, from 0x00 to 0x8E.Second, within
is31fl3729_set_scaling_register, the calculation for the scaling register address hadn't changed after the changes to the pin definitions, causing scaling register writes for LEDs to be written starting at 0x8F (effectively setting SW9_CS16 LED to max bright by default) through to 0x9E , with writes stopping one short of the highest CS value register, as well as never being able to write to scaling register 0x9F.These issues were noticed as I'm building my own custom split keeb using this matrix driver; If needed, I would be happy to provide schematics, PCB layout, and pictures as well 😊
Thank you, QMK team!
Types of Changes
Issues Fixed or Closed by This PR
Checklist