diff options
author | heavydemon21 <48092678+heavydemon21@users.noreply.github.com> | 2023-06-06 13:57:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-06 13:57:26 +0200 |
commit | 82585491b02566c4489900284fde969d48d4002a (patch) | |
tree | 5be0b3cbe30535804050771dccf95c503bb3b87d | |
parent | bdf59e4c3680987591bdf0234220922e5e41fc5a (diff) | |
parent | 7118317a18e3024b341d14e72a9e741a7b14b2e5 (diff) |
Merge branch 'lonkaars:dev' into dev
-rw-r--r-- | nicla/road.py | 7 | ||||
-rw-r--r-- | nicla/uart.py | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/nicla/road.py b/nicla/road.py index 8d60dff..adc79a4 100644 --- a/nicla/road.py +++ b/nicla/road.py @@ -12,11 +12,11 @@ clock = time.clock() WIDTH = 480 HEIGHT = 320 -HORIZON = 120 -STRETCH = 155 +HORIZON = 150 +STRETCH = 40 SQUEEZE = 400 -STEERING_ENTHOUSIASM = 7.0 +STEERING_ENTHOUSIASM = 3.0 ROAD_MIN_BRIGHTNESS = 0xa0 points = [(STRETCH, HORIZON), @@ -48,6 +48,7 @@ def drive(driveImg): avg *= STEERING_ENTHOUSIASM avg = max(-1, min(1, avg)) + print(avg) steerByte = int((avg + 1.0) * (DUI_CMD_STEER_END - DUI_CMD_STEER_START) / 2 + DUI_CMD_STEER_START) uart.uart_buffer(steerByte) sensor.dealloc_extra_fb() diff --git a/nicla/uart.py b/nicla/uart.py index 276f6d1..da150b0 100644 --- a/nicla/uart.py +++ b/nicla/uart.py @@ -16,14 +16,15 @@ def uart_send(byte): __uart_buffer = bytearray() def uart_flush(): global __uart_buffer - print("UART FLUSH START") + # print("UART FLUSH START") for byte in __uart_buffer: - print(f"BYTE 0x{byte:02X}") + # print(f"BYTE 0x{byte:02X}") uart_send(byte) # dit is de oplossing udelay(2000) uart_send(byte) udelay(2000) uart_send(byte) + udelay(2000) __uart_buffer = bytearray() def tx_irq_handler(pin): |