Tidied scheduler.py:process_tasks() a bit.

Added some in-source documentation and took sim-mode task completion out
of the function as it did not really belong there. This is almost a null
change (almost: now sim-mode task completion code is called every time
through the main loop; previously it could get skipped once if a command
had just set the task processing flag).
Merge pull request #315 from hjoliver/tidy-process-tasks-funcn

Tidied scheduler.py:process_tasks() a bit.