zapit: cleanup from load/save motor position functions

Origin commit data
------------------
Branch: ni/coolstream
Commit: 52c8acdc82
Author: TangoCash <eric@loxat.de>
Date: 2020-05-29 (Fri, 29 May 2020)

Origin message was:
------------------
- zapit: cleanup from load/save motor position functions

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2020-05-29 00:44:16 +02:00
committed by vanhofen
parent dbcd6314a0
commit 073ccfc6c9
5 changed files with 7 additions and 87 deletions

View File

@@ -93,7 +93,6 @@ class CServiceManager
void ParseChannels(xmlNodePtr node, const t_transport_stream_id transport_stream_id, const t_original_network_id original_network_id, t_satellite_position satellitePosition, freq_id_t freq, uint8_t polarization, delivery_system_t delsys);
void FindTransponder(xmlNodePtr search);
void ParseSatTransponders(delivery_system_t delsys, xmlNodePtr search, t_satellite_position satellitePosition);
int LoadMotorPositions(void);
bool LoadScanXml(delivery_system_t delsys);
@@ -113,7 +112,6 @@ class CServiceManager
bool InitSatPosition(t_satellite_position position, const char * name = NULL, bool force = false, delivery_system_t delsys = DVB_S, uint16_t nid = 0);
bool LoadServices(bool only_current);
void SaveServices(bool tocopy, bool if_changed = false, bool no_deleted = false);
void SaveMotorPositions();
bool SaveCurrentServices(transponder_id_t tpid);
bool CopyCurrentServices(transponder_id_t tpid);

View File

@@ -32,8 +32,6 @@
#endif
#define ZAPITCONFIGFILE CONFIGDIR "/zapit/zapit.conf"
#define MOTORCONFIGFILE CONFIGDIR "/zapit/motor.conf"
#define SATCONFIG CONFIGDIR "/zapit/sat.conf"
#define SERVICES_XML CONFIGDIR "/zapit/services.xml"
#define SERVICES_TMP "/tmp/services.tmp"
#define BOUQUETS_XML CONFIGDIR "/zapit/bouquets.xml"
@@ -49,13 +47,6 @@
#define SATELLITES_XML CONFIGDIR "/satellites.xml"
#define TERRESTRIAL_XML CONFIGDIR "/terrestrial.xml"
#if HAVE_TRIPLEDRAGON == 0
#define AUDIO_DEVICE "/dev/dvb/adapter0/audio0"
#define DEMUX_DEVICE "/dev/dvb/adapter0/demux0"
#define FRONTEND_DEVICE "/dev/dvb/adapter0/frontend0"
#define VIDEO_DEVICE "/dev/dvb/adapter0/video0"
#endif
#define CAMD_UDS_NAME "/tmp/camd.socket"

View File

@@ -317,9 +317,9 @@ bool CFEManager::loadSettings()
/* defaults, to replace CServiceManager::InitSatPosition/LoadMotorPositions
* in the future */
satconfig.position = position;
satconfig.diseqc = -1;
satconfig.commited = -1;
satconfig.uncommited = -1;
satconfig.diseqc = 0;
satconfig.commited = 0;
satconfig.uncommited = 0;
satconfig.motor_position = 0;
satconfig.diseqc_order = 0;
satconfig.lnbOffsetLow = 9750;

View File

@@ -252,7 +252,7 @@ CFrontend::CFrontend(int Number, int Adapter)
config.uni_scr = 0; /* the unicable SCR address 0-7 */
config.uni_freq = 0; /* the unicable frequency in MHz */
config.uni_lnb = 0; /* for two-position switches */
config.uni_pin = -1; /* for MDU setups */
config.uni_pin = 0; /* for MDU setups */
config.highVoltage = false;
config.motorRotationSpeed = 0; //in 0.1 degrees per second

View File

@@ -806,82 +806,13 @@ void CServiceManager::ParseSatTransponders(delivery_system_t delsys, xmlNodePtr
}
}
int CServiceManager::LoadMotorPositions(void)
{
FILE *fd = NULL;
char buffer[256] = "";
t_satellite_position satellitePosition;
int spos = 0, mpos = 0, diseqc = 0, uncom = 0, com = 0, usals = 0, inuse, input = 0;
int offH = 10600, offL = 9750, sw = 11700;
printf("[getservices] loading motor positions...\n");
/* this is only read and never written, so it only serves for
* upgrading from old pre-multituner capable neutrino */
if ((fd = fopen(SATCONFIG, "r"))) {
char *fg = fgets(buffer, 255, fd);
while(fg && !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);
int configured = 0;
if (diseqc != -1 || com != -1 || uncom != -1 || usals != 0 || mpos != 0)
configured = 1;
satellitePosition = spos;
sat_iterator_t sit = satellitePositions.find(satellitePosition);
if(sit != satellitePositions.end()) {
sit->second.diseqc = diseqc;
sit->second.commited = com;
sit->second.uncommited = uncom;
sit->second.motor_position = mpos;
sit->second.lnbOffsetLow = offL;
sit->second.lnbOffsetHigh = offH;
sit->second.lnbSwitch = sw;
sit->second.use_in_scan = inuse;
sit->second.use_usals = usals;
sit->second.input = input;
sit->second.position = satellitePosition;
sit->second.configured = configured;
}
fg = fgets(buffer, 255, fd);
}
fclose(fd);
}
else
printf("[getservices] %s not found.\n", SATCONFIG);
return 0;
}
#if 0
//never used
void CServiceManager::SaveMotorPositions()
{
FILE * fd;
sat_iterator_t sit;
printf("[getservices] saving motor positions...\n");
fd = fopen(SATCONFIG, "w");
if(fd == NULL) {
printf("[zapit] cannot open %s\n", SATCONFIG);
return;
}
fprintf(fd, "# sat position, stored rotor, diseqc, commited, uncommited, low, high, switch, use in full scan, use usals, input\n");
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,
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);
}
fdatasync(fileno(fd));
fclose(fd);
}
#endif
bool CServiceManager::InitSatPosition(t_satellite_position position, const char * name, bool force, delivery_system_t delsys, uint16_t nid)
{
if(force || (satellitePositions.find(position) == satellitePositions.end())) {
satellitePositions[position].position = position;
satellitePositions[position].diseqc = -1;
satellitePositions[position].commited = -1;
satellitePositions[position].uncommited = -1;
satellitePositions[position].diseqc = 0;
satellitePositions[position].commited = 0;
satellitePositions[position].uncommited = 0;
satellitePositions[position].motor_position = 0;
satellitePositions[position].diseqc_order = 0;
satellitePositions[position].lnbOffsetLow = 9750;