Add resistor switching logic