Added running variance calculation and report of stdev to remote LC messages#278
Open
NicholasIanMerritt wants to merge 1 commit intodevelopfrom
Open
Added running variance calculation and report of stdev to remote LC messages#278NicholasIanMerritt wants to merge 1 commit intodevelopfrom
NicholasIanMerritt wants to merge 1 commit intodevelopfrom
Conversation
…messages for the loadcell removed problematic submodule added Loadcell to beginning of message
matt001k
requested changes
Apr 14, 2025
Comment on lines
+137
to
139
| sprintf(data_string, "Loadcell | mean force: %f | max force: %f | min force: %f | stdev: %f | reading count: %d", mean_force, | ||
| max_force, min_force, stdev, cellular_send_read_counter); | ||
|
|
Contributor
There was a problem hiding this comment.
I recommend using snprintf here to avoid a buffer overflow of data_string. There also is some optimization if you make data_string a static variable. This way, the memory is allocated at compile time rather than every time this function is ran, saving you processing cycles and task memory usage.
Comment on lines
+53
to
+56
| float running_mean = 0; | ||
| float running_var = 0; | ||
| float old_mean = 0; | ||
| float stdev = 0; |
Contributor
There was a problem hiding this comment.
These values will be reset to zero every time this function is ran. To avoid this create a variable that will be static. That way the value is retained every time this function is ran. Note how max_force, min_force and mean_force are all static variables.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changed?
Added running variance calculation and report of stdev to the remote …
How does it make Bristlemouth better?
better lc data
Where should reviewers focus?
Any breaking changes I made?
Checklist