From cd10b439d0465afa6bce38188a4e9d8a5e74d859 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 21 Aug 2013 11:02:52 +0200 Subject: Added basic support for positioners to control steerable satellite dishes --- menu.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index dcfaecca..e466ae0f 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 3.2 2013/04/27 10:25:51 kls Exp $ + * $Id: menu.c 3.3 2013/08/21 10:45:11 kls Exp $ */ #include "menu.h" @@ -2971,6 +2971,14 @@ void cMenuSetupLNB::Setup(void) } } + Add(new cMenuEditBoolItem(tr("Setup.LNB$Use dish positioner"), &data.UsePositioner)); + if (data.UsePositioner) { + Add(new cMenuEditIntxItem(tr("Setup.LNB$Site latitude (degrees)"), &data.SiteLat, -900, 900, 10, tr("South"), tr("North"))); + Add(new cMenuEditIntxItem(tr("Setup.LNB$Site longitude (degrees)"), &data.SiteLon, -1800, 1800, 10, tr("West"), tr("East"))); + Add(new cMenuEditIntxItem(tr("Setup.LNB$Max. positioner swing (degrees)"), &data.PositionerSwing, 0, 900, 10)); + Add(new cMenuEditIntxItem(tr("Setup.LNB$Positioner speed (degrees/s)"), &data.PositionerSpeed, 1, 1800, 10)); + } + SetCurrent(Get(current)); Display(); } @@ -2978,6 +2986,7 @@ void cMenuSetupLNB::Setup(void) eOSState cMenuSetupLNB::ProcessKey(eKeys Key) { int oldDiSEqC = data.DiSEqC; + int oldUsePositioner = data.UsePositioner; bool DeviceBondingsChanged = false; if (Key == kOk) { cString NewDeviceBondings = satCableNumbers.ToString(); @@ -2986,7 +2995,7 @@ eOSState cMenuSetupLNB::ProcessKey(eKeys Key) } eOSState state = cMenuSetupBase::ProcessKey(Key); - if (Key != kNone && data.DiSEqC != oldDiSEqC) + if (Key != kNone && (data.DiSEqC != oldDiSEqC || data.UsePositioner != oldUsePositioner)) Setup(); else if (DeviceBondingsChanged) cDvbDevice::BondDevices(data.DeviceBondings); @@ -3625,6 +3634,7 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched) displayChannel = Skins.Current()->DisplayChannel(withInfo); number = 0; timeout = Switched || Setup.TimeoutRequChInfo; + positioner = NULL; channel = Channels.GetByNumber(Number); lastPresent = lastFollowing = NULL; if (channel) { @@ -3646,6 +3656,7 @@ cDisplayChannel::cDisplayChannel(eKeys FirstKey) lastTime.Set(); withInfo = Setup.ShowInfoOnChSwitch; displayChannel = Skins.Current()->DisplayChannel(withInfo); + positioner = NULL; channel = Channels.GetByNumber(cDevice::CurrentChannel()); ProcessKey(FirstKey); } @@ -3853,7 +3864,7 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) return osEnd; } }; - if (!timeout || lastTime.Elapsed() < (uint64_t)(Setup.ChannelInfoTime * 1000)) { + if (positioner || !timeout || lastTime.Elapsed() < (uint64_t)(Setup.ChannelInfoTime * 1000)) { if (Key == kNone && !number && group < 0 && !NewChannel && channel && channel->Number() != cDevice::CurrentChannel()) { // makes sure a channel switch through the SVDRP CHAN command is displayed channel = Channels.GetByNumber(cDevice::CurrentChannel()); @@ -3861,13 +3872,24 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) lastTime.Set(); } DisplayInfo(); - displayChannel->Flush(); if (NewChannel) { SetTrackDescriptions(NewChannel->Number()); // to make them immediately visible in the channel display Channels.SwitchTo(NewChannel->Number()); SetTrackDescriptions(NewChannel->Number()); // switching the channel has cleared them channel = NewChannel; } + const cPositioner *Positioner = cDevice::ActualDevice()->Positioner(); + bool PositionerMoving = Positioner && Positioner->IsMoving(); + SetNeedsFastResponse(PositionerMoving); + if (!PositionerMoving) { + if (positioner) + lastTime.Set(); // to keep the channel display up a few seconds after the target position has been reached + Positioner = NULL; + } + if (Positioner || positioner) // making sure we call SetPositioner(NULL) if there is a switch from "with" to "without" positioner + displayChannel->SetPositioner(Positioner); + positioner = Positioner; + displayChannel->Flush(); return osContinue; } return osEnd; -- cgit v1.2.3