-
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
memory and flash optimizations for 3.12 PR3 #3432
Conversation
@gudnimg I think we can easily switch to printf and not use |
I could not see any difference in the functionality when testing this locally Changes save 818 bytes of flash memory (I suspect this is due to dtostrf no longer being called in the firmware for MK3S?)
Saves 24 bytes of SRAM
Also fixed indentation of if statement Saves 248 bytes of flash
Saves 90B of flash and 2B of ram
Saves 54 bytes of Flash and 2 bytes of SRAM
"PINDA cal status:" is always printed no matter what cal_status is so we can pull that out of the conditional statment. cal_status is also a boolean, lets just print it directly. Its a simpler code. Saves 32 bytes of flash and 22 bytes of SRAM Change serial messages to PGM
Saves 34 bytes of flash memory and reduces code by 8 lines.
Save 348B of flash
7251e16
to
97c371e
Compare
Saves 12 bytes of SRAM but increases flash use by 12 bytes.
@gudnimg Unless you have some other RAM->PGM improvements, this PR is final. Please let me know if you have any other plans, becase if you don't I'll ask for a review from a second reviewer. |
@leptun I understand, I got no more changes for the time being :D |
@@ -7786,14 +7786,14 @@ SERIAL_PROTOCOLPGM("\n\n"); | |||
|
|||
updatePID(); | |||
SERIAL_PROTOCOLRPGM(MSG_OK); | |||
SERIAL_PROTOCOL(" p:"); | |||
SERIAL_PROTOCOLPGM(" p:"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think flash usage increases because strings in ram are optimized much more than strings in progmem. So there will be duplicates in progmem, while in ram these are deduplicated. Sadly, I couldn't find a fix for this besides using PSTR only once and using the pointer on multiple PROTOCOLRPGM functions
Cherrypicked changes from #3378
More commits to come.
Saved 1588B of flash, 130B of ram