Skip to content

Commit

Permalink
Add the option to enable/disable the moving average calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
arms22 committed Jul 25, 2016
1 parent aac62f1 commit a717cd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion SoftModem.cpp
Expand Up @@ -129,8 +129,12 @@ void SoftModem::demodulate(void)
return;

// Calculating the moving average
#if SOFT_MODEM_MOVING_AVERAGE_ENABLE
_lastDiff = (diff >> 1) + (diff >> 2) + (_lastDiff >> 2);

#else
_lastDiff = diff;
#endif

if(_lastDiff >= (uint8_t)(TCNT_LOW_TH_L)){
_lowCount += _lastDiff;
if(_recvStat == INACTIVE){
Expand Down
1 change: 1 addition & 0 deletions SoftModem.h
Expand Up @@ -29,6 +29,7 @@
//#define SOFT_MODEM_RX_BUF_SIZE (32)

#define SOFT_MODEM_DEBUG_ENABLE (0)
#define SOFT_MODEM_MOVING_AVERAGE_ENABLE (0)

class SoftModem : public Stream
{
Expand Down

0 comments on commit a717cd8

Please sign in to comment.