mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
zapit: improve unicable support
* support the LNB input parameter (bank) * save config per position in sat.conf
This commit is contained in:
@@ -181,6 +181,7 @@ typedef struct Zapit_config {
|
|||||||
double gotoXXLongitude;
|
double gotoXXLongitude;
|
||||||
int uni_scr;
|
int uni_scr;
|
||||||
int uni_qrg;
|
int uni_qrg;
|
||||||
|
int uni_lnb;
|
||||||
} t_zapit_config;
|
} t_zapit_config;
|
||||||
|
|
||||||
typedef std::map <uint32_t, TP_map> TP_map_t;
|
typedef std::map <uint32_t, TP_map> TP_map_t;
|
||||||
|
@@ -109,7 +109,8 @@ class CFrontend
|
|||||||
|
|
||||||
/* variables for EN 50494 (a.k.a Unicable) */
|
/* variables for EN 50494 (a.k.a Unicable) */
|
||||||
int uni_scr; /* the unicable SCR address, -1 == no unicable */
|
int uni_scr; /* the unicable SCR address, -1 == no unicable */
|
||||||
int uni_qrg; /* the unicable frequency in MHz, 0 == from spec */
|
int uni_qrg; /* the unicable frequency in MHz */
|
||||||
|
int uni_lnb; /* the input (0/1) of a twin-position switch */
|
||||||
|
|
||||||
int motorRotationSpeed; //in 0.1 degrees per second
|
int motorRotationSpeed; //in 0.1 degrees per second
|
||||||
bool highVoltage;
|
bool highVoltage;
|
||||||
@@ -192,7 +193,6 @@ class CFrontend
|
|||||||
};
|
};
|
||||||
void configRotor(int _motorRotationSpeed, bool _highVoltage)
|
void configRotor(int _motorRotationSpeed, bool _highVoltage)
|
||||||
{ motorRotationSpeed = _motorRotationSpeed; highVoltage = _highVoltage; };
|
{ motorRotationSpeed = _motorRotationSpeed; highVoltage = _highVoltage; };
|
||||||
void configUnicable(int scr, int qrg) { uni_scr = scr; uni_qrg = qrg; };
|
|
||||||
|
|
||||||
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);
|
||||||
|
@@ -16,6 +16,9 @@ typedef struct sat_config {
|
|||||||
int have_channels;
|
int have_channels;
|
||||||
t_satellite_position position;
|
t_satellite_position position;
|
||||||
int input;
|
int input;
|
||||||
|
int unicable_scr;
|
||||||
|
int unicable_qrg;
|
||||||
|
int unicable_lnb;
|
||||||
} sat_config_t;
|
} sat_config_t;
|
||||||
|
|
||||||
typedef enum diseqc_cmd_order {
|
typedef enum diseqc_cmd_order {
|
||||||
|
@@ -3,6 +3,8 @@
|
|||||||
*
|
*
|
||||||
* (C) 2002-2003 Andreas Oberritter <obi@tuxbox.org>
|
* (C) 2002-2003 Andreas Oberritter <obi@tuxbox.org>
|
||||||
*
|
*
|
||||||
|
* (C) 2007-2012 Stefan Seyfried
|
||||||
|
*
|
||||||
* 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
|
||||||
@@ -170,7 +172,8 @@ CFrontend::CFrontend(int Number, int Adapter)
|
|||||||
currentTransponder.diseqc = 255;
|
currentTransponder.diseqc = 255;
|
||||||
|
|
||||||
uni_scr = -1; /* the unicable SCR address, -1 == no unicable */
|
uni_scr = -1; /* the unicable SCR address, -1 == no unicable */
|
||||||
uni_qrg = 0; /* the unicable frequency in MHz, 0 == from spec */
|
uni_qrg = 0; /* the unicable frequency in MHz */
|
||||||
|
uni_lnb = 0; /* for two-position switches */
|
||||||
|
|
||||||
feTimeout = 40;
|
feTimeout = 40;
|
||||||
highVoltage = false;
|
highVoltage = false;
|
||||||
@@ -698,7 +701,7 @@ bool CFrontend::buildProperties(const struct dvb_frontend_parameters *feparams,
|
|||||||
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,
|
||||||
0); /* bank 0/1, like mini-diseqc a/b, not impl.*/
|
uni_lnb);
|
||||||
|
|
||||||
cmdseq.num += nrOfProps;
|
cmdseq.num += nrOfProps;
|
||||||
|
|
||||||
@@ -980,6 +983,11 @@ void CFrontend::setInput(t_satellite_position satellitePosition, uint32_t freque
|
|||||||
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);
|
||||||
|
/* unicable */
|
||||||
|
uni_scr = sit->second.unicable_scr;
|
||||||
|
uni_qrg = sit->second.unicable_qrg;
|
||||||
|
uni_lnb = sit->second.unicable_lnb;
|
||||||
|
|
||||||
if (diseqcType != DISEQC_ADVANCED) {
|
if (diseqcType != DISEQC_ADVANCED) {
|
||||||
setDiseqc(sit->second.diseqc, polarization, frequency);
|
setDiseqc(sit->second.diseqc, polarization, frequency);
|
||||||
return;
|
return;
|
||||||
@@ -1001,12 +1009,7 @@ void CFrontend::setInput(t_satellite_position satellitePosition, uint32_t freque
|
|||||||
uint32_t CFrontend::sendEN50494TuningCommand(const uint32_t frequency, const int high_band,
|
uint32_t CFrontend::sendEN50494TuningCommand(const uint32_t frequency, const int high_band,
|
||||||
const int horizontal, const int bank)
|
const int horizontal, const int bank)
|
||||||
{
|
{
|
||||||
uint32_t uni_qrgs[] = { 1284, 1400, 1516, 1632, 1748, 1864, 1980, 2096 };
|
uint32_t bpf = uni_qrg;
|
||||||
uint32_t bpf;
|
|
||||||
if (uni_qrg == 0)
|
|
||||||
bpf = uni_qrgs[uni_scr];
|
|
||||||
else
|
|
||||||
bpf = 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
|
||||||
@@ -1014,7 +1017,7 @@ uint32_t CFrontend::sendEN50494TuningCommand(const uint32_t frequency, const int
|
|||||||
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 && uni_scr >= 0 && 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, "[unicable] VOLT18=%d TONE_ON=%d, freq=%d bpf=%d uni_scr=%d bank=%d ret=%d\n", currentVoltage == SEC_VOLTAGE_18, currentToneMode == SEC_TONE_ON, frequency, bpf, uni_scr, bank, (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 */
|
(uni_scr << 5) | /* adress */
|
||||||
(bank << 4) | /* not implemented yet */
|
(bank << 4) | /* not implemented yet */
|
||||||
|
@@ -3,6 +3,8 @@
|
|||||||
*
|
*
|
||||||
* (C) 2002, 2003 by Andreas Oberritter <obi@tuxbox.org>
|
* (C) 2002, 2003 by Andreas Oberritter <obi@tuxbox.org>
|
||||||
*
|
*
|
||||||
|
* (C) 2007-2012 Stefan Seyfried
|
||||||
|
*
|
||||||
* 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
|
||||||
@@ -484,6 +486,7 @@ int CServiceManager::LoadMotorPositions(void)
|
|||||||
char buffer[256] = "";
|
char buffer[256] = "";
|
||||||
t_satellite_position satellitePosition;
|
t_satellite_position satellitePosition;
|
||||||
int spos = 0, mpos = 0, diseqc = 0, uncom = 0, com = 0, usals = 0, inuse, input = 0;
|
int spos = 0, mpos = 0, diseqc = 0, uncom = 0, com = 0, usals = 0, inuse, input = 0;
|
||||||
|
int uniscr = -1, uniqrg = 0, unilnb = 0;
|
||||||
int offH = 10600, offL = 9750, sw = 11700;
|
int offH = 10600, offL = 9750, sw = 11700;
|
||||||
|
|
||||||
printf("[getservices] loading motor positions...\n");
|
printf("[getservices] loading motor positions...\n");
|
||||||
@@ -491,7 +494,12 @@ int CServiceManager::LoadMotorPositions(void)
|
|||||||
if ((fd = fopen(SATCONFIG, "r"))) {
|
if ((fd = fopen(SATCONFIG, "r"))) {
|
||||||
fgets(buffer, 255, fd);
|
fgets(buffer, 255, fd);
|
||||||
while(!feof(fd)) {
|
while(!feof(fd)) {
|
||||||
sscanf(buffer, "%d %d %d %d %d %d %d %d %d %d %d", &spos, &mpos, &diseqc, &com, &uncom, &offL, &offH, &sw, &inuse, &usals, &input);
|
if (sscanf(buffer, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d",
|
||||||
|
&spos, &mpos, &diseqc, &com, &uncom, &offL, &offH,
|
||||||
|
&sw, &inuse, &usals, &input, &uniscr, &uniqrg, &unilnb) < 14) {
|
||||||
|
uniqrg = unilnb = 0;
|
||||||
|
uniscr = -1;
|
||||||
|
}
|
||||||
|
|
||||||
satellitePosition = spos;
|
satellitePosition = spos;
|
||||||
sat_iterator_t sit = satellitePositions.find(satellitePosition);
|
sat_iterator_t sit = satellitePositions.find(satellitePosition);
|
||||||
@@ -507,6 +515,9 @@ int CServiceManager::LoadMotorPositions(void)
|
|||||||
sit->second.use_usals = usals;
|
sit->second.use_usals = usals;
|
||||||
sit->second.input = input;
|
sit->second.input = input;
|
||||||
sit->second.position = satellitePosition;
|
sit->second.position = satellitePosition;
|
||||||
|
sit->second.unicable_scr = uniscr;
|
||||||
|
sit->second.unicable_qrg = uniqrg;
|
||||||
|
sit->second.unicable_lnb = unilnb;
|
||||||
}
|
}
|
||||||
fgets(buffer, 255, fd);
|
fgets(buffer, 255, fd);
|
||||||
}
|
}
|
||||||
@@ -529,11 +540,12 @@ void CServiceManager::SaveMotorPositions()
|
|||||||
printf("[zapit] cannot open %s\n", SATCONFIG);
|
printf("[zapit] cannot open %s\n", SATCONFIG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fprintf(fd, "# sat position, stored rotor, diseqc, commited, uncommited, low, high, switch, use in full scan, use usals, input\n");
|
fprintf(fd, "# sat position, stored rotor, diseqc, commited, uncommited, low, high, switch, use in full scan, use usals, input, unicable_scr, unicable_freq, unicable_lnb\n");
|
||||||
for(sit = satellitePositions.begin(); sit != satellitePositions.end(); sit++) {
|
for(sit = satellitePositions.begin(); sit != satellitePositions.end(); sit++) {
|
||||||
fprintf(fd, "%d %d %d %d %d %d %d %d %d %d %d\n", sit->first, sit->second.motor_position,
|
fprintf(fd, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", sit->first, sit->second.motor_position,
|
||||||
sit->second.diseqc, sit->second.commited, sit->second.uncommited, sit->second.lnbOffsetLow,
|
sit->second.diseqc, sit->second.commited, sit->second.uncommited, sit->second.lnbOffsetLow,
|
||||||
sit->second.lnbOffsetHigh, sit->second.lnbSwitch, sit->second.use_in_scan, sit->second.use_usals, sit->second.input);
|
sit->second.lnbOffsetHigh, sit->second.lnbSwitch, sit->second.use_in_scan, sit->second.use_usals, sit->second.input,
|
||||||
|
sit->second.unicable_scr, sit->second.unicable_qrg, sit->second.unicable_lnb);
|
||||||
}
|
}
|
||||||
fdatasync(fileno(fd));
|
fdatasync(fileno(fd));
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
@@ -553,6 +565,8 @@ void CServiceManager::InitSatPosition(t_satellite_position position)
|
|||||||
satellitePositions[position].use_in_scan = 0;
|
satellitePositions[position].use_in_scan = 0;
|
||||||
satellitePositions[position].use_usals = 0;
|
satellitePositions[position].use_usals = 0;
|
||||||
satellitePositions[position].input = 0;
|
satellitePositions[position].input = 0;
|
||||||
|
satellitePositions[position].unicable_scr = -1;
|
||||||
|
satellitePositions[position].unicable_qrg = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CServiceManager::LoadServices(bool only_current)
|
bool CServiceManager::LoadServices(bool only_current)
|
||||||
|
@@ -186,9 +186,6 @@ void CZapit::SaveSettings(bool write, bool write_a)
|
|||||||
configfile.setInt32("repeatUsals", config.repeatUsals);
|
configfile.setInt32("repeatUsals", config.repeatUsals);
|
||||||
configfile.setInt32("scanSDT", config.scanSDT);
|
configfile.setInt32("scanSDT", config.scanSDT);
|
||||||
|
|
||||||
configfile.setInt32("uni_scr", config.uni_scr);
|
|
||||||
configfile.setInt32("uni_qrg", config.uni_qrg);
|
|
||||||
|
|
||||||
configfile.setInt32("cam_ci", cam_ci);
|
configfile.setInt32("cam_ci", cam_ci);
|
||||||
|
|
||||||
#if 0 // unused
|
#if 0 // unused
|
||||||
@@ -267,9 +264,6 @@ void CZapit::LoadSettings()
|
|||||||
|
|
||||||
config.scanSDT = configfile.getInt32("scanSDT", 0);
|
config.scanSDT = configfile.getInt32("scanSDT", 0);
|
||||||
|
|
||||||
config.uni_scr = configfile.getInt32("uni_scr", -1);
|
|
||||||
config.uni_qrg = configfile.getInt32("uni_qrg", 0);
|
|
||||||
|
|
||||||
cam_ci = configfile.getInt32("cam_ci", 2);
|
cam_ci = configfile.getInt32("cam_ci", 2);
|
||||||
|
|
||||||
diseqcType = (diseqc_t)configfile.getInt32("diseqcType", NO_DISEQC);
|
diseqcType = (diseqc_t)configfile.getInt32("diseqcType", NO_DISEQC);
|
||||||
@@ -300,7 +294,6 @@ void CZapit::ConfigFrontend()
|
|||||||
CFrontend::getInstance()->configUsals(config.gotoXXLatitude, config.gotoXXLongitude,
|
CFrontend::getInstance()->configUsals(config.gotoXXLatitude, config.gotoXXLongitude,
|
||||||
config.gotoXXLaDirection, config.gotoXXLoDirection, config.repeatUsals);
|
config.gotoXXLaDirection, config.gotoXXLoDirection, config.repeatUsals);
|
||||||
CFrontend::getInstance()->configRotor(config.motorRotationSpeed, config.highVoltage);
|
CFrontend::getInstance()->configRotor(config.motorRotationSpeed, config.highVoltage);
|
||||||
CFrontend::getInstance()->configUnicable(config.uni_scr, config.uni_qrg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CZapit::SendPMT(bool forupdate)
|
void CZapit::SendPMT(bool forupdate)
|
||||||
|
Reference in New Issue
Block a user