From: Andrew C. <cro...@us...> - 2010-07-31 19:19:35
|
Update of /cvsroot/jmri/jmri/jmrix/sprog In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv17933 Modified Files: SprogThrottle.java Log Message: Round speed value rather than simple integer truncation Index: SprogThrottle.java =================================================================== RCS file: /cvsroot/jmri/jmri/jmrix/sprog/SprogThrottle.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SprogThrottle.java 6 Apr 2010 21:20:45 -0000 1.6 --- SprogThrottle.java 31 Jul 2010 19:19:26 -0000 1.7 *************** *** 92,96 **** float oldSpeed = this.speedSetting; this.speedSetting = speed; ! int value = (int)((127-1)*speed); // -1 for rescale to avoid estop if (value>0) value = value+1; // skip estop if (value>127) value = 127; // max possible speed --- 92,97 ---- float oldSpeed = this.speedSetting; this.speedSetting = speed; ! // int value = (int)((127-1)*speed); // -1 for rescale to avoid estop ! int value = Math.round((127-1)*speed); // -1 for rescale to avoid estop if (value>0) value = value+1; // skip estop if (value>127) value = 127; // max possible speed |