mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
DistanceSensor: make the max_distance setter more like __init__
This commit is contained in:
@@ -615,7 +615,7 @@ class DistanceSensor(SmoothedInputDevice):
|
|||||||
|
|
||||||
@max_distance.setter
|
@max_distance.setter
|
||||||
def max_distance(self, value):
|
def max_distance(self, value):
|
||||||
if not (value > 0):
|
if value <= 0:
|
||||||
raise ValueError('invalid maximum distance (must be positive)')
|
raise ValueError('invalid maximum distance (must be positive)')
|
||||||
t = self.threshold_distance
|
t = self.threshold_distance
|
||||||
self._max_distance = value
|
self._max_distance = value
|
||||||
|
|||||||
Reference in New Issue
Block a user