Revert "add collision delay"

This reverts commit 98dc4b5029.
This commit is contained in:
Siwat Sirichai 2022-11-11 21:42:14 +07:00
parent 98dc4b5029
commit ded055a790
1 changed files with 3 additions and 6 deletions

View File

@ -1,11 +1,9 @@
from telemetrix_rpi_pico import telemetrix_rpi_pico from telemetrix_rpi_pico import telemetrix_rpi_pico
from kuukar.kuukar_config import COLLISION_DETECTOR_PIN, COLLISION_ENABLE from kuukar.kuukar_config import COLLISION_DETECTOR_PIN, COLLISION_ENABLE
from kuukar.kuukar_lcd import lcd from kuukar.kuukar_lcd import lcd
from kuukar.kuukar_leds import leds from kuukar.kuukar_leds import leds
from time import perf_counter as pc
class collision: class collision:
lastCollision_ts = 0
def __init__(self, mcu: telemetrix_rpi_pico.TelemetrixRpiPico, lcd: lcd, leds: leds) -> None: def __init__(self, mcu: telemetrix_rpi_pico.TelemetrixRpiPico, lcd: lcd, leds: leds) -> None:
self.mcu = mcu self.mcu = mcu
self.lcd = lcd self.lcd = lcd
@ -15,6 +13,5 @@ class collision:
def collision_handle(self, data): def collision_handle(self, data):
val = data[2] val = data[2]
if val == 1 and pc() - self.lastCollision_ts > 1.5: if val == 1:
self.lcd.play_video("keke_hurt") self.lcd.play_video("keke_hurt")
self.lastCollision_ts = pc()