Skip to content

Commit

Permalink
fixes #19
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Sep 7, 2016
1 parent 1d567c1 commit f624356
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/pvWebMonitor/pvwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def add_pv(self, mne, pv, desc, fmt, as_string):
'format': fmt, # format for display
'value': None, # formatted value
'raw_value': None, # unformatted value
'char_value': None, # string value
'as_string': as_string, # whether to return the string representation of the value
}
self.pvdb[pv] = entry
Expand Down Expand Up @@ -210,11 +211,15 @@ def update_pvdb(self, pv, raw_value):
msg = '!!!ERROR!!! %s was not found in pvdb!' % pv
raise PvNotRegistered, msg
entry = self.pvdb[pv]
# ch = entry['ch']
ch = entry['ch']
entry['timestamp'] = utils.getTime()
entry['counter'] += 1
entry['raw_value'] = raw_value
entry['value'] = entry['format'] % raw_value
entry['char_value'] = ch.char_value
if entry['as_string']:
entry['value'] = ch.char_value
else:
entry['value'] = entry['format'] % raw_value

def EPICS_monitor_receiver(self, *args, **kws):
'''Response to an EPICS (PyEpics) monitor on the channel'''
Expand All @@ -236,7 +241,7 @@ def buildReport(self):

sorted_id_list = sorted(self.xref)
fields = ("name", "id", "description", "timestamp", "record_type",
"counter", "units", "value", "raw_value", "format")
"counter", "units", "value", "char_value", "raw_value", "format")

for mne in sorted_id_list:
pv = self.xref[mne]
Expand Down

0 comments on commit f624356

Please sign in to comment.