mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpimath] LinearFilter lastValue(): Fix runtime exception (#6713)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user