improvements for web service

many improvements to controller stability. rewrote buffer to read first
than execute received commands. added define statements to easily
configure source for different hardware.