import struct import serial import asyncio import time import operator import functools import threading import msp import async_serial from thrust_stand import ThrustStand, raw_thrust, raw_torque # baud 250000 #version 1585 print(time.time()) s = serial.Serial(port='/dev/ttyUSB0', baudrate=250000) print(time.time()) # ccode = bytes((1,)) # s.write(ccode) while True: l = s.readline() print(l) if l == b'Ready\r\n': break print('dupa') # # s.write(make_msp(2)) # # while True: # # i = s.read() # # print(f'{i[0]}: ({i})') pwm = 1000 # def xxx(): # while True: # code, data = read_msp(s) # print('aaa') # print(code) # print(data.hex()) # esc_voltage, esc_current, esc_power, load_thrust, load_left, rot_e, rot_o, temp0, temp1, temp2, basic_data_flag, acc_x, acc_y, acc_z, vibration, raw_pressure_p, raw_pressure_t, load_right, pro_data_flag = struct.unpack_from('= 1900: break # while True: # global pwm # print(pwm) # res = await m.do_poll(pwm) # print(res.load_thrust*1000) # await asyncio.sleep(0.2) # print(res) # def worker(): # asyncio.run(main()) # t = threading.Thread(target=worker) # t.start() asyncio.run(main())