You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the use case, where the input is not a simple read, but a bit more complex calculations.
So instead of doing the maths on every loop, just to ignore the outcome, because the timer, or the time window wasn't exceeded yet, it would be a good idea to test beforehand, if I need to calculate the input again.
I.e.:
Instead of
unsigned long msNow = millis();
Input = calculations();
if (myPID.Compute()) {
windowStartTime = msNow;
}
handleOutput();
Something like
if (myPID.WouldCompute()) {
unsigned long msNow = millis();
Input = calculations();
if (myPID.Compute()) {
windowStartTime = msNow;
}
}
handleOutput();
The text was updated successfully, but these errors were encountered:
Nanowires
changed the title
Improvement idea: WouldCompute()
Improvement idea: bool WouldCompute()
Feb 29, 2024
I have the use case, where the input is not a simple read, but a bit more complex calculations.
So instead of doing the maths on every loop, just to ignore the outcome, because the timer, or the time window wasn't exceeded yet, it would be a good idea to test beforehand, if I need to calculate the input again.
I.e.:
Instead of
Something like
The text was updated successfully, but these errors were encountered: