//This is the first release of my program for controlling rotors using
//the Z-World Micro-2g controller board.  I have tested it on a G-2700SDX
//and a G-2800SDX, it should also work on a G-1000SDX I just haven't 
//plugged it in to be sure.  With the addition of relays it should also
//be able to control other rotors that have analog position circuits.
//The positioning algorithm does make use of the Yaesu 90 degree overlap
//that gives 450 degrees of rotation.  It will pick the shortest distance
//to rotate for bearings in the overlap region.
//The default rotor setup is for a G-1000/2700/2800sdx with the left stop 
//at north.  A dumb terminal program can be used to set other parameters
//but they will not be saved yet if power is removed.
// the com port setting is 9600 baud, 8 bit, no parity, one stop bit
//the commands available from the com port are:
//	n         == select rotor number n as default rotor to control
//			valid values are 1,2,3,4 (only '1' has been tested)
//	C         == print heading for default rotor
//	Cn        == print heading for rotor n
//	Pm        == turn default rotor to preset m (m=1,2,3)
//                 default presets are 1=45deg, 2=90deg, 3=180deg
//	Pnm       == turn rotor n to preset m
//	Lm        == load default rotor preset m with current heading
//	Lnm       == load rotor n preset m with current heading
//	S         == stop the default rotor
//	Sn        == stop rotor n
//	T         == print tolerance values
//	Tn x      == set tolerance for rotor n to x (default x=20)
//	Mqqq      == turn default rotor to heading qqq
//	X4rMqqq   == same as Mqqq.  CT puts 'X4r' in front of the M
//                 command, don't know why, but this works with it anyway.
//	Z         == print calibration values
//	ZnL mmm   == read a/d value for rotor n Left stop which is at
//                 a bearing of mmm, save as left end calibration value
//	ZnR mmm   == same as above for right stop
//	ZnD mmm   == assign degree range mmm to rotor n
//	ZnL xxxx=yyy   == manually assign rotor n Left calibration voltage
//                       xxxx to bearing yyy
//	ZnR xxxx=yyy   == same as above for Right stop.
//	?         == print some interesting info
//    V         == print a/d values
//    R         == print rotor control bits (L/R for all 4 rotors)
//setup g-1000/2700/2800 for north stop (these are defaults)
//	Z1L 3990=000
//	Z1R 2440=090
//	Z1D 450 
//setup g-1000/2700/2800 for south stop
//	Z1L 3990=180
//	Z1R 2440=270
//	Z1D 450
//turn rotor to 35 degrees
//	M035