Add digipot code and other fixes