monitor update
This commit is contained in:
parent
805ee2291b
commit
671bbb04fa
@ -16,7 +16,7 @@
|
||||
#define KB_SCORE 0xEB
|
||||
#define KB_RESET 0xF3
|
||||
|
||||
#define fps 30
|
||||
#define fps 1
|
||||
|
||||
#define x_sp0 3 // 4s
|
||||
#define x_sp1 4
|
||||
|
@ -8,8 +8,8 @@ pos = [0, 0, 0, 0] # p1y p2y bx by
|
||||
|
||||
def init_serial(pipe_path, baudrate):
|
||||
global tty
|
||||
tty = serial.serial_for_url('loop://')
|
||||
return True
|
||||
# tty = serial.serial_for_url('loop://')
|
||||
# return True
|
||||
tty = serial.Serial(port=pipe_path, baudrate=baudrate)
|
||||
tty.reset_input_buffer()
|
||||
return True
|
||||
@ -70,10 +70,9 @@ def main():
|
||||
|
||||
pause = False
|
||||
while True:
|
||||
line = tty.readline()
|
||||
if len(line) < 7 or line[0] != ord('<') or line[-2] != ord('>'):
|
||||
line = tty.readline()[:-1]
|
||||
if len(line) < 4:
|
||||
continue
|
||||
line = line[1:-2]
|
||||
|
||||
if line[0] == ord('r'):
|
||||
pause = False
|
||||
@ -111,9 +110,9 @@ if __name__ == '__main__':
|
||||
exit(1)
|
||||
|
||||
# tty.write('Hello World\n'.encode('utf-8'))
|
||||
# tty.write(serial.to_bytes([ord('<'), 128 + 3, 128 + 12, 128 + 40, 128 + 15, ord('>'), 0x0a]))
|
||||
# tty.write('<pause>\n'.encode('utf-8'))
|
||||
# tty.write('<resume>\n'.encode('utf-8'))
|
||||
# tty.write(serial.to_bytes([ord('<'), 128 + 25, 128 + 25, 128 + 81, 128 + 25, ord('>'), 0x0a]))
|
||||
# tty.write(serial.to_bytes([128 + 3, 128 + 12, 128 + 40, 128 + 15, 0x0a]))
|
||||
# tty.write('pause\n'.encode('utf-8'))
|
||||
# tty.write('resume\n'.encode('utf-8'))
|
||||
# tty.write(serial.to_bytes([128 + 25, 128 + 25, 128 + 80, 128 + 1, 0x0a]))
|
||||
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user