From 330f9198e1a85021c32a1ce9f53e5259eabc6795 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Tue, 12 Jun 2007 22:37:52 +0000 Subject: add stv0299 snr to dB Calculation (thx to adenin for this) fallback to normal SNR when no SNR to dB calculation is available --- lib/python/Components/Converter/FrontendInfo.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Converter/FrontendInfo.py b/lib/python/Components/Converter/FrontendInfo.py index 34d55be4..6377d680 100644 --- a/lib/python/Components/Converter/FrontendInfo.py +++ b/lib/python/Components/Converter/FrontendInfo.py @@ -24,6 +24,7 @@ class FrontendInfo(Converter, object): @cached def getText(self): assert self.type != self.LOCK, "the text output of FrontendInfo cannot be used for lock info" + percent = None if self.type == self.BER: # as count count = self.source.ber if count is not None: @@ -35,9 +36,11 @@ class FrontendInfo(Converter, object): elif self.type == self.SNR: percent = self.source.snr elif self.type == self.SNRdB: - if self.source.snr_db is None: - return "N/A" - return "%3.02f dB" % (self.source.snr_db / 100.0) + if self.source.snr_db is not None: + return "%3.02f dB" % (self.source.snr_db / 100.0) + elif self.source.snr is not None: #fallback to normal SNR... + percent = self.source.snr + return "SNR:%d %%" % (percent * 100 / 65536) if percent is None: return "N/A" -- cgit v1.2.3