Improve responsiveness of command loop.

- Stop loop when queue is empty, and restart when next command is
  received. This makes the first command received after some time get
  sent instantly rather than in up to CMD_PERIOD seconds.
- Remove heartbeats.