diff --git a/motorHist.py b/motorHist.py index 5de9e0c279e0ec63d5819e2662269729550770cd..bc96aae1dd2ef6076565d4f9fec40d00fe233893 100755 --- a/motorHist.py +++ b/motorHist.py @@ -65,7 +65,7 @@ def msta_diff(last_msta, current_msta): bit_state = 1 else: bit_state = 0 - print "MSTA:\t%s bit (0x%X) changed to \"%s\" [%i]" % (msta_dict[bit][0], bit, msta_dict[bit][1][bit_state], bit_state) + print "MSTA:\t%s bit (0x%X) changed to \"%s\" (%i)" % (msta_dict[bit][0], bit, msta_dict[bit][1][bit_state], bit_state) def mip_diff(last_mip, current_mip): if last_mip == None: @@ -87,7 +87,7 @@ def mip_diff(last_mip, current_mip): bit_state = 1 else: bit_state = 0 - print "MIP:\t%s bit (0x%X) changed to \"%s\" [%i]" % (mip_dict[bit][0], bit, mip_dict[bit][1][bit_state], bit_state) + print "MIP:\t%s bit (0x%X) changed to \"%s\" (%i)" % (mip_dict[bit][0], bit, mip_dict[bit][1][bit_state], bit_state) def main(log_file): @@ -116,7 +116,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} + motor_dict[name] = {"MSTA" : None, "MIP" : None, "VAL" : None, "DMOV" : None} # Check for VAL change if field == "VAL": @@ -130,6 +130,18 @@ def main(log_file): motor_dict[name]["VAL"] = current_val print + # Check for DMOV change + if field == "DMOV": + # Catch error here? + current_dmov = int(value) + last_dmov = motor_dict[name]["DMOV"] + if last_dmov == None: + print "[%s %s] %s's %s field starts at %i" % (date, time, name, field, current_dmov) + else: + print "[%s %s] %s's %s field changed from %i to %i" % (date, time, name, field, last_dmov, current_dmov) + motor_dict[name]["DMOV"] = current_dmov + print + # Check for MSTA change if field == "MSTA": # Catch error here?