Rev 1139 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1139 | Rev 1141 | ||
---|---|---|---|
Line 9... | Line 9... | ||
9 | #include "parameter.h" |
9 | #include "parameter.h" |
10 | #include "pitch_neutral.h" |
10 | #include "pitch_neutral.h" |
11 | #include "pitch_md.h" |
11 | #include "pitch_md.h" |
12 | #include "pitch.h" |
12 | #include "pitch.h" |
Line -... | Line 13... | ||
- | 13 | ||
- | 14 | #define UNDEFINED 255 |
|
Line -... | Line 15... | ||
- | 15 | #define INVALID 255 |
|
13 | 16 | ||
Line -... | Line 17... | ||
- | 17 | int pitchInitialStickValue = UNDEFINED; |
|
14 | 18 | unsigned char pitchMode; |
|
15 | unsigned char pitchMode; |
19 | |
16 | 20 | ||
17 | char *pitchModeStrings[] = { |
21 | char *pitchModeStrings[] = { |
- | 22 | "Normal ", |
|
18 | "Normal ", |
23 | "Neutral ", |
Line 19... | Line 24... | ||
19 | "Neutral ", |
24 | "MD ", |
20 | "MD " |
25 | "Inaktiv " |
Line 32... | Line 37... | ||
32 | * wird nach jeder Setting-Auswahl sowie nach jeder Setting-Änderung |
37 | * wird nach jeder Setting-Auswahl sowie nach jeder Setting-Änderung |
33 | * aufgerufen. |
38 | * aufgerufen. |
34 | */ |
39 | */ |
35 | void pitch_init( void ) { |
40 | void pitch_init( void ) { |
Line -... | Line 41... | ||
- | 41 | ||
- | 42 | // Nur beim Einschalten ermitteln, da beim Setting-Wechsel ungültig |
|
- | 43 | if( pitchInitialStickValue == UNDEFINED ) { |
|
- | 44 | ||
- | 45 | // Warten, bis ein gültiger Wert von der Fernsteuerung anliegt |
|
- | 46 | unsigned int timer = SetDelay( 500 ); |
|
- | 47 | while( !CheckDelay( timer ) ); |
|
- | 48 | ||
- | 49 | pitchInitialStickValue = PPM_in[ EE_Parameter.Kanalbelegung[ K_GAS ] ]; |
|
- | 50 | } |
|
36 | 51 | ||
Line -... | Line 52... | ||
- | 52 | pitchMode = PARAM_PITCH_MODE; |
|
- | 53 | ||
- | 54 | /* Die Stick-Position beim Einschalten muß mit dem im Setting eingestellten |
|
- | 55 | * Pitch-Modus übereinstimmen. Sonst wird die Pitch-Steuerung aus Sicherheits- |
|
- | 56 | * gründen deaktiviert. Selbiges gilt, wenn die Höhenregelung deaktiviert wurde. |
|
- | 57 | */ |
|
- | 58 | switch( pitchMode ) { |
|
- | 59 | // Pitch-Modi mit neutralisiertem Gas |
|
- | 60 | case PARAM_PITCH_MODE_NEUTRAL: |
|
- | 61 | case PARAM_PITCH_MODE_MD: |
|
- | 62 | if( !( EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG ) ) |
|
- | 63 | pitchMode = PARAM_PITCH_MODE_INVALID; |
|
- | 64 | if( abs( pitchInitialStickValue ) > PARAM_PITCH_STICK_THRESHOLD ) |
|
- | 65 | pitchMode = PARAM_PITCH_MODE_INVALID; |
|
- | 66 | break; |
|
- | 67 | ||
- | 68 | // Pitch-Modi mit 0-Gas |
|
- | 69 | case PARAM_PITCH_MODE_NORMAL: |
|
- | 70 | if( pitchInitialStickValue > 35 - 120 ) |
|
- | 71 | pitchMode = PARAM_PITCH_MODE_INVALID; |
|
- | 72 | break; |
|
- | 73 | } |
|
37 | pitchMode = PARAM_PITCH_MODE; |
74 | |
Line 38... | Line 75... | ||
38 | 75 | pitch_neutral_init(); |
|
39 | pitch_md_init(); |
76 | pitch_md_init(); |
40 | 77 | ||
Line 62... | Line 99... | ||
62 | return pitch_neutral_value(); |
99 | return pitch_neutral_value(); |
Line 63... | Line 100... | ||
63 | 100 | ||
64 | case PARAM_PITCH_MODE_MD: |
101 | case PARAM_PITCH_MODE_MD: |
Line 65... | Line 102... | ||
65 | return pitch_md_value(); |
102 | return pitch_md_value(); |
66 | 103 | ||
- | 104 | case PARAM_PITCH_MODE_NORMAL: |
|
- | 105 | return pitch_mk_value(); |
|
- | 106 | ||
67 | default: |
107 | default: |
68 | return pitch_mk_value(); |
108 | return 0; |
Line 69... | Line 109... | ||
69 | } |
109 | } |
70 | } |
110 | } |
71 | 111 | ||
72 | 112 | ||
73 | /* |
113 | /* |
74 | * Führt eine Pitch-Berechnung aus, die der Original-SW entspricht. |
114 | * Führt eine Pitch-Berechnung aus, die der Original-SW entspricht. |
Line 75... | Line 115... | ||
75 | */ |
115 | */ |
76 | int pitch_mk_value( void ) { |
116 | int pitch_mk_value( void ) { |
Line 77... | Line 117... | ||
77 | register int stickValue = PPM_in[ EE_Parameter.Kanalbelegung[ K_GAS ] ]; |
117 | register int stickValue = PPM_in[ EE_Parameter.Kanalbelegung[ K_GAS ] ]; |