keep a ring buffer of gravity vectors, use the dot product of the newest and oldest to determine orthogonal vectors which mean the pebble has rotated through 90 degrees as if it is being looked at, also check the direction of gravity is consistent with being looked at, moved the update code into one function that now checks an update hasnt been done in the last 3 mins