Skip to content

Conversation

@TD-er
Copy link
Member

@TD-er TD-er commented Nov 28, 2023

Fixes: #4893

bool valid = false;
if (static_cast<int>(_current) == 0) getCurrent(valid);
if (valid && static_cast<int>(_current) > 0) _current_multiplier *= (value / _current);
if (valid && static_cast<int>(_current) > 0) _current_multiplier *= (expected / _current);
Copy link
Contributor

Choose a reason for hiding this comment

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

Will valid ever be set to true, if _current is already greater than 0, when calling this method? If not, then the multiplier won't be set, AFAICS...

Copy link
Member Author

Choose a reason for hiding this comment

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

Only when _power != 0, or when there is an interrupt while executing this function.

But with this PR I will no longer just call getCurrent() when updating the calibration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][P076] calculation with multiplier values is broken

2 participants