mirror of
				https://github.com/eclipse/upm.git
				synced 2025-10-30 06:34:58 +03:00 
			
		
		
		
	adafruitms1438: fix a bug in PWM handling for DC motors
Eric Hubert reported a bug in that no matter what setting he used to control the speed of a DC motor, it was always running at full speed. There was a bug in the setMotorSpeed() method that did not clear the 'FullOn' bit in the register used for PWM, causing full power to be applied all the time no matter the PWM duty cycle setting. This patch corrects that issue. Signed-off-by: Jon Trulson <jtrulson@ics.com> signed-off-by: Sisinty Sasmita Patra<sisinty.s.patra@intel.com>
This commit is contained in:
		 Jon Trulson
					Jon Trulson
				
			
				
					committed by
					
						 sisinty sasmita patra
						sisinty sasmita patra
					
				
			
			
				
	
			
			
			 sisinty sasmita patra
						sisinty sasmita patra
					
				
			
						parent
						
							fba8139416
						
					
				
				
					commit
					488ea234d5
				
			| @@ -152,6 +152,11 @@ void AdafruitMS1438::setMotorSpeed(DCMOTORS_T motor, int speed) | ||||
|  | ||||
|   float percent = float(speed) / 100.0; | ||||
|    | ||||
|   // make sure that the FullOn bit is turned off, or the speed setting | ||||
|   // (PWM duty cycle) won't have any effect. | ||||
|   m_pca9685->ledFullOn(m_dcMotors[motor].pwm, false); | ||||
|  | ||||
|   // set the PWM duty cycle | ||||
|   m_pca9685->ledOffTime(m_dcMotors[motor].pwm, int(4095.0 * percent)); | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user