OpenAnnePro / AnnePro2-Shine

Custom LED Matrix Firmware for Open Anne Pro 2 QMK Port
GNU General Public License v2.0
100 stars 51 forks source link

Alternative PWM algorithm #48

Closed blaa closed 3 years ago

Codetector1374 commented 3 years ago

Artifacts will be here: https://ci.codetector.org/job/OpenAnnePro/job/AnnePro2-Shine/view/change-requests/job/PR-48/

blaa commented 3 years ago

I thought I was calling animation once per whole column cycle (after whole board is lit once), but that's not the case. I'm doing it after each column at 1000Hz. That's not optimal IMHO. It's easier to control the fluency of the animation speed, but this code could be run once per all columns, at 70Hz.

This might buy some time for more complicated animations, save battery, etc. I'd probably want to change it.

kdarkhan commented 3 years ago

I thought I was calling animation once per whole column cycle (after whole board is lit once), but that's not the case. I'm doing it after each column at 1000Hz. That's not optimal IMHO. It's easier to control the fluency of the animation speed, but this code could be run once per all columns, at 70Hz.

This might buy some time for more complicated animations, save battery, etc. I'd probably want to change it.

@blaa what about the previous approach with current system tick? Did you swap it because of performance? When I was playing around this code I saw how adjusting the looping behavior was changing the animation speed and basing the decision on system tick seemed more reliable.

blaa commented 3 years ago

I thought I was calling animation once per whole column cycle (after whole board is lit once), but that's not the case. I'm doing it after each column at 1000Hz. That's not optimal IMHO. It's easier to control the fluency of the animation speed, but this code could be run once per all columns, at 70Hz. This might buy some time for more complicated animations, save battery, etc. I'd probably want to change it.

@blaa what about the previous approach with current system tick? Did you swap it because of performance? When I was playing around this code I saw how adjusting the looping behavior was changing the animation speed and basing the decision on system tick seemed more reliable.

Previously the loop was much more randomly scanning the col/rows and enabling the PWM. Initially when I rewrote this the sysTick approach was altered somehow by the ledIntensity setting - it altered the animation speed. The concept of tying it to the whole board scan seems valid:

But it did it wrong and too often. ;)

blaa commented 3 years ago

But it did it wrong and too often. ;)

I've changed it. The 1000Hz approach was useless. It's either once-per-refresh, or your solution to use a sysTick. Current should work the same.

Codetector1374 commented 3 years ago

Will merge later today On Apr 12, 2021, 7:38 PM -0400, Darkhan @.***>, wrote:

@kdarkhan approved this pull request. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.