AP_Math: Log source line of constrain_float nan's #15662
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.
This makes tracking down the source of constrain nan internal errors much easier. This change causes us to log the line number where we called
constrain_float
rather then the line number inside of theconstrain_float
function, which was never very helpful, as far to many places call that.This change does try and minimize the flash cost for small boards that are marginal, and only add's the line data on boards with more then 1MB of flash. This is a bit debatable to me, as the utility of this is so high that I think we should probably always be logging this, as if you hit this at the moment on a 1MB board it's very very difficult to diagnose what happened, whereas with this we at least have a good chance to track it down.
This whole PR has been used in anger to help actually track down the source of some constrain_nan errors in real code.
CubeOrange stats: