handle manual error
This commit is contained in:
parent
77094dfa53
commit
ab3a4477c7
|
@ -46,11 +46,12 @@ 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")
|
||||||
speed = 100 - (y - 60) / (205 - 60) * 200
|
if x is not None and y is not None:
|
||||||
turn = (x - 5) / (150 - 5) * 200 - 100
|
speed = 100 - (y - 60) / (205 - 60) * 200
|
||||||
print(f"Setting speed to {speed} and turn angle to {turn}")
|
turn = (x - 5) / (150 - 5) * 200 - 100
|
||||||
if not self.motion.is_roaming():
|
print(f"Setting speed to {speed} and turn angle to {turn}")
|
||||||
self.motion.drive_skew(speed,turn)
|
if not self.motion.is_roaming():
|
||||||
|
self.motion.drive_skew(speed,turn)
|
||||||
def _sensor_screen_updator(self):
|
def _sensor_screen_updator(self):
|
||||||
while True:
|
while True:
|
||||||
self.nextion.send_command(
|
self.nextion.send_command(
|
||||||
|
|
Loading…
Reference in New Issue