@ Override public void decrease ( final int steps ) throws IOException { if ( currentValue == 0 ) { return ; } if ( steps < 0 ) { throw new RuntimeException ( "Only positive values for parameter 'steps' allowed!" ) ; } if ( getNonVolatileMode ( ) != MicrochipPotentiometerNonVolatileMode . VOLATILE_ONLY ) { throw new RuntimeException ( "'decrease' is only valid for NonVolatileMode.VOLATILE_ONLY!" ) ; } // check boundaries final int actualSteps ; if ( steps > currentValue ) { actualSteps = currentValue ; } else { actualSteps = steps ; } int newValue = currentValue - actualSteps ; // if lower-boundary then set value in device to ensure sync // and for a large number of steps it is better to set a new value if ( ( newValue == 0 ) || ( steps > 5 ) ) { setCurrentValue ( newValue ) ; } // for a small number of steps use 'decrease'-method else { controller . decrease ( DeviceControllerChannel . valueOf ( channel ) , actualSteps ) ; currentValue = newValue ; } }
Decreases the wiper s value for n steps .