MAX30100
MAX30100 copied to clipboard
fixed mean diff and enhanced moving average
Hello,
The mean diff values array are not initialized, so it can get garbage values from memory and make the balance intensities crazy. It is fixed by memsetting at the constructor.
The moving average was enhanced by first checking if the last pulse ocurred long ago (example: the finger was removed and then put back again in the sensor) to reset the moving average array. Then, it is checked if the values of the BPM are out of bounds (50 <= BPM <= 220), so they can be ignored and not added to the moving average. Finally, the moving average sum was enhanced to avoid unnecessary calculations.