XXcontroller V1.4
=================

What you need to know
~~~~~~~~~~~~~~~~~~~~~
Currently available for QUAD+/QUAD-X/TRI configs
Runs on standard KK board
Only suitable for ATmega168/328
You will need for configuration,
either a: Sparkfun Serial LCD (16x2 5V) - www.sparkfun.com/products/9393
or a: Modern Devices LCD117 LCD - kit: shop.moderndevice.com/products/lcd117-kit assembled: shop.moderndevice.com/products/lcd117-asmb
note: currently the backlight brightness does not work on the LCD117 Display.

Features
~~~~~~~~
PID control loop
(Relatively!) easy setup procedure
Hardware PWM (or Soft-PWM for '300' versions)
Lots of configuration settings to tweak
Configuration changes using Tx & LCD Display (no PC needed to find/change those #defines)
Diagnostic info to help identify problems
Copter automatically dis-arms if no RxCollective signal
Startup check function will dis-able copter 


Hardware Install
~~~~~~~~~~~~~~~~
Flash the relevant hex file.

Hex files are in the form:

XX14x_XXXX300_M999_XX.hex
  ^   ^   ^   ^    ^
  |   |   |   |    + LCD type: MD=Modern Devices, SF=Sparkfun 
  |   |   |   |
  |   |   |   + Chip type M168 or M328
  |   |   |
  |   |   + 300Hz version 
  |   |
  |   + Type: QUAD+, QUADX or TRI
  |
  + Version: V1.4d

Motor Configurations (nb see note below!!!):
For QUAD+
Front (CW) M1
Left (CCW) M2
Right (CCW) M5
Back (CW) M6

QUAD-X
Front-Left (CW) M1
Front-Right (CCW) M2
Back-Right (CW) M5
Back-Left (CCW) M6

TRI
Front-Left (CW) M1
Front-Right (CCW) M2
Tail (CW) M5
Tail-Servo M6

nb - ***these assignments may have changed!***
Please go into Diagnostics/Motor to check you have the correct ones for your particular firmware.

Serial LCD connections:
TRI, TRI300 and QUAD use M4
QUAD300 uses different motor assignments (M1 -> 4) so LCD pin is M5
All 6 motor versions (HEX300 etc) use ICSP:4 (So ICSP pins are: 2=5v 4=Rx 6=0v )

First-time Setup
~~~~~~~~~~~~~~~~
Plug in LCD, power on TX and connect battery.
wait for LCD to show main menu (Copter QUAD+)
if the screen shows garbled characters, then you need to Adjust the LCD Timing (see below).
now go TxStick/Calibration and perform this function. Message will say 'Done!' (you may re-do this function at any time).
If the menu is constantly scrolling, make sure that your Rx connected light is on, if it is, then adjust the Tx Pitch Trim until it stops. 
Now you will need to calibrate your ESC's:
Remove propellors.
Turn on Tx, and put Collective to Max
Connect battery and wait for ESC bleep sequence.
Disconnect battery.
Now re-connect battery and check that ESC's will arm and that they all start at the same time.

Set Gyro Directions (nb please disable the Anti-stall option when doing this !)
Set Stick-Arm side/point and delay.

Adjust the LCD Timing
~~~~~~~~~~~~~~~~~~~~~
Because the internal oscillator is not very accurate, it is sometimes necessary to adjust the UART timing for the Serial LCD.
Power on the FC board and hold the Tx Yaw stick right for 5 seconds.
The screen will display (if readable) LCD Timing. Release the Yaw stick.
On the bottom line will/should show the timing parameter, the default is 102uS.
You can adjust the timing by moving the Yaw stick left or right (LED will flash to confirm)
If the LED does not blink, you have reached the end.
Moving the Yaw stick left reduces the timing, Right increases it.
Start by reducing the timing in increments of 2 (so try 100, then 98 etc).
After making adjustment, if the display is garbled (it generally won't correct itself), try un-plugging and plugging it back in.
You may find later the display gets the odd strange character, but you shouldn't worry too much.

General Flying
~~~~~~~~~~~~~~
The default settings are from my mid-sized quad with KK blackboard with enc03 gyros.
These gyros are not particularly sensitive, so if you're using other types, you will probably need to adjust them.
Also, I currently use Lo-rate on my Tx.
Good news is that there's alot more scope for tuning, the bad news is getting to understand how they interact with each other....
To change the gyro gain, adjust the 'P' term
Tx Stick sensitivity is via TxRate

The TxStick/Calibration function is the same as the 'Stick Centering' procedure from previous versions, so any Tx trim you may have added will be removed when you run this.
The hysteresis function only works correctly when TxStick trim is not used.
If you notice that your copter starts to drift from being level, this may be due to your gyros aclimatising (murata enc03's are quite temperature sensitive).Just land, dis-arm and re-arm (re-calibrates gyros) and see if the hover is now stable.
If it isn't stable, then you will need to add trim on the Copter, but usually it will be.
If you don't know whether to add + or - adjustment, go to Diagnostics/Rx menu, and move the relevant Tx stick to see what happens.

TRI-Copter Specific Points
~~~~~~~~~~~~~~~~~~~~~~~~~~

Tri-Copter setups have alot more variability than Quads.
Pretty much all this ReadMe file applies to Tri-Copters other than the 'no Tx Trim' which *can* be applied to the Yaw Tx Stick.

One feature I added was to slightly Roll the Copter when Yawing.

One glitch that I have been getting is that the Tail Motor, when armed, glitches occasionally.
This appears to be an interrupt conlict which happens, apparantly only when at Zero Collective.
If I find a cure, I will fix it, until then, it's an annoyance...  

Other Points
~~~~~~~~~~~~
The copter will always power on with the first Profile.

Change to a different Profile:
on top level menu find 'Profile Default'
Select it (Roll Right) and display will show 'PRF:Default'
then select it again and 'Default' will appear on bottom line.
Now use Pitch to cycle/select thru the available profiles.
Note that initially, they are all setup the same!

So the PID/TxRate setings apply to the current Profile you are in.

When switching the Yaw/Response, you may need to adjust the TxRate.

Motor Outputs
When looking at the Motor outputs in the Diagnostic menu, you will see that the numbers do not stay constant despite the copter being stationary. This is because the PID loop is constantly correcting for errors which there will always be.

Gyro calibration
takes place @ arming, but can also be done when not armed by putting Collective to Max.

LED
When dis-armed, led should flash every 4/5 seconds, if not, the Controller has either got stuck in an endless loop, or, it detected an error (gyro problem) during start-up.
LED will be permanently on when armed.


Diagnostics for Rx
1.54mS [ +4/ +3]
1.54ms is the incoming Signal length
+4 (Raw) is the normalised level (centre point subtracted) from pulse length
+3 (Nett) is the normalised level (+4) after hysteresis, end-point limits and then Trim-Adjust have been applied (in that order)
Rx/Coll does not have Trim-Adjust or Hysteresis applied
