Good work, follow rodw with his amendments I think they are correct. Just one point I noticed in the ini file is the z offset I think you have it at 0 it might be better just off 0 so as to not have false triggers.