AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
+INSTALL="$INSTALL -p"
+
AC_GNU_SOURCE
AC_SYS_LARGEFILE
[TARGET="$withval"],[TARGET="native"])
AC_ARG_WITH(targetprefix,
- [ --with-targetprefix=PATH prefix relative to target root [[PREFIX[for native], /[for cdk]]]],
+ [ --with-targetprefix=PATH prefix relative to target root (only applicable in cdk mode)],
[targetprefix="$withval"],[targetprefix="NONE"])
AC_ARG_WITH(debug,
AC_DEFINE(DEBUG,1,[Enable debug messages])
fi
+AC_MSG_CHECKING(target)
+
if test "$TARGET" = "native"; then
+ AC_MSG_RESULT(native)
+
if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
CFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
CXXFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
if test "$prefix" = "NONE"; then
prefix=/usr/local
fi
- if test "$targetprefix" = "NONE"; then
- targetprefix="\${prefix}"
- _targetprefix="${prefix}"
- else
- _targetprefix="$targetprefix"
- fi
+ targetprefix=$prefix
elif test "$TARGET" = "cdk"; then
+ AC_MSG_RESULT(cdk)
+
if test "$CC" = "" -a "$CXX" = ""; then
CC=powerpc-tuxbox-linux-gnu-gcc CXX=powerpc-tuxbox-linux-gnu-g++
fi
CXXFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
fi
if test "$prefix" = "NONE"; then
- prefix=/dbox2/cdkroot
+ AC_MSG_ERROR(invalid prefix, you need to specify one in cdk mode)
fi
if test "$targetprefix" = "NONE"; then
targetprefix=""
- _targetprefix=""
- else
- _targetprefix="$targetprefix"
fi
if test "$host_alias" = ""; then
cross_compiling=yes
host_alias=powerpc-tuxbox-linux-gnu
fi
else
+ AC_MSG_RESULT(none)
AC_MSG_ERROR([invalid target $TARGET, choose on from native,cdk]);
fi
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
-targetdatadir="\${targetprefix}/share"
-_targetdatadir="${_targetprefix}/share"
-targetsysconfdir="\${targetprefix}/etc"
-_targetsysconfdir="${_targetprefix}/etc"
-targetlocalstatedir="\${targetprefix}/var"
-_targetlocalstatedir="${_targetprefix}/var"
-targetlibdir="\${targetprefix}/lib"
-_targetlibdir="${_targetprefix}/lib"
-AC_SUBST(targetprefix)
-AC_SUBST(targetdatadir)
-AC_SUBST(targetsysconfdir)
-AC_SUBST(targetlocalstatedir)
-
check_path () {
return $(perl -e "if(\"$1\"=~m#^/usr/(local/)?bin#){print \"0\"}else{print \"1\";}")
}
])
+AC_DEFUN(TUXBOX_APPS_DIRECTORY_ONE,[
+AC_ARG_WITH($1,[ $6$7 [[PREFIX$4$5]]],[
+ _$2=$withval
+ if test "$TARGET" = "cdk"; then
+ $2=`eval echo "${targetprefix}$withval"`
+ else
+ $2=$withval
+ fi
+],[
+ $2="\${$3}$5"
+ if test "$TARGET" = "cdk"; then
+ _$2=`eval echo "${target$3}$5"`
+ else
+ _$2=`eval echo "${$3}$5"`
+ fi
+])
+
+dnl automake <= 1.6 don't support this
+dnl AC_SUBST($2)
+AC_DEFINE_UNQUOTED($2,"$_$2",$7)
+])
+
AC_DEFUN(TUXBOX_APPS_DIRECTORY,[
AC_REQUIRE([TUXBOX_APPS])
-CONFIGDIR="\${localstatedir}/tuxbox/config"
-_CONFIGDIR="${_targetlocalstatedir}/tuxbox/config"
-AC_SUBST(CONFIGDIR)
-AC_DEFINE_UNQUOTED(CONFIGDIR,"$_CONFIGDIR",[where to find the config files])
+if test "$TARGET" = "cdk"; then
+ datadir="\${prefix}/share"
+ tuxboxdatadir="\${prefix}/share/tuxbox"
+ zoneinfodir="\${datadir}/zoneinfo"
+ sysconfdir="\${prefix}/etc"
+ localstatedir="\${prefix}/var"
+ localedir="\${prefix}/var"
+ libdir="\${prefix}/lib"
+ targetdatadir="\${targetprefix}/share"
+ targetsysconfdir="\${targetprefix}/etc"
+ targetlocalstatedir="\${targetprefix}/var"
+ targetlibdir="\${targetprefix}/lib"
+fi
-DATADIR="\${datadir}/tuxbox"
-_DATADIR="${_targetdatadir}/tuxbox"
-AC_SUBST(DATADIR)
-AC_DEFINE_UNQUOTED(DATADIR,"$_DATADIR",[where to find data like icons])
+TUXBOX_APPS_DIRECTORY_ONE(configdir,CONFIGDIR,sysconfdir,/etc,,
+ [--with-configdir=PATH ],[where to find the config files])
-FONTDIR="\${datadir}/fonts"
-_FONTDIR="${_targetdatadir}/fonts"
-AC_SUBST(FONTDIR)
-AC_DEFINE_UNQUOTED(FONTDIR,"$_FONTDIR",[where to find the fonts])
+TUXBOX_APPS_DIRECTORY_ONE(datadir,DATADIR,datadir,/share,,
+ [--with-datadir=PATH ],[where to find data])
-GAMESDIR="\${localstatedir}/tuxbox/games"
-_GAMESDIR="${_targetlocalstatedir}/tuxbox/games"
-AC_SUBST(GAMESDIR)
-AC_DEFINE_UNQUOTED(GAMESDIR,"$_GAMESDIR",[where games data is stored])
+TUXBOX_APPS_DIRECTORY_ONE(localedir,LOCALEDIR,datadir,/share,/locale,
+ [--with-localedir=PATH ],[where to find locales])
-LIBDIR="\${libdir}/tuxbox"
-_LIBDIR="${_targetlibdir}/tuxbox"
-AC_SUBST(LIBDIR)
-AC_SUBST(_LIBDIR)
-AC_DEFINE_UNQUOTED(LIBDIR,"$_LIBDIR",[where to find the internal libs])
+TUXBOX_APPS_DIRECTORY_ONE(fontdir,FONTDIR,datadir,/share,/fonts,
+ [--with-fontdir=PATH ],[where to find the fonts])
-PLUGINDIR="\${libdir}/tuxbox/plugins"
-_PLUGINDIR="${_targetlibdir}/tuxbox/plugins"
-AC_SUBST(PLUGINDIR)
-AC_DEFINE_UNQUOTED(PLUGINDIR,"$_PLUGINDIR",[where to find the plugins])
+TUXBOX_APPS_DIRECTORY_ONE(gamesdir,GAMESDIR,localstatedir,/var,/tuxbox/games,
+ [--with-gamesdir=PATH ],[where games data is stored])
+
+TUXBOX_APPS_DIRECTORY_ONE(libdir,LIBDIR,libdir,/lib,/tuxbox,
+ [--with-libdir=PATH ],[where to find the internal libs])
-UCODEDIR="\${localstatedir}/tuxbox/ucodes"
-_UCODEDIR="${_targetlocalstatedir}/tuxbox/ucodes"
-AC_SUBST(UCODEDIR)
-AC_DEFINE_UNQUOTED(UCODEDIR,"$_UCODEDIR",[where to find the ucodes (firmware)])
+TUXBOX_APPS_DIRECTORY_ONE(plugindir,PLUGINDIR,libdir,/lib,/tuxbox/plugins,
+ [--with-plugindir=PATH ],[where to find the plugins])
+
+TUXBOX_APPS_DIRECTORY_ONE(tuxboxdatadir,TUXBOXDATADIR,datadir,/share,/tuxbox,
+ [--with-tuxboxdatadir=PATH],[where to find tuxbox data])
+
+TUXBOX_APPS_DIRECTORY_ONE(zoneinfodir,ZONEINFODIR,datadir,/share,/zoneinfo,
+ [--with-zoneinfodir=PATH ],[where to find zoneinfo db])
])
+dnl automake <= 1.6 needs this specifications
+AC_SUBST(CONFIGDIR)
+AC_SUBST(DATADIR)
+AC_SUBST(ZONEINFODIR)
+AC_SUBST(FONTDIR)
+AC_SUBST(GAMESDIR)
+AC_SUBST(LIBDIR)
+AC_SUBST(LOCALEDIR)
+AC_SUBST(PLUGINDIR)
+AC_SUBST(TUXBOXDATADIR)
+dnl end workaround
+
AC_DEFUN(TUXBOX_APPS_ENDIAN,[
AC_CHECK_HEADERS(endian.h)
AC_C_BIGENDIAN
])
AC_DEFUN(TUXBOX_APPS_DRIVER,[
-AC_ARG_WITH(driver,
- [ --with-driver=PATH path for driver sources[[NONE]]],
- [DRIVER="$withval"],[DRIVER=""])
-
-if test -z "$DRIVER"; then
- AC_MSG_ERROR([can't find driver sources])
-fi
-CPPFLAGS="$CPPFLAGS -I$DRIVER/include"
-AC_SUBST(DRIVER)
+#AC_ARG_WITH(driver,
+# [ --with-driver=PATH path for driver sources [[NONE]]],
+# [DRIVER="$withval"],[DRIVER=""])
+#
+#if test -d "$DRIVER/include"; then
+# AC_DEFINE(HAVE_DBOX2_DRIVER,1,[Define to 1 if you have the dbox2 driver sources])
+#else
+# AC_MSG_ERROR([can't find driver sources])
+#fi
+
+#AC_SUBST(DRIVER)
+
+#CPPFLAGS="$CPPFLAGS -I$DRIVER/include"
])
AC_DEFUN([TUXBOX_APPS_DVB],[
fi
])
-
AC_DEFUN(_TUXBOX_APPS_LIB_CONFIG,[
AC_PATH_PROG($1_CONFIG,$2,no)
if test "$$1_CONFIG" != "no"; then
])
AC_DEFUN(_TUXBOX_APPS_LIB_PKGCONFIG,[
-AC_REQUIRE([TUXBOX_APPS_PKGCONFIG])
-AC_MSG_CHECKING(for package $2)
-if PKG_CONFIG_PATH="${prefix}/lib/pkgconfig" $PKG_CONFIG --exists "$2" ; then
- AC_MSG_RESULT(yes)
- $1_CFLAGS=$(PKG_CONFIG_PATH="${prefix}/lib/pkgconfig" $PKG_CONFIG --cflags "$2")
- $1_LIBS=$(PKG_CONFIG_PATH="${prefix}/lib/pkgconfig" $PKG_CONFIG --libs "$2")
-else
- AC_MSG_RESULT(no)
-fi
-
+PKG_CHECK_MODULES($1,$2)
AC_SUBST($1_CFLAGS)
AC_SUBST($1_LIBS)
])
AC_SUBST(CATALOGS)
])
-
-
+dnl backward compatiblity
AC_DEFUN([AC_GNU_SOURCE],
[AH_VERBATIM([_GNU_SOURCE],
[/* Enable GNU extensions on systems that have them. */
AC_DEFINE([_GNU_SOURCE])
])
+AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+ [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])
+
/* where to find the config files */
#undef CONFIGDIR
-/* where to find data like icons */
+/* where to find data */
#undef DATADIR
/* Enable debug messages */
/* where games data is stored */
#undef GAMESDIR
+/* Define to 1 if you have the dvb includes */
+#undef HAVE_DVB
+
+/* Define to the version of the dvb api */
+#undef HAVE_DVB_API_VERSION
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* where to find the internal libs */
#undef LIBDIR
+/* where to find locales */
+#undef LOCALEDIR
+
/* Name of package */
#undef PACKAGE
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
-/* where to find the ucodes (firmware) */
-#undef UCODEDIR
+/* where to find tuxbox data */
+#undef TUXBOXDATADIR
/* Version number of package */
#undef VERSION
+/* where to find zoneinfo db */
+#undef ZONEINFODIR
+
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
TUXBOX_APPS_LIB_PKGCONFIG(PNG,libpng)
TUXBOX_APPS_LIB_PKGCONFIG(SIGC,sigc++-1.2)
#TUXBOX_APPS_LIB_PKGCONFIG(XMLTREE,tuxbox-xmltree)
-TUXBOX_APPS_LIB_CONFIG(SDL,sdl-config)
+#TUXBOX_APPS_LIB_CONFIG(SDL,sdl-config)
# fixme: decent python stuff
CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS $FRIBIDI_CFLAGS $ID3TAG_CFLAGS $MAD_CFLAGS $PLUGINS_CFLAGS $PNG_CFLAGS $SIGC_CFLAGS $XMLTREE_CFLAGS $SDL_CFLAGS -I/usr/include/python2.3 -DHAVE_CPP_FILT -DMEMLEAK_CHECK"
noinst_LIBRARIES = libenigma_dvb.a
libenigma_dvb_a_SOURCES = dvb.cpp demux.cpp frontend.cpp esection.cpp db.cpp \
- sec.cpp scan.cpp crc32.cpp pmt.cpp decoder.cpp eit.cpp
-
\ No newline at end of file
+ sec.cpp scan.cpp crc32.cpp pmt.cpp decoder.cpp eit.cpp rotor_calc.cpp
+
RESULT eDVBFrontend::getData(int num, int &data)
{
- if ( num < 4 )
+ if ( num < 5 )
{
data = m_data[num];
return 0;
RESULT eDVBFrontend::setData(int num, int val)
{
- if ( num < 4 )
+ if ( num < 5 )
{
m_data[num] = val;
return 0;
eSecCommandList m_sec_sequence;
- int m_data[4]; /* when satellite frontend then
+ int m_data[5]; /* when satellite frontend then
data[0] = lastcsw -> state of the committed switch
data[1] = lastucsw -> state of the uncommitted switch
data[2] = lastToneburst -> current state of toneburst switch
- data[3] = prevRotorPos -> current Rotor Position */
+ data[3] = lastRotorCmd -> last sent rotor cmd
+ data[4] = curRotorPos -> current Rotor Position */
void feEvent(int);
void timeout();
--- /dev/null
+#include <cmath>
+
+/*----------------------------------------------------------------------------*/
+double factorial_div( double value, int x)
+{
+ if(!x)
+ return 1;
+ else
+ {
+ while( x > 1)
+ {
+ value = value / x--;
+ }
+ }
+ return value;
+}
+
+/*----------------------------------------------------------------------------*/
+double powerd( double x, int y)
+{
+ int i=0;
+ double ans=1.0;
+
+ if(!y)
+ return 1.000;
+ else
+ {
+ while( i < y)
+ {
+ i++;
+ ans = ans * x;
+ }
+ }
+ return ans;
+}
+
+/*----------------------------------------------------------------------------*/
+double SIN( double x)
+{
+ int i=0;
+ int j=1;
+ int sign=1;
+ double y1 = 0.0;
+ double diff = 1000.0;
+
+ if (x < 0.0)
+ {
+ x = -1 * x;
+ sign = -1;
+ }
+
+ while ( x > 360.0*M_PI/180)
+ {
+ x = x - 360*M_PI/180;
+ }
+
+ if( x > (270.0 * M_PI / 180) )
+ {
+ sign = sign * -1;
+ x = 360.0*M_PI/180 - x;
+ }
+ else if ( x > (180.0 * M_PI / 180) )
+ {
+ sign = sign * -1;
+ x = x - 180.0 *M_PI / 180;
+ }
+ else if ( x > (90.0 * M_PI / 180) )
+ {
+ x = 180.0 *M_PI / 180 - x;
+ }
+
+ while( powerd( diff, 2) > 1.0E-16 )
+ {
+ i++;
+ diff = j * factorial_div( powerd( x, (2*i -1)) ,(2*i -1));
+ y1 = y1 + diff;
+ j = -1 * j;
+ }
+ return ( sign * y1 );
+}
+
+/*----------------------------------------------------------------------------*/
+double COS(double x)
+{
+ return SIN(90 * M_PI / 180 - x);
+}
+
+/*----------------------------------------------------------------------------*/
+double ATAN( double x)
+{
+ int i=0; /* counter for terms in binomial series */
+ int j=1; /* sign of nth term in series */
+ int k=0;
+ int sign = 1; /* sign of the input x */
+ double y = 0.0; /* the output */
+ double deltay = 1.0; /* the value of the next term in the series */
+ double addangle = 0.0; /* used if arctan > 22.5 degrees */
+
+ if (x < 0.0)
+ {
+ x = -1 * x;
+ sign = -1;
+ }
+
+ while( x > 0.3249196962 )
+ {
+ k++;
+ x = (x - 0.3249196962) / (1 + x * 0.3249196962);
+ }
+
+ addangle = k * 18.0 *M_PI/180;
+
+ while( powerd( deltay, 2) > 1.0E-16 )
+ {
+ i++;
+ deltay = j * powerd( x, (2*i -1)) / (2*i -1);
+ y = y + deltay;
+ j = -1 * j;
+ }
+ return (sign * (y + addangle) );
+}
+
+double ASIN(double x)
+{
+ return 2 * ATAN( x / (1 + std::sqrt(1.0 - x*x)));
+}
+
+double Radians( double number )
+{
+ return number*M_PI/180;
+}
+
+double Deg( double number )
+{
+ return number*180/M_PI;
+}
+
+double Rev( double number )
+{
+ return number - std::floor( number / 360.0 ) * 360;
+}
+
+double calcElevation( double SatLon, double SiteLat, double SiteLon, int Height_over_ocean = 0 )
+{
+ double a0=0.58804392,
+ a1=-0.17941557,
+ a2=0.29906946E-1,
+ a3=-0.25187400E-2,
+ a4=0.82622101E-4,
+
+ f = 1.00 / 298.257, // Earth flattning factor
+
+ r_sat=42164.57, // Distance from earth centre to satellite
+
+ r_eq=6378.14, // Earth radius
+
+ sinRadSiteLat=SIN(Radians(SiteLat)),
+ cosRadSiteLat=COS(Radians(SiteLat)),
+
+ Rstation = r_eq / ( std::sqrt( 1.00 - f*(2.00-f)*sinRadSiteLat*sinRadSiteLat ) ),
+
+ Ra = (Rstation+Height_over_ocean)*cosRadSiteLat,
+ Rz= Rstation*(1.00-f)*(1.00-f)*sinRadSiteLat,
+
+ alfa_rx=r_sat*COS(Radians(SatLon-SiteLon)) - Ra,
+ alfa_ry=r_sat*SIN(Radians(SatLon-SiteLon)),
+ alfa_rz=-Rz,
+
+ alfa_r_north=-alfa_rx*sinRadSiteLat + alfa_rz*cosRadSiteLat,
+ alfa_r_zenith=alfa_rx*cosRadSiteLat + alfa_rz*sinRadSiteLat,
+
+ El_geometric=Deg(ATAN( alfa_r_zenith/std::sqrt(alfa_r_north*alfa_r_north+alfa_ry*alfa_ry))),
+
+ x = std::fabs(El_geometric+0.589),
+ refraction=std::fabs(a0+a1*x+a2*x*x+a3*x*x*x+a4*x*x*x*x),
+
+ El_observed = 0.00;
+
+ if (El_geometric > 10.2)
+ El_observed = El_geometric+0.01617*(COS(Radians(std::fabs(El_geometric)))/SIN(Radians(std::fabs(El_geometric))) );
+ else
+ El_observed = El_geometric+refraction;
+
+ if (alfa_r_zenith < -3000)
+ El_observed=-99;
+
+ return El_observed;
+}
+
+double calcAzimuth(double SatLon, double SiteLat, double SiteLon, int Height_over_ocean=0)
+{
+ double f = 1.00 / 298.257, // Earth flattning factor
+
+ r_sat=42164.57, // Distance from earth centre to satellite
+
+ r_eq=6378.14, // Earth radius
+
+ sinRadSiteLat=SIN(Radians(SiteLat)),
+ cosRadSiteLat=COS(Radians(SiteLat)),
+
+ Rstation = r_eq / ( std::sqrt( 1 - f*(2-f)*sinRadSiteLat*sinRadSiteLat ) ),
+ Ra = (Rstation+Height_over_ocean)*cosRadSiteLat,
+ Rz = Rstation*(1-f)*(1-f)*sinRadSiteLat,
+
+ alfa_rx = r_sat*COS(Radians(SatLon-SiteLon)) - Ra,
+ alfa_ry = r_sat*SIN(Radians(SatLon-SiteLon)),
+ alfa_rz = -Rz,
+
+ alfa_r_north = -alfa_rx*sinRadSiteLat + alfa_rz*cosRadSiteLat,
+
+ Azimuth = 0.00;
+
+ if (alfa_r_north < 0)
+ Azimuth = 180+Deg(ATAN(alfa_ry/alfa_r_north));
+ else
+ Azimuth = Rev(360+Deg(ATAN(alfa_ry/alfa_r_north)));
+
+ return Azimuth;
+}
+
+double calcDeclination( double SiteLat, double Azimuth, double Elevation)
+{
+ return Deg( ASIN(SIN(Radians(Elevation)) *
+ SIN(Radians(SiteLat)) +
+ COS(Radians(Elevation)) *
+ COS(Radians(SiteLat)) +
+ COS(Radians(Azimuth))
+ )
+ );
+}
+
+double calcSatHourangle( double SatLon, double SiteLat, double SiteLon )
+{
+ double Azimuth=calcAzimuth(SatLon, SiteLat, SiteLon ),
+ Elevation=calcElevation( SatLon, SiteLat, SiteLon ),
+
+ a = - COS(Radians(Elevation)) * SIN(Radians(Azimuth)),
+
+ b = SIN(Radians(Elevation)) * COS(Radians(SiteLat))
+ -
+ COS(Radians(Elevation)) * SIN(Radians(SiteLat)) * COS(Radians(Azimuth)),
+
+// Works for all azimuths (northern & southern hemisphere)
+ returnvalue = 180 + Deg(ATAN(a/b));
+
+ if ( Azimuth > 270 )
+ {
+ returnvalue = ( (returnvalue-180) + 360 );
+ if (returnvalue>360)
+ returnvalue = 360 - (returnvalue-360);
+ }
+
+ if ( Azimuth < 90 )
+ returnvalue = ( 180 - returnvalue );
+
+ return returnvalue;
+}
--- /dev/null
+#ifndef __LIB_ROTOR_CALC_H__
+#define __LIB_ROTOR_CALC_H__
+double calcSatHourangle( double SatLon, double SiteLat, double SiteLon );
+#endif // __LIB_ROTOR_CALC_H__
\ No newline at end of file
#include <config.h>
#include <lib/dvb/sec.h>
+#include <lib/dvb/rotor_calc.h>
+
#if HAVE_DVB_API_VERSION < 3
#define INVERSION Inversion
#define FREQUENCY Frequency
eDVBSatelliteDiseqcParameters &diseqc_ref = astra1.m_diseqc_parameters;
eDVBSatelliteSwitchParameters &switch_ref = astra1.m_switch_parameters;
- lnb_ref.m_lof_hi = 10607000;
+ lnb_ref.m_lof_hi = 10600000;
lnb_ref.m_lof_lo = 9750000;
lnb_ref.m_lof_threshold = 11700000;
{
eDVBSatelliteDiseqcParameters &di_param = sit->second.m_diseqc_parameters;
eDVBSatelliteSwitchParameters &sw_param = sit->second.m_switch_parameters;
+ eDVBSatelliteRotorParameters &rotor_param = sit->second.m_rotor_parameters;
int hi=0,
voltage = iDVBFrontend::voltageOff,
tone = iDVBFrontend::toneOff,
lastcsw = -1,
lastucsw = -1,
lastToneburst = -1,
+ lastRotorCmd = -1,
curRotorPos = -1;
frontend.getData(0, lastcsw);
frontend.getData(1, lastucsw);
frontend.getData(2, lastToneburst);
- frontend.getData(3, curRotorPos);
+ frontend.getData(3, lastRotorCmd);
+ frontend.getData(4, curRotorPos);
if ( sat.frequency > lnb_param.m_lof_threshold )
hi = 1;
}
else
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 30) );
+
+ frontend.setData(0, csw);
+ frontend.setData(1, ucsw);
}
}
- if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 && curRotorPos != sat.orbital_position )
- {
- }
if ( (changed_burst || send_diseqc) && di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO )
{
sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 30) );
+ frontend.setData(2, di_param.m_toneburst_param);
+ }
+ if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 )
+ {
+ int RotorCmd=0;
+ bool useGotoXX = false;
+
+ std::map<int,int,eDVBSatelliteRotorParameters::Orbital_Position_Compare>::iterator it =
+ rotor_param.m_rotor_position_table.find( sat.orbital_position );
+
+ if (it != rotor_param.m_rotor_position_table.end()) // position for selected sat found ?
+ RotorCmd=it->second;
+ else // entry not in table found
+ {
+ eDebug("Entry for %d,%d° not in Rotor Table found... i try gotoXX°", sat.orbital_position / 10, sat.orbital_position % 10 );
+ useGotoXX = true;
+
+ int satDir = sat.orbital_position < 0 ?
+ eDVBSatelliteRotorParameters::WEST :
+ eDVBSatelliteRotorParameters::EAST;
+
+ double SatLon = abs(sat.orbital_position)/10.00,
+ SiteLat = rotor_param.m_gotoxx_parameters.m_latitude,
+ SiteLon = rotor_param.m_gotoxx_parameters.m_longitude;
+
+ if ( rotor_param.m_gotoxx_parameters.m_la_direction == eDVBSatelliteRotorParameters::SOUTH )
+ SiteLat = -SiteLat;
+
+ if ( rotor_param.m_gotoxx_parameters.m_lo_direction == eDVBSatelliteRotorParameters::WEST )
+ SiteLon = 360 - SiteLon;
+
+ if (satDir == eDVBSatelliteRotorParameters::WEST )
+ SatLon = 360 - SatLon;
+
+ eDebug("siteLatitude = %lf, siteLongitude = %lf, %lf degrees", SiteLat, SiteLon, SatLon );
+ double satHourAngle =
+ calcSatHourangle( SatLon, SiteLat, SiteLon );
+ eDebug("PolarmountHourAngle=%lf", satHourAngle );
+
+ static int gotoXTable[10] =
+ { 0x00, 0x02, 0x03, 0x05, 0x06, 0x08, 0x0A, 0x0B, 0x0D, 0x0E };
+
+ if (SiteLat >= 0) // Northern Hemisphere
+ {
+ int tmp=(int)round( fabs( 180 - satHourAngle ) * 10.0 );
+ RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
+
+ if (satHourAngle < 180) // the east
+ RotorCmd |= 0xE000;
+ else // west
+ RotorCmd |= 0xD000;
+ }
+ else // Southern Hemisphere
+ {
+ if (satHourAngle < 180) // the east
+ {
+ int tmp=(int)round( fabs( satHourAngle ) * 10.0 );
+ RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
+ RotorCmd |= 0xD000;
+ }
+ else // west
+ {
+ int tmp=(int)round( fabs( 360 - satHourAngle ) * 10.0 );
+ RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
+ RotorCmd |= 0xE000;
+ }
+ }
+ eDebug("RotorCmd = %04x", RotorCmd);
+ }
+ if ( RotorCmd != lastRotorCmd )
+ {
+ eDVBDiseqcCommand diseqc;
+ diseqc.data[0] = 0xE0;
+ diseqc.data[1] = 0x31; // positioner
+ if ( useGotoXX )
+ {
+ diseqc.len = 5;
+ diseqc.data[2] = 0x6E; // drive to angular position
+ diseqc.data[3] = ((RotorCmd & 0xFF00) / 0x100);
+ diseqc.data[4] = RotorCmd & 0xFF;
+ }
+ else
+ {
+ diseqc.len = 4;
+ diseqc.data[2] = 0x6B; // goto stored sat position
+ diseqc.data[3] = RotorCmd;
+ }
+ if ( rotor_param.m_inputpower_parameters.m_use )
+ { // use measure rotor input power to detect rotor state
+ sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
+ frontend.setData(3, RotorCmd);
+ frontend.setData(4, sat.orbital_position);
+ }
+ else
+ eFatal("rotor turning without inputpowermeasure not implemented yet");
+ }
}
}
else
{
public:
enum {
- NONE, SLEEP, SET_VOLTAGE, SET_TONE, SEND_DISEQC, SEND_TONEBURST, IF_LOCK_GOTO, IF_NOT_LOCK_GOTO, SET_FRONTEND
+ NONE, SLEEP, SET_VOLTAGE, SET_TONE,
+ SEND_DISEQC, SEND_TONEBURST, IF_LOCK_GOTO, IF_NOT_LOCK_GOTO,
+ MEASURE_IDLE_INPUTPOWER, SET_FRONTEND
};
int cmd;
union
int msec;
eDVBDiseqcCommand diseqc;
};
+ eSecCommand( int cmd )
+ :cmd(cmd)
+ {}
eSecCommand( int cmd, int val )
:cmd(cmd), voltage(val)
{}
libenigma_gdi_a_SOURCES = \
region.cpp grc.cpp epng.cpp erect.cpp fb.cpp font.cpp font_arabic.cpp gfbdc.cpp \
- glcddc.cpp gpixmap.cpp lcd.cpp sdl.cpp gfont.cpp
+ glcddc.cpp gpixmap.cpp lcd.cpp gfont.cpp
setPalette();
}
-// eAutoInitPtr<gFBDC> init_gFBDC(eAutoInitNumbers::graphic-1, "GFBDC");
+#ifndef SDLDC
+eAutoInitPtr<gFBDC> init_gFBDC(eAutoInitNumbers::graphic-1, "GFBDC");
+#endif
\ No newline at end of file
}
}
+#ifdef SDLDC
eAutoInitPtr<gSDLDC> init_gSDLDC(eAutoInitNumbers::graphic-1, "gSDLDC");
+#endif
@MAD_LIBS@ \
@PNG_LIBS@ \
@SIGC_LIBS@ \
- @SDL_LIBS@ \
-ldl -lpthread -lcrypt -lresolv -lpython2.3
enigma2$(EXEEXT): $(enigma2_OBJECTS) $(enigma2_DEPENDENCIES) $(enigma2_LDADD_WHOLE)
@rm -f enigma2$(EXEEXT)
-# $(CXXLINK) $(enigma2_LDFLAGS) $(enigma2_OBJECTS) -Wl,--export-dynamic -Wl,--whole-archive $(enigma2_LDADD_WHOLE) -Wl,--no-whole-archive $(enigma2_LDADD) $(LIBS)
- g++ -o enigma2$(EXEEXT) $(enigma2_LDFLAGS) $(enigma2_OBJECTS) -Wl,--export-dynamic -Wl,--whole-archive $(enigma2_LDADD_WHOLE) -Wl,--no-whole-archive $(enigma2_LDADD) $(LIBS)
+ $(CXXLINK) $(enigma2_LDFLAGS) $(enigma2_OBJECTS) -Wl,--export-dynamic -Wl,--whole-archive $(enigma2_LDADD_WHOLE) -Wl,--no-whole-archive $(enigma2_LDADD) $(LIBS)
+# g++ -o enigma2$(EXEEXT) $(enigma2_LDFLAGS) $(enigma2_OBJECTS) -Wl,--export-dynamic -Wl,--whole-archive $(enigma2_LDADD_WHOLE) -Wl,--no-whole-archive $(enigma2_LDADD) $(LIBS)
pal[a | 0x10] = (0x111111 * a) | 0xFF;
p.setPalette(pal, 0, 256);
- fontRenderClass::getInstance()->AddFont("/dbox2/cdkroot/share/fonts/arial.ttf", "Arial", 100);
+ fontRenderClass::getInstance()->AddFont("/usr/share/fonts/arial.ttf", "Arial", 100);
p.resetClip(gRegion(eRect(0, 0, 720, 576)));
pal[a | 0x10] = (0x111111 * a) | 0xFF;
p.setPalette(pal, 0, 256);
- fontRenderClass::getInstance()->AddFont("/dbox2/cdkroot/share/fonts/arial.ttf", "Arial", 100);
+ fontRenderClass::getInstance()->AddFont("/usr/share/fonts/arial.ttf", "Arial", 100);
eWidgetDesktop dsk(eSize(720, 576));
dsk.setDC(my_dc);
-#define SDLDC
#include <stdio.h>
#include <libsig_comp.h>
#include <lib/base/ebase.h>
#include <lib/gdi/grc.h>
#include <lib/gdi/gfbdc.h>
+#ifdef SDLDC
#include <lib/gdi/sdl.h>
+#endif
#include <lib/gdi/font.h>
#include <lib/gui/ewidget.h>
gFBDC::getInstance(my_dc);
#endif
- fontRenderClass::getInstance()->AddFont("/home/tmbinc/enigma2/fonts/arial.ttf", "Arial", 100);
+ fontRenderClass::getInstance()->AddFont("/usr/share/fonts/arial.ttf", "Arial", 100);
eWidgetDesktop dsk(eSize(720, 576));