fix spaces
This commit is contained in:
@@ -46,17 +46,17 @@ def read(ser):
|
||||
lap += 1
|
||||
data_dict[data[0]]['laps'] = lap
|
||||
data_dict[data[0]]['time'] = get_seconds()
|
||||
|
||||
|
||||
except:
|
||||
data_dict[data[0]] = {'name': data[1]}
|
||||
data_dict[data[0]]['time'] = get_seconds()
|
||||
data_dict[data[0]]['laps'] = 0
|
||||
|
||||
|
||||
data_json = json.dumps(data_dict, indent=4)
|
||||
print(data_json)
|
||||
with open(JSON_PATH, 'w') as file:
|
||||
file.write(data_json)
|
||||
|
||||
|
||||
def write(ser):
|
||||
while True:
|
||||
data = input('ID:')
|
||||
@@ -77,10 +77,10 @@ def write(ser):
|
||||
def main():
|
||||
s = serial.Serial(port="/dev/ttyACM3", parity=serial.PARITY_EVEN, stopbits=serial.STOPBITS_ONE, timeout=1)
|
||||
s.flush()
|
||||
|
||||
|
||||
rw = input('Read or Write tags? [R/w]')
|
||||
rw = rw.lower()
|
||||
|
||||
|
||||
if rw == 'w':
|
||||
s.write('w\r'.encode())
|
||||
write(s)
|
||||
@@ -90,12 +90,11 @@ def main():
|
||||
elif rw == '':
|
||||
s.write('r\r'.encode())
|
||||
read(s)
|
||||
|
||||
else:
|
||||
print('Invalid option')
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user