handle manual error
This commit is contained in:
parent
77094dfa53
commit
ab3a4477c7
|
@ -46,6 +46,7 @@ class lcd:
|
||||||
if component_id == 2 and press_type == '00':
|
if component_id == 2 and press_type == '00':
|
||||||
x = self.nextion.get_attribute("joystick.x")
|
x = self.nextion.get_attribute("joystick.x")
|
||||||
y = self.nextion.get_attribute("joystick.y")
|
y = self.nextion.get_attribute("joystick.y")
|
||||||
|
if x is not None and y is not None:
|
||||||
speed = 100 - (y - 60) / (205 - 60) * 200
|
speed = 100 - (y - 60) / (205 - 60) * 200
|
||||||
turn = (x - 5) / (150 - 5) * 200 - 100
|
turn = (x - 5) / (150 - 5) * 200 - 100
|
||||||
print(f"Setting speed to {speed} and turn angle to {turn}")
|
print(f"Setting speed to {speed} and turn angle to {turn}")
|
||||||
|
|
Loading…
Reference in New Issue