[tuxdroid-svn] r762 - firmware/tuxcore/trunk
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2007-12-07 10:04:26
|
Author: Paul_R Date: 2007-12-07 11:04:27 +0100 (Fri, 07 Dec 2007) New Revision: 762 Modified: firmware/tuxcore/trunk/motors.c Log: * Added a check when the spin direction is changing, to not increment the counter when an infinite movement is required. Modified: firmware/tuxcore/trunk/motors.c =================================================================== --- firmware/tuxcore/trunk/motors.c 2007-12-06 17:37:00 UTC (rev 761) +++ firmware/tuxcore/trunk/motors.c 2007-12-07 10:04:27 UTC (rev 762) @@ -682,7 +682,8 @@ * value to prevent counting the first switch detection that will happen as * soon as the rotation starts. */ if ((spin_direction == RIGHT) && (PSW_SPIN_PIN & PSW_SPIN_MK)) - spin_move_counter++; + if (spin_move_counter) + spin_move_counter++; spin_direction = LEFT; spin_PWM = pwm; spin_PWM_mask &= ~MOT_SPIN_R_MK; @@ -704,7 +705,8 @@ * value to prevent counting the first switch detection that will happen as * soon as the rotation starts. */ if ((spin_direction == LEFT) && (PSW_SPIN_PIN & PSW_SPIN_MK)) - spin_move_counter++; + if (spin_move_counter) + spin_move_counter++; spin_direction = RIGHT; spin_PWM = pwm; spin_PWM_mask &= ~MOT_SPIN_L_MK; |