Roberto´s latest changes + Makefile:
"!!! Just some code to look at !!!
Ha! Little bug in Sonar found that could lead to sudden spikes *fixed*.
Sonar code structure a little changed to make it easier to implement new sonar drivers (currently HC-SR04). Sonar/althold flight tested works but you must reduce the autolandrate, because with sonarcontact it will do a controlled but very quick landing... or increase the minimal hight for sonar, so the last 50cm or so are done just by baro, many combination possibilities.
set SONAR_Pinout = X(0) // 0 = PWM56, 1 = RC78, 2 = I2C (DaddyWalross)
set sonar_min = X(0) // Valid Sonar minimal range in cm (0-200)
set sonar_max = X(200) // Valid Sonar maximal range in cm (50-700)
set sonar_tilt = X(30) // Somehow copter tiltrange in degrees (not exactly) in wich Sonar is possible
set sonar_debug = 0 or 1 // 1 Sends Sonardata (within defined range and tilt) to debug[0] and tiltvalue to debug[1]
set cfg.baro_sonar_cf = X (0.9f) // The bigger, the more Sonarinfluence, makes switch between them smoother and defines baroinfluence when sonarcontact. 1.0f just takes Sonar, if contact (otherwise baro)"