legacy walk code ported from AVR