diff --git a/config.py b/config.py index af05ebf..5203ba3 100644 --- a/config.py +++ b/config.py @@ -4,8 +4,6 @@ from configutils import * SERIAL = '/dev/ttyUSB0' BAUD_RATE = 4800 -STOP_BITS = 1 -PARITY = None SFTP_HOST = 'rc-club-albersweiler.de' SFTP_PORT = 22 diff --git a/update.py b/update.py index c7bc6c4..7f6cd7f 100644 --- a/update.py +++ b/update.py @@ -63,6 +63,8 @@ def create_database(): def update_database(line): update_values = [] for name, _, _ in STORED_VALUES: + if line[name] == None: + return update_values += ["%f" % float(line[name])] now = time.time() @@ -115,7 +117,15 @@ def upload_graphs(): print("Unexpected error while uploading:", sys.exc_info()[1]) def main(): - pass + ser = serial.Serial(SERIAL, BAUD_RATE, timeout=10.0) + + while True: + line = ser.readline().decode('ascii') + print(line) + if len(line) > 0: + parsed = parse_line(line) + update_database(parsed) + if __name__ == '__main__':