diff --git a/motorHist.py b/motorHist.py index 40509103a1426330d0e679393ae0e3e01941c5b7..5307626fa19ec54a54ef15c782c6826e5a4cf756 100755 --- a/motorHist.py +++ b/motorHist.py @@ -117,7 +117,7 @@ def main(log_file): # Assume every record name is a motor, add to list if name is new if name not in motor_dict.keys(): - motor_dict[name] = {"MSTA" : None, "MIP" : None, "VAL" : None, "DMOV" : None} + motor_dict[name] = {"MSTA" : None, "MIP" : None, "VAL" : None, "DMOV" : None, "JOGF" : None, "JOGR" : None, "STOP" : None} # Check for VAL change if field == "VAL": @@ -169,6 +169,42 @@ def main(log_file): motor_dict[name]["MIP"] = current_mip print() + # Check for JOGR change + if field == "JOGR": + # Catch error here? + current_jogr = int(value) + last_jogr = motor_dict[name]["JOGR"] + if last_jogr == None: + print("[{} {}] {}'s {} field starts at {}".format(date, time, name, field, current_jogr)) + else: + print("[{} {}] {}'s {} field changed from {} to {}".format(date, time, name, field, last_jogr, current_jogr)) + motor_dict[name]["JOGR"] = current_jogr + print() + + # Check for JOGF change + if field == "JOGF": + # Catch error here? + current_jogf = int(value) + last_jogf = motor_dict[name]["JOGF"] + if last_jogf == None: + print("[{} {}] {}'s {} field starts at {}".format(date, time, name, field, current_jogf)) + else: + print("[{} {}] {}'s {} field changed from {} to {}".format(date, time, name, field, last_jogf, current_jogf)) + motor_dict[name]["JOGF"] = current_jogf + print() + + # Check for STOP change + if field == "STOP": + # Catch error here? + current_stop = int(value) + last_stop = motor_dict[name]["STOP"] + if last_stop == None: + print("[{} {}] {}'s {} field starts at {}".format(date, time, name, field, current_stop)) + else: + print("[{} {}] {}'s {} field changed from {} to {}".format(date, time, name, field, last_stop, current_stop)) + motor_dict[name]["STOP"] = current_stop + print() + fh.close() if __name__ == '__main__':