-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
use uint16_t
instead of uint32_t
when writing to OCR4C register
#4149
Conversation
Example: BEFORE
Note the call to Multiplication 32 x 32 with MUL
Triggers a call to
AFTERNo call to
|
Timer4 is used for the ALTFAN PWM and for the beeper tone. The print fan is not controlled by this. Try sending different M300 frequencies and also maybe try to have the side fan running to see that the pwm output doesn't change too much when the timer frequency changes. You need the altfan to test this. I don't have an altfan at the moment on the printer, so can't test this.
Teeeechnically it's 10bit, but it doesn't matter since we don't use Timer4 there anyway. |
Unfortunately I don't have an altfan :( Hopefully someone at Prusa or someone from the Community can try this change. Let's leave it for 3.14 for now (focus on 3.13 instead). |
I have altfans, but none on a printer. I just didn't find the time to service the printer in the past month or so. I'm planning to switch to the latest mmu3 extruder parts, altfan, superpinda, new print fan that is not broken, latest einsy revision and the lcd with the broken bootloader rendering. As soon as I find the time to switch to the altfan, I'll test this. |
Using uint16_t instead of uint32_t reduces code size and probably is quicker to execute OCR4C register is 2 bytes on ATmega2560 It's 1 byte on ATmega32u4 and ATmega16u4 Change in memory: Flash: -80 bytes SRAM: 0 bytes
Rebased PR to sync with MK3 branch. (462 commits) |
All values in bytes. Δ Delta to base
|
This is just an idea to save more memory.
Using
uint16_t
instead ofuint32_t
reduces code size and probably is quicker to executeOCR4C register is 2 bytes on ATmega2560
It's 1 byte on ATmega32u4 and ATmega16u4
Tested these changes on MK3S+. Editing print fan speed in the menus works fine and sound feedback works. I also ran a selftest and it seems to work the same as before.
Change in memory:
Flash: -80 bytes
SRAM: 0 bytes