Skip to content

Version 1.1 - Improved sleep algorithm

Choose a tag to compare

@dxinteractive dxinteractive released this 25 Aug 10:28
· 34 commits to master since this release
  • Improved the sleep algorithm to detect activity by using an exponential moving average on the margin of error (difference between new value and current one), so it behaves much more predictably with noisy readings, and is more accurate as it no longer prematurely halts responsive value movement.
  • update() can now accept a rawValue parameter so alternatives to analogRead can be used and passed in.
  • isSleeping() has been added to tell if the algorithm is in sleep mode
  • setSleepActivityThreshold() and setAwakeActivityThreshold() have been removed in favour of a single function setActivityThreshold() which accepts a float.
  • setSleepDelay() has been removed as it is no longer required.