linuxdvb: rotor - remember the last orbital position to skip movement...
This commit is contained in:
parent
8289df79be
commit
d5023cdac1
5 changed files with 64 additions and 0 deletions
|
@ -137,6 +137,12 @@ struct linuxdvb_satconf
|
|||
* LNB settings
|
||||
*/
|
||||
int ls_lnb_poweroff;
|
||||
|
||||
/*
|
||||
* Position
|
||||
*/
|
||||
int ls_orbital_pos;
|
||||
char ls_orbital_dir;
|
||||
|
||||
/*
|
||||
* Satconf elements
|
||||
|
|
|
@ -129,12 +129,38 @@ const idclass_t linuxdvb_rotor_usals_class =
|
|||
* Class methods
|
||||
* *************************************************************************/
|
||||
|
||||
static int
|
||||
linuxdvb_rotor_check_orbital_pos
|
||||
( dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls )
|
||||
{
|
||||
int pos;
|
||||
char dir;
|
||||
|
||||
|
||||
if (dvb_network_get_orbital_pos(lm->mm_network, &pos, &dir) < 0)
|
||||
return 0;
|
||||
|
||||
if (dir != ls->lse_parent->ls_orbital_dir)
|
||||
return 0;
|
||||
|
||||
if (abs(pos - ls->lse_parent->ls_orbital_pos) > 2)
|
||||
return 0;
|
||||
|
||||
tvhdebug("diseqc", "rotor already positioned to %i.%i%c",
|
||||
pos / 10, pos % 10, dir);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* GotoX */
|
||||
static int
|
||||
linuxdvb_rotor_gotox_tune
|
||||
( linuxdvb_rotor_t *lr, dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls, int fd )
|
||||
{
|
||||
int i;
|
||||
|
||||
if (linuxdvb_rotor_check_orbital_pos(lm, ls))
|
||||
return 0;
|
||||
|
||||
for (i = 0; i <= ls->lse_parent->ls_diseqc_repeats; i++) {
|
||||
if (linuxdvb_diseqc_send(fd, 0xE0, 0x31, 0x6B, 1, (int)lr->lr_position)) {
|
||||
tvherror("diseqc", "failed to set GOTOX pos %d", lr->lr_position);
|
||||
|
@ -199,6 +225,9 @@ linuxdvb_rotor_usals_tune
|
|||
int angle_1 = (((motor_angle > 0.0) ? 0xd0 : 0xe0) | (sixteenths >> 8));
|
||||
int angle_2 = (sixteenths & 0xff);
|
||||
|
||||
if (linuxdvb_rotor_check_orbital_pos(lm, ls))
|
||||
return 0;
|
||||
|
||||
tvhtrace("diseqc", "rotor USALS goto %0.1f%c (motor %0.2f %sclockwise)",
|
||||
fabs(pos), (pos > 0.0) ? 'E' : 'W',
|
||||
motor_angle, (motor_angle > 0.0) ? "counter-" : "");
|
||||
|
|
|
@ -649,6 +649,11 @@ linuxdvb_satconf_ele_tune ( linuxdvb_satconf_ele_t *lse )
|
|||
}
|
||||
}
|
||||
|
||||
/* Remember the last network position for rotor */
|
||||
dvb_network_get_orbital_pos(lm->mm_network,
|
||||
&lse->lse_parent->ls_orbital_pos,
|
||||
&lse->lse_parent->ls_orbital_dir);
|
||||
|
||||
/* Set the tone */
|
||||
b = lse->lse_lnb->lnb_band(lse->lse_lnb, lm);
|
||||
tvhtrace("disqec", "set diseqc tone %s", b ? "on" : "off");
|
||||
|
|
|
@ -46,6 +46,9 @@ dvb_network_t *dvb_network_find_by_uuid(const char *uuid);
|
|||
dvb_network_t *dvb_network_create0
|
||||
( const char *uuid, const idclass_t *idc, htsmsg_t *conf );
|
||||
|
||||
int dvb_network_get_orbital_pos
|
||||
( mpegts_network_t *mn, int *pos, char *dir );
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -632,6 +632,27 @@ dvb_network_find_by_uuid(const char *uuid)
|
|||
return (dvb_network_t*)in;
|
||||
}
|
||||
|
||||
int dvb_network_get_orbital_pos
|
||||
( mpegts_network_t *mn, int *pos, char *dir )
|
||||
{
|
||||
dvb_network_t *ln = (dvb_network_t *)mn;
|
||||
mpegts_mux_t *mm;
|
||||
dvb_mux_t *lm = NULL;
|
||||
|
||||
LIST_FOREACH(mm, &ln->mn_muxes, mm_network_link) {
|
||||
lm = (dvb_mux_t *)mm;
|
||||
if (lm->lm_tuning.u.dmc_fe_qpsk.orbital_dir)
|
||||
break;
|
||||
}
|
||||
if (lm) {
|
||||
*pos = lm->lm_tuning.u.dmc_fe_qpsk.orbital_pos;
|
||||
*dir = lm->lm_tuning.u.dmc_fe_qpsk.orbital_dir;
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Editor Configuration
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue