mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	Remove callback before adding a new one
This commit is contained in:
		| @@ -34,6 +34,7 @@ class InputDevice(GPIODevice): | |||||||
|     def add_callback(self, callback=None, bouncetime=1000): |     def add_callback(self, callback=None, bouncetime=1000): | ||||||
|         if callback is None: |         if callback is None: | ||||||
|             raise InputDeviceError('No callback function given') |             raise InputDeviceError('No callback function given') | ||||||
|  |         self.remove_callback() | ||||||
|         GPIO.add_event_detect(self.pin, self._edge, callback, bouncetime) |         GPIO.add_event_detect(self.pin, self._edge, callback, bouncetime) | ||||||
|  |  | ||||||
|     def remove_callback(self): |     def remove_callback(self): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user