Added GPIO switch protocol and various other fixes by CurlyMoo