|
@@ -14,7 +14,7 @@ ser = None
|
|
|
#串口打开
|
|
#串口打开
|
|
|
def openSer():
|
|
def openSer():
|
|
|
|
|
|
|
|
- ser = serial.Serial("COM8", 9600, timeout=0.5)
|
|
|
|
|
|
|
+ ser = serial.Serial("COM5", 9600, timeout=0.5)
|
|
|
# 字节大小
|
|
# 字节大小
|
|
|
ser.bytesize = 8
|
|
ser.bytesize = 8
|
|
|
# 无校验
|
|
# 无校验
|
|
@@ -51,14 +51,14 @@ def start(ser):
|
|
|
print("火车上报位置信息为 : ", data)
|
|
print("火车上报位置信息为 : ", data)
|
|
|
if data == b'\xc0\x1c\xed\xc0\xb1\xed' or data == b'\xc0\xb1\xed':
|
|
if data == b'\xc0\x1c\xed\xc0\xb1\xed' or data == b'\xc0\xb1\xed':
|
|
|
print("火车在左上报")
|
|
print("火车在左上报")
|
|
|
- res = requests.get("http://127.0.0.1:8080/api/train/updateTrainLocal?local=l")
|
|
|
|
|
|
|
+ res = requests.get("http://127.0.0.1:8082/api/train/updateTrainLocal?local=l")
|
|
|
print(res.text)
|
|
print(res.text)
|
|
|
if data == b'\xc0,\xed\xc0\xb2\xed' or data == b'\xc0\xb2\xed':
|
|
if data == b'\xc0,\xed\xc0\xb2\xed' or data == b'\xc0\xb2\xed':
|
|
|
print("火车在右上报")
|
|
print("火车在右上报")
|
|
|
- res = requests.get("http://127.0.0.1:8080/api/train/updateTrainLocal?local=r")
|
|
|
|
|
|
|
+ res = requests.get("http://127.0.0.1:8082/api/train/updateTrainLocal?local=r")
|
|
|
print(res.text)
|
|
print(res.text)
|
|
|
if data == b'\xc0\xb1\xedZ\xa5':
|
|
if data == b'\xc0\xb1\xedZ\xa5':
|
|
|
- res = requests.get("http://127.0.0.1:8080/api/train/updateTrainLocal?local=l")
|
|
|
|
|
|
|
+ res = requests.get("http://127.0.0.1:8082/api/train/updateTrainLocal?local=l")
|
|
|
print(res.text)
|
|
print(res.text)
|
|
|
print("火车复位上报")
|
|
print("火车复位上报")
|
|
|
time.sleep(0.1)
|
|
time.sleep(0.1)
|