Avoid using floating point in the heartbeat code #132
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior work in 2015 in this repository (commit 1c8ae71 and 52f3151)
had removed all uses of floating point, saving the flash memory needed
for floating point software routines.
More recently, floating point is used if HEARTBEAT_SUPERVISION is
enabled. By making a few small changes and adjusting things to use
integer math, we can save 600+ bytes of flash.
This also removes the deprecated function
HsDeactivate
which isn'tcalled from anywhere.
Before (with HEARTBEAT_SUPERVISION defined):
After (with HEARTBEAT_SUPERVISION defined):
Let me know if you want this script I used below- I can PR and include it in the repository! It is based off of https://github.com/torvalds/linux/blob/master/scripts/bloat-o-meter and tailored to work for platformio and C++ symbols. Here it is showing that several floating point functions were included before, and 608 bytes have been trimmed.