Compare commits

..

2 Commits

Author SHA1 Message Date
Siwat Sirichai e4821b3c6f adjust sleep timing 2022-11-11 22:14:50 +07:00
Siwat Sirichai 88734ec168 better handle roaming loop 2022-11-11 22:01:38 +07:00
3 changed files with 5 additions and 5 deletions

4
app.py
View File

@ -9,8 +9,8 @@ import kuukar.kuukar_environment as kuukar_environment
from kuukar.kuukar_config import SERIAL_MCU, SERIAL_DRV from kuukar.kuukar_config import SERIAL_MCU, SERIAL_DRV
mcu = telemetrix_rpi_pico.TelemetrixRpiPico(com_port=SERIAL_MCU) mcu = telemetrix_rpi_pico.TelemetrixRpiPico(com_port=SERIAL_MCU, sleep_tune=0.001)
drv = telemetrix_rpi_pico.TelemetrixRpiPico(com_port=SERIAL_DRV) drv = telemetrix_rpi_pico.TelemetrixRpiPico(com_port=SERIAL_DRV, sleep_tune=0.001)
sensors = kuukar_sensors.sensors(mcu) sensors = kuukar_sensors.sensors(mcu)
leds = kuukar_leds.leds(mcu) leds = kuukar_leds.leds(mcu)
motion = kuukar_motion.motion(mcu, drv, leds, sensors) motion = kuukar_motion.motion(mcu, drv, leds, sensors)

View File

@ -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

View File

@ -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
@ -150,4 +151,3 @@ class motion:
self.drive(drive_speed) self.drive(drive_speed)
if not self.roaming: if not self.roaming:
self.stop() self.stop()
time.sleep(0.3)