Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is very cool, but I was surprised to see what seems like an obvious bug in your code. In the buzzer() function, it looks like you were trying to use "buzz_prev" to optimize away extra writes of 0 when no magnetic field is detected. However, buzz_prev will never get reset because line 57, which sets it to zero, will only be executed if (!buzz_prev), that is, if it's already zero.


Nice catch Sir! You're right, line 57 should be below 55. Fix:

https://github.com/majek/dump/commit/7e9edeba2ead00a24341ec5...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: