better handle roaming loop
This commit is contained in:
parent
ded055a790
commit
88734ec168
|
@ -79,5 +79,5 @@ class leds:
|
||||||
print(leds.__blink_func(self.__get_time(), duration))
|
print(leds.__blink_func(self.__get_time(), duration))
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
if self.__get_time() > duration:
|
if self.__get_time() > duration:
|
||||||
flashing = False
|
self.flashing = False
|
||||||
break
|
break
|
||||||
|
|
|
@ -110,6 +110,7 @@ class motion:
|
||||||
while True:
|
while True:
|
||||||
if self.roaming:
|
if self.roaming:
|
||||||
self.__roam_handle()
|
self.__roam_handle()
|
||||||
|
time.sleep(0.3)
|
||||||
|
|
||||||
def __roam_handle(self):
|
def __roam_handle(self):
|
||||||
sensitivity = 35
|
sensitivity = 35
|
||||||
|
@ -149,5 +150,4 @@ class motion:
|
||||||
self.turn(-turn_speed, 1)
|
self.turn(-turn_speed, 1)
|
||||||
self.drive(drive_speed)
|
self.drive(drive_speed)
|
||||||
if not self.roaming:
|
if not self.roaming:
|
||||||
self.stop()
|
self.stop()
|
||||||
time.sleep(0.3)
|
|
Loading…
Reference in New Issue