Updated gateway code to recent codebase and Arduino version

Ported the changes from the last RF12demo sketch into the gateway code, ensure everything works fine with the latest Arduino version.