udoklein / dcf77

Noise resilient DCF77 decoder library for Arduino
http://blog.blinkenlight.net/experiments/dcf77/dcf77-library/
GNU General Public License v3.0
91 stars 28 forks source link

DCF77_Scope.ino bug - missing volatile declaration #42

Closed 6v6gt-duino closed 2 years ago

6v6gt-duino commented 2 years ago

DCF77_Scope.ino (bug)

The variable declared here:

boolean samples_pending = false;

is set in an ISR and used in the loop(). It should be declared additionally as volatile.

I discovered this while debugging the sketch on an ATtiny1614. I'm guessing, that in this case, the compiler has done some aggressive optimisation and kept the value in a register in the loop() code so it always behaves as if the value is false.

udoklein commented 2 years ago

Fixed with the newest release https://github.com/udoklein/dcf77/releases/tag/v3.3.7 . Thanks for finding this one.