@@ -25,6 +25,11 @@ template <typename T> class ObservableTimerMicros;
2525template <typename T> class ObservableIntervalMillis ;
2626template <typename T> class ObservableIntervalMicros ;
2727
28+ // New extended observables forward declarations
29+ template <typename T> class ObservableAccelerometer ;
30+ template <typename T> class ObservableUltrasonic ;
31+ template <typename T> class ObservableRotaryEncoder ;
32+
2833template <typename T> class FilterOnRising ;
2934template <typename T> class FilterOnFalling ;
3035template <typename T> class FilterMovingAverage ;
@@ -95,6 +100,18 @@ template <typename T> class TransformationJoin;
95100template <typename T> class TransformationToBool ;
96101template <typename T> class TransformationParseFloat ;
97102template <typename T> class TransformationParseInt ;
103+ template <typename T> class TransformationInterpolate ;
104+
105+ // New extended filters forward declarations
106+ template <typename T> class FilterHysteresis ;
107+ template <typename T> class FilterKalman ;
108+ template <typename T> class FilterPID ;
109+
110+ // New extended operators forward declarations
111+ template <typename T> class OperatorThrottle ;
112+ template <typename T, typename TAcc> class OperatorScan ;
113+ template <typename T> class OperatorStartWith ;
114+ template <typename T> class OperatorDebounce ;
98115
99116template <typename T> class AggregateCount ;
100117template <typename T> class AggregateCountdown ;
@@ -155,7 +172,7 @@ class Observable : IObservable<T>, IResetable<T>
155172 // "Fluent" behavior
156173 OperatorWhere<T>& Where (ReactivePredicate<T> condition);
157174 OperatorDistinct<T>& Distinct ();
158- OperatorDistinctUntilChaged <T>& DistinctUntilChanged ();
175+ OperatorDistinctUntilChanged <T>& DistinctUntilChanged ();
159176 OperatorFirst<T>& First ();
160177 OperatorLast<T>& Last ();
161178 OperatorSkip<T>& Skip (size_t num);
@@ -228,6 +245,20 @@ class Observable : IObservable<T>, IResetable<T>
228245 FilterIsNotZero<T>& IsNotZero ();
229246 FilterIsZero<T>& IsZero ();
230247
248+ // New extended filters
249+ FilterHysteresis<T>& Hysteresis (T lowThreshold, T highThreshold);
250+ FilterKalman<T>& Kalman (T processVariance, T measurementVariance, T estimatedError = 1.0 );
251+ FilterPID<T>& PID (T setpoint, T kp, T ki, T kd, T outputMin = -255 , T outputMax = 255 );
252+
253+ // New extended operators
254+ OperatorThrottle<T>& Throttle (unsigned long intervalMillis);
255+ template <typename TAcc> OperatorScan<T, TAcc>& Scan (TAcc seed, TAcc(*accumulator)(TAcc, T));
256+ OperatorStartWith<T>& StartWith (T startValue);
257+ OperatorDebounce<T>& Debounce (unsigned long debounceMillis);
258+
259+ // New extended transformations
260+ TransformationInterpolate<T>& Interpolate (T inputMin, T inputMax, T outputMin, T outputMax, bool constrain = true );
261+
231262 AggregateCount<T>& Count ();
232263 AggregateCountdown<T>& CountDown (size_t N);
233264 AggregateSum<T>& Sum ();
@@ -1000,6 +1031,74 @@ auto Observable<T>::ToAnalogOutput(uint8_t pin) -> ObserverAnalogOutput<T>&
10001031 Subscribe (*newOp);
10011032 return *newOp;
10021033}
1034+
1035+ // New extended filters implementations
1036+ template <typename T>
1037+ auto Observable<T>::Hysteresis(T lowThreshold, T highThreshold) -> FilterHysteresis<T>&
1038+ {
1039+ auto newOp = new FilterHysteresis<T>(lowThreshold, highThreshold);
1040+ Compound (*this , *newOp);
1041+ return *newOp;
1042+ }
1043+
1044+ template <typename T>
1045+ auto Observable<T>::Kalman(T processVariance, T measurementVariance, T estimatedError) -> FilterKalman<T>&
1046+ {
1047+ auto newOp = new FilterKalman<T>(processVariance, measurementVariance, estimatedError);
1048+ Compound (*this , *newOp);
1049+ return *newOp;
1050+ }
1051+
1052+ template <typename T>
1053+ auto Observable<T>::PID(T setpoint, T kp, T ki, T kd, T outputMin, T outputMax) -> FilterPID<T>&
1054+ {
1055+ auto newOp = new FilterPID<T>(setpoint, kp, ki, kd, outputMin, outputMax);
1056+ Compound (*this , *newOp);
1057+ return *newOp;
1058+ }
1059+
1060+ // New extended operators implementations
1061+ template <typename T>
1062+ auto Observable<T>::Throttle(unsigned long intervalMillis) -> OperatorThrottle<T>&
1063+ {
1064+ auto newOp = new OperatorThrottle<T>(intervalMillis);
1065+ Compound (*this , *newOp);
1066+ return *newOp;
1067+ }
1068+
1069+ template <typename T>
1070+ template <typename TAcc>
1071+ auto Observable<T>::Scan(TAcc seed, TAcc(*accumulator)(TAcc, T)) -> OperatorScan<T, TAcc>&
1072+ {
1073+ auto newOp = new OperatorScan<T, TAcc>(seed, accumulator);
1074+ Compound (*this , *newOp);
1075+ return *newOp;
1076+ }
1077+
1078+ template <typename T>
1079+ auto Observable<T>::StartWith(T startValue) -> OperatorStartWith<T>&
1080+ {
1081+ auto newOp = new OperatorStartWith<T>(startValue);
1082+ Compound (*this , *newOp);
1083+ return *newOp;
1084+ }
1085+
1086+ template <typename T>
1087+ auto Observable<T>::Debounce(unsigned long debounceMillis) -> OperatorDebounce<T>&
1088+ {
1089+ auto newOp = new OperatorDebounce<T>(debounceMillis);
1090+ Compound (*this , *newOp);
1091+ return *newOp;
1092+ }
1093+
1094+ // New extended transformations implementations
1095+ template <typename T>
1096+ auto Observable<T>::Interpolate(T inputMin, T inputMax, T outputMin, T outputMax, bool constrain) -> TransformationInterpolate<T>&
1097+ {
1098+ auto newOp = new TransformationInterpolate<T>(inputMin, inputMax, outputMin, outputMax, constrain);
1099+ Compound (*this , *newOp);
1100+ return *newOp;
1101+ }
10031102// #pragma endregion
10041103
10051104
0 commit comments