Fix bugs in calculate.c and add test
Switch to using a timed interrupt for ADC readings (about 8 per second)
Improve code style in calculate.c
Update comments in calculate_tables.py