Skip to content

Commit

Permalink
Changes to make extending classes easier.
Browse files Browse the repository at this point in the history
  • Loading branch information
jspark311 committed Jul 20, 2020
1 parent 285aa9f commit 60241d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/SensorFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ limitations under the License.

#include <inttypes.h>
#include <stdint.h>

#if defined (ARDUINO)
#include <Arduino.h>
#endif
Expand Down Expand Up @@ -433,7 +434,7 @@ template <typename T> T SensorFilter<T>::_calculate_rms() {
if ((window_size > 1) && (nullptr != samples)) {
T squared_samples = T(0);
for (int i = 0; i < window_size; i++) {
T s_tmp = sq(samples[i]);
T s_tmp = samples[i] * samples[i];
squared_samples += s_tmp;
}
result = sqrt(squared_samples / window_size);
Expand All @@ -453,7 +454,8 @@ template <typename T> T SensorFilter<T>::_calculate_stdev() {
if ((window_size > 1) && (nullptr != samples)) {
T deviation_sum = T(0);
for (int i = 0; i < window_size; i++) {
deviation_sum += sq(samples[i] - last_value);
T tmp = samples[i] - last_value;
deviation_sum += tmp * tmp;
}
result = sqrt(deviation_sum / window_size);
}
Expand Down
7 changes: 2 additions & 5 deletions src/Storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ class Storage {


protected:
uint64_t _free_space = 0L;
StorageReadCallback _read_cb = nullptr;
uint16_t _pl_flags = 0;

Storage() {}; // Protected constructor.

Expand All @@ -136,11 +138,6 @@ class Storage {
inline void _pl_set_flag(bool nu, uint16_t _flag) {
_pl_flags = (nu) ? (_pl_flags | _flag) : (_pl_flags & ~_flag);
};


private:
uint64_t _free_space = 0L;
uint16_t _pl_flags = 0;
};

#endif // __ABSTRACT_PERSIST_LAYER_H__

0 comments on commit 60241d4

Please sign in to comment.