mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Fix servo detach chopped PWM (#1650)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							76a6c39f25
						
					
				
				
					commit
					2e50e1f506
				
			| @@ -37,6 +37,11 @@ void HOT ESP8266PWM::write_state(float state) { | |||||||
|   uint32_t duty_off = total_time_us - duty_on; |   uint32_t duty_off = total_time_us - duty_on; | ||||||
|  |  | ||||||
|   if (duty_on == 0) { |   if (duty_on == 0) { | ||||||
|  |     // This is a hacky fix for servos: Servo PWM high time is maximum 2.4ms by default | ||||||
|  |     // The frequency check is to affect this fix for servos mostly as the frequency is usually 50-300 hz | ||||||
|  |     if (this->pin_->digital_read() && 50 <= this->frequency_ && this->frequency_ <= 300) { | ||||||
|  |       delay(3); | ||||||
|  |     } | ||||||
|     stopWaveform(this->pin_->get_pin()); |     stopWaveform(this->pin_->get_pin()); | ||||||
|     this->pin_->digital_write(this->pin_->is_inverted()); |     this->pin_->digital_write(this->pin_->is_inverted()); | ||||||
|   } else if (duty_off == 0) { |   } else if (duty_off == 0) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user