Skip to content
Snippets Groups Projects
Commit c5fea19a authored by kpetersn's avatar kpetersn
Browse files

Added support for DMOV field. Reverted change to how bit state was displayed.

parent 863d6a3f
No related branches found
No related tags found
No related merge requests found
......@@ -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?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment