mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 17:01:08 +02:00
Add struct to keep frontend settigs
* Add satellite map to keep configured satellites
* Change Lock() to handle usecount
* Use slave member to protect diseqc/voltage/tone operations
* Change debug to include frontend number
Origin commit data
------------------
Branch: ni/coolstream
Commit: c49ccd0b78
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-01-13 (Fri, 13 Jan 2012)
Origin message was:
------------------
* Add struct to keep frontend settigs
* Add satellite map to keep configured satellites
* Change Lock() to handle usecount
* Use slave member to protect diseqc/voltage/tone operations
* Change debug to include frontend number
------------------
This commit was generated by Migit
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
*
|
*
|
||||||
* (C) 2002-2003 Andreas Oberritter <obi@tuxbox.org>
|
* (C) 2002-2003 Andreas Oberritter <obi@tuxbox.org>
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 2011 CoolStream International Ltd
|
||||||
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@@ -23,8 +25,9 @@
|
|||||||
#define __zapit_frontend_h__
|
#define __zapit_frontend_h__
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include "types.h"
|
#include <zapit/types.h>
|
||||||
#include "channel.h"
|
#include <zapit/channel.h>
|
||||||
|
#include <zapit/satconfig.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#define FEC_S2_QPSK_1_2 (fe_code_rate_t)(FEC_AUTO+1) //10
|
#define FEC_S2_QPSK_1_2 (fe_code_rate_t)(FEC_AUTO+1) //10
|
||||||
@@ -76,9 +79,16 @@ typedef struct dvb_frontend_parameters FrontendParameters;
|
|||||||
|
|
||||||
#define MAX_LNBS 64 /* due to Diseqc 1.1 (2003-01-10 rasc) */
|
#define MAX_LNBS 64 /* due to Diseqc 1.1 (2003-01-10 rasc) */
|
||||||
|
|
||||||
class CFrontend;
|
class CFEManager;
|
||||||
typedef std::map<unsigned short, CFrontend*> fe_map_t;
|
|
||||||
typedef fe_map_t::iterator fe_map_iterator_t;
|
typedef struct frontend_config {
|
||||||
|
int diseqcRepeats;
|
||||||
|
int diseqcType;
|
||||||
|
int uni_scr;
|
||||||
|
int uni_qrg;
|
||||||
|
int motorRotationSpeed;
|
||||||
|
int highVoltage;
|
||||||
|
} frontend_config_t;
|
||||||
|
|
||||||
class CFrontend
|
class CFrontend
|
||||||
{
|
{
|
||||||
@@ -104,17 +114,9 @@ class CFrontend
|
|||||||
int32_t currentSatellitePosition;
|
int32_t currentSatellitePosition;
|
||||||
|
|
||||||
/* SETTINGS */
|
/* SETTINGS */
|
||||||
/* how often to repeat DiSEqC 1.1 commands */
|
frontend_config_t config;
|
||||||
uint8_t diseqcRepeats;
|
|
||||||
/* DiSEqC type of attached hardware */
|
|
||||||
diseqc_t diseqcType;
|
|
||||||
|
|
||||||
/* variables for EN 50494 (a.k.a Unicable) */
|
satellite_map_t satellites;
|
||||||
int uni_scr; /* the unicable SCR address, -1 == no unicable */
|
|
||||||
int uni_qrg; /* the unicable frequency in MHz, 0 == from spec */
|
|
||||||
|
|
||||||
int motorRotationSpeed; //in 0.1 degrees per second
|
|
||||||
bool highVoltage;
|
|
||||||
|
|
||||||
double gotoXXLatitude, gotoXXLongitude;
|
double gotoXXLatitude, gotoXXLongitude;
|
||||||
int gotoXXLaDirection, gotoXXLoDirection;
|
int gotoXXLaDirection, gotoXXLoDirection;
|
||||||
@@ -155,16 +157,17 @@ class CFrontend
|
|||||||
/* Private constructor */
|
/* Private constructor */
|
||||||
CFrontend(int Number = 0, int Adapter = 0);
|
CFrontend(int Number = 0, int Adapter = 0);
|
||||||
|
|
||||||
|
static CFrontend *getInstance(int Number = 0, int Adapter = 0);
|
||||||
friend class CFEManager;
|
friend class CFEManager;
|
||||||
public:
|
public:
|
||||||
~CFrontend(void);
|
~CFrontend(void);
|
||||||
static CFrontend *getInstance(int Number = 0, int Adapter = 0);
|
|
||||||
|
|
||||||
static fe_code_rate_t getCodeRate(const uint8_t fec_inner, int system = 0);
|
static fe_code_rate_t getCodeRate(const uint8_t fec_inner, int system = 0);
|
||||||
uint8_t getDiseqcPosition(void) const { return currentTransponder.diseqc; }
|
uint8_t getDiseqcPosition(void) const { return currentTransponder.diseqc; }
|
||||||
uint8_t getDiseqcRepeats(void) const { return diseqcRepeats; }
|
uint8_t getDiseqcRepeats(void) const { return config.diseqcRepeats; }
|
||||||
diseqc_t getDiseqcType(void) const { return diseqcType; }
|
diseqc_t getDiseqcType(void) const { return (diseqc_t) config.diseqcType; }
|
||||||
uint32_t getFrequency(void) const;
|
uint32_t getFrequency(void) const { return curfe.frequency; }
|
||||||
|
bool getHighBand() { return (int) getFrequency() >= lnbSwitch; }
|
||||||
static fe_modulation_t getModulation(const uint8_t modulation);
|
static fe_modulation_t getModulation(const uint8_t modulation);
|
||||||
uint8_t getPolarization(void) const;
|
uint8_t getPolarization(void) const;
|
||||||
const struct dvb_frontend_info *getInfo(void) const { return &info; };
|
const struct dvb_frontend_info *getInfo(void) const { return &info; };
|
||||||
@@ -178,7 +181,7 @@ class CFrontend
|
|||||||
|
|
||||||
int32_t getCurrentSatellitePosition() { return currentSatellitePosition; }
|
int32_t getCurrentSatellitePosition() { return currentSatellitePosition; }
|
||||||
|
|
||||||
void setDiseqcRepeats(const uint8_t repeats) { diseqcRepeats = repeats; }
|
void setDiseqcRepeats(const uint8_t repeats) { config.diseqcRepeats = repeats; }
|
||||||
void setDiseqcType(const diseqc_t type);
|
void setDiseqcType(const diseqc_t type);
|
||||||
void setTimeout(int timeout) { feTimeout = timeout; };
|
void setTimeout(int timeout) { feTimeout = timeout; };
|
||||||
void configUsals(double Latitude, double Longitude, int LaDirection, int LoDirection, bool _repeatUsals)
|
void configUsals(double Latitude, double Longitude, int LaDirection, int LoDirection, bool _repeatUsals)
|
||||||
@@ -190,8 +193,11 @@ class CFrontend
|
|||||||
repeatUsals = _repeatUsals;
|
repeatUsals = _repeatUsals;
|
||||||
};
|
};
|
||||||
void configRotor(int _motorRotationSpeed, bool _highVoltage)
|
void configRotor(int _motorRotationSpeed, bool _highVoltage)
|
||||||
{ motorRotationSpeed = _motorRotationSpeed; highVoltage = _highVoltage; };
|
{ config.motorRotationSpeed = _motorRotationSpeed; config.highVoltage = _highVoltage; };
|
||||||
void configUnicable(int scr, int qrg) { uni_scr = scr; uni_qrg = qrg; };
|
void configUnicable(int scr, int qrg) { config.uni_scr = scr; config.uni_qrg = qrg; };
|
||||||
|
|
||||||
|
frontend_config_t& getConfig() { return config; };
|
||||||
|
void setConfig(frontend_config_t cfg) { setDiseqcType((diseqc_t) cfg.diseqcType); config = cfg; };
|
||||||
|
|
||||||
int setParameters(TP_params *TP, bool nowait = 0);
|
int setParameters(TP_params *TP, bool nowait = 0);
|
||||||
int tuneFrequency (struct dvb_frontend_parameters * feparams, uint8_t polarization, bool nowait = false);
|
int tuneFrequency (struct dvb_frontend_parameters * feparams, uint8_t polarization, bool nowait = false);
|
||||||
@@ -208,24 +214,31 @@ class CFrontend
|
|||||||
|
|
||||||
fe_code_rate_t getCFEC ();
|
fe_code_rate_t getCFEC ();
|
||||||
transponder_id_t getTsidOnid() { return currentTransponder.TP_id; }
|
transponder_id_t getTsidOnid() { return currentTransponder.TP_id; }
|
||||||
|
bool sameTsidOnid(transponder_id_t tpid)
|
||||||
|
{
|
||||||
|
return (currentTransponder.TP_id == 0)
|
||||||
|
|| (tpid == currentTransponder.TP_id);
|
||||||
|
}
|
||||||
void setTsidOnid(transponder_id_t newid) { currentTransponder.TP_id = newid; }
|
void setTsidOnid(transponder_id_t newid) { currentTransponder.TP_id = newid; }
|
||||||
uint32_t getRate ();
|
uint32_t getRate ();
|
||||||
|
|
||||||
bool Open();
|
bool Open();
|
||||||
void Close();
|
void Close();
|
||||||
void Lock() { locked = true; };
|
void Lock();
|
||||||
void Unlock() { locked = false; };
|
void Unlock();
|
||||||
|
|
||||||
bool sendUncommittedSwitchesCommand(int input);
|
bool sendUncommittedSwitchesCommand(int input);
|
||||||
bool setInput(CZapitChannel *channel, bool nvod);
|
bool setInput(CZapitChannel *channel, bool nvod);
|
||||||
void setInput(t_satellite_position satellitePosition, uint32_t frequency, uint8_t polarization);
|
void setInput(t_satellite_position satellitePosition, uint32_t frequency, uint8_t polarization);
|
||||||
bool setDiseqcSimple(int sat_no, const uint8_t pol, const uint32_t frequency);
|
bool setDiseqcSimple(int sat_no, const uint8_t pol, const uint32_t frequency);
|
||||||
void setDiseqc(int sat_no, const uint8_t pol, const uint32_t frequency);
|
void setDiseqc(int sat_no, const uint8_t pol, const uint32_t frequency);
|
||||||
void setMasterSlave(bool _slave) { slave = _slave; };
|
void setMasterSlave(bool _slave);
|
||||||
int driveToSatellitePosition(t_satellite_position satellitePosition, bool from_scan = false);
|
int driveToSatellitePosition(t_satellite_position satellitePosition, bool from_scan = false);
|
||||||
void setLnbOffsets(int32_t _lnbOffsetLow, int32_t _lnbOffsetHigh, int32_t _lnbSwitch);
|
void setLnbOffsets(int32_t _lnbOffsetLow, int32_t _lnbOffsetHigh, int32_t _lnbSwitch);
|
||||||
struct dvb_frontend_event getEvent(void);
|
struct dvb_frontend_event getEvent(void);
|
||||||
bool Locked() { return locked; };
|
bool Locked() { return usecount; };
|
||||||
|
satellite_map_t & getSatellites() { return satellites; }
|
||||||
|
void setSatellites(satellite_map_t satmap) { satellites = satmap; }
|
||||||
|
int getNumber() { return fenumber; };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __zapit_frontend_h__ */
|
#endif /* __zapit_frontend_h__ */
|
||||||
|
@@ -3,6 +3,8 @@
|
|||||||
*
|
*
|
||||||
* (C) 2002-2003 Andreas Oberritter <obi@tuxbox.org>
|
* (C) 2002-2003 Andreas Oberritter <obi@tuxbox.org>
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 2011 CoolStream International Ltd
|
||||||
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@@ -114,8 +116,8 @@ static const struct dtv_property dvbc_cmdargs[] = {
|
|||||||
((tv2.tv_usec-tv.tv_usec) / 1000); \
|
((tv2.tv_usec-tv.tv_usec) / 1000); \
|
||||||
if(tmin > timer_msec) tmin = timer_msec; \
|
if(tmin > timer_msec) tmin = timer_msec; \
|
||||||
if(tmax < timer_msec) tmax = timer_msec; \
|
if(tmax < timer_msec) tmax = timer_msec; \
|
||||||
printf("%s: %u msec (min %u max %u)\n", \
|
printf("[fe%d] %s: %u msec (min %u max %u)\n", \
|
||||||
label, timer_msec, tmin, tmax);
|
fenumber, label, timer_msec, tmin, tmax);
|
||||||
|
|
||||||
// Internal Inner FEC representation
|
// Internal Inner FEC representation
|
||||||
typedef enum dvb_fec {
|
typedef enum dvb_fec {
|
||||||
@@ -132,6 +134,7 @@ typedef enum dvb_fec {
|
|||||||
fNone = 15
|
fNone = 15
|
||||||
} dvb_fec_t;
|
} dvb_fec_t;
|
||||||
|
|
||||||
|
/*********************************************************************************************************/
|
||||||
// Global fe instance
|
// Global fe instance
|
||||||
CFrontend *CFrontend::currentFe = NULL;
|
CFrontend *CFrontend::currentFe = NULL;
|
||||||
|
|
||||||
@@ -150,10 +153,10 @@ CFrontend::CFrontend(int Number, int Adapter)
|
|||||||
fd = -1;
|
fd = -1;
|
||||||
fenumber = Number;
|
fenumber = Number;
|
||||||
adapter = Adapter;
|
adapter = Adapter;
|
||||||
slave = fenumber; // FIXME
|
slave = false;
|
||||||
diseqcType = NO_DISEQC;
|
|
||||||
standby = true;
|
standby = true;
|
||||||
locked = false;
|
locked = false;
|
||||||
|
usecount = 0;
|
||||||
|
|
||||||
|
|
||||||
memset(&curfe, 0, sizeof(curfe));
|
memset(&curfe, 0, sizeof(curfe));
|
||||||
@@ -169,23 +172,27 @@ CFrontend::CFrontend(int Number, int Adapter)
|
|||||||
currentTransponder.TP_id = 0;
|
currentTransponder.TP_id = 0;
|
||||||
currentTransponder.diseqc = 255;
|
currentTransponder.diseqc = 255;
|
||||||
|
|
||||||
uni_scr = -1; /* the unicable SCR address, -1 == no unicable */
|
config.diseqcType = NO_DISEQC;
|
||||||
uni_qrg = 0; /* the unicable frequency in MHz, 0 == from spec */
|
config.diseqcRepeats = 0;
|
||||||
|
config.uni_scr = -1; /* the unicable SCR address, -1 == no unicable */
|
||||||
|
config.uni_qrg = 0; /* the unicable frequency in MHz, 0 == from spec */
|
||||||
|
config.highVoltage = false;
|
||||||
|
config.motorRotationSpeed = 0; //in 0.1 degrees per second
|
||||||
|
|
||||||
feTimeout = 40;
|
feTimeout = 40;
|
||||||
highVoltage = false;
|
// to allow Open() switch it off
|
||||||
motorRotationSpeed = 0; //in 0.1 degrees per second
|
currentVoltage = SEC_VOLTAGE_OFF; //SEC_VOLTAGE_13;
|
||||||
|
currentToneMode = SEC_TONE_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFrontend::~CFrontend(void)
|
CFrontend::~CFrontend(void)
|
||||||
{
|
{
|
||||||
|
printf("[fe%d] close frontend fd %d\n", fenumber, fd);
|
||||||
if(fd >= 0) {
|
if(fd >= 0) {
|
||||||
if (diseqcType > MINI_DISEQC)
|
Close();
|
||||||
sendDiseqcStandby();
|
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
currentFe = NULL;
|
//currentFe = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFrontend::Open(void)
|
bool CFrontend::Open(void)
|
||||||
@@ -205,11 +212,12 @@ bool CFrontend::Open(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fop(ioctl, FE_GET_INFO, &info);
|
fop(ioctl, FE_GET_INFO, &info);
|
||||||
printf("[fe0] frontend fd %d type %d\n", fd, info.type);
|
printf("[fe%d] frontend fd %d type %d\n", fenumber, fd, info.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME info.type = FE_QAM;
|
//FIXME info.type = FE_QAM;
|
||||||
currentVoltage = SEC_VOLTAGE_OFF;
|
//currentVoltage = SEC_VOLTAGE_OFF;
|
||||||
|
//secSetVoltage(SEC_VOLTAGE_OFF, 15);
|
||||||
secSetVoltage(SEC_VOLTAGE_13, 15);
|
secSetVoltage(SEC_VOLTAGE_13, 15);
|
||||||
secSetTone(SEC_TONE_OFF, 15);
|
secSetTone(SEC_TONE_OFF, 15);
|
||||||
sendDiseqcPowerOn();
|
sendDiseqcPowerOn();
|
||||||
@@ -225,7 +233,7 @@ void CFrontend::Close(void)
|
|||||||
if(standby)
|
if(standby)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!slave && diseqcType > MINI_DISEQC)
|
if (!slave && config.diseqcType > MINI_DISEQC)
|
||||||
sendDiseqcStandby();
|
sendDiseqcStandby();
|
||||||
|
|
||||||
secSetVoltage(SEC_VOLTAGE_OFF, 0);
|
secSetVoltage(SEC_VOLTAGE_OFF, 0);
|
||||||
@@ -234,11 +242,44 @@ void CFrontend::Close(void)
|
|||||||
standby = true;;
|
standby = true;;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFrontend::setMasterSlave(bool _slave)
|
||||||
|
{
|
||||||
|
if(slave == _slave)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(_slave) {
|
||||||
|
secSetVoltage(SEC_VOLTAGE_OFF, 0);
|
||||||
|
secSetTone(SEC_TONE_OFF, 15);
|
||||||
|
}
|
||||||
|
slave = _slave;
|
||||||
|
if(!slave) {
|
||||||
|
secSetVoltage(SEC_VOLTAGE_13, 0);
|
||||||
|
#if 1
|
||||||
|
diseqc_t diseqcType = (diseqc_t) config.diseqcType;
|
||||||
|
config.diseqcType = NO_DISEQC;
|
||||||
|
setDiseqcType(diseqcType);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CFrontend::reset(void)
|
void CFrontend::reset(void)
|
||||||
{
|
{
|
||||||
// No-op
|
// No-op
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFrontend::Lock()
|
||||||
|
{
|
||||||
|
usecount++;
|
||||||
|
INFO("[fe%d] usecount %d tp %llx\n", fenumber, usecount, getTsidOnid());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFrontend::Unlock()
|
||||||
|
{
|
||||||
|
if(usecount > 0)
|
||||||
|
usecount--;
|
||||||
|
INFO("[fe%d] usecount %d tp %llx\n", fenumber, usecount, getTsidOnid());
|
||||||
|
}
|
||||||
|
|
||||||
fe_code_rate_t CFrontend::getCFEC()
|
fe_code_rate_t CFrontend::getCFEC()
|
||||||
{
|
{
|
||||||
if (info.type == FE_QPSK) {
|
if (info.type == FE_QPSK) {
|
||||||
@@ -320,22 +361,6 @@ fe_modulation_t CFrontend::getModulation(const uint8_t modulation)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CFrontend::getFrequency(void) const
|
|
||||||
{
|
|
||||||
switch (info.type) {
|
|
||||||
case FE_QPSK:
|
|
||||||
if (currentToneMode == SEC_TONE_OFF)
|
|
||||||
return curfe.frequency;
|
|
||||||
else
|
|
||||||
return curfe.frequency;
|
|
||||||
|
|
||||||
case FE_QAM:
|
|
||||||
case FE_OFDM:
|
|
||||||
default:
|
|
||||||
return curfe.frequency;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t CFrontend::getPolarization(void) const
|
uint8_t CFrontend::getPolarization(void) const
|
||||||
{
|
{
|
||||||
return currentTransponder.polarization;
|
return currentTransponder.polarization;
|
||||||
@@ -415,7 +440,7 @@ struct dvb_frontend_event CFrontend::getEvent(void)
|
|||||||
|
|
||||||
memset(&event, 0, sizeof(struct dvb_frontend_event));
|
memset(&event, 0, sizeof(struct dvb_frontend_event));
|
||||||
|
|
||||||
printf("[fe0] getEvent: max timeout: %d\n", TIMEOUT_MAX_MS);
|
printf("[fe%d] getEvent: max timeout: %d\n", fenumber, TIMEOUT_MAX_MS);
|
||||||
FE_TIMER_START();
|
FE_TIMER_START();
|
||||||
|
|
||||||
//while (msec <= TIMEOUT_MAX_MS ) {
|
//while (msec <= TIMEOUT_MAX_MS ) {
|
||||||
@@ -427,12 +452,12 @@ struct dvb_frontend_event CFrontend::getEvent(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
FE_TIMER_STOP("[fe0] ############################## poll timeout, time");
|
FE_TIMER_STOP("############################## poll timeout, time");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pfd.revents & (POLLIN | POLLPRI)) {
|
if (pfd.revents & (POLLIN | POLLPRI)) {
|
||||||
FE_TIMER_STOP("[fe0] poll has event after");
|
FE_TIMER_STOP("poll has event after");
|
||||||
memset(&event, 0, sizeof(struct dvb_frontend_event));
|
memset(&event, 0, sizeof(struct dvb_frontend_event));
|
||||||
|
|
||||||
//fop(ioctl, FE_READ_STATUS, &event.status);
|
//fop(ioctl, FE_READ_STATUS, &event.status);
|
||||||
@@ -441,7 +466,7 @@ struct dvb_frontend_event CFrontend::getEvent(void)
|
|||||||
perror("CFrontend::getEvent ioctl");
|
perror("CFrontend::getEvent ioctl");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//printf("[fe0] poll events %d status %x\n", pfd.revents, event.status);
|
//printf("[fe%d] poll events %d status %x\n", fenumber, pfd.revents, event.status);
|
||||||
|
|
||||||
if (event.status & FE_HAS_LOCK) {
|
if (event.status & FE_HAS_LOCK) {
|
||||||
printf("[fe%d] ****************************** FE_HAS_LOCK: freq %lu\n", fenumber, (long unsigned int)event.parameters.frequency);
|
printf("[fe%d] ****************************** FE_HAS_LOCK: freq %lu\n", fenumber, (long unsigned int)event.parameters.frequency);
|
||||||
@@ -466,7 +491,7 @@ struct dvb_frontend_event CFrontend::getEvent(void)
|
|||||||
/* msec = TIME_STEP; */
|
/* msec = TIME_STEP; */
|
||||||
}
|
}
|
||||||
} else if (pfd.revents & POLLHUP) {
|
} else if (pfd.revents & POLLHUP) {
|
||||||
FE_TIMER_STOP("[fe0] poll hup after");
|
FE_TIMER_STOP("poll hup after");
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -560,7 +585,7 @@ void CFrontend::getDelSys(int f, int m, char *&fec, char *&sys, char *&mod)
|
|||||||
fec = (char *)"9/10";
|
fec = (char *)"9/10";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("[fe0] getDelSys: unknown FEC: %d !!!\n", f);
|
printf("[frontend] getDelSys: unknown FEC: %d !!!\n", f);
|
||||||
case FEC_AUTO:
|
case FEC_AUTO:
|
||||||
fec = (char *)"AUTO";
|
fec = (char *)"AUTO";
|
||||||
break;
|
break;
|
||||||
@@ -652,7 +677,7 @@ bool CFrontend::buildProperties(const struct dvb_frontend_parameters *feparams,
|
|||||||
fec = FEC_9_10;
|
fec = FEC_9_10;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("[fe0] DEMOD: unknown FEC: %d\n", fec_inner);
|
printf("[fe%d] DEMOD: unknown FEC: %d\n", fenumber, fec_inner);
|
||||||
case FEC_AUTO:
|
case FEC_AUTO:
|
||||||
case FEC_S2_AUTO:
|
case FEC_S2_AUTO:
|
||||||
fec = FEC_AUTO;
|
fec = FEC_AUTO;
|
||||||
@@ -693,7 +718,7 @@ bool CFrontend::buildProperties(const struct dvb_frontend_parameters *feparams,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (uni_scr >= 0)
|
if (config.uni_scr >= 0)
|
||||||
cmdseq.props[FREQUENCY].u.data = sendEN50494TuningCommand(feparams->frequency,
|
cmdseq.props[FREQUENCY].u.data = sendEN50494TuningCommand(feparams->frequency,
|
||||||
currentToneMode == SEC_TONE_ON,
|
currentToneMode == SEC_TONE_ON,
|
||||||
currentVoltage == SEC_VOLTAGE_18,
|
currentVoltage == SEC_VOLTAGE_18,
|
||||||
@@ -714,18 +739,18 @@ int CFrontend::setFrontend(const struct dvb_frontend_parameters *feparams, bool
|
|||||||
|
|
||||||
tuned = false;
|
tuned = false;
|
||||||
|
|
||||||
//printf("[fe0] DEMOD: FEC %s system %s modulation %s pilot %s\n", f, s, m, pilot == PILOT_ON ? "on" : "off");
|
//printf("[fe%d] DEMOD: FEC %s system %s modulation %s pilot %s\n", fenumber, f, s, m, pilot == PILOT_ON ? "on" : "off");
|
||||||
struct dvb_frontend_event ev;
|
struct dvb_frontend_event ev;
|
||||||
{
|
{
|
||||||
// Erase previous events
|
// Erase previous events
|
||||||
while (1) {
|
while (1) {
|
||||||
if (ioctl(fd, FE_GET_EVENT, &ev) < 0)
|
if (ioctl(fd, FE_GET_EVENT, &ev) < 0)
|
||||||
break;
|
break;
|
||||||
printf("[fe0] DEMOD: event status %d\n", ev.status);
|
//printf("[fe%d] DEMOD: event status %d\n", fenumber, ev.status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("[fe0] DEMOD: FEC %s system %s modulation %s pilot %s, freq %d\n", f, s, m, pilot == PILOT_ON ? "on" : "off", p->props[FREQUENCY].u.data);
|
//printf("[fe%d] DEMOD: FEC %s system %s modulation %s pilot %s, freq %d\n", fenumber, f, s, m, pilot == PILOT_ON ? "on" : "off", p->props[FREQUENCY].u.data);
|
||||||
if (!buildProperties(feparams, cmdseq))
|
if (!buildProperties(feparams, cmdseq))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -736,7 +761,7 @@ int CFrontend::setFrontend(const struct dvb_frontend_parameters *feparams, bool
|
|||||||
perror("FE_SET_PROPERTY failed");
|
perror("FE_SET_PROPERTY failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
FE_TIMER_STOP("[fe0] FE_SET_PROPERTY took");
|
FE_TIMER_STOP("FE_SET_PROPERTY took");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
FE_TIMER_INIT();
|
FE_TIMER_INIT();
|
||||||
@@ -745,7 +770,7 @@ int CFrontend::setFrontend(const struct dvb_frontend_parameters *feparams, bool
|
|||||||
struct dvb_frontend_event event;
|
struct dvb_frontend_event event;
|
||||||
event = getEvent();
|
event = getEvent();
|
||||||
|
|
||||||
FE_TIMER_STOP("[fe0] tuning took");
|
FE_TIMER_STOP("tuning took");
|
||||||
}
|
}
|
||||||
|
|
||||||
return tuned;
|
return tuned;
|
||||||
@@ -753,13 +778,13 @@ int CFrontend::setFrontend(const struct dvb_frontend_parameters *feparams, bool
|
|||||||
|
|
||||||
void CFrontend::secSetTone(const fe_sec_tone_mode_t toneMode, const uint32_t ms)
|
void CFrontend::secSetTone(const fe_sec_tone_mode_t toneMode, const uint32_t ms)
|
||||||
{
|
{
|
||||||
if (info.type != FE_QPSK)
|
if (slave || info.type != FE_QPSK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (currentToneMode == toneMode)
|
if (currentToneMode == toneMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (uni_scr >= 0) {
|
if (config.uni_scr >= 0) {
|
||||||
/* this is too ugly for words. the "currentToneMode" is the only place
|
/* this is too ugly for words. the "currentToneMode" is the only place
|
||||||
where the global "highband" state is saved. So we need to fake it for
|
where the global "highband" state is saved. So we need to fake it for
|
||||||
unicable and still set the tone on... */
|
unicable and still set the tone on... */
|
||||||
@@ -774,24 +799,27 @@ void CFrontend::secSetTone(const fe_sec_tone_mode_t toneMode, const uint32_t ms)
|
|||||||
FE_TIMER_START();
|
FE_TIMER_START();
|
||||||
if (fop(ioctl, FE_SET_TONE, toneMode) == 0) {
|
if (fop(ioctl, FE_SET_TONE, toneMode) == 0) {
|
||||||
currentToneMode = toneMode;
|
currentToneMode = toneMode;
|
||||||
FE_TIMER_STOP("[fe0] FE_SET_TONE took");
|
FE_TIMER_STOP("FE_SET_TONE took");
|
||||||
usleep(1000 * ms);
|
usleep(1000 * ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrontend::secSetVoltage(const fe_sec_voltage_t voltage, const uint32_t ms)
|
void CFrontend::secSetVoltage(const fe_sec_voltage_t voltage, const uint32_t ms)
|
||||||
{
|
{
|
||||||
|
if (slave || info.type != FE_QPSK)
|
||||||
|
return;
|
||||||
|
|
||||||
if (currentVoltage == voltage)
|
if (currentVoltage == voltage)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf("[fe%d] voltage %s\n", fenumber, voltage == SEC_VOLTAGE_OFF ? "OFF" : voltage == SEC_VOLTAGE_13 ? "13" : "18");
|
printf("[fe%d] voltage %s\n", fenumber, voltage == SEC_VOLTAGE_OFF ? "OFF" : voltage == SEC_VOLTAGE_13 ? "13" : "18");
|
||||||
//printf("[fe%d] voltage %s high %d\n", fenumber, voltage == SEC_VOLTAGE_OFF ? "OFF" : voltage == SEC_VOLTAGE_13 ? "13" : "18", highVoltage);
|
//printf("[fe%d] voltage %s high %d\n", fenumber, voltage == SEC_VOLTAGE_OFF ? "OFF" : voltage == SEC_VOLTAGE_13 ? "13" : "18", config.highVoltage);
|
||||||
//int val = highVoltage;
|
//int val = config.highVoltage;
|
||||||
//fop(ioctl, FE_ENABLE_HIGH_LNB_VOLTAGE, val);
|
//fop(ioctl, FE_ENABLE_HIGH_LNB_VOLTAGE, val);
|
||||||
|
|
||||||
//FE_TIMER_INIT();
|
//FE_TIMER_INIT();
|
||||||
//FE_TIMER_START();
|
//FE_TIMER_START();
|
||||||
if (uni_scr >= 0) {
|
if (config.uni_scr >= 0) {
|
||||||
/* see my comment in secSetTone... */
|
/* see my comment in secSetTone... */
|
||||||
currentVoltage = voltage; /* need to know polarization for unicable */
|
currentVoltage = voltage; /* need to know polarization for unicable */
|
||||||
fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_13); /* voltage must not be 18V */
|
fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_13); /* voltage must not be 18V */
|
||||||
@@ -800,7 +828,7 @@ void CFrontend::secSetVoltage(const fe_sec_voltage_t voltage, const uint32_t ms)
|
|||||||
|
|
||||||
if (fop(ioctl, FE_SET_VOLTAGE, voltage) == 0) {
|
if (fop(ioctl, FE_SET_VOLTAGE, voltage) == 0) {
|
||||||
currentVoltage = voltage;
|
currentVoltage = voltage;
|
||||||
//FE_TIMER_STOP("[fe0] FE_SET_VOLTAGE took");
|
//FE_TIMER_STOP("[frontend] FE_SET_VOLTAGE took");
|
||||||
usleep(1000 * ms); // FIXME : is needed ?
|
usleep(1000 * ms); // FIXME : is needed ?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -811,10 +839,12 @@ void CFrontend::secResetOverload(void)
|
|||||||
|
|
||||||
void CFrontend::sendDiseqcCommand(const struct dvb_diseqc_master_cmd *cmd, const uint32_t ms)
|
void CFrontend::sendDiseqcCommand(const struct dvb_diseqc_master_cmd *cmd, const uint32_t ms)
|
||||||
{
|
{
|
||||||
printf("[fe0] Diseqc cmd: ");
|
printf("[fe%d] Diseqc cmd: ", fenumber);
|
||||||
for (int i = 0; i < cmd->msg_len; i++)
|
for (int i = 0; i < cmd->msg_len; i++)
|
||||||
printf("0x%X ", cmd->msg[i]);
|
printf("0x%X ", cmd->msg[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
if(slave)
|
||||||
|
return;
|
||||||
if (fop(ioctl, FE_DISEQC_SEND_MASTER_CMD, cmd) == 0)
|
if (fop(ioctl, FE_DISEQC_SEND_MASTER_CMD, cmd) == 0)
|
||||||
usleep(1000 * ms);
|
usleep(1000 * ms);
|
||||||
}
|
}
|
||||||
@@ -834,25 +864,25 @@ void CFrontend::setDiseqcType(const diseqc_t newDiseqcType)
|
|||||||
{
|
{
|
||||||
switch (newDiseqcType) {
|
switch (newDiseqcType) {
|
||||||
case NO_DISEQC:
|
case NO_DISEQC:
|
||||||
INFO("NO_DISEQC");
|
INFO("fe%d: NO_DISEQC", fenumber);
|
||||||
break;
|
break;
|
||||||
case MINI_DISEQC:
|
case MINI_DISEQC:
|
||||||
INFO("MINI_DISEQC");
|
INFO("fe%d: MINI_DISEQC", fenumber);
|
||||||
break;
|
break;
|
||||||
case SMATV_REMOTE_TUNING:
|
case SMATV_REMOTE_TUNING:
|
||||||
INFO("SMATV_REMOTE_TUNING");
|
INFO("fe%d: SMATV_REMOTE_TUNING", fenumber);
|
||||||
break;
|
break;
|
||||||
case DISEQC_1_0:
|
case DISEQC_1_0:
|
||||||
INFO("DISEQC_1_0");
|
INFO("fe%d: DISEQC_1_0", fenumber);
|
||||||
break;
|
break;
|
||||||
case DISEQC_1_1:
|
case DISEQC_1_1:
|
||||||
INFO("DISEQC_1_1");
|
INFO("fe%d: DISEQC_1_1", fenumber);
|
||||||
break;
|
break;
|
||||||
case DISEQC_1_2:
|
case DISEQC_1_2:
|
||||||
INFO("DISEQC_1_2");
|
INFO("fe%d: DISEQC_1_2", fenumber);
|
||||||
break;
|
break;
|
||||||
case DISEQC_ADVANCED:
|
case DISEQC_ADVANCED:
|
||||||
INFO("DISEQC_ADVANCED");
|
INFO("fe%d: DISEQC_ADVANCED", fenumber);
|
||||||
break;
|
break;
|
||||||
#if 0
|
#if 0
|
||||||
case DISEQC_2_0:
|
case DISEQC_2_0:
|
||||||
@@ -871,20 +901,20 @@ void CFrontend::setDiseqcType(const diseqc_t newDiseqcType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!slave && (diseqcType <= MINI_DISEQC)
|
if (!slave && (config.diseqcType <= MINI_DISEQC)
|
||||||
&& (newDiseqcType > MINI_DISEQC)) {
|
&& (newDiseqcType > MINI_DISEQC)) {
|
||||||
sendDiseqcPowerOn();
|
sendDiseqcPowerOn();
|
||||||
sendDiseqcReset();
|
sendDiseqcReset();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
if (diseqcType != newDiseqcType) {
|
if (config.diseqcType != newDiseqcType) {
|
||||||
sendDiseqcPowerOn();
|
sendDiseqcPowerOn();
|
||||||
sendDiseqcReset();
|
sendDiseqcReset();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
diseqcType = newDiseqcType;
|
config.diseqcType = newDiseqcType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrontend::setLnbOffsets(int32_t _lnbOffsetLow, int32_t _lnbOffsetHigh, int32_t _lnbSwitch)
|
void CFrontend::setLnbOffsets(int32_t _lnbOffsetLow, int32_t _lnbOffsetHigh, int32_t _lnbSwitch)
|
||||||
@@ -892,7 +922,7 @@ void CFrontend::setLnbOffsets(int32_t _lnbOffsetLow, int32_t _lnbOffsetHigh, int
|
|||||||
lnbOffsetLow = _lnbOffsetLow * 1000;
|
lnbOffsetLow = _lnbOffsetLow * 1000;
|
||||||
lnbOffsetHigh = _lnbOffsetHigh * 1000;
|
lnbOffsetHigh = _lnbOffsetHigh * 1000;
|
||||||
lnbSwitch = _lnbSwitch * 1000;
|
lnbSwitch = _lnbSwitch * 1000;
|
||||||
printf("[fe0] setLnbOffsets %d/%d/%d\n", lnbOffsetLow, lnbOffsetHigh, lnbSwitch);
|
printf("[fe%d] setLnbOffsets %d/%d/%d\n", fenumber, lnbOffsetLow, lnbOffsetHigh, lnbSwitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrontend::sendMotorCommand(uint8_t cmdtype, uint8_t address, uint8_t command, uint8_t num_parameters, uint8_t parameter1, uint8_t parameter2, int repeat)
|
void CFrontend::sendMotorCommand(uint8_t cmdtype, uint8_t address, uint8_t command, uint8_t num_parameters, uint8_t parameter1, uint8_t parameter2, int repeat)
|
||||||
@@ -912,7 +942,7 @@ void CFrontend::sendMotorCommand(uint8_t cmdtype, uint8_t address, uint8_t comma
|
|||||||
cmd.msg[4] = parameter2;
|
cmd.msg[4] = parameter2;
|
||||||
cmd.msg_len = 3 + num_parameters;
|
cmd.msg_len = 3 + num_parameters;
|
||||||
|
|
||||||
//secSetVoltage(highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15);
|
//secSetVoltage(config.highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15);
|
||||||
secSetVoltage(SEC_VOLTAGE_13, 15);
|
secSetVoltage(SEC_VOLTAGE_13, 15);
|
||||||
secSetTone(SEC_TONE_OFF, 15);
|
secSetTone(SEC_TONE_OFF, 15);
|
||||||
|
|
||||||
@@ -932,7 +962,7 @@ void CFrontend::positionMotor(uint8_t motorPosition)
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (motorPosition != 0) {
|
if (motorPosition != 0) {
|
||||||
secSetVoltage(highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15);
|
secSetVoltage(config.highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15);
|
||||||
secSetTone(SEC_TONE_OFF, 25);
|
secSetTone(SEC_TONE_OFF, 25);
|
||||||
cmd.msg[3] = motorPosition;
|
cmd.msg[3] = motorPosition;
|
||||||
|
|
||||||
@@ -972,14 +1002,14 @@ bool CFrontend::setInput(CZapitChannel * channel, bool nvod)
|
|||||||
|
|
||||||
void CFrontend::setInput(t_satellite_position satellitePosition, uint32_t frequency, uint8_t polarization)
|
void CFrontend::setInput(t_satellite_position satellitePosition, uint32_t frequency, uint8_t polarization)
|
||||||
{
|
{
|
||||||
sat_iterator_t sit = satellitePositions.find(satellitePosition);
|
sat_iterator_t sit = satellites.find(satellitePosition);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printf("[fe0] setInput: SatellitePosition %d -> %d\n", currentSatellitePosition, satellitePosition);
|
printf("[fe%d] setInput: SatellitePosition %d -> %d\n", fenumber, currentSatellitePosition, satellitePosition);
|
||||||
if (currentSatellitePosition != satellitePosition)
|
if (currentSatellitePosition != satellitePosition)
|
||||||
#endif
|
#endif
|
||||||
setLnbOffsets(sit->second.lnbOffsetLow, sit->second.lnbOffsetHigh, sit->second.lnbSwitch);
|
setLnbOffsets(sit->second.lnbOffsetLow, sit->second.lnbOffsetHigh, sit->second.lnbSwitch);
|
||||||
if (diseqcType != DISEQC_ADVANCED) {
|
if (config.diseqcType != DISEQC_ADVANCED) {
|
||||||
setDiseqc(sit->second.diseqc, polarization, frequency);
|
setDiseqc(sit->second.diseqc, polarization, frequency);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1002,20 +1032,20 @@ uint32_t CFrontend::sendEN50494TuningCommand(const uint32_t frequency, const int
|
|||||||
{
|
{
|
||||||
uint32_t uni_qrgs[] = { 1284, 1400, 1516, 1632, 1748, 1864, 1980, 2096 };
|
uint32_t uni_qrgs[] = { 1284, 1400, 1516, 1632, 1748, 1864, 1980, 2096 };
|
||||||
uint32_t bpf;
|
uint32_t bpf;
|
||||||
if (uni_qrg == 0)
|
if (config.uni_qrg == 0)
|
||||||
bpf = uni_qrgs[uni_scr];
|
bpf = uni_qrgs[config.uni_scr];
|
||||||
else
|
else
|
||||||
bpf = uni_qrg;
|
bpf = config.uni_qrg;
|
||||||
|
|
||||||
struct dvb_diseqc_master_cmd cmd = {
|
struct dvb_diseqc_master_cmd cmd = {
|
||||||
{0xe0, 0x10, 0x5a, 0x00, 0x00, 0x00}, 5
|
{0xe0, 0x10, 0x5a, 0x00, 0x00, 0x00}, 5
|
||||||
};
|
};
|
||||||
unsigned int t = (frequency / 1000 + bpf + 2) / 4 - 350;
|
unsigned int t = (frequency / 1000 + bpf + 2) / 4 - 350;
|
||||||
if (t < 1024 && uni_scr >= 0 && uni_scr < 8)
|
if (t < 1024 && config.uni_scr >= 0 && config.uni_scr < 8)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "VOLT18=%d TONE_ON=%d, freq=%d bpf=%d ret=%d\n", currentVoltage == SEC_VOLTAGE_18, currentToneMode == SEC_TONE_ON, frequency, bpf, (t + 350) * 4000 - frequency);
|
fprintf(stderr, "VOLT18=%d TONE_ON=%d, freq=%d bpf=%d ret=%d\n", currentVoltage == SEC_VOLTAGE_18, currentToneMode == SEC_TONE_ON, frequency, bpf, (t + 350) * 4000 - frequency);
|
||||||
cmd.msg[3] = (t >> 8) | /* highest 3 bits of t */
|
cmd.msg[3] = (t >> 8) | /* highest 3 bits of t */
|
||||||
(uni_scr << 5) | /* adress */
|
(config.uni_scr << 5) | /* adress */
|
||||||
(bank << 4) | /* not implemented yet */
|
(bank << 4) | /* not implemented yet */
|
||||||
(horizontal << 3) | /* horizontal == 0x08 */
|
(horizontal << 3) | /* horizontal == 0x08 */
|
||||||
(high_band) << 2; /* high_band == 0x04 */
|
(high_band) << 2; /* high_band == 0x04 */
|
||||||
@@ -1026,7 +1056,7 @@ uint32_t CFrontend::sendEN50494TuningCommand(const uint32_t frequency, const int
|
|||||||
fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_13);
|
fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_13);
|
||||||
return (t + 350) * 4000 - frequency;
|
return (t + 350) * 4000 - frequency;
|
||||||
}
|
}
|
||||||
WARN("ooops. t > 1024? (%d) or uni_scr out of range? (%d)", t, uni_scr);
|
WARN("ooops. t > 1024? (%d) or uni_scr out of range? (%d)", t, config.uni_scr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1104,7 +1134,7 @@ int CFrontend::setParameters(TP_params *TP, bool /*nowait*/)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("[fe0] tuner to frequency %d (offset %d)\n", feparams->frequency, freq_offset);
|
printf("[fe%d] tuner to frequency %d (offset %d)\n", fenumber, feparams->frequency, freq_offset);
|
||||||
setFrontend(feparams);
|
setFrontend(feparams);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1134,7 +1164,7 @@ bool CFrontend::sendUncommittedSwitchesCommand(int input)
|
|||||||
{0xe0, 0x10, 0x39, 0x00, 0x00, 0x00}, 4
|
{0xe0, 0x10, 0x39, 0x00, 0x00, 0x00}, 4
|
||||||
};
|
};
|
||||||
|
|
||||||
printf("[fe0] uncommitted %d -> %d\n", uncommitedInput, input);
|
printf("[fe%d] uncommitted %d -> %d\n", fenumber, uncommitedInput, input);
|
||||||
if ((input < 0) || (uncommitedInput == input))
|
if ((input < 0) || (uncommitedInput == input))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -1158,8 +1188,10 @@ bool CFrontend::setDiseqcSimple(int sat_no, const uint8_t pol, const uint32_t fr
|
|||||||
{0xe0, 0x10, 0x38, 0x00, 0x00, 0x00}, 4
|
{0xe0, 0x10, 0x38, 0x00, 0x00, 0x00}, 4
|
||||||
};
|
};
|
||||||
|
|
||||||
printf("[fe0] diseqc input %d -> %d\n", diseqc, sat_no);
|
INFO("[fe%d] diseqc input %d -> %d", fenumber, diseqc, sat_no);
|
||||||
currentTransponder.diseqc = sat_no;
|
currentTransponder.diseqc = sat_no;
|
||||||
|
if (slave)
|
||||||
|
return true;
|
||||||
if ((sat_no >= 0) && (diseqc != sat_no)) {
|
if ((sat_no >= 0) && (diseqc != sat_no)) {
|
||||||
diseqc = sat_no;
|
diseqc = sat_no;
|
||||||
printf("[fe%d] diseqc no. %d\n", fenumber, sat_no);
|
printf("[fe%d] diseqc no. %d\n", fenumber, sat_no);
|
||||||
@@ -1176,10 +1208,10 @@ bool CFrontend::setDiseqcSimple(int sat_no, const uint8_t pol, const uint32_t fr
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
#if 0 //do we need this in advanced setup ?
|
#if 0 //do we need this in advanced setup ?
|
||||||
if (diseqcType == SMATV_REMOTE_TUNING)
|
if (config.diseqcType == SMATV_REMOTE_TUNING)
|
||||||
sendDiseqcSmatvRemoteTuningCommand(frequency);
|
sendDiseqcSmatvRemoteTuningCommand(frequency);
|
||||||
|
|
||||||
if (diseqcType == MINI_DISEQC)
|
if (config.diseqcType == MINI_DISEQC)
|
||||||
sendToneBurst(b, 15);
|
sendToneBurst(b, 15);
|
||||||
currentTransponder.diseqc = sat_no;
|
currentTransponder.diseqc = sat_no;
|
||||||
#endif
|
#endif
|
||||||
@@ -1195,6 +1227,7 @@ void CFrontend::setDiseqc(int sat_no, const uint8_t pol, const uint32_t frequenc
|
|||||||
fe_sec_mini_cmd_t b = (sat_no & 1) ? SEC_MINI_B : SEC_MINI_A;
|
fe_sec_mini_cmd_t b = (sat_no & 1) ? SEC_MINI_B : SEC_MINI_A;
|
||||||
int delay = 0;
|
int delay = 0;
|
||||||
|
|
||||||
|
INFO("[fe%d] diseqc input %d -> %d", fenumber, diseqc, sat_no);
|
||||||
if (slave)
|
if (slave)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1204,14 +1237,14 @@ void CFrontend::setDiseqc(int sat_no, const uint8_t pol, const uint32_t frequenc
|
|||||||
//secSetVoltage(SEC_VOLTAGE_13, 15);//FIXME for test
|
//secSetVoltage(SEC_VOLTAGE_13, 15);//FIXME for test
|
||||||
secSetTone(SEC_TONE_OFF, 20);
|
secSetTone(SEC_TONE_OFF, 20);
|
||||||
|
|
||||||
for (loop = 0; loop <= diseqcRepeats; loop++) {
|
for (loop = 0; loop <= config.diseqcRepeats; loop++) {
|
||||||
//usleep(50*1000); /* sleep at least 50 milli seconds */
|
//usleep(50*1000); /* sleep at least 50 milli seconds */
|
||||||
|
|
||||||
if (diseqcType == MINI_DISEQC)
|
if (config.diseqcType == MINI_DISEQC)
|
||||||
sendToneBurst(b, 1);
|
sendToneBurst(b, 1);
|
||||||
|
|
||||||
delay = 0;
|
delay = 0;
|
||||||
if (diseqcType == DISEQC_1_1) { /* setup the uncommited switch first */
|
if (config.diseqcType == DISEQC_1_1) { /* setup the uncommited switch first */
|
||||||
|
|
||||||
delay = 60; // delay for 1.0 after 1.1 command
|
delay = 60; // delay for 1.0 after 1.1 command
|
||||||
cmd.msg[2] = 0x39; /* port group = uncommited switches */
|
cmd.msg[2] = 0x39; /* port group = uncommited switches */
|
||||||
@@ -1230,7 +1263,7 @@ void CFrontend::setDiseqc(int sat_no, const uint8_t pol, const uint32_t frequenc
|
|||||||
sendDiseqcCommand(&cmd, 100); /* send the command to setup second uncommited switch and wait 100 ms !!! */
|
sendDiseqcCommand(&cmd, 100); /* send the command to setup second uncommited switch and wait 100 ms !!! */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (diseqcType >= DISEQC_1_0) { /* DISEQC 1.0 */
|
if (config.diseqcType >= DISEQC_1_0) { /* DISEQC 1.0 */
|
||||||
|
|
||||||
usleep(delay * 1000);
|
usleep(delay * 1000);
|
||||||
//cmd.msg[0] |= 0x01; /* repeated transmission */
|
//cmd.msg[0] |= 0x01; /* repeated transmission */
|
||||||
@@ -1244,7 +1277,7 @@ void CFrontend::setDiseqc(int sat_no, const uint8_t pol, const uint32_t frequenc
|
|||||||
|
|
||||||
usleep(25 * 1000);
|
usleep(25 * 1000);
|
||||||
|
|
||||||
if (diseqcType == SMATV_REMOTE_TUNING)
|
if (config.diseqcType == SMATV_REMOTE_TUNING)
|
||||||
sendDiseqcSmatvRemoteTuningCommand(frequency);
|
sendDiseqcSmatvRemoteTuningCommand(frequency);
|
||||||
|
|
||||||
#if 0 // setSec do this, when tune called
|
#if 0 // setSec do this, when tune called
|
||||||
@@ -1330,24 +1363,24 @@ int CFrontend::driveToSatellitePosition(t_satellite_position satellitePosition,
|
|||||||
int new_position = 0, old_position = 0;
|
int new_position = 0, old_position = 0;
|
||||||
bool use_usals = 0;
|
bool use_usals = 0;
|
||||||
|
|
||||||
//if(diseqcType == DISEQC_ADVANCED) //FIXME testing
|
//if(config.diseqcType == DISEQC_ADVANCED) //FIXME testing
|
||||||
{
|
{
|
||||||
printf("[fe0] SatellitePosition %d -> %d\n", currentSatellitePosition, satellitePosition);
|
printf("[fe%d] SatellitePosition %d -> %d\n", fenumber, currentSatellitePosition, satellitePosition);
|
||||||
bool moved = false;
|
bool moved = false;
|
||||||
|
|
||||||
sat_iterator_t sit = satellitePositions.find(satellitePosition);
|
sat_iterator_t sit = satellites.find(satellitePosition);
|
||||||
if (sit == satellitePositions.end()) {
|
if (sit == satellites.end()) {
|
||||||
printf("[fe0] satellite position %d not found!\n", satellitePosition);
|
printf("[fe%d] satellite position %d not found!\n", fenumber, satellitePosition);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
new_position = sit->second.motor_position;
|
new_position = sit->second.motor_position;
|
||||||
use_usals = sit->second.use_usals;
|
use_usals = sit->second.use_usals;
|
||||||
}
|
}
|
||||||
sit = satellitePositions.find(currentSatellitePosition);
|
sit = satellites.find(currentSatellitePosition);
|
||||||
if (sit != satellitePositions.end())
|
if (sit != satellites.end())
|
||||||
old_position = sit->second.motor_position;
|
old_position = sit->second.motor_position;
|
||||||
|
|
||||||
printf("[fe0] motorPosition %d -> %d usals %s\n", old_position, new_position, use_usals ? "on" : "off");
|
printf("[fe%d] motorPosition %d -> %d usals %s\n", fenumber, old_position, new_position, use_usals ? "on" : "off");
|
||||||
|
|
||||||
if (currentSatellitePosition == satellitePosition)
|
if (currentSatellitePosition == satellitePosition)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1363,15 +1396,16 @@ int CFrontend::driveToSatellitePosition(t_satellite_position satellitePosition,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (from_scan || (new_position > 0 && old_position > 0)) {
|
if (from_scan || (new_position > 0 && old_position > 0)) {
|
||||||
waitForMotor = motorRotationSpeed ? 2 + abs(satellitePosition - currentSatellitePosition) / motorRotationSpeed : 0;
|
waitForMotor = config.motorRotationSpeed ? 2 + abs(satellitePosition - currentSatellitePosition) / config.motorRotationSpeed : 0;
|
||||||
}
|
}
|
||||||
if (moved) {
|
if (moved) {
|
||||||
//currentSatellitePosition = satellitePosition;
|
//currentSatellitePosition = satellitePosition;
|
||||||
waitForMotor = motorRotationSpeed ? 2 + abs(satellitePosition - currentSatellitePosition) / motorRotationSpeed : 0;
|
waitForMotor = config.motorRotationSpeed ? 2 + abs(satellitePosition - currentSatellitePosition) / config.motorRotationSpeed : 0;
|
||||||
currentSatellitePosition = satellitePosition;
|
currentSatellitePosition = satellitePosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//currentSatellitePosition = satellitePosition;
|
//FIXME we never remember currentSatellitePosition for non-rotor ?
|
||||||
|
currentSatellitePosition = satellitePosition;
|
||||||
|
|
||||||
return waitForMotor;
|
return waitForMotor;
|
||||||
}
|
}
|
||||||
@@ -1626,5 +1660,5 @@ void CFrontend::gotoXX(t_satellite_position pos)
|
|||||||
|
|
||||||
printf("RotorCmd = %04x\n", RotorCmd);
|
printf("RotorCmd = %04x\n", RotorCmd);
|
||||||
sendMotorCommand(0xE0, 0x31, 0x6E, 2, ((RotorCmd & 0xFF00) / 0x100), RotorCmd & 0xFF, repeatUsals);
|
sendMotorCommand(0xE0, 0x31, 0x6E, 2, ((RotorCmd & 0xFF00) / 0x100), RotorCmd & 0xFF, repeatUsals);
|
||||||
secSetVoltage(highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15); //FIXME ?
|
secSetVoltage(config.highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15); //FIXME ?
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user