Fix lag issue
Signed-off-by: fly <merspieler@alwaysdata.net>
This commit is contained in:
parent
0e7415296c
commit
4cbf58f8dc
1 changed files with 8 additions and 17 deletions
25
fcuSync.py
25
fcuSync.py
|
@ -231,11 +231,17 @@ winwing_fcu_set_led(Leds.EXPED_YELLOW, 70)
|
|||
winwing_fcu_set_led(Leds.SCREEN_BACKLIGHT, 200)
|
||||
winwing_fcu_lcd_set(speed, heading, alt, vs, 0x0)
|
||||
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM | socket.SOCK_NONBLOCK)
|
||||
s.bind(('', 12000))
|
||||
try:
|
||||
message = "d,100,360,10000,----,0.0,0.0,d"
|
||||
while True:
|
||||
message, address = s.recvfrom(1024)
|
||||
time.sleep(0.1)
|
||||
try:
|
||||
while True:
|
||||
message, address = s.recvfrom(1024)
|
||||
except BlockingIOError:
|
||||
pass
|
||||
print(message)
|
||||
items = str(message).split(",")
|
||||
winwing_fcu_lcd_set(items[1], items[2], items[3], items[4], 0x0)
|
||||
|
@ -320,18 +326,3 @@ try:
|
|||
|
||||
except KeyboardInterrupt:
|
||||
s.close()
|
||||
|
||||
#while True:
|
||||
# buf_in = [None] * 7
|
||||
# winwing_fcu_set_led(Leds.AP1_GREEN, 1)
|
||||
# winwing_fcu_set_led(Leds.AP2_GREEN, 0)
|
||||
# winwing_fcu_lcd_set(speed, heading, alt, vs, 0x0)
|
||||
# speed = speed + 1
|
||||
# heading = heading + 3
|
||||
# if heading > 360:
|
||||
# heading = 0
|
||||
# time.sleep(0.5)
|
||||
# winwing_fcu_set_led(Leds.AP1_GREEN, 0)
|
||||
# winwing_fcu_set_led(Leds.AP2_GREEN, 1)
|
||||
# winwing_fcu_lcd_set(speed, heading, alt, vs, 0xff)
|
||||
# time.sleep(0.5)
|
||||
|
|
Loading…
Reference in a new issue