Subversion Repositories FlightCtrl

Rev

Rev 2337 | Rev 2341 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2337 Rev 2340
1
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2
// + www.MikroKopter.com
2
// + www.MikroKopter.com
3
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
// + Software Nutzungsbedingungen (english version: see below)
4
// + Software Nutzungsbedingungen (english version: see below)
5
// + der Fa. HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland - nachfolgend Lizenzgeber genannt -
5
// + der Fa. HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland - nachfolgend Lizenzgeber genannt -
6
// + Der Lizenzgeber räumt dem Kunden ein nicht-ausschließliches, zeitlich und räumlich* unbeschränktes Recht ein, die im den
6
// + Der Lizenzgeber räumt dem Kunden ein nicht-ausschließliches, zeitlich und räumlich* unbeschränktes Recht ein, die im den
7
// + Mikrocontroller verwendete Firmware für die Hardware Flight-Ctrl, Navi-Ctrl, BL-Ctrl, MK3Mag & PC-Programm MikroKopter-Tool 
7
// + Mikrocontroller verwendete Firmware für die Hardware Flight-Ctrl, Navi-Ctrl, BL-Ctrl, MK3Mag & PC-Programm MikroKopter-Tool 
8
// + - nachfolgend Software genannt - nur für private Zwecke zu nutzen.
8
// + - nachfolgend Software genannt - nur für private Zwecke zu nutzen.
9
// + Der Einsatz dieser Software ist nur auf oder mit Produkten des Lizenzgebers zulässig.
9
// + Der Einsatz dieser Software ist nur auf oder mit Produkten des Lizenzgebers zulässig.
10
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11
// + Die vom Lizenzgeber gelieferte Software ist urheberrechtlich geschützt. Alle Rechte an der Software sowie an sonstigen im
11
// + Die vom Lizenzgeber gelieferte Software ist urheberrechtlich geschützt. Alle Rechte an der Software sowie an sonstigen im
12
// + Rahmen der Vertragsanbahnung und Vertragsdurchführung überlassenen Unterlagen stehen im Verhältnis der Vertragspartner ausschließlich dem Lizenzgeber zu.
12
// + Rahmen der Vertragsanbahnung und Vertragsdurchführung überlassenen Unterlagen stehen im Verhältnis der Vertragspartner ausschließlich dem Lizenzgeber zu.
13
// + Die in der Software enthaltenen Copyright-Vermerke, Markenzeichen, andere Rechtsvorbehalte, Seriennummern sowie
13
// + Die in der Software enthaltenen Copyright-Vermerke, Markenzeichen, andere Rechtsvorbehalte, Seriennummern sowie
14
// + sonstige der Programmidentifikation dienenden Merkmale dürfen vom Kunden nicht verändert oder unkenntlich gemacht werden.
14
// + sonstige der Programmidentifikation dienenden Merkmale dürfen vom Kunden nicht verändert oder unkenntlich gemacht werden.
15
// + Der Kunde trifft angemessene Vorkehrungen für den sicheren Einsatz der Software. Er wird die Software gründlich auf deren
15
// + Der Kunde trifft angemessene Vorkehrungen für den sicheren Einsatz der Software. Er wird die Software gründlich auf deren
16
// + Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt.
16
// + Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt.
17
// + Die Haftung des Lizenzgebers wird - soweit gesetzlich zulässig - begrenzt in Höhe des typischen und vorhersehbaren
17
// + Die Haftung des Lizenzgebers wird - soweit gesetzlich zulässig - begrenzt in Höhe des typischen und vorhersehbaren
18
// + Schadens. Die gesetzliche Haftung bei Personenschäden und nach dem Produkthaftungsgesetz bleibt unberührt. Dem Lizenzgeber steht jedoch der Einwand 
18
// + Schadens. Die gesetzliche Haftung bei Personenschäden und nach dem Produkthaftungsgesetz bleibt unberührt. Dem Lizenzgeber steht jedoch der Einwand 
19
// + des Mitverschuldens offen.
19
// + des Mitverschuldens offen.
20
// + Der Kunde trifft angemessene Vorkehrungen für den Fall, dass die Software ganz oder teilweise nicht ordnungsgemäß arbeitet.
20
// + Der Kunde trifft angemessene Vorkehrungen für den Fall, dass die Software ganz oder teilweise nicht ordnungsgemäß arbeitet.
21
// + Er wird die Software gründlich auf deren Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt.
21
// + Er wird die Software gründlich auf deren Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt.
22
// + Der Kunde wird er seine Daten vor Einsatz der Software nach dem Stand der Technik sichern.
22
// + Der Kunde wird er seine Daten vor Einsatz der Software nach dem Stand der Technik sichern.
23
// + Der Kunde ist darüber unterrichtet, dass der Lizenzgeber seine Daten im zur Vertragsdurchführung erforderlichen Umfang
23
// + Der Kunde ist darüber unterrichtet, dass der Lizenzgeber seine Daten im zur Vertragsdurchführung erforderlichen Umfang
24
// + und auf Grundlage der Datenschutzvorschriften erhebt, speichert, verarbeitet und, sofern notwendig, an Dritte übermittelt.
24
// + und auf Grundlage der Datenschutzvorschriften erhebt, speichert, verarbeitet und, sofern notwendig, an Dritte übermittelt.
25
// + *) Die räumliche Nutzung bezieht sich nur auf den Einsatzort, nicht auf die Reichweite der programmierten Software.
25
// + *) Die räumliche Nutzung bezieht sich nur auf den Einsatzort, nicht auf die Reichweite der programmierten Software.
26
// + #### ENDE DER NUTZUNGSBEDINGUNGEN ####'
26
// + #### ENDE DER NUTZUNGSBEDINGUNGEN ####'
27
// +  Hinweis: Informationen über erweiterte Nutzungsrechte (wie z.B. Nutzung für nicht-private Zwecke) sind auf Anfrage per Email an info(@)hisystems.de verfügbar.
27
// +  Hinweis: Informationen über erweiterte Nutzungsrechte (wie z.B. Nutzung für nicht-private Zwecke) sind auf Anfrage per Email an info(@)hisystems.de verfügbar.
28
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
28
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
29
// + Software LICENSING TERMS
29
// + Software LICENSING TERMS
30
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
30
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31
// + of HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland, Germany - the Licensor -
31
// + of HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland, Germany - the Licensor -
32
// + The Licensor grants the customer a non-exclusive license to use the microcontroller firmware of the Flight-Ctrl, Navi-Ctrl, BL-Ctrl, and MK3Mag hardware 
32
// + The Licensor grants the customer a non-exclusive license to use the microcontroller firmware of the Flight-Ctrl, Navi-Ctrl, BL-Ctrl, and MK3Mag hardware 
33
// + (the Software) exclusively for private purposes. The License is unrestricted with respect to time and territory*.
33
// + (the Software) exclusively for private purposes. The License is unrestricted with respect to time and territory*.
34
// + The Software may only be used with the Licensor's products.
34
// + The Software may only be used with the Licensor's products.
35
// + The Software provided by the Licensor is protected by copyright. With respect to the relationship between the parties to this
35
// + The Software provided by the Licensor is protected by copyright. With respect to the relationship between the parties to this
36
// + agreement, all rights pertaining to the Software and other documents provided during the preparation and execution of this
36
// + agreement, all rights pertaining to the Software and other documents provided during the preparation and execution of this
37
// + agreement shall be the property of the Licensor.
37
// + agreement shall be the property of the Licensor.
38
// + The information contained in the Software copyright notices, trademarks, other legal reservations, serial numbers and other
38
// + The information contained in the Software copyright notices, trademarks, other legal reservations, serial numbers and other
39
// + features that can be used to identify the program may not be altered or defaced by the customer.
39
// + features that can be used to identify the program may not be altered or defaced by the customer.
40
// + The customer shall be responsible for taking reasonable precautions
40
// + The customer shall be responsible for taking reasonable precautions
41
// + for the safe use of the Software. The customer shall test the Software thoroughly regarding its suitability for the
41
// + for the safe use of the Software. The customer shall test the Software thoroughly regarding its suitability for the
42
// + intended purpose before implementing it for actual operation. The Licensor's liability shall be limited to the extent of typical and
42
// + intended purpose before implementing it for actual operation. The Licensor's liability shall be limited to the extent of typical and
43
// + foreseeable damage to the extent permitted by law, notwithstanding statutory liability for bodily injury and product
43
// + foreseeable damage to the extent permitted by law, notwithstanding statutory liability for bodily injury and product
44
// + liability. However, the Licensor shall be entitled to the defense of contributory negligence.
44
// + liability. However, the Licensor shall be entitled to the defense of contributory negligence.
45
// + The customer will take adequate precautions in the case, that the software is not working properly. The customer will test
45
// + The customer will take adequate precautions in the case, that the software is not working properly. The customer will test
46
// + the software for his purpose before any operational usage. The customer will backup his data before using the software.
46
// + the software for his purpose before any operational usage. The customer will backup his data before using the software.
47
// + The customer understands that the Licensor collects, stores and processes, and, where required, forwards, customer data
47
// + The customer understands that the Licensor collects, stores and processes, and, where required, forwards, customer data
48
// + to third parties to the extent necessary for executing the agreement, subject to applicable data protection and privacy regulations.
48
// + to third parties to the extent necessary for executing the agreement, subject to applicable data protection and privacy regulations.
49
// + *) The territory aspect only refers to the place where the Software is used, not its programmed range.
49
// + *) The territory aspect only refers to the place where the Software is used, not its programmed range.
50
// + #### END OF LICENSING TERMS ####
50
// + #### END OF LICENSING TERMS ####
51
// + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de.
51
// + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de.
52
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
52
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
53
 
53
 
54
 
54
 
55
#ifndef EEMEM
55
#ifndef EEMEM
56
#define EEMEM __attribute__ ((section (".eeprom")))
56
#define EEMEM __attribute__ ((section (".eeprom")))
57
#endif
57
#endif
58
 
58
 
59
 
59
 
60
#include <avr/eeprom.h>
60
#include <avr/eeprom.h>
61
#include <string.h>
61
#include <string.h>
62
#include "eeprom.h"
62
#include "eeprom.h"
63
#include "uart.h"
63
#include "uart.h"
64
#include "led.h"
64
#include "led.h"
65
#include "main.h"
65
#include "main.h"
66
#include "fc.h"
66
#include "fc.h"
67
#include "twimaster.h"
67
#include "twimaster.h"
68
 
68
 
69
paramset_t              EE_Parameter;
69
paramset_t              EE_Parameter;
70
MixerTable_t    Mixer;
70
MixerTable_t    Mixer;
71
uint8_t RequiredMotors;
71
uint8_t RequiredMotors;
72
 
72
 
73
 
73
 
74
uint8_t RAM_Checksum(uint8_t* pBuffer, uint16_t len)
74
uint8_t RAM_Checksum(uint8_t* pBuffer, uint16_t len)
75
{
75
{
76
        uint8_t crc = 0xAA;
76
        uint8_t crc = 0xAA;
77
        uint16_t i;
77
        uint16_t i;
78
 
78
 
79
        for(i=0; i<len; i++)
79
        for(i=0; i<len; i++)
80
        {
80
        {
81
                crc += pBuffer[i];
81
                crc += pBuffer[i];
82
        }
82
        }
83
        return crc;
83
        return crc;
84
}
84
}
85
 
85
 
86
uint8_t EEProm_Checksum(uint16_t EEAddr, uint16_t len)
86
uint8_t EEProm_Checksum(uint16_t EEAddr, uint16_t len)
87
{
87
{
88
        uint8_t crc = 0xAA;
88
        uint8_t crc = 0xAA;
89
        uint16_t off;
89
        uint16_t off;
90
 
90
 
91
        for(off=0; off<len; off++)
91
        for(off=0; off<len; off++)
92
        {
92
        {
93
                crc += eeprom_read_byte((uint8_t*)(EEAddr + off));;
93
                crc += eeprom_read_byte((uint8_t*)(EEAddr + off));;
94
        }
94
        }
95
        return crc;
95
        return crc;
96
}
96
}
97
 
97
 
98
void ParamSet_DefaultStickMapping(void)
98
void ParamSet_DefaultStickMapping(void)
99
{
99
{
100
        EE_Parameter.Kanalbelegung[K_GAS]   = 1;
100
        EE_Parameter.Kanalbelegung[K_GAS]   = 1;
101
        EE_Parameter.Kanalbelegung[K_ROLL]  = 2;
101
        EE_Parameter.Kanalbelegung[K_ROLL]  = 2;
102
        EE_Parameter.Kanalbelegung[K_NICK]  = 3;
102
        EE_Parameter.Kanalbelegung[K_NICK]  = 3;
103
        EE_Parameter.Kanalbelegung[K_GIER]  = 4;
103
        EE_Parameter.Kanalbelegung[K_GIER]  = 4;
104
        EE_Parameter.Kanalbelegung[K_POTI1] = 5;
104
        EE_Parameter.Kanalbelegung[K_POTI1] = 5;
105
        EE_Parameter.Kanalbelegung[K_POTI2] = 6;
105
        EE_Parameter.Kanalbelegung[K_POTI2] = 6;
106
        EE_Parameter.Kanalbelegung[K_POTI3] = 7;
106
        EE_Parameter.Kanalbelegung[K_POTI3] = 7;
107
        EE_Parameter.Kanalbelegung[K_POTI4] = 8;
107
        EE_Parameter.Kanalbelegung[K_POTI4] = 8;
108
        EE_Parameter.Kanalbelegung[K_POTI5] = 9;
108
        EE_Parameter.Kanalbelegung[K_POTI5] = 9;
109
        EE_Parameter.Kanalbelegung[K_POTI6] = 10;
109
        EE_Parameter.Kanalbelegung[K_POTI6] = 10;
110
        EE_Parameter.Kanalbelegung[K_POTI7] = 11;
110
        EE_Parameter.Kanalbelegung[K_POTI7] = 11;
111
        EE_Parameter.Kanalbelegung[K_POTI8] = 12;
111
        EE_Parameter.Kanalbelegung[K_POTI8] = 12;
112
}
112
}
113
 
113
 
114
 
114
 
115
/***************************************************/
115
/***************************************************/
116
/*    Default Values for parameter set 1           */
116
/*    Default Values for parameter set 1           */
117
/***************************************************/
117
/***************************************************/
118
void CommonDefaults(void)
118
void CommonDefaults(void)
119
{
119
{
120
        EE_Parameter.Revision = EEPARAM_REVISION;
120
        EE_Parameter.Revision = EEPARAM_REVISION;
121
        memset(EE_Parameter.Name,0,12); // delete name
121
        memset(EE_Parameter.Name,0,12); // delete name
122
        if(PlatinenVersion >= 20)
122
        if(PlatinenVersion >= 20)
123
        {
123
        {
124
                EE_Parameter.Gyro_D = 10;
124
                EE_Parameter.Gyro_D = 10;
125
                EE_Parameter.Driftkomp = 0;
125
                EE_Parameter.Driftkomp = 0;
126
                EE_Parameter.GyroAccFaktor = 27;
126
                EE_Parameter.GyroAccFaktor = 27;
127
                EE_Parameter.WinkelUmschlagNick = 78;
127
                EE_Parameter.WinkelUmschlagNick = 78;
128
                EE_Parameter.WinkelUmschlagRoll = 78;
128
                EE_Parameter.WinkelUmschlagRoll = 78;
129
        }
129
        }
130
        else
130
        else
131
        {
131
        {
132
                EE_Parameter.Gyro_D = 3;
132
                EE_Parameter.Gyro_D = 3;
133
                EE_Parameter.Driftkomp = 32;
133
                EE_Parameter.Driftkomp = 32;
134
                EE_Parameter.GyroAccFaktor = 30;
134
                EE_Parameter.GyroAccFaktor = 30;
135
                EE_Parameter.WinkelUmschlagNick = 85;
135
                EE_Parameter.WinkelUmschlagNick = 85;
136
                EE_Parameter.WinkelUmschlagRoll = 85;
136
                EE_Parameter.WinkelUmschlagRoll = 85;
137
        }
137
        }
138
        EE_Parameter.GyroAccAbgleich = 32;        // 1/k
138
        EE_Parameter.GyroAccAbgleich = 32;        // 1/k
139
        EE_Parameter.BitConfig = 0;              // Looping usw.
139
        EE_Parameter.BitConfig = 0;              // Looping usw.
140
        EE_Parameter.GlobalConfig = CFG_ACHSENKOPPLUNG_AKTIV | CFG_KOMPASS_AKTIV | CFG_GPS_AKTIV | CFG_HOEHEN_SCHALTER;
140
        EE_Parameter.GlobalConfig = CFG_ACHSENKOPPLUNG_AKTIV | CFG_KOMPASS_AKTIV | CFG_GPS_AKTIV | CFG_HOEHEN_SCHALTER;
141
        EE_Parameter.ExtraConfig = CFG_GPS_AID | CFG2_VARIO_BEEP;
141
        EE_Parameter.ExtraConfig = CFG_GPS_AID | CFG2_VARIO_BEEP;
142
        EE_Parameter.GlobalConfig3 = CFG3_SPEAK_ALL;//CFG3_VARIO_FAILSAFE; 
142
        EE_Parameter.GlobalConfig3 = CFG3_SPEAK_ALL;//CFG3_VARIO_FAILSAFE; 
143
        EE_Parameter.Receiver = RECEIVER_HOTT;
143
        EE_Parameter.Receiver = RECEIVER_HOTT;
144
        EE_Parameter.MotorSafetySwitch = 0;
144
        EE_Parameter.MotorSafetySwitch = 0;
145
        EE_Parameter.ExternalControl = 0;
145
        EE_Parameter.ExternalControl = 0;
146
 
146
 
147
        EE_Parameter.Gas_Min = 8;             // Wert : 0-32
147
        EE_Parameter.Gas_Min = 8;             // Wert : 0-32
148
        EE_Parameter.Gas_Max = 230;           // Wert : 33-247
148
        EE_Parameter.Gas_Max = 230;           // Wert : 33-247
149
        EE_Parameter.KompassWirkung = 64;    // Wert : 0-247
149
        EE_Parameter.KompassWirkung = 64;    // Wert : 0-247
150
 
150
 
151
        EE_Parameter.Hoehe_MinGas = 30;
151
        EE_Parameter.Hoehe_MinGas = 30;
152
        EE_Parameter.MaxHoehe     = 255;         // Wert : 0-247   255 -> Poti1
152
        EE_Parameter.MaxHoehe     = 255;         // Wert : 0-247   255 -> Poti1
153
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
153
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
154
        if(ACC_AltitudeControl)
154
        if(ACC_AltitudeControl)
155
        {
155
        {
156
                EE_Parameter.Hoehe_P      = 20;          // Wert : 0-32
156
                EE_Parameter.Hoehe_P      = 20;          // Wert : 0-32
157
                EE_Parameter.Luftdruck_D  = 40;          // Wert : 0-247
157
                EE_Parameter.Luftdruck_D  = 40;          // Wert : 0-247
158
                EE_Parameter.Hoehe_ACC_Wirkung = 30;     // Wert : 0-247
158
                EE_Parameter.Hoehe_ACC_Wirkung = 30;     // Wert : 0-247
159
                EE_Parameter.Hoehe_HoverBand = 1;         // Wert : 0-247
159
                EE_Parameter.Hoehe_HoverBand = 1;         // Wert : 0-247
160
                EE_Parameter.Hoehe_GPS_Z = 0;           // Wert : 0-247
160
                EE_Parameter.Hoehe_GPS_Z = 0;           // Wert : 0-247
161
                EE_Parameter.Hoehe_StickNeutralPoint = 127;// Wert : 0-247 (0 = Hover-Estimation)
161
                EE_Parameter.Hoehe_StickNeutralPoint = 127;// Wert : 0-247 (0 = Hover-Estimation)
162
        }
162
        }
163
        else
163
        else
164
#endif
164
#endif
165
        {
165
        {
166
                EE_Parameter.Hoehe_P      = 15;          // Wert : 0-32
166
                EE_Parameter.Hoehe_P      = 15;          // Wert : 0-32
167
                EE_Parameter.Luftdruck_D  = 30;          // Wert : 0-247
167
                EE_Parameter.Luftdruck_D  = 30;          // Wert : 0-247
168
                EE_Parameter.Hoehe_ACC_Wirkung = 0;     // Wert : 0-247
168
                EE_Parameter.Hoehe_ACC_Wirkung = 0;     // Wert : 0-247
169
                EE_Parameter.Hoehe_HoverBand = 8;         // Wert : 0-247
169
                EE_Parameter.Hoehe_HoverBand = 8;         // Wert : 0-247
170
                EE_Parameter.Hoehe_GPS_Z = 20;           // Wert : 0-247
170
                EE_Parameter.Hoehe_GPS_Z = 20;           // Wert : 0-247
171
                EE_Parameter.Hoehe_StickNeutralPoint = 0;// Wert : 0-247 (0 = Hover-Estimation)
171
                EE_Parameter.Hoehe_StickNeutralPoint = 0;// Wert : 0-247 (0 = Hover-Estimation)
172
        }
172
        }
173
       
173
       
174
        EE_Parameter.Hoehe_Verstaerkung = 15;    // Wert : 0-50 (15 -> ca. +/- 5m/sek bei Stick-Voll-Ausschlag)
174
        EE_Parameter.Hoehe_Verstaerkung = 15;    // Wert : 0-50 (15 -> ca. +/- 5m/sek bei Stick-Voll-Ausschlag)
-
 
175
        EE_Parameter.StartLandChannel = 0;  
-
 
176
        EE_Parameter.LandingSpeed = 12;  
175
 
177
 
176
        EE_Parameter.UserParam1 =   0;           // zur freien Verwendung
178
        EE_Parameter.UserParam1 =   0;           // zur freien Verwendung
177
        EE_Parameter.UserParam2 =   0;           // zur freien Verwendung
179
        EE_Parameter.UserParam2 =   0;           // zur freien Verwendung
178
        EE_Parameter.UserParam3 =   0;           // zur freien Verwendung
180
        EE_Parameter.UserParam3 =   0;           // zur freien Verwendung
179
        EE_Parameter.UserParam4 =   0;           // zur freien Verwendung
181
        EE_Parameter.UserParam4 =   0;           // zur freien Verwendung
180
        EE_Parameter.UserParam5 =   0;           // zur freien Verwendung
182
        EE_Parameter.UserParam5 =   0;           // zur freien Verwendung
181
        EE_Parameter.UserParam6 =   0;           // zur freien Verwendung
183
        EE_Parameter.UserParam6 =   0;           // zur freien Verwendung
182
        EE_Parameter.UserParam7 = 0;             // zur freien Verwendung
184
        EE_Parameter.UserParam7 = 0;             // zur freien Verwendung
183
        EE_Parameter.UserParam8 = 0;             // zur freien Verwendung
185
        EE_Parameter.UserParam8 = 0;             // zur freien Verwendung
184
 
186
 
185
        EE_Parameter.ServoNickControl = 128;     // Wert : 0-247     // Stellung des Servos
187
        EE_Parameter.ServoNickControl = 128;     // Wert : 0-247     // Stellung des Servos
186
        EE_Parameter.ServoNickComp = 50;         // Wert : 0-247     // Einfluss Gyro/Servo
188
        EE_Parameter.ServoNickComp = 50;         // Wert : 0-247     // Einfluss Gyro/Servo
187
        EE_Parameter.ServoCompInvert = 2;        // Wert : 0-247     // Richtung Einfluss Gyro/Servo
189
        EE_Parameter.ServoCompInvert = 2;        // Wert : 0-247     // Richtung Einfluss Gyro/Servo
188
        EE_Parameter.ServoNickMin = 15;          // Wert : 0-247     // Anschlag
190
        EE_Parameter.ServoNickMin = 15;          // Wert : 0-247     // Anschlag
189
        EE_Parameter.ServoNickMax = 230;         // Wert : 0-247     // Anschlag
191
        EE_Parameter.ServoNickMax = 230;         // Wert : 0-247     // Anschlag
190
        EE_Parameter.ServoNickRefresh = 4;
192
        EE_Parameter.ServoNickRefresh = 4;
191
        EE_Parameter.Servo3 = 125;
193
        EE_Parameter.Servo3 = 125;
192
        EE_Parameter.Servo4 = 125;
194
        EE_Parameter.Servo4 = 125;
193
        EE_Parameter.Servo5 = 125;
195
        EE_Parameter.Servo5 = 125;
194
        EE_Parameter.ServoRollControl = 128;     // Wert : 0-247     // Stellung des Servos
196
        EE_Parameter.ServoRollControl = 128;     // Wert : 0-247     // Stellung des Servos
195
        EE_Parameter.ServoRollComp = 85;         // Wert : 0-247     // Einfluss Gyro/Servo
197
        EE_Parameter.ServoRollComp = 85;         // Wert : 0-247     // Einfluss Gyro/Servo
196
        EE_Parameter.ServoRollMin = 70;          // Wert : 0-247     // Anschlag
198
        EE_Parameter.ServoRollMin = 70;          // Wert : 0-247     // Anschlag
197
        EE_Parameter.ServoRollMax = 220;         // Wert : 0-247     // Anschlag
199
        EE_Parameter.ServoRollMax = 220;         // Wert : 0-247     // Anschlag
198
        EE_Parameter.ServoManualControlSpeed = 60;
200
        EE_Parameter.ServoManualControlSpeed = 60;
199
        EE_Parameter.CamOrientation = 0;         // Wert : 0-24 -> 0-360 -> 15° steps
201
        EE_Parameter.CamOrientation = 0;         // Wert : 0-24 -> 0-360 -> 15° steps
200
 
202
 
201
        EE_Parameter.J16Bitmask = 95;
203
        EE_Parameter.J16Bitmask = 95;
202
        EE_Parameter.J17Bitmask = 243;
204
        EE_Parameter.J17Bitmask = 243;
203
        EE_Parameter.WARN_J16_Bitmask = 0xAA;
205
        EE_Parameter.WARN_J16_Bitmask = 0xAA;
204
        EE_Parameter.WARN_J17_Bitmask = 0xAA;
206
        EE_Parameter.WARN_J17_Bitmask = 0xAA;
205
        EE_Parameter.J16Timing = 40;
207
        EE_Parameter.J16Timing = 40;
206
        EE_Parameter.J17Timing = 40;
208
        EE_Parameter.J17Timing = 40;
207
    EE_Parameter.NaviOut1Parameter = 0;       // Photo release in meter
209
    EE_Parameter.NaviOut1Parameter = 0;       // Photo release in meter
208
        EE_Parameter.LoopGasLimit = 50;
210
        EE_Parameter.LoopGasLimit = 50;
209
        EE_Parameter.LoopThreshold = 90;         // Wert: 0-247  Schwelle für Stickausschlag
211
        EE_Parameter.LoopThreshold = 90;         // Wert: 0-247  Schwelle für Stickausschlag
210
        EE_Parameter.LoopHysterese = 50;
212
        EE_Parameter.LoopHysterese = 50;
211
 
213
 
212
        EE_Parameter.NaviGpsModeControl = 254; // 254 -> Poti 2
214
        EE_Parameter.NaviGpsModeControl = 254; // 254 -> Poti 2
213
        EE_Parameter.NaviGpsGain = 100;
215
        EE_Parameter.NaviGpsGain = 100;
214
        EE_Parameter.NaviGpsP = 90;
216
        EE_Parameter.NaviGpsP = 90;
215
        EE_Parameter.NaviGpsI = 90;
217
        EE_Parameter.NaviGpsI = 90;
216
        EE_Parameter.NaviGpsD = 90;
218
        EE_Parameter.NaviGpsD = 90;
217
        EE_Parameter.NaviGpsPLimit = 75;
219
        EE_Parameter.NaviGpsPLimit = 75;
218
        EE_Parameter.NaviGpsILimit = 85;
220
        EE_Parameter.NaviGpsILimit = 85;
219
        EE_Parameter.NaviGpsDLimit = 75;
221
        EE_Parameter.NaviGpsDLimit = 75;
220
        EE_Parameter.NaviGpsACC = 0;
222
        EE_Parameter.NaviGpsACC = 0;
221
        EE_Parameter.NaviGpsMinSat = 6;
223
        EE_Parameter.NaviGpsMinSat = 6;
222
        EE_Parameter.NaviStickThreshold = 8;
224
        EE_Parameter.NaviStickThreshold = 8;
223
        EE_Parameter.NaviWindCorrection = 90;
225
        EE_Parameter.NaviWindCorrection = 90;
224
        EE_Parameter.NaviAccCompensation = 42;
226
        EE_Parameter.NaviAccCompensation = 42;
225
        EE_Parameter.NaviOperatingRadius = 245;
227
        EE_Parameter.NaviOperatingRadius = 245;
226
        EE_Parameter.NaviAngleLimitation = 140;
228
        EE_Parameter.NaviAngleLimitation = 140;
227
        EE_Parameter.NaviPH_LoginTime = 5;
229
        EE_Parameter.NaviPH_LoginTime = 5;
228
        EE_Parameter.OrientationAngle = 0;
230
        EE_Parameter.OrientationAngle = 0;
229
        EE_Parameter.CareFreeModeControl = 0;
231
        EE_Parameter.CareFreeModeControl = 0;
230
        EE_Parameter.UnterspannungsWarnung = 33; // Wert : 0-247 ( Automatische Zellenerkennung bei < 50)
232
        EE_Parameter.UnterspannungsWarnung = 33; // Wert : 0-247 ( Automatische Zellenerkennung bei < 50)
231
        EE_Parameter.NotGas = 65;                // Wert : 0-247     // Gaswert bei Empangsverlust (ggf. in Prozent)
233
        EE_Parameter.NotGas = 65;                // Wert : 0-247     // Gaswert bei Empangsverlust (ggf. in Prozent)
232
        EE_Parameter.NotGasZeit = 90;            // Wert : 0-247     // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen
234
        EE_Parameter.NotGasZeit = 90;            // Wert : 0-247     // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen
233
        EE_Parameter.MotorSmooth = 0;          
235
        EE_Parameter.MotorSmooth = 0;          
234
        EE_Parameter.ComingHomeAltitude = 0;      // 0 = don't change 
236
        EE_Parameter.ComingHomeAltitude = 0;      // 0 = don't change 
235
        EE_Parameter.FailSafeTime = 0;            // 0 = off
237
        EE_Parameter.FailSafeTime = 0;            // 0 = off
236
        EE_Parameter.MaxAltitude = 150;           // 0 = off
238
        EE_Parameter.MaxAltitude = 150;           // 0 = off
237
        EE_Parameter.AchsKopplung1 = 125;
239
        EE_Parameter.AchsKopplung1 = 125;
238
        EE_Parameter.AchsKopplung2 = 52;
240
        EE_Parameter.AchsKopplung2 = 52;
239
        EE_Parameter.FailsafeChannel = 0;
241
        EE_Parameter.FailsafeChannel = 0;
240
        EE_Parameter.ServoFilterNick = 0;
242
        EE_Parameter.ServoFilterNick = 0;
241
        EE_Parameter.ServoFilterRoll = 0;
243
        EE_Parameter.ServoFilterRoll = 0;
242
}
244
}
243
/*
245
/*
244
void ParamSet_DefaultSet1(void) // sport
246
void ParamSet_DefaultSet1(void) // sport
245
{
247
{
246
        CommonDefaults();
248
        CommonDefaults();
247
        EE_Parameter.Stick_P = 14;            // Wert : 1-20
249
        EE_Parameter.Stick_P = 14;            // Wert : 1-20
248
        EE_Parameter.Stick_D = 16;            // Wert : 0-20
250
        EE_Parameter.Stick_D = 16;            // Wert : 0-20
249
        EE_Parameter.StickGier_P = 12;             // Wert : 1-20
251
        EE_Parameter.StickGier_P = 12;             // Wert : 1-20
250
        EE_Parameter.Gyro_P = 80;             // Wert : 0-247
252
        EE_Parameter.Gyro_P = 80;             // Wert : 0-247
251
        EE_Parameter.Gyro_I = 150;            // Wert : 0-247
253
        EE_Parameter.Gyro_I = 150;            // Wert : 0-247
252
        EE_Parameter.Gyro_Gier_P = 80;        // Wert : 0-247
254
        EE_Parameter.Gyro_Gier_P = 80;        // Wert : 0-247
253
        EE_Parameter.Gyro_Gier_I = 150;       // Wert : 0-247
255
        EE_Parameter.Gyro_Gier_I = 150;       // Wert : 0-247
254
        EE_Parameter.Gyro_Stability = 6;          // Wert : 1-8
256
        EE_Parameter.Gyro_Stability = 6;          // Wert : 1-8
255
        EE_Parameter.I_Faktor = 32;
257
        EE_Parameter.I_Faktor = 32;
256
        EE_Parameter.CouplingYawCorrection = 1;
258
        EE_Parameter.CouplingYawCorrection = 1;
257
        EE_Parameter.GyroAccAbgleich = 16;        // 1/k;
259
        EE_Parameter.GyroAccAbgleich = 16;        // 1/k;
258
        EE_Parameter.DynamicStability = 100;
260
        EE_Parameter.DynamicStability = 100;
259
        memcpy(EE_Parameter.Name, "Sport\0", 12);
261
        memcpy(EE_Parameter.Name, "Sport\0", 12);
260
        EE_Parameter.crc = RAM_Checksum((uint8_t*)(&EE_Parameter), sizeof(EE_Parameter)-1);
262
        EE_Parameter.crc = RAM_Checksum((uint8_t*)(&EE_Parameter), sizeof(EE_Parameter)-1);
261
}
263
}
262
*/
264
*/
263
 
265
 
264
/***************************************************/
266
/***************************************************/
265
/*    Default Values for parameter set 1           */
267
/*    Default Values for parameter set 1           */
266
/***************************************************/
268
/***************************************************/
267
void ParamSet_DefaultSet1(void) // normal
269
void ParamSet_DefaultSet1(void) // normal
268
{
270
{
269
        CommonDefaults();
271
        CommonDefaults();
270
        EE_Parameter.Stick_P = 10;               // Wert : 1-20
272
        EE_Parameter.Stick_P = 10;               // Wert : 1-20
271
        EE_Parameter.Stick_D = 16;               // Wert : 0-20
273
        EE_Parameter.Stick_D = 16;               // Wert : 0-20
272
        EE_Parameter.StickGier_P = 6;                 // Wert : 1-20
274
        EE_Parameter.StickGier_P = 6;                 // Wert : 1-20
273
        EE_Parameter.Gyro_P = 90;                // Wert : 0-247
275
        EE_Parameter.Gyro_P = 90;                // Wert : 0-247
274
        EE_Parameter.Gyro_I = 120;               // Wert : 0-247
276
        EE_Parameter.Gyro_I = 120;               // Wert : 0-247
275
        EE_Parameter.Gyro_Gier_P = 90;           // Wert : 0-247
277
        EE_Parameter.Gyro_Gier_P = 90;           // Wert : 0-247
276
        EE_Parameter.Gyro_Gier_I = 120;          // Wert : 0-247
278
        EE_Parameter.Gyro_Gier_I = 120;          // Wert : 0-247
277
        EE_Parameter.Gyro_Stability = 6;                  // Wert : 1-8
279
        EE_Parameter.Gyro_Stability = 6;                  // Wert : 1-8
278
        EE_Parameter.I_Faktor = 32;
280
        EE_Parameter.I_Faktor = 32;
279
        EE_Parameter.CouplingYawCorrection = 60;
281
        EE_Parameter.CouplingYawCorrection = 60;
280
        EE_Parameter.DynamicStability = 75;
282
        EE_Parameter.DynamicStability = 75;
281
        memcpy(EE_Parameter.Name, "Fast",4);
283
        memcpy(EE_Parameter.Name, "Fast",4);
282
        EE_Parameter.crc = RAM_Checksum((uint8_t*)(&EE_Parameter), sizeof(EE_Parameter)-1);
284
        EE_Parameter.crc = RAM_Checksum((uint8_t*)(&EE_Parameter), sizeof(EE_Parameter)-1);
283
}
285
}
284
 
286
 
285
 
287
 
286
/***************************************************/
288
/***************************************************/
287
/*    Default Values for parameter set 2           */
289
/*    Default Values for parameter set 2           */
288
/***************************************************/
290
/***************************************************/
289
void ParamSet_DefaultSet2(void) // beginner
291
void ParamSet_DefaultSet2(void) // beginner
290
{
292
{
291
        CommonDefaults();
293
        CommonDefaults();
292
        EE_Parameter.Stick_P = 8;                // Wert : 1-20
294
        EE_Parameter.Stick_P = 8;                // Wert : 1-20
293
        EE_Parameter.Stick_D = 16;               // Wert : 0-20
295
        EE_Parameter.Stick_D = 16;               // Wert : 0-20
294
        EE_Parameter.StickGier_P  = 6;                // Wert : 1-20
296
        EE_Parameter.StickGier_P  = 6;                // Wert : 1-20
295
        EE_Parameter.Gyro_P = 100;               // Wert : 0-247
297
        EE_Parameter.Gyro_P = 100;               // Wert : 0-247
296
        EE_Parameter.Gyro_I = 120;               // Wert : 0-247
298
        EE_Parameter.Gyro_I = 120;               // Wert : 0-247
297
        EE_Parameter.Gyro_Gier_P = 100;          // Wert : 0-247
299
        EE_Parameter.Gyro_Gier_P = 100;          // Wert : 0-247
298
        EE_Parameter.Gyro_Gier_I = 120;          // Wert : 0-247
300
        EE_Parameter.Gyro_Gier_I = 120;          // Wert : 0-247
299
        EE_Parameter.Gyro_Stability = 6;                  // Wert : 1-8
301
        EE_Parameter.Gyro_Stability = 6;                  // Wert : 1-8
300
        EE_Parameter.I_Faktor = 16;
302
        EE_Parameter.I_Faktor = 16;
301
        EE_Parameter.CouplingYawCorrection = 70;
303
        EE_Parameter.CouplingYawCorrection = 70;
302
        EE_Parameter.DynamicStability = 70;
304
        EE_Parameter.DynamicStability = 70;
303
        memcpy(EE_Parameter.Name, "Normal",6);
305
        memcpy(EE_Parameter.Name, "Normal",6);
304
        EE_Parameter.crc = RAM_Checksum((uint8_t*)(&EE_Parameter), sizeof(EE_Parameter)-1);
306
        EE_Parameter.crc = RAM_Checksum((uint8_t*)(&EE_Parameter), sizeof(EE_Parameter)-1);
305
}
307
}
306
 
308
 
307
/***************************************************/
309
/***************************************************/
308
/*    Default Values for parameter set 3           */
310
/*    Default Values for parameter set 3           */
309
/***************************************************/
311
/***************************************************/
310
void ParamSet_DefaultSet3(void) // beginner
312
void ParamSet_DefaultSet3(void) // beginner
311
{
313
{
312
        CommonDefaults();
314
        CommonDefaults();
313
        EE_Parameter.Stick_P = 6;                // Wert : 1-20
315
        EE_Parameter.Stick_P = 6;                // Wert : 1-20
314
        EE_Parameter.Stick_D = 10;               // Wert : 0-20
316
        EE_Parameter.Stick_D = 10;               // Wert : 0-20
315
        EE_Parameter.StickGier_P  = 4;           // Wert : 1-20
317
        EE_Parameter.StickGier_P  = 4;           // Wert : 1-20
316
        EE_Parameter.Gyro_P = 100;               // Wert : 0-247
318
        EE_Parameter.Gyro_P = 100;               // Wert : 0-247
317
        EE_Parameter.Gyro_I = 120;               // Wert : 0-247
319
        EE_Parameter.Gyro_I = 120;               // Wert : 0-247
318
        EE_Parameter.Gyro_Gier_P = 100;          // Wert : 0-247
320
        EE_Parameter.Gyro_Gier_P = 100;          // Wert : 0-247
319
        EE_Parameter.Gyro_Gier_I = 120;          // Wert : 0-247
321
        EE_Parameter.Gyro_Gier_I = 120;          // Wert : 0-247
320
        EE_Parameter.Gyro_Stability = 6;              // Wert : 1-8
322
        EE_Parameter.Gyro_Stability = 6;              // Wert : 1-8
321
        EE_Parameter.I_Faktor = 16;
323
        EE_Parameter.I_Faktor = 16;
322
        EE_Parameter.CouplingYawCorrection = 70;
324
        EE_Parameter.CouplingYawCorrection = 70;
323
        EE_Parameter.DynamicStability = 70;
325
        EE_Parameter.DynamicStability = 70;
324
        memcpy(EE_Parameter.Name, "Easy", 4);
326
        memcpy(EE_Parameter.Name, "Easy", 4);
325
        EE_Parameter.crc = RAM_Checksum((uint8_t*)(&EE_Parameter), sizeof(EE_Parameter)-1);
327
        EE_Parameter.crc = RAM_Checksum((uint8_t*)(&EE_Parameter), sizeof(EE_Parameter)-1);
326
}
328
}
327
 
329
 
328
 
330
 
329
/***************************************************/
331
/***************************************************/
330
/*       Read Parameter from EEPROM as byte        */
332
/*       Read Parameter from EEPROM as byte        */
331
/***************************************************/
333
/***************************************************/
332
uint8_t GetParamByte(uint16_t param_id)
334
uint8_t GetParamByte(uint16_t param_id)
333
{
335
{
334
        return eeprom_read_byte((uint8_t*)(EEPROM_ADR_PARAM_BEGIN + param_id));
336
        return eeprom_read_byte((uint8_t*)(EEPROM_ADR_PARAM_BEGIN + param_id));
335
}
337
}
336
 
338
 
337
/***************************************************/
339
/***************************************************/
338
/*       Write Parameter to EEPROM as byte         */
340
/*       Write Parameter to EEPROM as byte         */
339
/***************************************************/
341
/***************************************************/
340
void SetParamByte(uint16_t param_id, uint8_t value)
342
void SetParamByte(uint16_t param_id, uint8_t value)
341
{
343
{
342
        eeprom_write_byte((uint8_t*)(EEPROM_ADR_PARAM_BEGIN + param_id), value);
344
        eeprom_write_byte((uint8_t*)(EEPROM_ADR_PARAM_BEGIN + param_id), value);
343
}
345
}
344
 
346
 
345
/***************************************************/
347
/***************************************************/
346
/*       Read Parameter from EEPROM as word        */
348
/*       Read Parameter from EEPROM as word        */
347
/***************************************************/
349
/***************************************************/
348
uint16_t GetParamWord(uint16_t param_id)
350
uint16_t GetParamWord(uint16_t param_id)
349
{
351
{
350
        return eeprom_read_word((uint16_t *)(EEPROM_ADR_PARAM_BEGIN + param_id));
352
        return eeprom_read_word((uint16_t *)(EEPROM_ADR_PARAM_BEGIN + param_id));
351
}
353
}
352
 
354
 
353
/***************************************************/
355
/***************************************************/
354
/*       Write Parameter to EEPROM as word         */
356
/*       Write Parameter to EEPROM as word         */
355
/***************************************************/
357
/***************************************************/
356
void SetParamWord(uint16_t param_id, uint16_t value)
358
void SetParamWord(uint16_t param_id, uint16_t value)
357
{
359
{
358
        eeprom_write_word((uint16_t*)(EEPROM_ADR_PARAM_BEGIN + param_id), value);
360
        eeprom_write_word((uint16_t*)(EEPROM_ADR_PARAM_BEGIN + param_id), value);
359
}
361
}
360
 
362
 
361
/***************************************************/
363
/***************************************************/
362
/*       Read Parameter Set from EEPROM            */
364
/*       Read Parameter Set from EEPROM            */
363
/***************************************************/
365
/***************************************************/
364
// number [1..5]
366
// number [1..5]
365
uint8_t ParamSet_ReadFromEEProm(uint8_t setnumber)
367
uint8_t ParamSet_ReadFromEEProm(uint8_t setnumber)
366
{
368
{
367
        uint8_t crc;
369
        uint8_t crc;
368
        uint16_t eeaddr;
370
        uint16_t eeaddr;
369
 
371
 
370
        // range the setnumber
372
        // range the setnumber
371
        if((1 > setnumber) || (setnumber > 5)) setnumber = 3;
373
        if((1 > setnumber) || (setnumber > 5)) setnumber = 3;
372
 
374
 
373
        // calculate eeprom addr
375
        // calculate eeprom addr
374
        eeaddr = EEPROM_ADR_PARAMSET + PARAMSET_STRUCT_LEN * (setnumber - 1);
376
        eeaddr = EEPROM_ADR_PARAMSET + PARAMSET_STRUCT_LEN * (setnumber - 1);
375
 
377
 
376
        // calculate checksum from eeprom
378
        // calculate checksum from eeprom
377
        crc = EEProm_Checksum(eeaddr, PARAMSET_STRUCT_LEN - 1);
379
        crc = EEProm_Checksum(eeaddr, PARAMSET_STRUCT_LEN - 1);
378
 
380
 
379
        // check crc
381
        // check crc
380
        if(crc != eeprom_read_byte((uint8_t*)(eeaddr + PARAMSET_STRUCT_LEN - 1))) return 0;
382
        if(crc != eeprom_read_byte((uint8_t*)(eeaddr + PARAMSET_STRUCT_LEN - 1))) return 0;
381
 
383
 
382
        // check revision
384
        // check revision
383
        if(eeprom_read_byte((uint8_t*)(eeaddr)) != EEPARAM_REVISION) return 0;
385
        if(eeprom_read_byte((uint8_t*)(eeaddr)) != EEPARAM_REVISION) return 0;
384
 
386
 
385
        // read paramset from eeprom
387
        // read paramset from eeprom
386
        eeprom_read_block((void *) &EE_Parameter, (void*)(EEPROM_ADR_PARAMSET + PARAMSET_STRUCT_LEN * (setnumber - 1)), PARAMSET_STRUCT_LEN);
388
        eeprom_read_block((void *) &EE_Parameter, (void*)(EEPROM_ADR_PARAMSET + PARAMSET_STRUCT_LEN * (setnumber - 1)), PARAMSET_STRUCT_LEN);
387
        LED_Init();
389
        LED_Init();
388
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
390
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
389
        LIBFC_HoTT_Clear();
391
        LIBFC_HoTT_Clear();
390
#endif
392
#endif
391
        return 1;
393
        return 1;
392
}
394
}
393
 
395
 
394
/***************************************************/
396
/***************************************************/
395
/*        Write Parameter Set to EEPROM            */
397
/*        Write Parameter Set to EEPROM            */
396
/***************************************************/
398
/***************************************************/
397
// number [1..5]
399
// number [1..5]
398
uint8_t ParamSet_WriteToEEProm(uint8_t setnumber)
400
uint8_t ParamSet_WriteToEEProm(uint8_t setnumber)
399
{
401
{
400
        uint8_t crc;
402
        uint8_t crc;
401
 
403
 
402
        if(EE_Parameter.Revision == EEPARAM_REVISION) // write only the right revision to eeprom
404
        if(EE_Parameter.Revision == EEPARAM_REVISION) // write only the right revision to eeprom
403
        {
405
        {
404
                if(setnumber > 5) setnumber = 5;
406
                if(setnumber > 5) setnumber = 5;
405
                if(setnumber < 1) return 0;
407
                if(setnumber < 1) return 0;
406
        LIBFC_CheckSettings();
408
        LIBFC_CheckSettings();
407
                if(EE_Parameter.GlobalConfig3 & CFG3_VARIO_FAILSAFE)         // check the Setting: Not more than 100% emergency gas
409
                if(EE_Parameter.GlobalConfig3 & CFG3_VARIO_FAILSAFE)         // check the Setting: Not more than 100% emergency gas
408
                        {
410
                        {
409
                         if(EE_Parameter.NotGas > 99) EE_Parameter.NotGas = 80; // i.e. 80% of Hovergas
411
                         if(EE_Parameter.NotGas > 99) EE_Parameter.NotGas = 80; // i.e. 80% of Hovergas
410
                        }
412
                        }
411
                // update checksum
413
                // update checksum
412
                EE_Parameter.crc = RAM_Checksum((uint8_t*)(&EE_Parameter), sizeof(EE_Parameter)-1);
414
                EE_Parameter.crc = RAM_Checksum((uint8_t*)(&EE_Parameter), sizeof(EE_Parameter)-1);
413
 
415
 
414
                // write paramset to eeprom
416
                // write paramset to eeprom
415
                eeprom_write_block((void *) &EE_Parameter, (void*)(EEPROM_ADR_PARAMSET + PARAMSET_STRUCT_LEN * (setnumber - 1)), PARAMSET_STRUCT_LEN);
417
                eeprom_write_block((void *) &EE_Parameter, (void*)(EEPROM_ADR_PARAMSET + PARAMSET_STRUCT_LEN * (setnumber - 1)), PARAMSET_STRUCT_LEN);
416
 
418
 
417
                // backup channel settings to separate block in eeprom
419
                // backup channel settings to separate block in eeprom
418
                eeprom_write_block( (void*)(EE_Parameter.Kanalbelegung), (void*)(EEPROM_ADR_CHANNELS), sizeof(EE_Parameter.Kanalbelegung));
420
                eeprom_write_block( (void*)(EE_Parameter.Kanalbelegung), (void*)(EEPROM_ADR_CHANNELS), sizeof(EE_Parameter.Kanalbelegung));
419
 
421
 
420
                // write crc of channel block to eeprom
422
                // write crc of channel block to eeprom
421
                crc = RAM_Checksum((uint8_t*)(EE_Parameter.Kanalbelegung), sizeof(EE_Parameter.Kanalbelegung));
423
                crc = RAM_Checksum((uint8_t*)(EE_Parameter.Kanalbelegung), sizeof(EE_Parameter.Kanalbelegung));
422
                eeprom_write_byte((uint8_t*)(EEPROM_ADR_CHANNELS + sizeof(EE_Parameter.Kanalbelegung)), crc);
424
                eeprom_write_byte((uint8_t*)(EEPROM_ADR_CHANNELS + sizeof(EE_Parameter.Kanalbelegung)), crc);
423
 
425
 
424
                // update active settings number
426
                // update active settings number
425
                SetActiveParamSet(setnumber);
427
                SetActiveParamSet(setnumber);
426
                LED_Init();
428
                LED_Init();
427
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
429
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
428
                LIBFC_HoTT_Clear();
430
                LIBFC_HoTT_Clear();
429
#endif
431
#endif
430
                return 1;
432
                return 1;
431
        }
433
        }
432
        // wrong revision
434
        // wrong revision
433
        return 0;
435
        return 0;
434
}
436
}
435
 
437
 
436
/***************************************************/
438
/***************************************************/
437
/*          Read MixerTable from EEPROM            */
439
/*          Read MixerTable from EEPROM            */
438
/***************************************************/
440
/***************************************************/
439
uint8_t MixerTable_ReadFromEEProm(void)
441
uint8_t MixerTable_ReadFromEEProm(void)
440
{
442
{
441
        uint8_t crc;
443
        uint8_t crc;
442
 
444
 
443
        // calculate checksum in eeprom
445
        // calculate checksum in eeprom
444
        crc = EEProm_Checksum(EEPROM_ADR_MIXERTABLE, sizeof(Mixer) - 1);
446
        crc = EEProm_Checksum(EEPROM_ADR_MIXERTABLE, sizeof(Mixer) - 1);
445
 
447
 
446
        // check crc
448
        // check crc
447
        if( crc != eeprom_read_byte((uint8_t*)(EEPROM_ADR_MIXERTABLE + sizeof(Mixer) - 1)) ) return 0;
449
        if( crc != eeprom_read_byte((uint8_t*)(EEPROM_ADR_MIXERTABLE + sizeof(Mixer) - 1)) ) return 0;
448
 
450
 
449
        // check revision
451
        // check revision
450
        if(eeprom_read_byte((uint8_t*)(EEPROM_ADR_MIXERTABLE)) != EEMIXER_REVISION) return 0;
452
        if(eeprom_read_byte((uint8_t*)(EEPROM_ADR_MIXERTABLE)) != EEMIXER_REVISION) return 0;
451
 
453
 
452
        // read mixer table
454
        // read mixer table
453
        eeprom_read_block((void *) &Mixer, (void*)(EEPROM_ADR_MIXERTABLE), sizeof(Mixer));
455
        eeprom_read_block((void *) &Mixer, (void*)(EEPROM_ADR_MIXERTABLE), sizeof(Mixer));
454
        return 1;
456
        return 1;
455
}
457
}
456
 
458
 
457
/***************************************************/
459
/***************************************************/
458
/*          Write Mixer Table to EEPROM            */
460
/*          Write Mixer Table to EEPROM            */
459
/***************************************************/
461
/***************************************************/
460
uint8_t MixerTable_WriteToEEProm(void)
462
uint8_t MixerTable_WriteToEEProm(void)
461
{
463
{
462
        if(Mixer.Revision == EEMIXER_REVISION)
464
        if(Mixer.Revision == EEMIXER_REVISION)
463
        {
465
        {
464
                // update crc
466
                // update crc
465
                Mixer.crc = RAM_Checksum((uint8_t*)(&Mixer), sizeof(Mixer) - 1);
467
                Mixer.crc = RAM_Checksum((uint8_t*)(&Mixer), sizeof(Mixer) - 1);
466
 
468
 
467
                // write to eeprom
469
                // write to eeprom
468
                eeprom_write_block((void *) &Mixer, (void*)(EEPROM_ADR_MIXERTABLE), sizeof(Mixer));
470
                eeprom_write_block((void *) &Mixer, (void*)(EEPROM_ADR_MIXERTABLE), sizeof(Mixer));
469
                return 1;
471
                return 1;
470
        }
472
        }
471
        else return 0;
473
        else return 0;
472
}
474
}
473
 
475
 
474
/***************************************************/
476
/***************************************************/
475
/*    Default Values for Mixer Table               */
477
/*    Default Values for Mixer Table               */
476
/***************************************************/
478
/***************************************************/
477
void MixerTable_Default(void) // Quadro
479
void MixerTable_Default(void) // Quadro
478
{
480
{
479
        uint8_t i;
481
        uint8_t i;
480
 
482
 
481
        Mixer.Revision = EEMIXER_REVISION;
483
        Mixer.Revision = EEMIXER_REVISION;
482
        // clear mixer table
484
        // clear mixer table
483
        for(i = 0; i < 16; i++)
485
        for(i = 0; i < 16; i++)
484
        {
486
        {
485
                Mixer.Motor[i][MIX_GAS]  = 0;
487
                Mixer.Motor[i][MIX_GAS]  = 0;
486
                Mixer.Motor[i][MIX_NICK] = 0;
488
                Mixer.Motor[i][MIX_NICK] = 0;
487
                Mixer.Motor[i][MIX_ROLL] = 0;
489
                Mixer.Motor[i][MIX_ROLL] = 0;
488
                Mixer.Motor[i][MIX_YAW]  = 0;
490
                Mixer.Motor[i][MIX_YAW]  = 0;
489
        }
491
        }
490
        // default = Quadro
492
        // default = Quadro
491
        Mixer.Motor[0][MIX_GAS] = 64; Mixer.Motor[0][MIX_NICK] = +64; Mixer.Motor[0][MIX_ROLL] =   0; Mixer.Motor[0][MIX_YAW] = +64;
493
        Mixer.Motor[0][MIX_GAS] = 64; Mixer.Motor[0][MIX_NICK] = +64; Mixer.Motor[0][MIX_ROLL] =   0; Mixer.Motor[0][MIX_YAW] = +64;
492
        Mixer.Motor[1][MIX_GAS] = 64; Mixer.Motor[1][MIX_NICK] = -64; Mixer.Motor[1][MIX_ROLL] =   0; Mixer.Motor[1][MIX_YAW] = +64;
494
        Mixer.Motor[1][MIX_GAS] = 64; Mixer.Motor[1][MIX_NICK] = -64; Mixer.Motor[1][MIX_ROLL] =   0; Mixer.Motor[1][MIX_YAW] = +64;
493
        Mixer.Motor[2][MIX_GAS] = 64; Mixer.Motor[2][MIX_NICK] =   0; Mixer.Motor[2][MIX_ROLL] = -64; Mixer.Motor[2][MIX_YAW] = -64;
495
        Mixer.Motor[2][MIX_GAS] = 64; Mixer.Motor[2][MIX_NICK] =   0; Mixer.Motor[2][MIX_ROLL] = -64; Mixer.Motor[2][MIX_YAW] = -64;
494
        Mixer.Motor[3][MIX_GAS] = 64; Mixer.Motor[3][MIX_NICK] =   0; Mixer.Motor[3][MIX_ROLL] = +64; Mixer.Motor[3][MIX_YAW] = -64;
496
        Mixer.Motor[3][MIX_GAS] = 64; Mixer.Motor[3][MIX_NICK] =   0; Mixer.Motor[3][MIX_ROLL] = +64; Mixer.Motor[3][MIX_YAW] = -64;
495
        memcpy(Mixer.Name, "Quadro\0\0\0\0\0\0", 12);
497
        memcpy(Mixer.Name, "Quadro\0\0\0\0\0\0", 12);
496
        Mixer.crc = RAM_Checksum((uint8_t*)(&Mixer), sizeof(Mixer) - 1);
498
        Mixer.crc = RAM_Checksum((uint8_t*)(&Mixer), sizeof(Mixer) - 1);
497
}
499
}
498
 
500
 
499
/***************************************************/
501
/***************************************************/
500
/*       Get active parameter set                  */
502
/*       Get active parameter set                  */
501
/***************************************************/
503
/***************************************************/
502
uint8_t GetActiveParamSet(void)
504
uint8_t GetActiveParamSet(void)
503
{
505
{
504
        uint8_t setnumber;
506
        uint8_t setnumber;
505
        setnumber = eeprom_read_byte((uint8_t*)(EEPROM_ADR_PARAM_BEGIN + PID_ACTIVE_SET));
507
        setnumber = eeprom_read_byte((uint8_t*)(EEPROM_ADR_PARAM_BEGIN + PID_ACTIVE_SET));
506
        if(setnumber > 5)
508
        if(setnumber > 5)
507
        {
509
        {
508
                setnumber = 3;
510
                setnumber = 3;
509
                eeprom_write_byte((void*)(EEPROM_ADR_PARAM_BEGIN+PID_ACTIVE_SET), setnumber);
511
                eeprom_write_byte((void*)(EEPROM_ADR_PARAM_BEGIN+PID_ACTIVE_SET), setnumber);
510
        }
512
        }
511
        ActiveParamSet = setnumber;
513
        ActiveParamSet = setnumber;
512
        return(setnumber);
514
        return(setnumber);
513
}
515
}
514
 
516
 
515
/***************************************************/
517
/***************************************************/
516
/*       Set active parameter set                  */
518
/*       Set active parameter set                  */
517
/***************************************************/
519
/***************************************************/
518
void SetActiveParamSet(uint8_t setnumber)
520
void SetActiveParamSet(uint8_t setnumber)
519
{
521
{
520
        if(setnumber > 5) setnumber = 5;
522
        if(setnumber > 5) setnumber = 5;
521
        if(setnumber < 1) setnumber = 1;
523
        if(setnumber < 1) setnumber = 1;
522
        ActiveParamSet = setnumber;
524
        ActiveParamSet = setnumber;
523
        eeprom_write_byte((uint8_t*)(EEPROM_ADR_PARAM_BEGIN + PID_ACTIVE_SET), setnumber);
525
        eeprom_write_byte((uint8_t*)(EEPROM_ADR_PARAM_BEGIN + PID_ACTIVE_SET), setnumber);
524
}
526
}
525
 
527
 
526
/***************************************************/
528
/***************************************************/
527
/*       Set default parameter set                 */
529
/*       Set default parameter set                 */
528
/***************************************************/
530
/***************************************************/
529
void SetDefaultParameter(uint8_t set, uint8_t restore_channels)
531
void SetDefaultParameter(uint8_t set, uint8_t restore_channels)
530
{
532
{
531
 
533
 
532
        if(set > 5) set = 5;
534
        if(set > 5) set = 5;
533
        else if(set < 1) set = 1;
535
        else if(set < 1) set = 1;
534
 
536
 
535
        switch(set)
537
        switch(set)
536
        {
538
        {
537
                case 1:
539
                case 1:
538
                        ParamSet_DefaultSet1(); // Fill ParamSet Structure to default parameter set 1 (Sport)
540
                        ParamSet_DefaultSet1(); // Fill ParamSet Structure to default parameter set 1 (Sport)
539
                        break;
541
                        break;
540
                case 2:
542
                case 2:
541
                        ParamSet_DefaultSet2(); // Kamera
543
                        ParamSet_DefaultSet2(); // Kamera
542
                        break;
544
                        break;
543
                case 3:
545
                case 3:
544
                        ParamSet_DefaultSet3(); // Beginner
546
                        ParamSet_DefaultSet3(); // Beginner
545
                        break;
547
                        break;
546
                default:
548
                default:
547
                        ParamSet_DefaultSet3(); // Beginner
549
                        ParamSet_DefaultSet3(); // Beginner
548
                        break;
550
                        break;
549
        }
551
        }
550
        if(restore_channels)
552
        if(restore_channels)
551
        {
553
        {
552
                uint8_t crc;
554
                uint8_t crc;
553
                // 1st check for a valid channel backup in eeprom
555
                // 1st check for a valid channel backup in eeprom
554
                crc = EEProm_Checksum(EEPROM_ADR_CHANNELS, sizeof(EE_Parameter.Kanalbelegung));
556
                crc = EEProm_Checksum(EEPROM_ADR_CHANNELS, sizeof(EE_Parameter.Kanalbelegung));
555
                if(crc == eeprom_read_byte((uint8_t*)(EEPROM_ADR_CHANNELS + sizeof(EE_Parameter.Kanalbelegung))) )
557
                if(crc == eeprom_read_byte((uint8_t*)(EEPROM_ADR_CHANNELS + sizeof(EE_Parameter.Kanalbelegung))) )
556
                {
558
                {
557
                        eeprom_read_block((void *)EE_Parameter.Kanalbelegung, (void*)(EEPROM_ADR_CHANNELS), sizeof(EE_Parameter.Kanalbelegung));
559
                        eeprom_read_block((void *)EE_Parameter.Kanalbelegung, (void*)(EEPROM_ADR_CHANNELS), sizeof(EE_Parameter.Kanalbelegung));
558
                }
560
                }
559
                else ParamSet_DefaultStickMapping();
561
                else ParamSet_DefaultStickMapping();
560
        }
562
        }
561
        else ParamSet_DefaultStickMapping();
563
        else ParamSet_DefaultStickMapping();
562
        ParamSet_WriteToEEProm(set);
564
        ParamSet_WriteToEEProm(set);
563
}
565
}
564
 
566
 
565
/***************************************************/
567
/***************************************************/
566
/*       Initialize EEPROM Parameter Sets          */
568
/*       Initialize EEPROM Parameter Sets          */
567
/***************************************************/
569
/***************************************************/
568
void ParamSet_Init(void)
570
void ParamSet_Init(void)
569
{
571
{
570
        uint8_t channel_backup  = 0, bad_params = 0, ee_default = 0,i;
572
        uint8_t channel_backup  = 0, bad_params = 0, ee_default = 0,i;
571
        if(GetParamByte(PID_EE_REVISION) == EEPARAM_REVISION - 50)  SetParamByte(PID_EE_REVISION,EEPARAM_REVISION); // remove the EEPARAM_REVISION_SUB from Version 0.90g
573
        if(GetParamByte(PID_EE_REVISION) == EEPARAM_REVISION - 50)  SetParamByte(PID_EE_REVISION,EEPARAM_REVISION); // remove the EEPARAM_REVISION_SUB from Version 0.90g
572
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
574
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
573
        if(PlatinenVersion != GetParamByte(PID_HARDWARE_VERSION))
575
        if(PlatinenVersion != GetParamByte(PID_HARDWARE_VERSION))
574
         {
576
         {
575
          if(PlatinenVersion == 22 && GetParamByte(PID_HARDWARE_VERSION) == 21 && !(PIND & 0x10)) SetParamByte(PID_EE_REVISION,0); // reset the Settings if the Version changed to V2.2
577
          if(PlatinenVersion == 22 && GetParamByte(PID_HARDWARE_VERSION) == 21 && !(PIND & 0x10)) SetParamByte(PID_EE_REVISION,0); // reset the Settings if the Version changed to V2.2
576
          SetParamByte(PID_HARDWARE_VERSION,PlatinenVersion); // Remember the Version number
578
          SetParamByte(PID_HARDWARE_VERSION,PlatinenVersion); // Remember the Version number
577
          wdt_enable(WDTO_15MS); // Reset-Commando
579
          wdt_enable(WDTO_15MS); // Reset-Commando
578
          printf("\n\r--> Hardware Version Byte Changed <--");
580
          printf("\n\r--> Hardware Version Byte Changed <--");
579
          while(1);
581
          while(1);
580
         }
582
         }
581
#endif
583
#endif
582
        if((EEPARAM_REVISION) != GetParamByte(PID_EE_REVISION))  
584
        if((EEPARAM_REVISION) != GetParamByte(PID_EE_REVISION))  
583
        {
585
        {
584
                ee_default = 1; // software update or forced by mktool
586
                ee_default = 1; // software update or forced by mktool
585
        }
587
        }
586
        // 1st check for a valid channel backup in eeprom
588
        // 1st check for a valid channel backup in eeprom
587
        i = EEProm_Checksum(EEPROM_ADR_CHANNELS, sizeof(EE_Parameter.Kanalbelegung));
589
        i = EEProm_Checksum(EEPROM_ADR_CHANNELS, sizeof(EE_Parameter.Kanalbelegung));
588
        if(i == eeprom_read_byte((uint8_t*)(EEPROM_ADR_CHANNELS + sizeof(EE_Parameter.Kanalbelegung)))) channel_backup = 1;
590
        if(i == eeprom_read_byte((uint8_t*)(EEPROM_ADR_CHANNELS + sizeof(EE_Parameter.Kanalbelegung)))) channel_backup = 1;
589
 
591
 
590
        // parameter check
592
        // parameter check
591
 
593
 
592
        // check all 5 parameter settings
594
        // check all 5 parameter settings
593
        for (i = 1;i < 6; i++)
595
        for (i = 1;i < 6; i++)
594
        {
596
        {
595
                if(ee_default || !ParamSet_ReadFromEEProm(i)) // could not read paramset from eeprom
597
                if(ee_default || !ParamSet_ReadFromEEProm(i)) // could not read paramset from eeprom
596
                {
598
                {
597
                        bad_params = 1;
599
                        bad_params = 1;
598
                        printf("\n\rGenerating default Parameter Set %d",i);
600
                        printf("\n\rGenerating default Parameter Set %d",i);
599
                        switch(i)
601
                        switch(i)
600
                        {
602
                        {
601
                                case 1:
603
                                case 1:
602
                                        ParamSet_DefaultSet1(); // Fill ParamSet Structure to default parameter set 1 (Sport)
604
                                        ParamSet_DefaultSet1(); // Fill ParamSet Structure to default parameter set 1 (Sport)
603
                                        break;
605
                                        break;
604
                                case 2:
606
                                case 2:
605
                                        ParamSet_DefaultSet2(); // Kamera
607
                                        ParamSet_DefaultSet2(); // Kamera
606
                                        break;
608
                                        break;
607
                                case 3:
609
                                case 3:
608
                                        ParamSet_DefaultSet3(); // Beginner
610
                                        ParamSet_DefaultSet3(); // Beginner
609
                                        break;
611
                                        break;
610
                                default:
612
                                default:
611
                                        ParamSet_DefaultSet3(); // Kamera
613
                                        ParamSet_DefaultSet3(); // Kamera
612
                                        break;
614
                                        break;
613
                        }
615
                        }
614
                        if(channel_backup) // if we have an channel mapping backup in eeprom
616
                        if(channel_backup) // if we have an channel mapping backup in eeprom
615
                        {       // restore it from eeprom
617
                        {       // restore it from eeprom
616
                                eeprom_read_block((void *)EE_Parameter.Kanalbelegung, (void*)(EEPROM_ADR_CHANNELS), sizeof(EE_Parameter.Kanalbelegung));
618
                                eeprom_read_block((void *)EE_Parameter.Kanalbelegung, (void*)(EEPROM_ADR_CHANNELS), sizeof(EE_Parameter.Kanalbelegung));
617
                        }
619
                        }
618
                        else
620
                        else
619
                        {       // use default mapping
621
                        {       // use default mapping
620
                                ParamSet_DefaultStickMapping();
622
                                ParamSet_DefaultStickMapping();
621
                        }
623
                        }
622
                        ParamSet_WriteToEEProm(i);
624
                        ParamSet_WriteToEEProm(i);
623
                }
625
                }
624
        }
626
        }
625
        if(bad_params) // at least one of the parameter settings were invalid
627
        if(bad_params) // at least one of the parameter settings were invalid
626
        {
628
        {
627
                // default-Setting is parameter set 3
629
                // default-Setting is parameter set 3
628
                SetActiveParamSet(3);
630
                SetActiveParamSet(3);
629
        }
631
        }
630
 
632
 
631
 
633
 
632
        // read active parameter set to ParamSet stucture
634
        // read active parameter set to ParamSet stucture
633
        i = GetActiveParamSet();
635
        i = GetActiveParamSet();
634
        ParamSet_ReadFromEEProm(i);
636
        ParamSet_ReadFromEEProm(i);
635
        printf("\n\rUsing Parameter Set %d", i);
637
        printf("\n\rUsing Parameter Set %d", i);
636
 
638
 
637
        // load mixer table
639
        // load mixer table
638
        if(GetParamByte(PID_EE_REVISION) == 0xff || !MixerTable_ReadFromEEProm() )
640
        if(GetParamByte(PID_EE_REVISION) == 0xff || !MixerTable_ReadFromEEProm() )
639
        {
641
        {
640
                printf("\n\rGenerating default Mixer Table");
642
                printf("\n\rGenerating default Mixer Table");
641
                MixerTable_Default(); // Quadro
643
                MixerTable_Default(); // Quadro
642
                MixerTable_WriteToEEProm();
644
                MixerTable_WriteToEEProm();
643
        }
645
        }
644
        if(ee_default)  SetParamByte(PID_EE_REVISION, (EEPARAM_REVISION));
646
        if(ee_default)  SetParamByte(PID_EE_REVISION, (EEPARAM_REVISION));
645
        // determine motornumber
647
        // determine motornumber
646
        RequiredMotors = 0;
648
        RequiredMotors = 0;
647
        for(i = 0; i < 16; i++)
649
        for(i = 0; i < 16; i++)
648
        {
650
        {
649
                if(Mixer.Motor[i][MIX_GAS] > 0) RequiredMotors++;
651
                if(Mixer.Motor[i][MIX_GAS] > 0) RequiredMotors++;
650
        }
652
        }
651
 
653
 
652
        printf("\n\rMixer-Config: '%s' (%u Motors)",Mixer.Name, RequiredMotors);
654
        printf("\n\rMixer-Config: '%s' (%u Motors)",Mixer.Name, RequiredMotors);
653
 PrintLine();// ("\n\r===================================");
655
 PrintLine();// ("\n\r===================================");
654
 
656
 
655
}
657
}
656
 
658