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