This is a "plugin" for the Video Disk Recorder (VDR).

Written by:                  Luca Olivetti <luca@olivetti.cjb.net>
Pieces of code and inspiration taken from the rotor plugin by  
Thomas Bergwinkl <Thomas.Bergwinkl@t-online.de>


See the file COPYING for license information.

THIS PLUGINS NEEDS vdr >= 1.3.47 (including 1.4.X)

DESCRIPTION

With this plugin you can control a linear or an horizon to horizon actuator
controlled through the parallel port.
This kind of actuator usually needs a 36V supply (I drive mine at 12V to
reduce noise) and has a reed relay that gives pulses while the motor is 
running. By counting the pulses you know the position of the actuator
(and the position of the dish).
You have to build a simple circuit to interface the parallel port to the
actuator. The circuit I used is in the file actuator.sch (made with
geda-gschem, see http://www.geda.seul.org, a png rendering is in
actuator.png) in the "module" subdirectory.
You also have to build and load a kernel module (2.6.x kernel needed), look
in the "module" subdirectory for details.


POSITION COUNTING

The position increments going west and decrements going east (you have to
connect the motor accordingly!).
The soft East Limit (the origin) is always 0, i.e. during normal operation
the position range is 0..West Limit.

THEMES

The plugins supports color themes to better blend with vdr. The default
theme uses the same color as the ST:TNG skin, to use the other provided
themes, copy the *.themes file to your themes directory. I provide themes
for the following skins

-Enigma
-Enigma with the Dark Blue theme
-Elchi

but you can write your own since these are standard vdr themes for a fake
"actuator" skin.

SETUP MENU

In the setup-menu of the plugin you have to select the dvb card which is
connected to the dish driven by the actuator (see below in "KNOWN PROBLEMS"
about multi cards setups).
You can also set a minimum screen refresh time (in ms) that will be used in
the plugin main menu: I found that, with a dxr3, if you refresh the screen
too often the osd gets garbled. I set it to 250 for my dxr3. Note that too
low a value will cause high cpu usage.
Finally you can select wether there should be an indication of the dish
position when the satellite is changed. 

MAIN MENU

In the plugin-menu you see on the top the dish target and position.
Next there's an indication of the signal strength of the currently
tuned channel. You also see the dish target and the dish position.

Then the onscreen buttons (select with up,down,left,right, operate
with Ok):

Drive East      : moves the dish east.
Halt	    	: stops any movement of the motor.
Drive West 	: moves the dish west.
Recalc 		: sets the position of the dish to the position of the
                  currently selected satellite (source).
Goto xx    	: actuator goes to position xx.
Store    	: the current position will be stored to the current
		  satellite (source).
XX Steps East	: dish moves XX steps eastwards.
Enable/Disable
Limits          : enables/disables the soft limits. Note that the limits
                  will be automatically enabled when you leave the menu.
XX Steps West	: dish moves XX steps westwards.
Set East Limit  : sets the position of the dish at 0 and recalculates all
                  stored positions.
Set Zero        : sets the position of the dish but won't recalculate stored
                  positions.
Set West Limit  : stores the current position as the west soft limit.


If you're positioned on the line showing the current satellite, you can
select another one with the left and right buttons and go to its position
with the Ok button.

Frequency, Symbolrate, Vpid & Apid: Here you can select the parameters 
(switch the polarizaton pressing left/right) of a transponder  you want
to tune to (by pressing OK) and see what signal-strength you get there.
When possible you should also see the new channel on screen.

Scan Transponder: If you press OK on Scan Transponder, vdr
will switch to the selected transponder and scan for new/updated channels.
During this operation a message and a progress bar is shown, and
pressing any key will interrupt the scanning. The header of the screen will
show the total number of channels found and the number of new ones.
 

SATELLITE SCANNING

if the plugin can find a file for the current source in the
"plugins/transponders" subdirectory of the configuration directory, there
will be an additional option "Scan Satellite". The two numbers at right are
the index of the transponder from where the scanning will start (so that you
can make a partial scan) and the total number of the transponders found in
the file. If you press left or right you can select a different transponder
and its data will be shown in the Frequency and Symbolrate fields. If you
press OK all transponders, starting from the selected index, will be
scanned. A message and a progress bar will be shown, and pressing any key
will stop the operation, leaving the index at the current position so you
can resume scanning later on. The header of the screen will show the total
number of channels found and the number of new ones.

The name of the transponder file for a satellite is XXXX.ini, where XXXX
represents the satellite position in tenths of degree, eg. for 
28.2E the filename will be 0282.ini, for 30.0W the filename will be 3300.ini
(i.e. (360.0-30.0)*10).
The file format is the same as the channelscan plugin, which in turn claims
to use the same format as the windows program prog-dvb.
You can search for pre-made ini files on google.

MARKING CHANNELS

Channel marking is an aid in finding stale channel entries.
Marking a channel means prepending a "+" to its name, if, during a
transponder or satellite scan, a channel is found the "+" will be removed,
so the channels that still have a "+" in the name haven't been found during
a scan (note that this doesn't mean the channel is invalid, so check them
before deleting them).

The button "Mark channels" will mark all channels belonging to the currently
selected satellite, "Unmark channels" and "Delete marked channels" will
allow you to either remove the mark from all the channels or delete all
marked channels (regardless of the satellite they belong to).

Note that this isn't a foolproof method to remove stale channels (e.g. I
cannot seem to find many spanish channels with a channels scan even if
they're regularly broadcasting, spaniards in power are allergic to
standards) so double and triple check before hitting the "Delete marked
channels" button.

POSITION DISPLAY

If you selected the corresponding option in the setup menu, each time the
satellite changes you'll see an indication of the dish position while the
dish is moving, but only if there's nothing else on the osd. You can
interact as usual with the osd, in that case the dish position indication
will disappear.

KNOWN PROBLEMS

- The plugin will load the current dish position at start-up and stores it
on disk each time it detects it has changed. It's possible to lose the
actual position if the pc crashes while the dish is moving. In this case you
have to manually peak the dish at a known satellite (it may be necessary to
disable the limits) and use the "Recalc" function. I'd like to store the
position in the cmos ram (in the kernel module) but I don't know where I can
find a couple of free bytes (and if the pc crashes while storing the
position, it may not have updated the cmos ram checksum).

- When the pc is turned on or off my parallel port sets all data lines at 1,
driving both relays for a very short while. Due to the wiring of the relays
the motor should not move anyway. If you don't like it you can modify the
circuit to add some more logic to avoid the problem.

- vdr assumes that, as soon as a channel has been switched to, the new source
(satellite) is valid, even if the dish is moving, so the autoupdate function
will assign new/updated channels to the wrong satellite. The plugin's
workaround is to disable autoupdate while the dish is moving and restore the
previous setting only when it has reached the target satellite. It's
possible that the plugin will fail to restore the value of this setting.
If you see that channels aren't updating anymore check this setting (main
menu->configuration->dbv->update channels, note that while the dish is
moving this setting is always "no", so check and modify it only when the
actuator is idle).

- in a multi card setup, vdr considers all cards equally capable of providing
any source (satellite), regardless to the dish/lnb the card is connected to.
This is obviously wrong. Attached to the following post you'll find a patch
to configure which sources (satellites) a card can relly tune to:
http://article.gmane.org/gmane.linux.vdr/14038

- If a recording starts on a different satellite than the current one, it's
possible than vdr will restart if it takes too much time to reach the
position. In the patches subdirectory there's a steerable-vdr-x.x.x.patch to
give more time to the dish to reach the target after starting a recording.
