give debounce a compiler macro and fix read_encoder