OttoDIY / OttoDIYLib

Latest and official Libraries for Arduino Otto DIY robots
http://www..ottodiy.com/
GNU General Public License v3.0
115 stars 73 forks source link

Improving RAM footprint decreasing the memory usage by serial command identifiers #29

Closed ddanielvaz closed 2 years ago

ddanielvaz commented 2 years ago

When using method addCommand, the identifier has only 2 bytes but they are stored in a struct of 35 bytes, this pull request is a proposal to fix it. The default library setup, has 16 identifiers of 35 bytes, using 560 bytes. After improvement it will use 32 bytes, a reduction of 528 bytes, or 94%. It is very significant when using arduino nano that has 2048 Bytes of RAM, an improvement of ~25%.

cparrapa commented 2 years ago

Looks good @ddanielvaz simple change for a big improvement thanks!