2 years ago Omar Polo
move the logic into its own function.
pull in control.c, with some local edits to integrate into the project