mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 08:51:10 +02:00
motorcontrol: add frontend member and param to select frontend to use; set live frontend to selected for diseqc commands
This commit is contained in:
@@ -44,7 +44,7 @@
|
|||||||
#include <driver/screen_max.h>
|
#include <driver/screen_max.h>
|
||||||
|
|
||||||
#include <zapit/satconfig.h>
|
#include <zapit/satconfig.h>
|
||||||
#include <zapit/frontend_c.h>
|
#include <zapit/zapit.h>
|
||||||
|
|
||||||
static int g_sig;
|
static int g_sig;
|
||||||
static int g_snr;
|
static int g_snr;
|
||||||
@@ -59,11 +59,21 @@ static int moving = 0;
|
|||||||
#define BAR_WIDTH 100
|
#define BAR_WIDTH 100
|
||||||
#define BAR_HEIGHT 16 //(13 + BAR_BORDER*2)
|
#define BAR_HEIGHT 16 //(13 + BAR_BORDER*2)
|
||||||
|
|
||||||
CMotorControl::CMotorControl()
|
CMotorControl::CMotorControl(int tnum)
|
||||||
{
|
{
|
||||||
|
printf("CMotorControl::CMotorControl: tuner %d\n", tnum);
|
||||||
|
frontend = CFEManager::getInstance()->getFE(tnum);
|
||||||
|
if(frontend == NULL) {
|
||||||
|
printf("CMotorControl::CMotorControl: BUG, invalid tuner number %d, using first\n", tnum);
|
||||||
|
frontend = CFEManager::getInstance()->getFE(0);
|
||||||
|
}
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CMotorControl::~CMotorControl()
|
||||||
|
{
|
||||||
|
printf("CMotorControl::~CMotorControl\n");
|
||||||
|
}
|
||||||
void CMotorControl::Init(void)
|
void CMotorControl::Init(void)
|
||||||
{
|
{
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
frameBuffer = CFrameBuffer::getInstance();
|
||||||
@@ -120,6 +130,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &)
|
|||||||
x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2;
|
x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2;
|
||||||
y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - height) / 2;
|
y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - height) / 2;
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* send satellite list to zapit */
|
/* send satellite list to zapit */
|
||||||
for(sit = satellitePositions.begin(); sit != satellitePositions.end(); sit++) {
|
for(sit = satellitePositions.begin(); sit != satellitePositions.end(); sit++) {
|
||||||
if(!strcmp(sit->second.name.c_str(),scansettings.satNameNoDiseqc)) {
|
if(!strcmp(sit->second.name.c_str(),scansettings.satNameNoDiseqc)) {
|
||||||
@@ -131,23 +142,28 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
origPosition = motorPosition;
|
#endif
|
||||||
|
/* send satellite list to zapit */
|
||||||
|
sat.position = CServiceManager::getInstance()->GetSatellitePosition(scansettings.satNameNoDiseqc);
|
||||||
|
strncpy(sat.satName, scansettings.satNameNoDiseqc, 50);
|
||||||
|
satList.push_back(sat);
|
||||||
|
|
||||||
|
satellite_map_t & satmap = frontend->getSatellites();
|
||||||
|
sit = satmap.find(sat.position);
|
||||||
|
if(sit != satmap.end() && sit->second.motor_position)
|
||||||
|
motorPosition = sit->second.motor_position;
|
||||||
|
|
||||||
|
origPosition = motorPosition;
|
||||||
|
//FIXME change cZapit live fe
|
||||||
|
g_Zapit->stopPlayBack();
|
||||||
g_Zapit->setScanSatelliteList( satList);
|
g_Zapit->setScanSatelliteList( satList);
|
||||||
|
CZapit::getInstance()->SetLiveFrontend(frontend);
|
||||||
|
|
||||||
TP.feparams.frequency = atoi(scansettings.TP_freq);
|
TP.feparams.frequency = atoi(scansettings.TP_freq);
|
||||||
TP.feparams.u.qpsk.symbol_rate = atoi(scansettings.TP_rate);
|
TP.feparams.u.qpsk.symbol_rate = atoi(scansettings.TP_rate);
|
||||||
TP.feparams.u.qpsk.fec_inner = (fe_code_rate_t)scansettings.TP_fec;
|
TP.feparams.u.qpsk.fec_inner = (fe_code_rate_t)scansettings.TP_fec;
|
||||||
TP.polarization = scansettings.TP_pol;
|
TP.polarization = scansettings.TP_pol;
|
||||||
#if 0
|
|
||||||
CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo ();
|
|
||||||
TP.feparams.frequency = si.tsfrequency;
|
|
||||||
TP.feparams.u.qpsk.symbol_rate = si.rate;
|
|
||||||
TP.feparams.u.qpsk.fec_inner = si.fec;
|
|
||||||
TP.polarization = si.polarisation;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_Zapit->stopPlayBack();
|
|
||||||
g_Zapit->tune_TP(TP);
|
g_Zapit->tune_TP(TP);
|
||||||
|
|
||||||
paint();
|
paint();
|
||||||
@@ -335,15 +351,16 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &)
|
|||||||
printf("[motorcontrol] 5 key received... store present satellite number: %d\n", motorPosition);
|
printf("[motorcontrol] 5 key received... store present satellite number: %d\n", motorPosition);
|
||||||
if(motorPosition != origPosition) {
|
if(motorPosition != origPosition) {
|
||||||
printf("[motorcontrol] position changed %d -> %d\n", origPosition, motorPosition);
|
printf("[motorcontrol] position changed %d -> %d\n", origPosition, motorPosition);
|
||||||
for(sit = satellitePositions.begin(); sit != satellitePositions.end(); sit++) {
|
for(sit = satmap.begin(); sit != satmap.end(); sit++) {
|
||||||
if(sit->second.motor_position == motorPosition)
|
if(sit->second.motor_position == motorPosition)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(sit != satellitePositions.end()) {
|
if(sit != satmap.end()) {
|
||||||
printf("[motorcontrol] new positions configured for %s\n", sit->second.name.c_str());
|
std::string satname = CServiceManager::getInstance()->GetSatelliteName(sit->first);
|
||||||
|
printf("[motorcontrol] new positions configured for %s\n", satname.c_str());
|
||||||
std::string buf = g_Locale->getText(LOCALE_MOTORCONTROL_OVERRIDE);
|
std::string buf = g_Locale->getText(LOCALE_MOTORCONTROL_OVERRIDE);
|
||||||
buf += " ";
|
buf += " ";
|
||||||
buf += sit->second.name;
|
buf += satname;
|
||||||
buf += " ?";
|
buf += " ?";
|
||||||
store = (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, buf,CMessageBox::mbrNo,CMessageBox::mbNo|CMessageBox::mbYes) == CMessageBox::mbrYes);
|
store = (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, buf,CMessageBox::mbrNo,CMessageBox::mbNo|CMessageBox::mbYes) == CMessageBox::mbrYes);
|
||||||
}
|
}
|
||||||
@@ -414,7 +431,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hide();
|
hide();
|
||||||
CFrontend::getInstance()->setTsidOnid(0);
|
frontend->setTsidOnid(0);
|
||||||
|
|
||||||
return menu_return::RETURN_REPAINT;
|
return menu_return::RETURN_REPAINT;
|
||||||
}
|
}
|
||||||
@@ -701,8 +718,8 @@ void CMotorControl::showSNR()
|
|||||||
|
|
||||||
int sw;
|
int sw;
|
||||||
|
|
||||||
ssig = CFrontend::getInstance()->getSignalStrength();
|
ssig = frontend->getSignalStrength();
|
||||||
ssnr = CFrontend::getInstance()->getSignalNoiseRatio();
|
ssnr = frontend->getSignalNoiseRatio();
|
||||||
|
|
||||||
snr = (ssnr & 0xFFFF) * 100 / 65535;
|
snr = (ssnr & 0xFFFF) * 100 / 65535;
|
||||||
sig = (ssig & 0xFFFF) * 100 / 65535;
|
sig = (ssig & 0xFFFF) * 100 / 65535;
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
#include <gui/widget/progressbar.h>
|
#include <gui/widget/progressbar.h>
|
||||||
#include <driver/framebuffer.h>
|
#include <driver/framebuffer.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <zapit/femanager.h>
|
||||||
|
|
||||||
#define STEP_MODE_OFF 0
|
#define STEP_MODE_OFF 0
|
||||||
#define STEP_MODE_AUTO 1
|
#define STEP_MODE_AUTO 1
|
||||||
@@ -49,6 +49,7 @@ class CMotorControl : public CMenuTarget
|
|||||||
private:
|
private:
|
||||||
void Init(void);
|
void Init(void);
|
||||||
CFrameBuffer *frameBuffer;
|
CFrameBuffer *frameBuffer;
|
||||||
|
CFrontend *frontend;
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
int width;
|
int width;
|
||||||
@@ -81,7 +82,8 @@ class CMotorControl : public CMenuTarget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CMotorControl();
|
CMotorControl(int tnum = 0);
|
||||||
|
~CMotorControl();
|
||||||
void hide();
|
void hide();
|
||||||
int exec(CMenuTarget* parent, const std::string & actionKey);
|
int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user