[wpimath] LinearFilter lastValue(): Fix runtime exception (#6713)

This commit is contained in:
Brendan Raykoff
2024-06-07 20:24:34 -04:00
committed by GitHub
parent 1c884b2260
commit 0606da64c9
2 changed files with 6 additions and 2 deletions

View File

@@ -56,6 +56,7 @@ public class LinearFilter {
private final DoubleCircularBuffer m_outputs;
private final double[] m_inputGains;
private final double[] m_outputGains;
private double m_lastOutput;
private static int instances;
@@ -310,6 +311,7 @@ public class LinearFilter {
m_outputs.addFirst(retVal);
}
m_lastOutput = retVal;
return retVal;
}
@@ -319,7 +321,7 @@ public class LinearFilter {
* @return The last value.
*/
public double lastValue() {
return m_outputs.getFirst();
return m_lastOutput;
}
/**