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

Flash optimizations #260

Merged
merged 10 commits into from
Oct 23, 2023
Merged

Flash optimizations #260

merged 10 commits into from
Oct 23, 2023

Conversation

elral
Copy link
Collaborator

@elral elral commented Oct 19, 2023

Description of changes

I went a couple of times through all functions, not much I found to optimize the Flash usage.

  • there are unused parameters in the handler functions. They are deleted -> -30 bytes
  • common usage of size for all pins (int -> uint8_t) -> no reduction of flash
  • not using UniqueID lib for AVR's -> -192 bytes
  • replacing the sprintf() function for the serial handling in config.cpp by an own simple one -> - 1468 bytes

Overall this results in 1690 bytes less of Flash usage and 43 bytes less of RAM usage.

One important remark
I have deleted the usage of UniqueID for all AVR Boards. There was only less time where this was used. If a board was initialized in this timeframe, a new serial number will be generated with this change. I guess there are only verly less user who are affected, not to say no user is affected.
I vote to take now the chance to get rid of these serial numbers to not deal with them in the future.
If we should still keep them, I will add again the detection but without using the sprintf() function to take care of the huge flash saving.

@MobiFlight-Admin @neilenns @GioCC may I ask you to comment on this and to add ideas/changes for further reducing of Flash/RAM usage.

@github-actions
Copy link

Firmware for this pull request:
Firmware.zip

@github-actions
Copy link

Firmware for this pull request:
Firmware.zip

@github-actions
Copy link

Firmware for this pull request:
Firmware.zip

@DocMoebiuz DocMoebiuz changed the title Flash optimazations Flash optimizations Oct 21, 2023
Copy link
Collaborator

@DocMoebiuz DocMoebiuz left a comment

Choose a reason for hiding this comment

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

Looking good. Thanks!

src/Config.cpp Show resolved Hide resolved
src/MF_Button/MFButton.h Outdated Show resolved Hide resolved
src/MF_Segment/MFSegments.cpp Show resolved Hide resolved
@DocMoebiuz DocMoebiuz marked this pull request as ready for review October 21, 2023 19:50
@DocMoebiuz DocMoebiuz self-requested a review October 21, 2023 19:51
Copy link
Collaborator

@DocMoebiuz DocMoebiuz left a comment

Choose a reason for hiding this comment

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

There is one byte that we want to change to uint8_t so that it is perfect.

@github-actions
Copy link

Firmware for this pull request:
Firmware.zip

@elral elral requested a review from DocMoebiuz October 22, 2023 06:29
@github-actions
Copy link

Firmware for this pull request:
Firmware.zip

@github-actions
Copy link

Firmware for this pull request:
Firmware.zip

Copy link
Collaborator

@DocMoebiuz DocMoebiuz left a comment

Choose a reason for hiding this comment

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

THANK YOU!

@DocMoebiuz DocMoebiuz merged commit 74bce07 into MobiFlight:main Oct 23, 2023
1 check passed
@DocMoebiuz DocMoebiuz added the enhancement New feature or request label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants