Giter Site home page Giter Site logo

alexandrehiroyuki / movingaverageplus Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 5.0 163 KB

Moving Average Plus is a C++ library that implements a moving average on the Arduino platform. Performance and usability are the two focuses I thought of when creating this library, so every improvement tip is welcome. It is useful for filtering noisy data from sensors, for example.

Home Page: https://alexandrehiroyuki.github.io/MovingAveragePlusDocs/

License: MIT License

C++ 100.00%
algorithms arduino arduino-library arduino-platform cpp data-processing data-structures filters moving-average pio platformio

movingaverageplus's Introduction

Hey, you can call me Hiro! ๐Ÿค

็งใฏๅฎไน‹ใงใ™ใ€‚ใ‚ˆใ‚ใ—ใใŠใญใŒใ„ใ—ใพใ™๏ผ

Featured Repositories โœจ

Featured Repository Data Tome Featured Repository Moving Average Plus Featured Repository Things Board Device Emulator Featured Repository instant chat

movingaverageplus's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

movingaverageplus's Issues

Memory allocation

I'm using MA w/ Arduino 1.8.16. It appears to me that memory for the MA is not allocated in static RAM, but in heap or stack. At least changing the numbers in "MovingAveragePlus <uint16_t> press_L(20);" has no effect on RAM allocation. Compiler always states "678 Bytes (33%)" dyn memory. That clashs w/ Stack size and the program becomes non executable w/out any error msg. at compilation.

I think this library will be great if ...

Hi, Thanks for creating an awesome library.
I just want to give you a suggest, I think this library will be great if added with other statistical function such as standard deviation of samples, variance, etc. That's all. Best regards, Octa.

Extend Get() to receive average for the last x datapoints

I would like to determine the average of the last 30 values. In parallel, I would like the average of the last 10 values.
To achieve this, I would have to create two MovingAverage and feed them with the same data.

MovingAverage<unsigned int> slowSensor(30);
MovingAverage<unsigned int> fastSensor(10);

slowSensor.push(sensorData);
fastSensor.push(sensorData);

By extending the get() with an optional parameter, it would be possible to solve this issue with one MovingAverage object

for example:

int slowSensorMovingAvg = slowSensor.get(); // average of 30 datapoints
int fastSensorMovingAvg = slowSensor.get(10); // average of 10 datapoints

Average of an incomplete filled MovingAverage object

By default all positions will be initialized with 0. If I create a MovingAverage<unsigned int> fooAvg(10); and fill it with only 5 values, then the average should also only be calculated from these 5 values.

Index order incorrect

When pushing into the moving average, the number is added at the end of the array. It should be pushed into the front.

v5.0.0

Changelog

  • added unit tests to MovingAveragePlus
  • fix back() method
  • fix resize() method

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.