Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
886 | killagreg | 1 | #ifndef _EEPROM_H |
2 | #define _EEPROM_H |
||
3 | |||
4 | #include <inttypes.h> |
||
5 | |||
1180 | killagreg | 6 | #define EEPROM_ADR_PARAM_BEGIN 0 |
1222 | killagreg | 7 | #define PID_PARAM_REVISION 1 // byte |
886 | killagreg | 8 | #define PID_ACTIVE_SET 2 // byte |
9 | #define PID_PRESSURE_OFFSET 3 // byte |
||
936 | killagreg | 10 | #define PID_ACC_NICK 4 // word |
886 | killagreg | 11 | #define PID_ACC_ROLL 6 // word |
1180 | killagreg | 12 | #define PID_ACC_TOP 8 // word |
886 | killagreg | 13 | |
14 | #ifdef USE_KILLAGREG |
||
1222 | killagreg | 15 | #define PID_MM3_X_OFF 11 // byte |
16 | #define PID_MM3_Y_OFF 12 // byte |
||
17 | #define PID_MM3_Z_OFF 13 // byte |
||
18 | #define PID_MM3_X_RANGE 14 // word |
||
19 | #define PID_MM3_Y_RANGE 16 // word |
||
20 | #define PID_MM3_Z_RANGE 18 // word |
||
886 | killagreg | 21 | #endif |
22 | |||
1222 | killagreg | 23 | |
1180 | killagreg | 24 | #define EEPROM_ADR_CHANNELS 80 // 8 bytes |
886 | killagreg | 25 | |
1180 | killagreg | 26 | #define EEPROM_ADR_PARAMSET_LENGTH 98 // word |
27 | #define EEPROM_ADR_PARAMSET_BEGIN 100 |
||
28 | |||
1222 | killagreg | 29 | |
30 | #define EEPROM_ADR_MIXER_TABLE 1000 // 1000 - 1076 |
||
31 | |||
32 | |||
33 | |||
34 | #define MIX_GAS 0 |
||
35 | #define MIX_NICK 1 |
||
36 | #define MIX_ROLL 2 |
||
37 | #define MIX_YAW 3 |
||
38 | |||
39 | typedef struct |
||
40 | { |
||
41 | uint8_t Revision; |
||
42 | int8_t Name[12]; |
||
43 | int8_t Motor[16][4]; |
||
44 | } __attribute__((packed)) MixerTable_t; |
||
45 | |||
46 | extern MixerTable_t Mixer; |
||
47 | |||
48 | |||
1078 | killagreg | 49 | // bit mask for ParamSet.GlobalConfig |
886 | killagreg | 50 | #define CFG_HEIGHT_CONTROL 0x01 |
51 | #define CFG_HEIGHT_SWITCH 0x02 |
||
52 | #define CFG_HEADING_HOLD 0x04 |
||
53 | #define CFG_COMPASS_ACTIVE 0x08 |
||
54 | #define CFG_COMPASS_FIX 0x10 |
||
55 | #define CFG_GPS_ACTIVE 0x20 |
||
56 | #define CFG_AXIS_COUPLING_ACTIVE 0x40 |
||
57 | #define CFG_ROTARY_RATE_LIMITER 0x80 |
||
58 | |||
1078 | killagreg | 59 | // bit mask for ParamSet.BitConfig |
886 | killagreg | 60 | #define CFG_LOOP_UP 0x01 |
61 | #define CFG_LOOP_DOWN 0x02 |
||
62 | #define CFG_LOOP_LEFT 0x04 |
||
63 | #define CFG_LOOP_RIGHT 0x08 |
||
1078 | killagreg | 64 | #define CFG_HEIGHT_3SWITCH 0x10 |
886 | killagreg | 65 | |
1078 | killagreg | 66 | // defines for lookup ParamSet.ChannelAssignment |
936 | killagreg | 67 | #define CH_NICK 0 |
886 | killagreg | 68 | #define CH_ROLL 1 |
936 | killagreg | 69 | #define CH_GAS 2 |
886 | killagreg | 70 | #define CH_YAW 3 |
71 | #define CH_POTI1 4 |
||
72 | #define CH_POTI2 5 |
||
73 | #define CH_POTI3 6 |
||
74 | #define CH_POTI4 7 |
||
75 | |||
1222 | killagreg | 76 | #define EEPARAM_REVISION 75 // is count up, if paramater stucture has changed (compatibility) |
77 | #define EEMIXER_REVISION 1 // is count up, if Mixer stucture has changed (compatibility) |
||
886 | killagreg | 78 | |
79 | // values above 250 representing poti1 to poti4 |
||
80 | typedef struct |
||
1180 | killagreg | 81 | { |
82 | uint8_t ChannelAssignment[8]; // see upper defines for details |
||
83 | uint8_t GlobalConfig; // see upper defines for bitcoding |
||
84 | uint8_t HeightMinGas; // Wert : 0-100 |
||
85 | uint8_t HeightD; // Wert : 0-250 |
||
86 | uint8_t MaxHeight; // Wert : 0-32 |
||
87 | uint8_t HeightP; // Wert : 0-32 |
||
88 | uint8_t Height_Gain; // Wert : 0-50 |
||
89 | uint8_t Height_ACC_Effect; // Wert : 0-250 |
||
90 | uint8_t StickP; // Wert : 1-6 |
||
91 | uint8_t StickD; // Wert : 0-64 |
||
92 | uint8_t StickYawP; // Wert : 1-20 |
||
93 | uint8_t GasMin; // Wert : 0-32 |
||
94 | uint8_t GasMax; // Wert : 33-250 |
||
95 | uint8_t GyroAccFactor; // Wert : 1-64 |
||
96 | uint8_t CompassYawEffect; // Wert : 0-32 |
||
97 | uint8_t GyroP; // Wert : 10-250 |
||
98 | uint8_t GyroI; // Wert : 0-250 |
||
99 | uint8_t GyroD; // Wert : 0-250 |
||
100 | uint8_t LowVoltageWarning; // Wert : 0-250 |
||
101 | uint8_t EmergencyGas; // Wert : 0-250 //Gaswert bei Empängsverlust |
||
102 | uint8_t EmergencyGasDuration; // Wert : 0-250 // Zeitbis auf EmergencyGas geschaltet wird, wg. Rx-Problemen |
||
103 | uint8_t UfoArrangement; // x oder + Formation |
||
104 | uint8_t IFactor; // Wert : 0-250 |
||
105 | uint8_t UserParam1; // Wert : 0-250 |
||
106 | uint8_t UserParam2; // Wert : 0-250 |
||
107 | uint8_t UserParam3; // Wert : 0-250 |
||
108 | uint8_t UserParam4; // Wert : 0-250 |
||
109 | uint8_t ServoNickControl; // Wert : 0-250 // Stellung des Servos |
||
110 | uint8_t ServoNickComp; // Wert : 0-250 // Einfluss Gyro/Servo |
||
111 | uint8_t ServoNickMin; // Wert : 0-250 // Anschlag |
||
112 | uint8_t ServoNickMax; // Wert : 0-250 // Anschlag |
||
113 | uint8_t ServoRefresh; // Wert: 0-250 // Refreshrate of servo pwm output |
||
114 | uint8_t LoopGasLimit; // Wert: 0-250 max. Gas während Looping |
||
115 | uint8_t LoopThreshold; // Wert: 0-250 Schwelle für Stickausschlag |
||
116 | uint8_t LoopHysteresis; // Wert: 0-250 Hysterese für Stickausschlag |
||
117 | uint8_t AxisCoupling1; // Wert: 0-250 Faktor, mit dem Yaw die Achsen Roll und Nick koppelt (NickRollMitkopplung) |
||
118 | uint8_t AxisCoupling2; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
||
119 | uint8_t AxisCouplingYawCorrection;// Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
||
120 | uint8_t AngleTurnOverNick; // Wert: 0-250 180°-Punkt |
||
121 | uint8_t AngleTurnOverRoll; // Wert: 0-250 180°-Punkt |
||
122 | uint8_t GyroAccTrim; // 1/k (Koppel_ACC_Wirkung) |
||
123 | uint8_t DriftComp; // limit for gyrodrift compensation |
||
124 | uint8_t DynamicStability; // PID limit for Attitude controller |
||
125 | uint8_t UserParam5; // Wert : 0-250 |
||
126 | uint8_t UserParam6; // Wert : 0-250 |
||
127 | uint8_t UserParam7; // Wert : 0-250 |
||
128 | uint8_t UserParam8; // Wert : 0-250 |
||
129 | uint8_t J16Bitmask; // for the J16 Output |
||
130 | uint8_t J16Timing; // for the J16 Output |
||
131 | uint8_t J17Bitmask; // for the J17 Output |
||
132 | uint8_t J17Timing; // for the J17 Output |
||
133 | uint8_t NaviGpsModeControl; // Parameters for the Naviboard |
||
134 | uint8_t NaviGpsGain; // overall gain for GPS-PID controller |
||
135 | uint8_t NaviGpsP; // P gain for GPS-PID controller |
||
136 | uint8_t NaviGpsI; // I gain for GPS-PID controller |
||
137 | uint8_t NaviGpsD; // D gain for GPS-PID controller |
||
138 | uint8_t NaviGpsPLimit; // P limit for GPS-PID controller |
||
139 | uint8_t NaviGpsILimit; // I limit for GPS-PID controller |
||
140 | uint8_t NaviGpsDLimit; // D limit for GPS-PID controller |
||
141 | uint8_t NaviGpsACC; // ACC gain for GPS-PID controller |
||
142 | uint8_t NaviGpsMinSat; // number of sattelites neccesary for GPS functions |
||
143 | uint8_t NaviStickThreshold; // activation threshild for detection of manual stick movements |
||
144 | uint8_t NaviWindCorrection; // streng of wind course correction |
||
145 | uint8_t NaviSpeedCompensation; // D gain fefore position hold login |
||
146 | uint8_t NaviOperatingRadius; // Radius limit in m around start position for GPS flights |
||
147 | uint8_t NaviAngleLimitation; // limitation of attitude angle controlled by the gps algorithm |
||
148 | uint8_t NaviPHLoginTime; // position hold logintimeout |
||
149 | uint8_t ExternalControl; // for serial Control |
||
150 | uint8_t BitConfig; // see upper defines for bitcoding |
||
151 | uint8_t ServoNickCompInvert; // Wert : 0-250 0 oder 1 // WICHTIG!!! am Ende lassen |
||
152 | uint8_t Reserved[4]; |
||
153 | int8_t Name[12]; |
||
886 | killagreg | 154 | } paramset_t; |
155 | |||
156 | #define PARAMSET_STRUCT_LEN sizeof(paramset_t) |
||
157 | |||
158 | extern paramset_t ParamSet; |
||
159 | |||
160 | extern void ParamSet_Init(void); |
||
161 | extern void ParamSet_ReadFromEEProm(uint8_t setnumber); |
||
162 | extern void ParamSet_WriteToEEProm(uint8_t setnumber); |
||
163 | extern uint8_t GetActiveParamSet(void); |
||
164 | extern void SetActiveParamSet(uint8_t setnumber); |
||
165 | |||
1222 | killagreg | 166 | extern uint8_t MixerTable_ReadFromEEProm(void); |
167 | extern uint8_t MixerTable_WriteToEEProm(void); |
||
886 | killagreg | 168 | |
169 | |||
1222 | killagreg | 170 | extern uint8_t GetParamByte(uint16_t param_id); |
171 | extern void SetParamByte(uint16_t param_id, uint8_t value); |
||
172 | extern uint16_t GetParamWord(uint16_t param_id); |
||
173 | extern void SetParamWord(uint16_t param_id, uint16_t value); |
||
174 | |||
175 | |||
886 | killagreg | 176 | #endif //_EEPROM_H |