more work on rotary encoder