Subversion Repositories NaviCtrl

Rev

Rev 693 | Rev 723 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 693 Rev 699
1
#ifndef _SPI_SLAVE_H
1
#ifndef _SPI_SLAVE_H
2
#define _SPI_SLAVE_H
2
#define _SPI_SLAVE_H
3
 
3
 
4
#include "fifo.h"
4
#include "fifo.h"
5
#include "gps.h"
5
#include "gps.h"
6
#include "main.h"
6
#include "main.h"
7
 
7
 
8
#define SPEAK_ERR_CALIBARTION  1
8
#define SPEAK_ERR_CALIBARTION  1
9
#define SPEAK_ERR_RECEICER       2
9
#define SPEAK_ERR_RECEICER       2
10
#define SPEAK_ERR_DATABUS        3
10
#define SPEAK_ERR_DATABUS        3
11
#define SPEAK_ERR_NAVI           4
11
#define SPEAK_ERR_NAVI           4
12
#define SPEAK_ERROR                      5
12
#define SPEAK_ERROR                      5
13
#define SPEAK_ERR_COMPASS        6
13
#define SPEAK_ERR_COMPASS        6
14
#define SPEAK_ERR_SENSOR         7
14
#define SPEAK_ERR_SENSOR         7
15
#define SPEAK_ERR_GPS            8
15
#define SPEAK_ERR_GPS            8
16
#define SPEAK_ERR_MOTOR          9
16
#define SPEAK_ERR_MOTOR          9
17
#define SPEAK_MAX_TEMPERAT  10
17
#define SPEAK_MAX_TEMPERAT  10
18
#define SPEAK_ALTI_REACHED  11
18
#define SPEAK_ALTI_REACHED  11
19
#define SPEAK_WP_REACHED    12
19
#define SPEAK_WP_REACHED    12
20
#define SPEAK_NEXT_WP       13
20
#define SPEAK_NEXT_WP       13
21
#define SPEAK_LANDING       14
21
#define SPEAK_LANDING       14
22
#define SPEAK_GPS_FIX       15
22
#define SPEAK_GPS_FIX       15
23
#define SPEAK_UNDERVOLTAGE  16
23
#define SPEAK_UNDERVOLTAGE  16
24
#define SPEAK_GPS_HOLD      17
24
#define SPEAK_GPS_HOLD      17
25
#define SPEAK_GPS_HOME      18
25
#define SPEAK_GPS_HOME      18
26
#define SPEAK_GPS_OFF       19
26
#define SPEAK_GPS_OFF       19
27
#define SPEAK_BEEP          20
27
#define SPEAK_BEEP          20
28
#define SPEAK_MIKROKOPTER   21
28
#define SPEAK_MIKROKOPTER   21
29
#define SPEAK_CAPACITY      22
29
#define SPEAK_CAPACITY      22
30
#define SPEAK_CF_OFF        23
30
#define SPEAK_CF_OFF        23
31
#define SPEAK_CALIBRATE     24
31
#define SPEAK_CALIBRATE     24
32
#define SPEAK_MAX_RANGE     25
32
#define SPEAK_MAX_RANGE     25
33
#define SPEAK_MAX_ALTITUD   26
33
#define SPEAK_MAX_ALTITUD   26
34
 
34
 
35
#define SPEAK_20M                       37   // ?
35
#define SPEAK_20M                       37   // ?
36
#define SPEAK_MK_OFF            38
36
#define SPEAK_MK_OFF            38
37
#define SPEAK_ALTITUDE_ON       39
37
#define SPEAK_ALTITUDE_ON       39
38
#define SPEAK_ALTITUDE_OFF      40
38
#define SPEAK_ALTITUDE_OFF      40
39
#define SPEAK_100M                      41   // ?
39
#define SPEAK_100M                      41   // ?
40
#define SPEAK_CONNECTED         42
40
#define SPEAK_CONNECTED         42
41
#define SPEAK_CF_ON             46
41
#define SPEAK_CF_ON             46
42
#define SPEAK_SINKING           47   // ?
42
#define SPEAK_SINKING           47   // ?
43
#define SPEAK_RISING            48
43
#define SPEAK_RISING            48
44
#define SPEAK_HOLDING           49   // ?
44
#define SPEAK_HOLDING           49   // ?
45
#define SPEAK_GPS_ON            50       // ?
45
#define SPEAK_GPS_ON            50       // ?
46
#define SPEAK_FOLLWING          51   // ?
46
#define SPEAK_FOLLWING          51   // ?
47
#define SPEAK_STARTING      52
47
#define SPEAK_STARTING      52
48
 
48
 
49
 
49
 
50
#define SS_PIN GPIO_ReadBit(GPIO2, GPIO_Pin_7)
50
#define SS_PIN GPIO_ReadBit(GPIO2, GPIO_Pin_7)
51
 
51
 
52
#define SPI_FCCMD_USER                  10
52
#define SPI_FCCMD_USER                  10
53
#define SPI_FCCMD_STICK                 11
53
#define SPI_FCCMD_STICK                 11
54
#define SPI_FCCMD_MISC                  12
54
#define SPI_FCCMD_MISC                  12
55
#define SPI_FCCMD_PARAMETER1    13
55
#define SPI_FCCMD_PARAMETER1    13
56
#define SPI_FCCMD_VERSION               14
56
#define SPI_FCCMD_VERSION               14
57
#define SPI_FCCMD_SLOW3                 15
57
#define SPI_FCCMD_SLOW3                 15
58
#define SPI_FCCMD_BL_ACCU               16
58
#define SPI_FCCMD_BL_ACCU               16
59
#define SPI_FCCMD_PARAMETER2    17
59
#define SPI_FCCMD_PARAMETER2    17
60
#define SPI_FCCMD_NEUTRAL               18
60
#define SPI_FCCMD_NEUTRAL               18
61
#define SPI_FCCMD_SLOW                  19 //  kommt nicht vor
61
#define SPI_FCCMD_SLOW                  19 //  kommt nicht vor
62
#define SPI_FCCMD_SLOW2                 20
62
#define SPI_FCCMD_SLOW2                 20
63
#define SPI_FCCMD_STICK2                21
63
#define SPI_FCCMD_STICK2                21
64
 
64
 
65
#define CHK_POTI(b,a) { if(a < 248) b = a; else b = FC.Poti[255 - a]; }
65
#define CHK_POTI(b,a) { if(a < 248) b = a; else b = FC.Poti[255 - a]; }
66
#define CHK_POTI_MM(b,a,min,max) {CHK_POTI(b,a); LIMIT_MIN_MAX(b, min, max); }
66
#define CHK_POTI_MM(b,a,min,max) {CHK_POTI(b,a); LIMIT_MIN_MAX(b, min, max); }
67
 
67
 
68
// devides only the Poti-value
68
// devides only the Poti-value
69
#define CHK_POTI_DIV(b,a,div) { if(a < 248) b = a; else b = FC.Poti[255 - a] / div; }
69
#define CHK_POTI_DIV(b,a,div) { if(a < 248) b = a; else b = FC.Poti[255 - a] / div; }
70
#define CHK_POTI_MM_DIV(b,a,min,max,div) {CHK_POTI_DIV(b,a,div); LIMIT_MIN_MAX(b, min, max); }
70
#define CHK_POTI_MM_DIV(b,a,min,max,div) {CHK_POTI_DIV(b,a,div); LIMIT_MIN_MAX(b, min, max); }
71
 
71
 
72
extern s32 Kalman_K;
72
extern s32 Kalman_K;
73
extern s32 Kalman_Kompass ;
73
extern s32 Kalman_Kompass ;
74
extern s32 Kalman_MaxDrift;
74
extern s32 Kalman_MaxDrift;
75
extern s32 Kalman_MaxFusion;
75
extern s32 Kalman_MaxFusion;
76
extern s32 ToFcGpsZ;
76
extern s32 ToFcGpsZ;
77
extern s32 ToFC_Rotate_C, ToFC_Rotate_S;
77
extern s32 ToFC_Rotate_C, ToFC_Rotate_S;
78
extern s32 HeadFreeStartAngle,CompassDirectionAtMotorStart;
78
extern s32 HeadFreeStartAngle,CompassDirectionAtMotorStart;
79
extern s16 FC_WP_EventChannel,LogFC_WP_EventChannel,FC_WP_EventChannel_Processed;
79
extern s16 FC_WP_EventChannel,LogFC_WP_EventChannel,FC_WP_EventChannel_Processed;
80
extern u32 ToFC_AltitudeRate;
80
extern u32 ToFC_AltitudeRate;
81
extern s32 ToFC_AltitudeSetpoint;
81
extern s32 ToFC_AltitudeSetpoint;
82
extern u8 NC_GPS_ModeCharacter;
82
extern u8 NC_GPS_ModeCharacter;
83
extern u8 FC_is_Calibrated;
83
extern u8 FC_is_Calibrated;
84
extern u8 FCCalibActive;
84
extern u8 FCCalibActive;
85
extern u8 SpeakHoTT;
85
extern u8 SpeakHoTT;
86
extern u8 NC_Wait_for_LED;
86
extern u8 NC_Wait_for_LED;
87
extern s16 GyroCompassCorrected;
-
 
88
extern s16 CompassSetpointCorrected; // The compass setpoint that the FC tries to keep - corrected with the magnetic declination
-
 
89
extern s16 CompassSetpoint;
-
 
90
extern u8 AmountOfMotors;
-
 
91
extern s16 SimulatedDirection;    // simulated compass direction
-
 
92
 
87
 
93
#define MAX_RC_IN  16+12+3+4 // 16ch + 12ser + 3stages + 4 reserved
88
#define MAX_RC_IN  16+12+3+4 // 16ch + 12ser + 3stages + 4 reserved
94
extern s8 PPM_In[MAX_RC_IN];
89
extern s8 PPM_In[MAX_RC_IN];
95
           
90
           
96
extern u8 BL_MinOfMaxPWM;  // indication if all BL-controllers run on full power
91
extern u8 BL_MinOfMaxPWM;  // indication if all BL-controllers run on full power
97
extern u8 Logging_BL_MinOfMaxPWM;
92
extern u8 Logging_BL_MinOfMaxPWM;
98
extern u8 ErrorCheck_BL_MinOfMaxPWM;
93
extern u8 ErrorCheck_BL_MinOfMaxPWM;
99
extern u32 FC_I2C_ErrorConter;
94
extern u32 FC_I2C_ErrorConter;
100
extern u8 FromFC_VarioCharacter;
95
extern u8 FromFC_VarioCharacter;
101
extern u8 Logging_FCStatusFlags1,Logging_FCStatusFlags2;
96
extern u8 Logging_FCStatusFlags1,Logging_FCStatusFlags2;
102
extern s16 POI_KameraNick;
97
extern s16 POI_KameraNick;
103
extern u8 NC_To_FC_Flags, NC_To_FC_Autostart;
-
 
104
extern u16 FlugMinutenGesamt;
98
extern u16 FlugMinutenGesamt;
105
extern u32 LoggingGasFilter, LoggingGasCnt;
99
extern u32 LoggingGasFilter, LoggingGasCnt;
106
extern u8 HoverGas;
100
extern u8 HoverGas;
107
extern s16 FromFlightCtrl_AccNick,FromFlightCtrl_AccRoll,FromFlightCtrl_GyroNick,FromFlightCtrl_GyroRoll;
101
extern s16 FromFlightCtrl_AccNick,FromFlightCtrl_AccRoll,FromFlightCtrl_GyroNick,FromFlightCtrl_GyroRoll;
108
extern u8 RequestConfigFromFC;
102
extern u8 RequestConfigFromFC;
109
 
103
 
110
typedef struct
104
typedef struct
111
{
105
{
112
        u8   Command;
106
        u8   Command;
113
        s16  AngleNick;  // NickAngle in 0.1 deg
107
        s16  AngleNick;  // NickAngle in 0.1 deg
114
        s16  AngleRoll;  // RollAngle in 0.1 deg
108
        s16  AngleRoll;  // RollAngle in 0.1 deg
115
        s16  GyroHeading; // Heading in 0.1 deg
109
        s16  GyroHeading; // Heading in 0.1 deg
116
        s16  GyroYaw;
110
        s16  GyroYaw;
117
        u16  FCStatus;
111
        u16  FCStatus;
118
        union
112
        union
119
        {
113
        {
120
                u8    Byte[20];
114
                u8    Byte[20];
121
                s8        sByte[20];
115
                s8        sByte[20];
122
                u16   Int[10];
116
                u16   Int[10];
123
                s16   sInt[10];
117
                s16   sInt[10];
124
                u32   Long[5];
118
                u32   Long[5];
125
                s32   sLong[5];
119
                s32   sLong[5];
126
                float Float[5];
120
                float Float[5];
127
        } __attribute__((packed)) Param;
121
        } __attribute__((packed)) Param;
128
        u8 Chksum;
122
        u8 Chksum;
129
 } __attribute__((packed)) FromFlightCtrl_t;
123
 } __attribute__((packed)) FromFlightCtrl_t;
130
 
124
 
131
#define SPI_NCCMD_OSD_DATA              100
125
#define SPI_NCCMD_OSD_DATA              100
132
#define SPI_NCCMD_GPS_POS               101
126
#define SPI_NCCMD_GPS_POS               101
133
#define SPI_NCCMD_GPS_TARGET    102
127
#define SPI_NCCMD_GPS_TARGET    102
134
#define SPI_NCCMD_KALMAN                103
128
#define SPI_NCCMD_KALMAN                103
135
#define SPI_NCCMD_VERSION               104
129
#define SPI_NCCMD_VERSION               104
136
#define SPI_NCCMD_GPSINFO               105
130
#define SPI_NCCMD_GPSINFO               105
137
#define SPI_NCCMD_HOTT_INFO             106
131
#define SPI_NCCMD_HOTT_INFO             106
138
#define SPI_MISC                                107
132
#define SPI_MISC                                107
139
#define SPI_SERIAL_CH                   108
133
#define SPI_SERIAL_CH                   108
140
 
134
 
141
#define HOTT_VARIO_PACKET_ID            0x89
135
#define HOTT_VARIO_PACKET_ID            0x89
142
#define HOTT_GPS_PACKET_ID                      0x8A
136
#define HOTT_GPS_PACKET_ID                      0x8A
143
#define HOTT_ELECTRIC_AIR_PACKET_ID     0x8E
137
#define HOTT_ELECTRIC_AIR_PACKET_ID     0x8E
144
#define HOTT_GENERAL_PACKET_ID          0x8D
138
#define HOTT_GENERAL_PACKET_ID          0x8D
145
#define JETI_GPS_PACKET_ID1                     0x01
139
#define JETI_GPS_PACKET_ID1                     0x01
146
#define JETI_GPS_PACKET_ID2                     0x02
140
#define JETI_GPS_PACKET_ID2                     0x02
147
#define HOTT_WPL_NAME                           0x03
141
#define HOTT_WPL_NAME                           0x03
148
 
142
 
149
typedef struct
143
typedef struct
150
{
144
{
151
        u8 Command;
145
        u8 Command;
152
        GPS_Stick_t GPSStick;
146
        GPS_Stick_t GPSStick;
153
        s16 CompassHeading;
147
        s16 CompassHeading;
154
        s16 AccErrorN;
148
        s16 AccErrorN;
155
        s16 AccErrorR;
149
        s16 AccErrorR;
156
        union
150
        union
157
        {
151
        {
158
                u8    Byte[20];
152
                u8    Byte[20];
159
                s8    sByte[20];
153
                s8    sByte[20];
160
                u16       Int[10];
154
                u16       Int[10];
161
                s16   sInt[10];
155
                s16   sInt[10];
162
                u32   Long[5];
156
                u32   Long[5];
163
                s32   sLong[5];
157
                s32   sLong[5];
164
                float Float[5];
158
                float Float[5];
165
        } __attribute__((packed)) Param;
159
        } __attribute__((packed)) Param;
166
        u8 Chksum;
160
        u8 Chksum;
167
 } __attribute__((packed)) ToFlightCtrl_t;
161
 } __attribute__((packed)) ToFlightCtrl_t;
168
 
162
 
169
typedef struct
163
typedef struct
170
{
164
{
171
        unsigned char Sync1,Sync2;
165
        unsigned char Sync1,Sync2;
172
        unsigned char WhoAmI;
166
        unsigned char WhoAmI;
173
        unsigned char Data[240];
167
        unsigned char Data[240];
174
        unsigned char Chksum;
168
        unsigned char Chksum;
175
}__attribute__((packed)) str_HugeBlockFromFC;
169
}__attribute__((packed)) str_HugeBlockFromFC;
176
extern str_HugeBlockFromFC HugeBlockFromFC;
170
extern str_HugeBlockFromFC HugeBlockFromFC;
177
 
171
 
178
typedef struct
172
typedef struct
179
{
173
{
180
        unsigned char Sync1,Sync2;
174
        unsigned char Sync1,Sync2;
181
        unsigned char WhoAmI;
175
        unsigned char WhoAmI;
182
        unsigned char Data[240];
176
        unsigned char Data[240];
183
        unsigned char Chksum;
177
        unsigned char Chksum;
184
}__attribute__((packed)) str_HugeBlockToFC;
178
}__attribute__((packed)) str_HugeBlockToFC;
185
extern str_HugeBlockToFC HugeBlockToFC;
179
extern str_HugeBlockToFC HugeBlockToFC;
186
 
180
 
187
typedef struct
181
typedef struct
188
{
182
{
189
 u8 Current;
183
 u8 Current;
190
 u8 Temperature;
184
 u8 Temperature;
191
 u8 MaxPWM;
185
 u8 MaxPWM;
192
 u8 State;
186
 u8 State;
193
 u8 NotReadyCnt;
187
 u8 NotReadyCnt;
194
} __attribute__((packed)) Motor_t;
188
} __attribute__((packed)) Motor_t;
195
 
189
 
196
extern Motor_t Motor[MAX_MOTORS];
190
extern Motor_t Motor[MAX_MOTORS];
197
 
191
 
198
#define MOTOR_STATE_NEW_PROTOCOL_MASK   0x01
192
#define MOTOR_STATE_NEW_PROTOCOL_MASK   0x01
199
#define MOTOR_STATE_FAST_MODE           0x02
193
#define MOTOR_STATE_FAST_MODE           0x02
200
#define MOTOR_STATE_BL30                0x04   // extended Current measurement -> 200 = 20A    201 = 21A    255 = 75A (20+55)
194
#define MOTOR_STATE_BL30                0x04   // extended Current measurement -> 200 = 20A    201 = 21A    255 = 75A (20+55)
201
extern u8 Motor_Version[MAX_MOTORS]; // das kann nicht in die struct, weil der PC die Struktur bekommt
195
extern u8 Motor_Version[MAX_MOTORS]; // das kann nicht in die struct, weil der PC die Struktur bekommt
202
 
196
 
203
 
197
 
204
typedef struct
198
typedef struct
205
{
199
{
206
   u8 Major;
200
   u8 Major;
207
   u8 Minor;
201
   u8 Minor;
208
   u8 Patch;
202
   u8 Patch;
209
   u8 Compatible;
203
   u8 Compatible;
210
   u8 Hardware;
204
   u8 Hardware;
211
} __attribute__((packed)) SPI_Version_t;
205
} __attribute__((packed)) SPI_Version_t;
212
 
206
 
213
 
207
 
214
extern FromFlightCtrl_t   FromFlightCtrl;
208
extern FromFlightCtrl_t   FromFlightCtrl;
215
extern ToFlightCtrl_t     ToFlightCtrl;
209
extern ToFlightCtrl_t     ToFlightCtrl;
216
extern volatile u32 SPI0_Timeout;
210
extern volatile u32 SPI0_Timeout;
217
extern SPI_Version_t FC_Version;
211
extern SPI_Version_t FC_Version;
218
extern s16 GPS_Aid_StickMultiplikator;
212
extern s16 GPS_Aid_StickMultiplikator;
219
extern u8 CompassCalState;
213
extern u8 CompassCalState;
220
extern u8 Out1TriggerUpdateNewData;
214
extern u8 Out1TriggerUpdateNewData;
221
extern u8 LowVoltageLandingActive;
215
extern u8 LowVoltageLandingActive;
222
 
216
 
223
void SPI0_Init(void);
217
void SPI0_Init(void);
224
void SPI0_GetFlightCtrlVersion(void);
218
void SPI0_GetFlightCtrlVersion(void);
225
void SPI0_UpdateBuffer(void);
219
void SPI0_UpdateBuffer(void);
226
u16 BL3_Current(u8 who); // in 0.1A
220
u16 BL3_Current(u8 who); // in 0.1A
227
 
221
 
228
typedef struct
222
typedef struct
229
{
223
{
230
        unsigned char Revision;
224
        unsigned char Revision;
231
        unsigned char Kanalbelegung[12];       // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
225
        unsigned char Kanalbelegung[12];       // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
232
        unsigned char GlobalConfig;           // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
226
        unsigned char GlobalConfig;           // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
233
        unsigned char Hoehe_MinGas;           // Wert : 0-100
227
        unsigned char Hoehe_MinGas;           // Wert : 0-100
234
        unsigned char Luftdruck_D;            // Wert : 0-250
228
        unsigned char Luftdruck_D;            // Wert : 0-250
235
        unsigned char HoeheChannel;           // Wert : 0-32
229
        unsigned char HoeheChannel;           // Wert : 0-32
236
        unsigned char Hoehe_P;                // Wert : 0-32
230
        unsigned char Hoehe_P;                // Wert : 0-32
237
        unsigned char Hoehe_Verstaerkung;     // Wert : 0-50
231
        unsigned char Hoehe_Verstaerkung;     // Wert : 0-50
238
        unsigned char Hoehe_ACC_Wirkung;      // Wert : 0-250
232
        unsigned char Hoehe_ACC_Wirkung;      // Wert : 0-250
239
        unsigned char Hoehe_HoverBand;        // Wert : 0-250
233
        unsigned char Hoehe_HoverBand;        // Wert : 0-250
240
        unsigned char Hoehe_TiltCompensation; // Wert : 0-250
234
        unsigned char Hoehe_TiltCompensation; // Wert : 0-250
241
        unsigned char Hoehe_StickNeutralPoint;// Wert : 0-250
235
        unsigned char Hoehe_StickNeutralPoint;// Wert : 0-250
242
        unsigned char Stick_P;                // Wert : 1-6
236
        unsigned char Stick_P;                // Wert : 1-6
243
        unsigned char Stick_D;                // Wert : 0-64
237
        unsigned char Stick_D;                // Wert : 0-64
244
        unsigned char StickGier_P;            // Wert : 1-20
238
        unsigned char StickGier_P;            // Wert : 1-20
245
        unsigned char Gas_Min;                // Wert : 0-32
239
        unsigned char Gas_Min;                // Wert : 0-32
246
        unsigned char Gas_Max;                // Wert : 33-250
240
        unsigned char Gas_Max;                // Wert : 33-250
247
        unsigned char GyroAccFaktor;          // Wert : 1-64
241
        unsigned char GyroAccFaktor;          // Wert : 1-64
248
        unsigned char KompassWirkung;         // Wert : 0-32
242
        unsigned char KompassWirkung;         // Wert : 0-32
249
        unsigned char Gyro_P;                 // Wert : 10-250
243
        unsigned char Gyro_P;                 // Wert : 10-250
250
        unsigned char Gyro_I;                 // Wert : 0-250
244
        unsigned char Gyro_I;                 // Wert : 0-250
251
        unsigned char Gyro_D;                 // Wert : 0-250
245
        unsigned char Gyro_D;                 // Wert : 0-250
252
        unsigned char Gyro_Gier_P;            // Wert : 10-250
246
        unsigned char Gyro_Gier_P;            // Wert : 10-250
253
        unsigned char Gyro_Gier_I;            // Wert : 0-250
247
        unsigned char Gyro_Gier_I;            // Wert : 0-250
254
        unsigned char Gyro_Stability;         // Wert : 0-16
248
        unsigned char Gyro_Stability;         // Wert : 0-16
255
        unsigned char UnterspannungsWarnung;  // Wert : 0-250
249
        unsigned char UnterspannungsWarnung;  // Wert : 0-250
256
        unsigned char NotGas;                 // Wert : 0-250     //Gaswert bei Empängsverlust
250
        unsigned char NotGas;                 // Wert : 0-250     //Gaswert bei Empängsverlust
257
        unsigned char NotGasZeit;             // Wert : 0-250     // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen
251
        unsigned char NotGasZeit;             // Wert : 0-250     // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen
258
        unsigned char Receiver;                   // 0= Summensignal, 1= Spektrum, 2 =Jeti, 3=ACT DSL, 4=ACT S3D
252
        unsigned char Receiver;                   // 0= Summensignal, 1= Spektrum, 2 =Jeti, 3=ACT DSL, 4=ACT S3D
259
        unsigned char I_Faktor;               // Wert : 0-250
253
        unsigned char I_Faktor;               // Wert : 0-250
260
        unsigned char UserParam1;             // Wert : 0-250
254
        unsigned char UserParam1;             // Wert : 0-250
261
        unsigned char UserParam2;             // Wert : 0-250
255
        unsigned char UserParam2;             // Wert : 0-250
262
        unsigned char UserParam3;             // Wert : 0-250
256
        unsigned char UserParam3;             // Wert : 0-250
263
        unsigned char UserParam4;             // Wert : 0-250
257
        unsigned char UserParam4;             // Wert : 0-250
264
        unsigned char ServoNickControl;       // Wert : 0-250     // Stellung des Servos
258
        unsigned char ServoNickControl;       // Wert : 0-250     // Stellung des Servos
265
        unsigned char ServoNickComp;          // Wert : 0-250     // Einfluss Gyro/Servo
259
        unsigned char ServoNickComp;          // Wert : 0-250     // Einfluss Gyro/Servo
266
        unsigned char ServoNickMin;           // Wert : 0-250     // Anschlag
260
        unsigned char ServoNickMin;           // Wert : 0-250     // Anschlag
267
        unsigned char ServoNickMax;           // Wert : 0-250     // Anschlag
261
        unsigned char ServoNickMax;           // Wert : 0-250     // Anschlag
268
        //--- Seit V0.75
262
        //--- Seit V0.75
269
        unsigned char ServoRollControl;       // Wert : 0-250     // Stellung des Servos
263
        unsigned char ServoRollControl;       // Wert : 0-250     // Stellung des Servos
270
        unsigned char ServoRollComp;          // Wert : 0-250
264
        unsigned char ServoRollComp;          // Wert : 0-250
271
        unsigned char ServoRollMin;           // Wert : 0-250
265
        unsigned char ServoRollMin;           // Wert : 0-250
272
        unsigned char ServoRollMax;           // Wert : 0-250
266
        unsigned char ServoRollMax;           // Wert : 0-250
273
        //---
267
        //---
274
        unsigned char ServoNickRefresh;       // Speed of the Servo
268
        unsigned char ServoNickRefresh;       // Speed of the Servo
275
    unsigned char ServoManualControlSpeed;//
269
    unsigned char ServoManualControlSpeed;//
276
    unsigned char CamOrientation;         //
270
    unsigned char CamOrientation;         //
277
        unsigned char Servo3;                    // Value or mapping of the Servo Output
271
        unsigned char Servo3;                    // Value or mapping of the Servo Output
278
        unsigned char Servo4;                            // Value or mapping of the Servo Output
272
        unsigned char Servo4;                            // Value or mapping of the Servo Output
279
        unsigned char Servo5;                            // Value or mapping of the Servo Output
273
        unsigned char Servo5;                            // Value or mapping of the Servo Output
280
        unsigned char LoopGasLimit;           // Wert: 0-250  max. Gas während Looping
274
        unsigned char LoopGasLimit;           // Wert: 0-250  max. Gas während Looping
281
        unsigned char LoopThreshold;          // Wert: 0-250  Schwelle für Stickausschlag
275
        unsigned char LoopThreshold;          // Wert: 0-250  Schwelle für Stickausschlag
282
        unsigned char LoopHysterese;          // Wert: 0-250  Hysterese für Stickausschlag
276
        unsigned char LoopHysterese;          // Wert: 0-250  Hysterese für Stickausschlag
283
        unsigned char AchsKopplung1;          // Wert: 0-250  Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung)
277
        unsigned char AchsKopplung1;          // Wert: 0-250  Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung)
284
        unsigned char AchsKopplung2;          // Wert: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
278
        unsigned char AchsKopplung2;          // Wert: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
285
        unsigned char CouplingYawCorrection;  // Wert: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
279
        unsigned char CouplingYawCorrection;  // Wert: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
286
        unsigned char WinkelUmschlagNick;     // Wert: 0-250  180°-Punkt
280
        unsigned char WinkelUmschlagNick;     // Wert: 0-250  180°-Punkt
287
        unsigned char WinkelUmschlagRoll;     // Wert: 0-250  180°-Punkt
281
        unsigned char WinkelUmschlagRoll;     // Wert: 0-250  180°-Punkt
288
        unsigned char GyroAccAbgleich;        // 1/k  (Koppel_ACC_Wirkung)
282
        unsigned char GyroAccAbgleich;        // 1/k  (Koppel_ACC_Wirkung)
289
        unsigned char Driftkomp;
283
        unsigned char Driftkomp;
290
        unsigned char DynamicStability;
284
        unsigned char DynamicStability;
291
        unsigned char UserParam5;             // Wert : 0-250
285
        unsigned char UserParam5;             // Wert : 0-250
292
        unsigned char UserParam6;             // Wert : 0-250
286
        unsigned char UserParam6;             // Wert : 0-250
293
        unsigned char UserParam7;             // Wert : 0-250
287
        unsigned char UserParam7;             // Wert : 0-250
294
        unsigned char UserParam8;             // Wert : 0-250
288
        unsigned char UserParam8;             // Wert : 0-250
295
        //---Output ---------------------------------------------
289
        //---Output ---------------------------------------------
296
        unsigned char J16Bitmask;             // for the J16 Output
290
        unsigned char J16Bitmask;             // for the J16 Output
297
        unsigned char J16Timing;              // for the J16 Output
291
        unsigned char J16Timing;              // for the J16 Output
298
        unsigned char J17Bitmask;             // for the J17 Output
292
        unsigned char J17Bitmask;             // for the J17 Output
299
        unsigned char J17Timing;              // for the J17 Output
293
        unsigned char J17Timing;              // for the J17 Output
300
        // seit version V0.75c
294
        // seit version V0.75c
301
        unsigned char WARN_J16_Bitmask;       // for the J16 Output
295
        unsigned char WARN_J16_Bitmask;       // for the J16 Output
302
        unsigned char WARN_J17_Bitmask;       // for the J17 Output
296
        unsigned char WARN_J17_Bitmask;       // for the J17 Output
303
        //---NaviCtrl---------------------------------------------
297
        //---NaviCtrl---------------------------------------------
304
        unsigned char AutoPhotoDistance;      // Auto Photo
298
        unsigned char AutoPhotoDistance;      // Auto Photo
305
        unsigned char NaviGpsModeChannel;     // Parameters for the Naviboard
299
        unsigned char NaviGpsModeChannel;     // Parameters for the Naviboard
306
        unsigned char NaviGpsGain;
300
        unsigned char NaviGpsGain;
307
        unsigned char NaviGpsP;
301
        unsigned char NaviGpsP;
308
        unsigned char NaviGpsI;
302
        unsigned char NaviGpsI;
309
        unsigned char NaviGpsD;
303
        unsigned char NaviGpsD;
310
        unsigned char NaviGpsPLimit;
304
        unsigned char NaviGpsPLimit;
311
        unsigned char NaviGpsILimit;
305
        unsigned char NaviGpsILimit;
312
        unsigned char NaviGpsDLimit;
306
        unsigned char NaviGpsDLimit;
313
        unsigned char NaviGpsA;
307
        unsigned char NaviGpsA;
314
        unsigned char NaviGpsMinSat;
308
        unsigned char NaviGpsMinSat;
315
        unsigned char NaviStickThreshold;
309
        unsigned char NaviStickThreshold;
316
        unsigned char NaviWindCorrection;
310
        unsigned char NaviWindCorrection;
317
        unsigned char NaviAccCompensation;    // New since 0.86 -> was: SpeedCompensation
311
        unsigned char NaviAccCompensation;    // New since 0.86 -> was: SpeedCompensation
318
        unsigned char NaviMaxFlyingRange;     // in 10m
312
        unsigned char NaviMaxFlyingRange;     // in 10m
319
        unsigned char NaviAngleLimitation;
313
        unsigned char NaviAngleLimitation;
320
        unsigned char NaviPH_LoginTime;
314
        unsigned char NaviPH_LoginTime;
321
        unsigned char NaviDescendRange;
315
        unsigned char NaviDescendRange;
322
        //---Ext.Ctrl---------------------------------------------
316
        //---Ext.Ctrl---------------------------------------------
323
        unsigned char ExternalControl;         // for serial Control
317
        unsigned char ExternalControl;         // for serial Control
324
        //---CareFree---------------------------------------------
318
        //---CareFree---------------------------------------------
325
        unsigned char OrientationAngle;        // Where is the front-direction?
319
        unsigned char OrientationAngle;        // Where is the front-direction?
326
        unsigned char CareFreeChannel;     // switch for CareFree
320
        unsigned char CareFreeChannel;     // switch for CareFree
327
    unsigned char MotorSafetySwitch;
321
    unsigned char MotorSafetySwitch;
328
    unsigned char MotorSmooth;
322
    unsigned char MotorSmooth;
329
    unsigned char ComingHomeAltitude;
323
    unsigned char ComingHomeAltitude;
330
    unsigned char FailSafeTime;
324
    unsigned char FailSafeTime;
331
    unsigned char MaxAltitude;
325
    unsigned char MaxAltitude;
332
        unsigned char FailsafeChannel;         // if the value of this channel is > 100, the MK reports "RC-Lost"
326
        unsigned char FailsafeChannel;         // if the value of this channel is > 100, the MK reports "RC-Lost"
333
        unsigned char ServoFilterNick;  
327
        unsigned char ServoFilterNick;  
334
        unsigned char ServoFilterRoll;  
328
        unsigned char ServoFilterRoll;  
335
    unsigned char Servo3OnValue;
329
    unsigned char Servo3OnValue;
336
    unsigned char Servo3OffValue;
330
    unsigned char Servo3OffValue;
337
    unsigned char Servo4OnValue;
331
    unsigned char Servo4OnValue;
338
    unsigned char Servo4OffValue;
332
    unsigned char Servo4OffValue;
339
        unsigned char ServoFS_Pos[5];
333
        unsigned char ServoFS_Pos[5];
340
        unsigned char StartLandChannel;  
334
        unsigned char StartLandChannel;  
341
        unsigned char LandingSpeed;  
335
        unsigned char LandingSpeed;  
342
        unsigned char CompassOffset;        
336
        unsigned char CompassOffset;        
343
        unsigned char AutoLandingVoltage;    // in 0,1V  0 -> disabled
337
        unsigned char AutoLandingVoltage;   // in 0,1V  0 -> disabled
344
        unsigned char ComingHomeVoltage;    // in 0,1V  0 -> disabled
338
        unsigned char ComingHomeVoltage;    // in 0,1V  0 -> disabled
345
        unsigned char AutoPhotoAtitudes;
339
        unsigned char AutoPhotoAtitudes;
346
        unsigned char SingleWpSpeed;
340
        unsigned char SingleWpSpeed;
347
        unsigned char LandingPulse;
341
        unsigned char LandingPulse;
348
        unsigned char SingleWpControlChannel;
342
        unsigned char SingleWpControlChannel;
349
        unsigned char MenuKeyChannel;
343
        unsigned char MenuKeyChannel;
350
        //------------------------------------------------
344
        //------------------------------------------------
351
        unsigned char BitConfig;          // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
345
        unsigned char BitConfig;          // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
352
        unsigned char ServoCompInvert;    // //  0x01 = Nick, 0x02 = Roll, 0x04 = relative moving // WICHTIG!!! am Ende lassen
346
        unsigned char ServoCompInvert;    // //  0x01 = Nick, 0x02 = Roll, 0x04 = relative moving // WICHTIG!!! am Ende lassen
353
        unsigned char ExtraConfig;        // bitcodiert
347
        unsigned char ExtraConfig;        // bitcodiert
354
        unsigned char GlobalConfig3;      // bitcodiert
348
        unsigned char GlobalConfig3;      // bitcodiert
355
        char Name[12];
349
        char Name[12];
356
        unsigned char crc;                                // must be the last byte!
350
        unsigned char crc;                                // must be the last byte!
357
} __attribute__((packed)) paramset_t; // 150 bytes
351
} __attribute__((packed)) paramset_t; // 150 bytes
358
 
352
 
359
extern paramset_t EE_Parameter;
353
extern paramset_t EE_Parameter;
360
 
354
 
361
#endif //_SPI_SLAVE_H
355
#endif //_SPI_SLAVE_H
362
 
356