Subversion Repositories FlightCtrl

Rev

Rev 1749 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1749 Rev 1756
Line 51... Line 51...
51
// +  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51
// +  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
// +  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
52
// +  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
53
// +  POSSIBILITY OF SUCH DAMAGE.
53
// +  POSSIBILITY OF SUCH DAMAGE.
54
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
54
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Line -... Line 55...
-
 
55
 
-
 
56
//Interessanten Maximumwerte
-
 
57
//Capacity.ActualCurrent/10, Capacity.ActualCurrent%10
-
 
58
//GPSInfo.Speed,GPSInfo.NumOfSats
-
 
59
//VarioMeter
-
 
60
//HoverGas/4
-
 
61
 
-
 
62
 
55
 
63
 
56
#include "main.h"
64
#include "main.h"
57
#include "mymath.h"
65
#include "mymath.h"
Line 58... Line 66...
58
#include "isqrt.h"
66
#include "isqrt.h"
Line 59... Line 67...
59
 
67
 
60
#ifdef NODISPLAY                        //  main.h
68
#ifdef NODISPLAY                        //  main.h
-
 
69
 
61
 
70
 
Line -... Line 71...
-
 
71
 
Line 62... Line 72...
62
 
72
#endif
63
 
73
unsigned char loop1, loop2, loop3;
-
 
74
unsigned char settingdest = 5;
-
 
75
int keynumber=-7;
64
#endif
76
 
65
unsigned char loop1, loop2, loop3, loop4;
77
unsigned short CurrentOffset = 0;///
66
int keynumber=-7;
78
 
67
 
79
unsigned char pos1, pos2, pos3, pos4=0;
68
 
80
unsigned char Motors0,Motors1,Motors2,Motors3,Motors4,Motors5,Motors6,Motors7;
Line 1309... Line 1321...
1309
                static unsigned long HoverGasFilter = 0;
1321
                static unsigned long HoverGasFilter = 0;
1310
                static unsigned char delay = 100, BaroAtUpperLimit = 0, BaroAtLowerLimit = 0;
1322
                static unsigned char delay = 100, BaroAtUpperLimit = 0, BaroAtLowerLimit = 0;
1311
            int CosAttitude;    // for projection of hoover gas
1323
            int CosAttitude;    // for projection of hoover gas
Line 1312... Line 1324...
1312
 
1324
 
-
 
1325
                // get the current hooverpoint
-
 
1326
                        if((FCFlags & FCFLAG_FLY)) ///
1313
                // get the current hooverpoint
1327
                                {
1314
                DebugOut.Analog[21] = HoverGas;
1328
                                DebugOut.Analog[21] = HoverGas;
1315
 
1329
                                }
1316
        // Expand the measurement
1330
        // Expand the measurement
1317
                // measurement of air pressure close to upper limit and no overflow in correction of the new OCR0A value occurs
1331
                // measurement of air pressure close to upper limit and no overflow in correction of the new OCR0A value occurs
1318
          if(!BaroExpandActive)
1332
          if(!BaroExpandActive)
1319
                   {
1333
                   {
Line 1598... Line 1612...
1598
                                {   // reduce the time constant of averaging by factor of 2 to get much faster a stable value
1612
                                {   // reduce the time constant of averaging by factor of 2 to get much faster a stable value
1599
                                        HoverGasFilter -= HoverGasFilter/(HOVER_GAS_AVERAGE/4L);
1613
                                        HoverGasFilter -= HoverGasFilter/(HOVER_GAS_AVERAGE/4L);
1600
                                        HoverGasFilter += 4L * tmp_long2;
1614
                                        HoverGasFilter += 4L * tmp_long2;
1601
                                }
1615
                                }
1602
                          else //later
1616
                          else //later
-
 
1617
                         
-
 
1618
                         
1603
                          if(abs(VarioMeter) < 100) // only on small vertical speed
1619
                          if(abs(VarioMeter) < 100) // only on small vertical speed
1604
                                {
1620
                                {
1605
                                        HoverGasFilter -= HoverGasFilter/HOVER_GAS_AVERAGE;
1621
                                        HoverGasFilter -= HoverGasFilter/HOVER_GAS_AVERAGE;
1606
                                        HoverGasFilter += tmp_long2;
1622
                                        HoverGasFilter += tmp_long2;
1607
                                }
1623
                                }
-
 
1624
                               
-
 
1625
                               
1608
                                HoverGas = (int16_t)(HoverGasFilter/HOVER_GAS_AVERAGE);
1626
                                HoverGas = (int16_t)(HoverGasFilter/HOVER_GAS_AVERAGE);
1609
                                if(EE_Parameter.Hoehe_HoverBand)
1627
                                if(EE_Parameter.Hoehe_HoverBand)
1610
                                {
1628
                                {
1611
                                        int16_t band;
1629
                                        int16_t band;
1612
                                        band = HoverGas / EE_Parameter.Hoehe_HoverBand; // the higher the parameter the smaller the range
1630
                                        band = HoverGas / EE_Parameter.Hoehe_HoverBand; // the higher the parameter the smaller the range