From f97a4e53dcd9321cfe4d026f8efac3a3fea1cb6a Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Mon, 2 Jun 2008 14:35:58 +0000 Subject: [PATCH] dont use and show input power measurement (for rotor running detection), when the hardware doesn't support it --- lib/dvb/dvb.cpp | 9 ++++++ lib/dvb/dvb.h | 1 + lib/dvb/sec.h | 2 ++ lib/python/Components/SystemInfo.py | 3 ++ lib/python/Screens/Satconfig.py | 56 ++++++++++++++++++++++--------------- 5 files changed, 48 insertions(+), 23 deletions(-) diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index f5eadda..41c4f3c 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -748,6 +748,15 @@ error: return ret; } +bool eDVBResourceManager::canMeasureFrontendInputPower() +{ + for (eSmartPtrList::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i) + { + return i->m_frontend->readInputpower() >= 0; + } + return false; +} + class eDVBChannelFilePush: public eFilePushThread { public: diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h index c71a4d1..d2148bc 100644 --- a/lib/dvb/dvb.h +++ b/lib/dvb/dvb.h @@ -215,6 +215,7 @@ public: #ifdef SWIG public: #endif + bool canMeasureFrontendInputPower(); PSignal1 frontendUseMaskChanged; SWIG_VOID(RESULT) allocateRawChannel(eUsePtr &SWIG_OUTPUT, int slot_index); PyObject *setFrontendSlotInformations(SWIG_PYOBJECT(ePyObject) list); diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index 9522426..2241e00 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -270,6 +270,7 @@ private: eSmartPtrList &m_avail_frontends; bool m_rotorMoving; int m_not_linked_slot_mask; + bool m_canMeasureInputPower; #endif #ifdef SWIG eDVBSatelliteEquipmentControl(); @@ -324,6 +325,7 @@ public: PyObject *get_exclusive_satellites(int tu1, int tu2); void setRotorMoving(bool); // called from the frontend's bool isRotorMoving(); + bool canMeasureInputPower() { return m_canMeasureInputPower; } }; #endif diff --git a/lib/python/Components/SystemInfo.py b/lib/python/Components/SystemInfo.py index 844c954..c3c8ff3 100644 --- a/lib/python/Components/SystemInfo.py +++ b/lib/python/Components/SystemInfo.py @@ -1,3 +1,5 @@ +from enigma import eDVBResourceManager + SystemInfo = { } #FIXMEE... @@ -9,3 +11,4 @@ def getNumVideoDecoders(): return idx SystemInfo["NumVideoDecoders"] = getNumVideoDecoders() +SystemInfo["CanMeasureFrontendInputPower"] = eDVBResourceManager.getInstance().canMeasureFrontendInputPower() diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index e32c45f..5415ae0 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -1,5 +1,6 @@ from enigma import eDVBDB from Screen import Screen +from Components.SystemInfo import SystemInfo from Components.ActionMap import ActionMap from Components.ConfigList import ConfigListScreen from Components.MenuList import MenuList @@ -29,18 +30,22 @@ class NimSetup(Screen, ConfigListScreen): list.append(getConfigListEntry(" ", nim.longitudeOrientation)) list.append(getConfigListEntry(_("Latitude"), nim.latitude)) list.append(getConfigListEntry(" ", nim.latitudeOrientation)) - - self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), nim.powerMeasurement) - list.append(self.advancedPowerMeasurement) - if nim.powerMeasurement.value: - list.append(getConfigListEntry(_("Power threshold in mA"), nim.powerThreshold)) - self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), nim.turningSpeed) - list.append(self.turningSpeed) - if nim.turningSpeed.value == "fast epoch": - self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), nim.fastTurningBegin) - self.turnFastEpochEnd = getConfigListEntry(_("End time"), nim.fastTurningEnd) - list.append(self.turnFastEpochBegin) - list.append(self.turnFastEpochEnd) + if SystemInfo["CanMeasureFrontendInputPower"]: + self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), nim.powerMeasurement) + list.append(self.advancedPowerMeasurement) + if nim.powerMeasurement.value: + list.append(getConfigListEntry(_("Power threshold in mA"), nim.powerThreshold)) + self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), nim.turningSpeed) + list.append(self.turningSpeed) + if nim.turningSpeed.value == "fast epoch": + self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), nim.fastTurningBegin) + self.turnFastEpochEnd = getConfigListEntry(_("End time"), nim.fastTurningEnd) + list.append(self.turnFastEpochBegin) + list.append(self.turnFastEpochEnd) + else: + if nim.powerMeasurement.value: + nim.powerMeasurement.value = False + nim.powerMeasurement.save() def createSetup(self): print "Creating setup" @@ -199,17 +204,22 @@ class NimSetup(Screen, ConfigListScreen): self.list.append(getConfigListEntry(" ", currLnb.longitudeOrientation)) self.list.append(getConfigListEntry(_("Latitude"), currLnb.latitude)) self.list.append(getConfigListEntry(" ", currLnb.latitudeOrientation)) - self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), currLnb.powerMeasurement) - self.list.append(self.advancedPowerMeasurement) - if currLnb.powerMeasurement.value: - self.list.append(getConfigListEntry(_("Power threshold in mA"), currLnb.powerThreshold)) - self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), currLnb.turningSpeed) - self.list.append(self.turningSpeed) - if currLnb.turningSpeed.value == "fast epoch": - self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), currLnb.fastTurningBegin) - self.turnFastEpochEnd = getConfigListEntry(_("End time"), currLnb.fastTurningEnd) - self.list.append(self.turnFastEpochBegin) - self.list.append(self.turnFastEpochEnd) + if SystemInfo["CanMeasureFrontendInputPower"]: + self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), currLnb.powerMeasurement) + self.list.append(self.advancedPowerMeasurement) + if currLnb.powerMeasurement.value: + self.list.append(getConfigListEntry(_("Power threshold in mA"), currLnb.powerThreshold)) + self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), currLnb.turningSpeed) + self.list.append(self.turningSpeed) + if currLnb.turningSpeed.value == "fast epoch": + self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), currLnb.fastTurningBegin) + self.turnFastEpochEnd = getConfigListEntry(_("End time"), currLnb.fastTurningEnd) + self.list.append(self.turnFastEpochBegin) + self.list.append(self.turnFastEpochEnd) + else: + if currLnb.powerMeasurement.value: + currLnb.powerMeasurement.value = False + currLnb.powerMeasurement.save() self.advancedLof = getConfigListEntry(_("LOF"), currLnb.lof) self.list.append(self.advancedLof) if currLnb.lof.value == "user_defined": -- 2.7.4