diff --git a/src/pvWebMonitor/pvwatch.py b/src/pvWebMonitor/pvwatch.py index 0363499..2a68db8 100644 --- a/src/pvWebMonitor/pvwatch.py +++ b/src/pvWebMonitor/pvwatch.py @@ -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 @@ -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''' @@ -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]