Subversion Repositories FlightCtrl

Rev

Rev 824 | Rev 846 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 824 Rev 831
Line 36... Line 36...
36
// +   * The use of this project (hardware, software, binary files, sources and documentation) is only permittet 
36
// +   * The use of this project (hardware, software, binary files, sources and documentation) is only permittet 
37
// +     for non-commercial use (directly or indirectly)
37
// +     for non-commercial use (directly or indirectly)
38
// +     Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted 
38
// +     Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted 
39
// +     with our written permission
39
// +     with our written permission
40
// +   * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be 
40
// +   * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be 
-
 
41
// +     clearly linked as origin 
41
// +     clearly linked as origin // +   * porting to systems other than hardware from www.mikrokopter.de is not allowed
42
// +   * porting to systems other than hardware from www.mikrokopter.de is not allowed
42
// +  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
43
// +  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
43
// +  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44
// +  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44
// +  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45
// +  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45
// +  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
46
// +  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
46
// +  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
47
// +  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Line 438... Line 439...
438
    GRN_ON;
439
    GRN_ON;
439
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
440
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
440
// Gaswert ermitteln
441
// Gaswert ermitteln
441
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
442
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
442
        GasMischanteil = StickGas;
443
        GasMischanteil = StickGas;
443
    if(GasMischanteil < MIN_GAS) GasMischanteil = MIN_GAS;
444
    if(GasMischanteil < MIN_GAS + 10) GasMischanteil = MIN_GAS + 10;
444
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
445
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
445
// Empfang schlecht
446
// Empfang schlecht
446
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
447
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
447
   if(SenderOkay < 100)
448
   if(SenderOkay < 100)
448
        {
449
        {
Line 980... Line 981...
980
     {
981
     {
981
       int w,v,r,fehler,korrektur;
982
       int w,v,r,fehler,korrektur;
982
       static int KompassSignalSchlecht = 0;
983
       static int KompassSignalSchlecht = 0;
983
       w = abs(IntegralNick /512); // mit zunehmender Neigung den Einfluss drosseln
984
       w = abs(IntegralNick /512); // mit zunehmender Neigung den Einfluss drosseln
984
       v = abs(IntegralRoll /512);
985
       v = abs(IntegralRoll /512);
985
//v /= 4;
-
 
986
//w /= 4;
-
 
987
       if(v > w) w = v; // grösste Neigung ermitteln
986
       if(v > w) w = v; // grösste Neigung ermitteln
988
//       if((MaxStickNick > 32) || (MaxStickRoll > 32)) w *= 2;
-
 
989
       korrektur = w / 8 + 1;
987
       korrektur = w / 8 + 1;
990
       if(w < 25 && NeueKompassRichtungMerken && !KompassSignalSchlecht)    
988
       if(w < 25 && NeueKompassRichtungMerken && !KompassSignalSchlecht)    
991
        {
989
        {
992
         KompassStartwert = KompassValue;
990
         KompassStartwert = KompassValue;
993
         NeueKompassRichtungMerken = 0;
991
         NeueKompassRichtungMerken = 0;
994
        }
992
        }
Line 995... Line 993...
995
 
993
 
996
       fehler = ((540 + KompassValue - (ErsatzKompass/GIER_GRAD_FAKTOR)) % 360) - 180;
994
       fehler = ((540 + KompassValue - (ErsatzKompass/GIER_GRAD_FAKTOR)) % 360) - 180;
997
       ErsatzKompass += (fehler * 8) / korrektur;
-
 
998
//           DebugOut.Analog[10] = fehler;
995
       ErsatzKompass += (fehler * 8) / korrektur;
999
       w = (w * Parameter_KompassWirkung) / 64;           // auf die Wirkung normieren
996
       w = (w * Parameter_KompassWirkung) / 64;           // auf die Wirkung normieren
1000
       w = Parameter_KompassWirkung - w;                  // Wirkung ggf drosseln
997
       w = Parameter_KompassWirkung - w;                  // Wirkung ggf drosseln
1001
       if(w > 0)
998
       if(w > 0)
1002
        {
999
        {
1003
          if(!KompassSignalSchlecht)
1000
          if(!KompassSignalSchlecht)
1004
          {
1001
          {
1005
           GierGyroFehler += fehler;
1002
           GierGyroFehler += fehler;
1006
           v = 64 + ((MaxStickNick + MaxStickRoll)) / 8;  
-
 
1007
           //v = 32;
1003
           v = 64 + ((MaxStickNick + MaxStickRoll)) / 8;  
1008
           //r = ((540 + (ErsatzKompass/GIER_GRAD_FAKTOR) - KompassStartwert) % 360) - 180;
1004
           //r = ((540 + (ErsatzKompass/GIER_GRAD_FAKTOR) - KompassStartwert) % 360) - 180;
1009
           r = KompassRichtung;
1005
           r = KompassRichtung;
1010
           v = (r * w) / v;  // nach Kompass ausrichten
1006
           v = (r * w) / v;  // nach Kompass ausrichten
1011
           w = 3 * Parameter_KompassWirkung;
1007
           w = 3 * Parameter_KompassWirkung;