Make constants actually const.
Lots of cleanup.

 * Make all indentation 2 spaces
 * Split out the pulse code from getDistance into a new function
 * Cleanup the median calculation code.
Merge pull request #1 from tsukasa-au/master

General cleanup