Luke900/flysight — pull request #2 by crwper (2014-09-21 21:23:23+00:00)
Title: Fixed timing issues

I think this will fix the issues with "stutter". There are two issues I've found:

1. In the ```config.txt``` file you supplied, ```Min``` and ```Max``` were set to the same value. This means that the rate of change of pitch is undefined, which means the tone rate is unpredictable. If you set these values, e.g., to ```Min: 0``` and ```Max: 300``` then the tone rate should be stable.

2. There were some underlying timing issues resulting from writing to the microSD card. Namely, sometimes a flush operation can take as long as 140 ms, and in the old version of the firmware execution would block until this was complete. In the new version, operations other than card access are allowed while the card is busy. This makes the tone timing a lot more regular.

To fix the second issue, I've broken the ```f_flush``` command into three separate steps which are called by a state machine in the ```UBX_Task``` function. The next step cannot be called until the card reports that it is "ready" after the previous step, which prevents the blocking problem we saw previously.