mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-22 18:51:25 +00:00
Make com port a input argument
This commit is contained in:
parent
bb31e57fc2
commit
2681ab0548
@ -4,10 +4,35 @@ import sys
|
||||
|
||||
import sample_data
|
||||
|
||||
with serial.Serial(port='COM15', baudrate=2400, bytesize=8, parity='E', stopbits=1) as ser:
|
||||
for packet in sample_data.kaifa_20190508_packets:
|
||||
print('sleeping')
|
||||
sys.stdout.flush()
|
||||
time.sleep(2)
|
||||
ser.write(packet)
|
||||
serial_port = sys.argv[1]
|
||||
|
||||
with serial.Serial(port=serial_port, baudrate=2400, bytesize=8, parity='E', stopbits=1) as ser:
|
||||
time.sleep(1)
|
||||
while True:
|
||||
for packet in sample_data.kaifa_20190508_packets[:]:
|
||||
sys.stdout.flush()
|
||||
ser.write(packet)
|
||||
print('sleeping')
|
||||
time.sleep(2)
|
||||
break
|
||||
|
||||
|
||||
# POST HTTP/1.1
|
||||
# Host: kanskje.de:8181
|
||||
# User-Agent: ESP32HTTPClient
|
||||
# Connection: close
|
||||
# Accept-Encoding: identity;q=1,chunked;q=0.1,*;q=0
|
||||
# Authorization: Basic dmVnYXJ3ZTpmaXNrZW4=
|
||||
# Content-Type: application/json
|
||||
# Content-Length: 44
|
||||
#
|
||||
# {"up":88695,"t":1557354754,"data":{"P":931}}
|
||||
|
||||
# POST / HTTP/1.1
|
||||
# Host: kanskje.de:8181
|
||||
# User-Agent: curl/7.64.0
|
||||
# Accept: */*
|
||||
# Content-Type: application/json
|
||||
# Content-Length: 44
|
||||
#
|
||||
# {"up":88695,"t":1557354754,"data":{"P":931}}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user