Subversion Repositories FlightCtrl

Rev

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

Rev 2120 Rev 2146
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
#include "libfc.h"
53
#include "libfc.h"
54
#include "printf_P.h"
54
#include "printf_P.h"
55
#include "main.h"
55
#include "main.h"
56
#include "spi.h"
56
#include "spi.h"
57
#include "capacity.h"
57
#include "capacity.h"
58
 
58
 
59
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
59
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
60
 
60
 
61
#define HoTT_printf(format, args...)                    {  _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);}
61
#define HoTT_printf(format, args...)                    {  _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);}
62
#define HoTT_printfxy(x,y,format, args...)              { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);}
62
#define HoTT_printfxy(x,y,format, args...)              { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);}
63
#define HoTT_printfxy_INV(x,y,format, args...)          { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);}
63
#define HoTT_printfxy_INV(x,y,format, args...)          { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);}
64
#define HoTT_printfxy_BLINK(x,y,format, args...)        { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);}
64
#define HoTT_printfxy_BLINK(x,y,format, args...)        { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);}
65
#define HoTT_printf_BLINK(format, args...)              { _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);}
65
#define HoTT_printf_BLINK(format, args...)              { _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);}
66
#define HoTT_printf_INV(format, args...)                        { _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);}
66
#define HoTT_printf_INV(format, args...)                        { _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);}
67
 
67
 
68
#define VOICE_MINIMALE_EINGANSSPANNUNG    16
68
#define VOICE_MINIMALE_EINGANSSPANNUNG    16
69
#define VOICE_BEEP                         5
69
#define VOICE_BEEP                         5
70
#define HoTT_GRAD       96
70
#define HoTT_GRAD       96
71
#define HoTT_LINKS      123
71
#define HoTT_LINKS      123
72
#define HoTT_RECHTS 124
72
#define HoTT_RECHTS 124
73
#define HoTT_OBEN       125
73
#define HoTT_OBEN       125
74
#define HoTT_UNTEN      126
74
#define HoTT_UNTEN      126
75
 
75
 
76
#define HOTT_KEY_RIGHT  1
76
#define HOTT_KEY_RIGHT  1
77
#define HOTT_KEY_DOWN   2
77
#define HOTT_KEY_DOWN   2
78
#define HOTT_KEY_UP     4
78
#define HOTT_KEY_UP     4
79
#define HOTT_KEY_SET    6
79
#define HOTT_KEY_SET    6
80
#define HOTT_KEY_LEFT   8
80
#define HOTT_KEY_LEFT   8
81
 
81
 
82
GPSPacket_t GPSPacket;
82
GPSPacket_t GPSPacket;
83
VarioPacket_t VarioPacket;
83
VarioPacket_t VarioPacket;
84
ASCIIPacket_t ASCIIPacket;
84
ASCIIPacket_t ASCIIPacket;
85
ElectricAirPacket_t ElectricAirPacket;
85
ElectricAirPacket_t ElectricAirPacket;
86
HoTTGeneral_t HoTTGeneral;
86
HoTTGeneral_t HoTTGeneral;
87
unsigned char SpeakHoTT = SPEAK_MIKROKOPTER;
87
unsigned char SpeakHoTT = SPEAK_MIKROKOPTER;
88
int HoTTVarioMeter = 0;
88
int HoTTVarioMeter = 0;
89
const char PROGMEM MIKROKOPTER[] =      {"     MikroKopter     "};
89
const char PROGMEM MIKROKOPTER[] =      {"     MikroKopter     "};
90
const char PROGMEM UNDERVOLTAGE[] =     {" !! LiPo voltage !!  "};
90
const char PROGMEM UNDERVOLTAGE[] =     {" !! LiPo voltage !!  "};
91
const char PROGMEM NC_ERROR_TEXT[MAX_ERR_NUMBER][17] =
91
const char PROGMEM NC_ERROR_TEXT[MAX_ERR_NUMBER][17] =
92
{
92
{
93
//0123456789123456
93
//0123456789123456
94
 "No Error        \0",  // 0
94
 "No Error        \0",  // 0
95
 "Not compatible  \0",  // 1
95
 "Not compatible  \0",  // 1
96
 "MK3Mag not compa\0",  // 2
96
 "MK3Mag not compa\0",  // 2
97
 "No FC communicat\0",  // 3
97
 "No FC communicat\0",  // 3
98
 "MK3Mag communica\0",  // 4
98
 "MK3Mag communica\0",  // 4
99
 "GPS communicatio\0",  // 5
99
 "GPS communicatio\0",  // 5
100
 "compass value   \0",  // 6
100
 "compass value   \0",  // 6
101
 "RC Signal lost  \0",  // 7
101
 "RC Signal lost  \0",  // 7
102
 "FC spi rx error \0",  // 8
102
 "FC spi rx error \0",  // 8
103
 "No NC communicat\0",  // 9
103
 "No NC communicat\0",  // 9
104
 "FC Nick Gyro    \0",  // 10
104
 "FC Nick Gyro    \0",  // 10
105
 "FC Roll Gyro    \0",  // 11
105
 "FC Roll Gyro    \0",  // 11
106
 "FC Yaw Gyro     \0",  // 12
106
 "FC Yaw Gyro     \0",  // 12
107
 "FC Nick ACC     \0",  // 13
107
 "FC Nick ACC     \0",  // 13
108
 "FC Roll ACC     \0",  // 14
108
 "FC Roll ACC     \0",  // 14
109
 "FC Z-ACC        \0",  // 15
109
 "FC Z-ACC        \0",  // 15
110
 "Pressure sensor \0",  // 16
110
 "Pressure sensor \0",  // 16
111
 "I2C FC->BL-Ctrl \0",  // 17
111
 "I2C FC->BL-Ctrl \0",  // 17
112
 "Bl Missing      \0",  // 18
112
 "Bl Missing      \0",  // 18
113
 "Mixer Error     \0",  // 19
113
 "Mixer Error     \0",  // 19
114
 "Carefree Error  \0",  // 20
114
 "Carefree Error  \0",  // 20
115
 "GPS Fix lost    \0",  // 21
115
 "GPS Fix lost    \0",  // 21
116
 "Magnet Error    \0",  // 22
116
 "Magnet Error    \0",  // 22
117
 "Motor restart   \0",  // 23
117
 "Motor restart   \0",  // 23
118
 "BL Limitation   \0",  // 24
118
 "BL Limitation   \0",  // 24
119
 "GPS Range       \0",  // 25
119
 "GPS Range       \0",  // 25
120
 "No SD-Card      \0",  // 26
120
 "No SD-Card      \0",  // 26
121
 "SD-Logging error\0",  // 27
121
 "SD-Logging error\0",  // 27
122
 "Flying range!   \0",  // 28
122
 "Flying range!   \0",  // 28
123
 "Max Altitude!   \0"   // 29
123
 "Max Altitude!   \0",  // 29
-
 
124
 "No GPS fix      \0"   // 30
124
};
125
};
125
 
126
 
126
 
127
 
127
const char PROGMEM HOTT_ERROR[MAX_ERR_NUMBER][2] =
128
const char PROGMEM HOTT_ERROR[MAX_ERR_NUMBER][2] =
128
{       // 1 -> only in flight   0 -> also on ground
129
{       // 1 -> only in flight   0 -> also on ground
129
//0123456789123456
130
//0123456789123456
130
         {0,0},// "No Error        \0",  // 0
131
         {0,0},// "No Error        \0",  // 0
131
         {SPEAK_ERROR,0},// "Not compatible  \0",  // 1
132
         {SPEAK_ERROR,0},// "Not compatible  \0",  // 1
132
         {SPEAK_ERROR,0},// "MK3Mag not compa\0",  // 2
133
         {SPEAK_ERROR,0},// "MK3Mag not compa\0",  // 2
133
         {SPEAK_ERR_NAVI,1},// "No FC communicat\0",  // 3
134
         {SPEAK_ERR_NAVI,1},// "No FC communicat\0",  // 3
134
         {SPEAK_ERR_COMPASS,1},// "MK3Mag communica\0",  // 4
135
         {SPEAK_ERR_COMPASS,1},// "MK3Mag communica\0",  // 4
135
         {SPEAK_ERR_GPS,0},// "GPS communicatio\0",  // 5
136
         {SPEAK_ERR_GPS,0},// "GPS communicatio\0",  // 5
136
         {SPEAK_ERR_COMPASS,1},// "compass value   \0",  // 6
137
         {SPEAK_ERR_COMPASS,1},// "compass value   \0",  // 6
137
         {SPEAK_ERR_RECEICER,0},// "RC Signal lost  \0",  // 7
138
         {SPEAK_ERR_RECEICER,0},// "RC Signal lost  \0",  // 7
138
         {SPEAK_ERR_NAVI,0},// "FC spi rx error \0",  // 8
139
         {SPEAK_ERR_NAVI,0},// "FC spi rx error \0",  // 8
139
         {SPEAK_ERR_NAVI,0},// "No NC communicat\0",  // 9
140
         {SPEAK_ERR_NAVI,0},// "No NC communicat\0",  // 9
140
         {SPEAK_ERR_SENSOR,0},// "FC Nick Gyro    \0",  // 10
141
         {SPEAK_ERR_SENSOR,0},// "FC Nick Gyro    \0",  // 10
141
         {SPEAK_ERR_SENSOR,0},// "FC Roll Gyro    \0",  // 11
142
         {SPEAK_ERR_SENSOR,0},// "FC Roll Gyro    \0",  // 11
142
         {SPEAK_ERR_SENSOR,0},// "FC Yaw Gyro     \0",  // 12
143
         {SPEAK_ERR_SENSOR,0},// "FC Yaw Gyro     \0",  // 12
143
         {SPEAK_ERR_SENSOR,0},// "FC Nick ACC     \0",  // 13
144
         {SPEAK_ERR_SENSOR,0},// "FC Nick ACC     \0",  // 13
144
         {SPEAK_ERR_SENSOR,0},// "FC Roll ACC     \0",  // 14
145
         {SPEAK_ERR_SENSOR,0},// "FC Roll ACC     \0",  // 14
145
         {SPEAK_ERR_SENSOR,0},// "FC Z-ACC        \0",  // 15
146
         {SPEAK_ERR_SENSOR,0},// "FC Z-ACC        \0",  // 15
146
         {SPEAK_ERR_SENSOR,0},// "Pressure sensor \0",  // 16
147
         {SPEAK_ERR_SENSOR,0},// "Pressure sensor \0",  // 16
147
         {SPEAK_ERR_DATABUS,1},// "I2C FC->BL-Ctrl \0",  // 17
148
         {SPEAK_ERR_DATABUS,1},// "I2C FC->BL-Ctrl \0",  // 17
148
         {SPEAK_ERR_DATABUS,1},// "Bl Missing      \0",  // 18
149
         {SPEAK_ERR_DATABUS,1},// "Bl Missing      \0",  // 18
149
         {SPEAK_ERROR,0},// "Mixer Error     \0",  // 19
150
         {SPEAK_ERROR,0},// "Mixer Error     \0",  // 19
150
         {SPEAK_CF_OFF,1},// "Carefree Error  \0",  // 20
151
         {SPEAK_CF_OFF,1},// "Carefree Error  \0",  // 20
151
         {SPEAK_GPS_FIX,1},// "GPS Fix lost    \0",  // 21
152
         {SPEAK_GPS_FIX,1},// "GPS Fix lost    \0",  // 21
152
         {SPEAK_ERR_COMPASS,0},// "Magnet Error    \0",  // 22
153
         {SPEAK_ERR_COMPASS,0},// "Magnet Error    \0",  // 22
153
         {SPEAK_ERR_MOTOR,1},// "Motor restart   \0",  // 23
154
         {SPEAK_ERR_MOTOR,1},// "Motor restart   \0",  // 23
154
         {SPEAK_MAX_TEMPERAT,1},// "BL Limitation   \0",  // 24
155
         {SPEAK_MAX_TEMPERAT,1},// "BL Limitation   \0",  // 24
155
         {SPEAK_MAX_RANGE,1},// "GPS Range       \0",  // 25
156
         {SPEAK_MAX_RANGE,1},// "GPS Range       \0",  // 25
156
         {SPEAK_ERROR,1},// "No SD-Card      \0",  // 26
157
         {SPEAK_ERROR,1},// "No SD-Card      \0",  // 26
157
         {SPEAK_ERROR,1},// "SD-Logging error\0",  // 27
158
         {SPEAK_ERROR,1},// "SD-Logging error\0",  // 27
158
         {SPEAK_MAX_RANGE,1},// "Flying range!   \0",   // 28
159
         {SPEAK_MAX_RANGE,1},// "Flying range!   \0",   // 28
159
         {SPEAK_MAX_ALTITUD,1}// "Max Altitude!   \0"   // 29
160
         {SPEAK_MAX_ALTITUD,1},// "Max Altitude!   \0"   // 29
-
 
161
         {SPEAK_GPS_FIX,1}// "no GPS Fix,  // 30
160
};
162
};
161
 
-
 
162
 
163
 
163
 
164
 
164
unsigned char MaxBlTempertaure = 0;
165
unsigned char MaxBlTempertaure = 0;
165
unsigned char MinBlTempertaure = 0;
166
unsigned char MinBlTempertaure = 0;
166
unsigned char HottestBl = 0;
167
unsigned char HottestBl = 0;
167
 
168
 
168
void GetHottestBl(void)
169
void GetHottestBl(void)
169
{
170
{
170
 static unsigned char search = 0,tmp_max,tmp_min,who;
171
 static unsigned char search = 0,tmp_max,tmp_min,who;
171
                if(Motor[search].Temperature > tmp_max) { tmp_max = Motor[search].Temperature; who = search;}
172
                if(Motor[search].Temperature > tmp_max) { tmp_max = Motor[search].Temperature; who = search;}
172
                else
173
                else
173
                if(Motor[search].Temperature) if(Motor[search].Temperature < tmp_min) tmp_min = Motor[search].Temperature;
174
                if(Motor[search].Temperature) if(Motor[search].Temperature < tmp_min) tmp_min = Motor[search].Temperature;
174
                if(++search > MAX_MOTORS)
175
                if(++search > MAX_MOTORS)
175
                {
176
                {
176
                 search = 0;
177
                 search = 0;
177
                 if(tmp_min != 255) MinBlTempertaure = tmp_min; else MinBlTempertaure = 0;
178
                 if(tmp_min != 255) MinBlTempertaure = tmp_min; else MinBlTempertaure = 0;
178
                 MaxBlTempertaure = tmp_max;
179
                 MaxBlTempertaure = tmp_max;
179
                 HottestBl = who;
180
                 HottestBl = who;
180
                 tmp_min = 255;
181
                 tmp_min = 255;
181
                 tmp_max = 0;
182
                 tmp_max = 0;
182
                 who = 0;
183
                 who = 0;
183
                 }
184
                 }
184
}
185
}
185
 
186
 
186
//---------------------------------------------------------------
187
//---------------------------------------------------------------
187
void Hott_ClearLine(unsigned char line)
188
void Hott_ClearLine(unsigned char line)
188
{
189
{
189
 HoTT_printfxy(0,line,"                     ");
190
 HoTT_printfxy(0,line,"                     ");
190
}
191
}
191
//---------------------------------------------------------------
192
//---------------------------------------------------------------
192
 
193
 
193
unsigned char HoTT_Waring(void)
194
unsigned char HoTT_Waring(void)
194
{
195
{
195
  unsigned char status = 0;
196
  unsigned char status = 0;
196
  static char old_status = 0;
197
  static char old_status = 0;
197
  static int repeat;
198
  static int repeat;
198
//if(Parameter_UserParam1) return(Parameter_UserParam1); 
199
//if(Parameter_UserParam1) return(Parameter_UserParam1); 
199
//DebugOut.Analog[16] = 0;
200
//DebugOut.Analog[16] = 0;
200
  if(FC_StatusFlags & FC_STATUS_LOWBAT) status = VOICE_MINIMALE_EINGANSSPANNUNG;
201
  if(FC_StatusFlags & FC_STATUS_LOWBAT) status = VOICE_MINIMALE_EINGANSSPANNUNG;
201
  else
202
  else
202
  if(NC_ErrorCode)      
203
  if(NC_ErrorCode)      
203
   {
204
   {
204
    if(MotorenEin || !pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][1])) status = pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][0]);
205
    if(MotorenEin || !pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][1])) status = pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][0]);
205
   }
206
   }
206
 
207
 
207
  if(!status)
208
  if(!status)
208
   {
209
   {
209
        if(!(GetParamByte(PID_SPEAK_HOTT_CFG) & 0x01)) SpeakHoTT = 0;  // is the voice wanted?
210
        if(!(GetParamByte(PID_SPEAK_HOTT_CFG) & 0x01)) SpeakHoTT = 0;  // is the voice wanted?
210
    else status = SpeakHoTT;
211
    else status = SpeakHoTT;
211
   };
212
   };
212
 
213
 
213
  if(old_status == status)
214
  if(old_status == status)
214
   {
215
   {
215
    if(!CheckDelay(repeat)) return(0);
216
    if(!CheckDelay(repeat)) return(0);
216
        repeat = SetDelay(5000);
217
        repeat = SetDelay(5000);
217
   }
218
   }
218
   else repeat = SetDelay(2000);
219
   else repeat = SetDelay(2000);
219
 
220
 
220
  if(status)
221
  if(status)
221
   {
222
   {
222
    if(status == SpeakHoTT) SpeakHoTT = 0;
223
    if(status == SpeakHoTT) SpeakHoTT = 0;
223
   }   
224
   }   
224
  old_status = status;
225
  old_status = status;
225
//  DebugOut.Analog[16] = status;
226
//  DebugOut.Analog[16] = status;
226
  return(status);
227
  return(status);
227
}
228
}
228
 
229
 
229
//---------------------------------------------------------------
230
//---------------------------------------------------------------
230
void NC_Fills_HoTT_Telemety(void)
231
void NC_Fills_HoTT_Telemety(void)
231
{
232
{
232
 unsigned char *ptr = NULL;
233
 unsigned char *ptr = NULL;
233
 unsigned char max = 0,i,z;
234
 unsigned char max = 0,i,z;
234
 switch(FromNaviCtrl.Param.Byte[11])
235
 switch(FromNaviCtrl.Param.Byte[11])
235
  {
236
  {
236
   case HOTT_VARIO_PACKET_ID:
237
   case HOTT_VARIO_PACKET_ID:
237
                ptr = (unsigned char *) &VarioPacket;
238
                ptr = (unsigned char *) &VarioPacket;
238
                max = sizeof(VarioPacket);
239
                max = sizeof(VarioPacket);
239
                break;
240
                break;
240
   case HOTT_GPS_PACKET_ID:
241
   case HOTT_GPS_PACKET_ID:
241
                ptr = (unsigned char *) &GPSPacket;
242
                ptr = (unsigned char *) &GPSPacket;
242
                max = sizeof(GPSPacket);
243
                max = sizeof(GPSPacket);
243
                break;
244
                break;
244
   case HOTT_ELECTRIC_AIR_PACKET_ID:
245
   case HOTT_ELECTRIC_AIR_PACKET_ID:
245
                ptr = (unsigned char *) &ElectricAirPacket;
246
                ptr = (unsigned char *) &ElectricAirPacket;
246
                max = sizeof(ElectricAirPacket);
247
                max = sizeof(ElectricAirPacket);
247
                break;
248
                break;
248
   case HOTT_GENERAL_PACKET_ID:
249
   case HOTT_GENERAL_PACKET_ID:
249
                ptr = (unsigned char *) &HoTTGeneral;
250
                ptr = (unsigned char *) &HoTTGeneral;
250
                max = sizeof(HoTTGeneral);
251
                max = sizeof(HoTTGeneral);
251
                break;
252
                break;
252
  }
253
  }
253
 z = FromNaviCtrl.Param.Byte[0]; // Data allocation
254
 z = FromNaviCtrl.Param.Byte[0]; // Data allocation
254
 
255
 
255
 for(i=0; i < FromNaviCtrl.Param.Byte[1]; i++)
256
 for(i=0; i < FromNaviCtrl.Param.Byte[1]; i++)
256
  {
257
  {
257
   if(z >= max) break;
258
   if(z >= max) break;
258
   ptr[z] = FromNaviCtrl.Param.Byte[2+i];
259
   ptr[z] = FromNaviCtrl.Param.Byte[2+i];
259
   z++;
260
   z++;
260
  }
261
  }
261
}
262
}
262
 
263
 
263
unsigned int BuildHoTT_Vario(void)
264
unsigned int BuildHoTT_Vario(void)
264
{
265
{
265
 unsigned int tmp = 30000;
266
 unsigned int tmp = 30000;
266
 if(VarioCharacter == '+' || VarioCharacter == '-')
267
 if(VarioCharacter == '+' || VarioCharacter == '-')
267
  {
268
  {
268
   tmp = 30000 + (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 3;
269
   tmp = 30000 + (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 3;
269
   if(tmp < 30000 && tmp > 30000 - 50) tmp = 30000 - 50; // weil es sonst erst bei < 0,5m/sek piept
270
   if(tmp < 30000 && tmp > 30000 - 50) tmp = 30000 - 50; // weil es sonst erst bei < 0,5m/sek piept
270
  }
271
  }
271
 else
272
 else
272
 if((VarioCharacter == ' ') && (FC_StatusFlags & FC_STATUS_FLY))
273
 if((VarioCharacter == ' ') && (FC_StatusFlags & FC_STATUS_FLY))
273
  {
274
  {
274
   tmp = 30000 + HoTTVarioMeter;
275
   tmp = 30000 + HoTTVarioMeter;
275
   if(tmp > 30000)
276
   if(tmp > 30000)
276
    {
277
    {
277
     if(tmp < 30000 + 100) tmp = 30000;
278
     if(tmp < 30000 + 100) tmp = 30000;
278
         else tmp -= 100;
279
         else tmp -= 100;
279
        }
280
        }
280
   if(tmp < 30000)
281
   if(tmp < 30000)
281
    {
282
    {
282
     if(tmp > 30000 - 100) tmp = 30000;
283
     if(tmp > 30000 - 100) tmp = 30000;
283
         else tmp += 100;
284
         else tmp += 100;
284
        }
285
        }
285
  }
286
  }
286
 else
287
 else
287
 if(VarioCharacter == '^') tmp = 30000 + FromNC_AltitudeSpeed * 10;
288
 if(VarioCharacter == '^') tmp = 30000 + FromNC_AltitudeSpeed * 10;
288
 else
289
 else
289
 if(VarioCharacter == 'v') tmp = 30000 - FromNC_AltitudeSpeed * 10;
290
 if(VarioCharacter == 'v') tmp = 30000 - FromNC_AltitudeSpeed * 10;
290
 
291
 
291
 return(tmp);
292
 return(tmp);
292
}
293
}
293
 
294
 
294
 
295
 
295
//---------------------------------------------------------------
296
//---------------------------------------------------------------
296
unsigned char HoTT_Telemety(unsigned char packet_request)
297
unsigned char HoTT_Telemety(unsigned char packet_request)
297
{
298
{
298
unsigned char i;
299
unsigned char i;
299
  //Debug("rqst: %02X",packet_request);
300
  //Debug("rqst: %02X",packet_request);
300
 
301
 
301
 switch(packet_request)
302
 switch(packet_request)
302
 {
303
 {
303
  case HOTT_VARIO_PACKET_ID:
304
  case HOTT_VARIO_PACKET_ID:
304
                VarioPacket.Altitude = HoehenWert/100 + 500;  
305
                VarioPacket.Altitude = HoehenWert/100 + 500;  
305
                VarioPacket.m_sec = BuildHoTT_Vario();
306
                VarioPacket.m_sec = BuildHoTT_Vario();
306
                VarioPacket.m_3sec = VarioPacket.m_sec;
307
                VarioPacket.m_3sec = VarioPacket.m_sec;
307
                VarioPacket.m_10sec = VarioPacket.m_sec;
308
                VarioPacket.m_10sec = VarioPacket.m_sec;
308
                if (VarioPacket.Altitude < VarioPacket.MinAltitude) VarioPacket.MinAltitude = VarioPacket.Altitude;
309
                if (VarioPacket.Altitude < VarioPacket.MinAltitude) VarioPacket.MinAltitude = VarioPacket.Altitude;
309
                if (VarioPacket.Altitude > VarioPacket.MaxAltitude) VarioPacket.MaxAltitude = VarioPacket.Altitude;            
310
                if (VarioPacket.Altitude > VarioPacket.MaxAltitude) VarioPacket.MaxAltitude = VarioPacket.Altitude;            
310
                VarioPacket.WarnBeep = 0;//HoTT_Waring();
311
                VarioPacket.WarnBeep = 0;//HoTT_Waring();
311
                HoTT_DataPointer = (unsigned char *) &VarioPacket;
312
                HoTT_DataPointer = (unsigned char *) &VarioPacket;
312
        VarioPacket.FreeCharacters[0] = VarioCharacter;
313
        VarioPacket.FreeCharacters[0] = VarioCharacter;
313
    if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) VarioPacket.FreeCharacters[1] = 'C'; else VarioPacket.FreeCharacters[1] = ' ';
314
    if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) VarioPacket.FreeCharacters[1] = 'C'; else VarioPacket.FreeCharacters[1] = ' ';
314
//      VarioPacket.FreeCharacters[2] = ' ';
315
//      VarioPacket.FreeCharacters[2] = ' ';
315
    if(NC_ErrorCode)
316
    if(NC_ErrorCode)
316
         {
317
         {
317
                for(i=0; i<16;i++) VarioPacket.Text[i+4] = pgm_read_byte(&NC_ERROR_TEXT[NC_ErrorCode][i]);
318
                for(i=0; i<16;i++) VarioPacket.Text[i+4] = pgm_read_byte(&NC_ERROR_TEXT[NC_ErrorCode][i]);
318
                VarioPacket.Text[0] = NC_ErrorCode/10 + '0';
319
                VarioPacket.Text[0] = NC_ErrorCode/10 + '0';
319
                VarioPacket.Text[1] = NC_ErrorCode%10 + '0';
320
                VarioPacket.Text[1] = NC_ErrorCode%10 + '0';
320
                VarioPacket.Text[2] = ':';
321
                VarioPacket.Text[2] = ':';
321
         }
322
         }
322
         else
323
         else
323
         if(FC_StatusFlags & FC_STATUS_LOWBAT) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&UNDERVOLTAGE[i]); // no Error
324
         if(FC_StatusFlags & FC_STATUS_LOWBAT) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&UNDERVOLTAGE[i]); // no Error
324
         else    
325
         else    
325
         for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&MIKROKOPTER[i]); // no Error
326
         for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&MIKROKOPTER[i]); // no Error
326
         
327
         
327
                return(sizeof(VarioPacket));
328
                return(sizeof(VarioPacket));
328
                break;
329
                break;
329
 
330
 
330
  case HOTT_GPS_PACKET_ID:
331
  case HOTT_GPS_PACKET_ID:
331
                GPSPacket.Altitude = HoehenWert/100 + 500;  
332
                GPSPacket.Altitude = HoehenWert/100 + 500;  
332
//              GPSPacket.Distance = GPSInfo.HomeDistance/10;  // macht die NC
333
//              GPSPacket.Distance = GPSInfo.HomeDistance/10;  // macht die NC
333
//              GPSPacket.Heading = GPSInfo.HomeBearing/2;     // macht die NC
334
//              GPSPacket.Heading = GPSInfo.HomeBearing/2;     // macht die NC
334
//              GPSPacket.Speed = (GPSInfo.Speed * 36) / 10;   // macht die NC
335
//              GPSPacket.Speed = (GPSInfo.Speed * 36) / 10;   // macht die NC
335
                GPSPacket.m_sec = BuildHoTT_Vario();
336
                GPSPacket.m_sec = BuildHoTT_Vario();
336
                GPSPacket.m_3sec = 120;
337
                GPSPacket.m_3sec = 120;
337
                GPSPacket.NumOfSats = GPSInfo.NumOfSats;
338
                GPSPacket.NumOfSats = GPSInfo.NumOfSats;
338
                GPSPacket.WarnBeep = HoTT_Waring();
339
                GPSPacket.WarnBeep = HoTT_Waring();
339
                if(GPSInfo.Flags & FLAG_DIFFSOLN) GPSPacket.SatFix = 'D';
340
                if(GPSInfo.Flags & FLAG_DIFFSOLN) GPSPacket.SatFix = 'D';
340
                else
341
                else
341
        if(GPSInfo.SatFix == SATFIX_3D) GPSPacket.SatFix = ' ';
342
        if(GPSInfo.SatFix == SATFIX_3D) GPSPacket.SatFix = ' ';
342
                else GPSPacket.SatFix = '!';
343
                else GPSPacket.SatFix = '!';
343
                HoTT_DataPointer = (unsigned char *) &GPSPacket;
344
                HoTT_DataPointer = (unsigned char *) &GPSPacket;
344
                GPSPacket.FreeCharacters[0] = NC_GPS_ModeCharacter;
345
                GPSPacket.FreeCharacters[0] = NC_GPS_ModeCharacter;
345
                GPSPacket.FreeCharacters[2] = GPSPacket.SatFix;
346
                GPSPacket.FreeCharacters[2] = GPSPacket.SatFix;
346
                GPSPacket.HomeDirection = GPSInfo.HomeBearing / 2;//230;
347
                GPSPacket.HomeDirection = GPSInfo.HomeBearing / 2;//230;
347
                return(sizeof(GPSPacket));  
348
                return(sizeof(GPSPacket));  
348
                break;
349
                break;
349
  case HOTT_ELECTRIC_AIR_PACKET_ID:
350
  case HOTT_ELECTRIC_AIR_PACKET_ID:
350
                GetHottestBl();
351
                GetHottestBl();
351
                ElectricAirPacket.Altitude = HoehenWert/100 + 500;
352
                ElectricAirPacket.Altitude = HoehenWert/100 + 500;
352
                ElectricAirPacket.Battery1 = UBat;
353
                ElectricAirPacket.Battery1 = UBat;
353
                ElectricAirPacket.Battery2 = UBat;
354
                ElectricAirPacket.Battery2 = UBat;
354
                ElectricAirPacket.VoltageCell1 = ErsatzKompassInGrad / 2;
355
                ElectricAirPacket.VoltageCell1 = ErsatzKompassInGrad / 2;
355
                ElectricAirPacket.VoltageCell8 = ElectricAirPacket.VoltageCell1;
356
                ElectricAirPacket.VoltageCell8 = ElectricAirPacket.VoltageCell1;
356
                ElectricAirPacket.VoltageCell6 = GPSInfo.HomeBearing / 2;
357
                ElectricAirPacket.VoltageCell6 = GPSInfo.HomeBearing / 2;
357
                ElectricAirPacket.VoltageCell7 = GPSInfo.HomeDistance/20;
358
                ElectricAirPacket.VoltageCell7 = GPSInfo.HomeDistance/20;
358
                ElectricAirPacket.VoltageCell13 = ElectricAirPacket.VoltageCell6;
359
                ElectricAirPacket.VoltageCell13 = ElectricAirPacket.VoltageCell6;
359
                ElectricAirPacket.VoltageCell14 = ElectricAirPacket.VoltageCell7;
360
                ElectricAirPacket.VoltageCell14 = ElectricAirPacket.VoltageCell7;
360
                ElectricAirPacket.m_sec = BuildHoTT_Vario();
361
                ElectricAirPacket.m_sec = BuildHoTT_Vario();
361
                ElectricAirPacket.m_3sec = 120;
362
                ElectricAirPacket.m_3sec = 120;
362
                ElectricAirPacket.InputVoltage = UBat;
363
                ElectricAirPacket.InputVoltage = UBat;
363
                ElectricAirPacket.Temperature1 = MinBlTempertaure + 20;
364
                ElectricAirPacket.Temperature1 = MinBlTempertaure + 20;
364
                ElectricAirPacket.Temperature2 = MaxBlTempertaure + 20;
365
                ElectricAirPacket.Temperature2 = MaxBlTempertaure + 20;
365
                ElectricAirPacket.Capacity = Capacity.UsedCapacity/10;
366
                ElectricAirPacket.Capacity = Capacity.UsedCapacity/10;
366
                ElectricAirPacket.WarnBeep = 0;//HoTT_Waring();
367
                ElectricAirPacket.WarnBeep = 0;//HoTT_Waring();
367
                ElectricAirPacket.Current = Capacity.ActualCurrent;
368
                ElectricAirPacket.Current = Capacity.ActualCurrent;
368
                HoTT_DataPointer = (unsigned char *) &ElectricAirPacket;
369
                HoTT_DataPointer = (unsigned char *) &ElectricAirPacket;
369
                ElectricAirPacket.FlightTimeMinutes = FlugSekunden / 60;
370
                ElectricAirPacket.FlightTimeMinutes = FlugSekunden / 60;
370
                ElectricAirPacket.FlightTimeSeconds = FlugSekunden % 60;
371
                ElectricAirPacket.FlightTimeSeconds = FlugSekunden % 60;
371
                return(sizeof(ElectricAirPacket));
372
                return(sizeof(ElectricAirPacket));
372
                break;
373
                break;
373
  case HOTT_GENERAL_PACKET_ID:
374
  case HOTT_GENERAL_PACKET_ID:
374
                GetHottestBl();
375
                GetHottestBl();
375
                HoTTGeneral.Rpm = GPSInfo.HomeDistance/100;
376
                HoTTGeneral.Rpm = GPSInfo.HomeDistance/100;
376
                HoTTGeneral.VoltageCell1 = ErsatzKompassInGrad / 2;
377
                HoTTGeneral.VoltageCell1 = ErsatzKompassInGrad / 2;
377
                HoTTGeneral.VoltageCell6 = GPSInfo.HomeBearing / 2;
378
                HoTTGeneral.VoltageCell6 = GPSInfo.HomeBearing / 2;
378
                if(UBat > BattLowVoltageWarning + 5) HoTTGeneral.FuelPercent = (UBat - (BattLowVoltageWarning + 6)) * 3;
379
                if(UBat > BattLowVoltageWarning + 5) HoTTGeneral.FuelPercent = (UBat - (BattLowVoltageWarning + 6)) * 3;
379
                else HoTTGeneral.FuelPercent = 0;
380
                else HoTTGeneral.FuelPercent = 0;
380
                HoTTGeneral.FuelCapacity = HoehenWert/100;
381
                HoTTGeneral.FuelCapacity = HoehenWert/100;
381
                if(HoTTGeneral.FuelCapacity < 0) HoTTGeneral.FuelCapacity = 0;
382
                if(HoTTGeneral.FuelCapacity < 0) HoTTGeneral.FuelCapacity = 0;
382
                HoTTGeneral.Altitude = HoehenWert/100 + 500;
383
                HoTTGeneral.Altitude = HoehenWert/100 + 500;
383
                HoTTGeneral.Battery1 = UBat;
384
                HoTTGeneral.Battery1 = UBat;
384
                HoTTGeneral.Battery2 = UBat;
385
                HoTTGeneral.Battery2 = UBat;
385
                HoTTGeneral.m_sec =  BuildHoTT_Vario();
386
                HoTTGeneral.m_sec =  BuildHoTT_Vario();
386
                HoTTGeneral.m_3sec = 120;
387
                HoTTGeneral.m_3sec = 120;
387
                HoTTGeneral.InputVoltage = UBat;
388
                HoTTGeneral.InputVoltage = UBat;
388
                HoTTGeneral.Temperature1 = MinBlTempertaure + 20;
389
                HoTTGeneral.Temperature1 = MinBlTempertaure + 20;
389
                HoTTGeneral.Temperature2 = MaxBlTempertaure + 20;
390
                HoTTGeneral.Temperature2 = MaxBlTempertaure + 20;
390
                HoTTGeneral.Capacity = Capacity.UsedCapacity/10;
391
                HoTTGeneral.Capacity = Capacity.UsedCapacity/10;
391
                HoTTGeneral.WarnBeep = 0;//HoTT_Waring();
392
                HoTTGeneral.WarnBeep = 0;//HoTT_Waring();
392
                HoTTGeneral.Current = Capacity.ActualCurrent;
393
                HoTTGeneral.Current = Capacity.ActualCurrent;
393
                HoTT_DataPointer = (unsigned char *) &HoTTGeneral;
394
                HoTT_DataPointer = (unsigned char *) &HoTTGeneral;
394
                return(sizeof(HoTTGeneral));
395
                return(sizeof(HoTTGeneral));
395
                break;
396
                break;
396
  default: return(0);
397
  default: return(0);
397
  }            
398
  }            
398
}
399
}
399
 
400
 
400
//---------------------------------------------------------------
401
//---------------------------------------------------------------
401
void HoTT_Menu(void)
402
void HoTT_Menu(void)
402
{
403
{
403
 static unsigned char line, page = 0,show_current = 0,show_mag = 0, show_poti = 0;
404
 static unsigned char line, page = 0,show_current = 0,show_mag = 0, show_poti = 0;
404
 unsigned char tmp;
405
 unsigned char tmp;
405
 HoTTVarioMeter = (HoTTVarioMeter * 7 + VarioMeter) / 8;
406
 HoTTVarioMeter = (HoTTVarioMeter * 7 + VarioMeter) / 8;
406
 
407
 
407
 if(page == 0)
408
 if(page == 0)
408
  switch(line++)
409
  switch(line++)
409
  {
410
  {
410
        case 0:  
411
        case 0:  
411
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
412
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
412
                         HoTT_printfxy_BLINK(0,0,"  %2i.%1iV  ",UBat/10, UBat%10)
413
                         HoTT_printfxy_BLINK(0,0,"  %2i.%1iV  ",UBat/10, UBat%10)
413
                        else
414
                        else
414
                         HoTT_printfxy(0,0,"  %2i.%1iV  ",UBat/10, UBat%10)
415
                         HoTT_printfxy(0,0,"  %2i.%1iV  ",UBat/10, UBat%10)
415
 
416
 
416
                        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
417
                        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
417
                          {
418
                          {
418
                           if(HoehenReglerAktiv)        HoTT_printfxy_INV(10,0,"ALT:%4im %c", (int16_t)(HoehenWert/100),VarioCharacter)
419
                           if(HoehenReglerAktiv)        HoTT_printfxy_INV(10,0,"ALT:%4im %c", (int16_t)(HoehenWert/100),VarioCharacter)
419
                           else                                         HoTT_printfxy(10,0,"ALT:%4im  ", (int16_t)(HoehenWert/100))
420
                           else                                         HoTT_printfxy(10,0,"ALT:%4im  ", (int16_t)(HoehenWert/100))
420
                           }
421
                           }
421
            else    HoTT_printfxy(10,0,"ALT:---- ");
422
            else    HoTT_printfxy(10,0,"ALT:---- ");
422
                        break;
423
                        break;
423
        case 1:  
424
        case 1:  
424
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
425
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
425
                         HoTT_printfxy_BLINK(0,1,"  %2i:%02i  ",FlugSekunden/60,FlugSekunden%60)
426
                         HoTT_printfxy_BLINK(0,1,"  %2i:%02i  ",FlugSekunden/60,FlugSekunden%60)
426
            else   HoTT_printfxy(0,1,"  %2i:%02i  ",FlugSekunden/60,FlugSekunden%60);                      
427
            else   HoTT_printfxy(0,1,"  %2i:%02i  ",FlugSekunden/60,FlugSekunden%60);                      
427
                        HoTT_printfxy(10,1,"DIR: %3d%c",ErsatzKompassInGrad, HoTT_GRAD);
428
                        HoTT_printfxy(10,1,"DIR: %3d%c",ErsatzKompassInGrad, HoTT_GRAD);
428
                        if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(20,1,"C") else HoTT_printfxy(20,1," ");
429
                        if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(20,1,"C") else HoTT_printfxy(20,1," ");
429
            break;
430
            break;
430
        case 2:
431
        case 2:
431
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
432
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
432
                         HoTT_printfxy_BLINK(0,2,"  %5i  ",Capacity.UsedCapacity)
433
                         HoTT_printfxy_BLINK(0,2,"  %5i  ",Capacity.UsedCapacity)
433
            else   HoTT_printfxy(0,2,"  %5i  ",Capacity.UsedCapacity);                     
434
            else   HoTT_printfxy(0,2,"  %5i  ",Capacity.UsedCapacity);                     
434
                        HoTT_printfxy(12,2,"I:%2i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
435
                        HoTT_printfxy(12,2,"I:%2i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
435
                        break;
436
                        break;
436
        case 3:
437
        case 3:
437
                        HoTT_printfxy(9,0,":");
438
                        HoTT_printfxy(9,0,":");
438
                        HoTT_printfxy(9,1,":");
439
                        HoTT_printfxy(9,1,":");
439
                        HoTT_printfxy(9,2,":");
440
                        HoTT_printfxy(9,2,":");
440
                        HoTT_printfxy(0,3,"---------+-----------");
441
                        HoTT_printfxy(0,3,"---------+-----------");
441
 
442
 
442
//                      HoTT_printfxy(0,3,"---------------------");
443
//                      HoTT_printfxy(0,3,"---------------------");
443
                        HoTT_printfxy(0,6,"---------------------");
444
                        HoTT_printfxy(0,6,"---------------------");
444
                        break;
445
                        break;
445
        case 4:  
446
        case 4:  
446
                        if(NaviDataOkay)
447
                        if(NaviDataOkay)
447
                        {
448
                        {
448
                                HoTT_printfxy(9,4,":");
449
                                HoTT_printfxy(9,4,":");
449
                                HoTT_printfxy(0,4,"SAT:%2d ",GPSInfo.NumOfSats);
450
                                HoTT_printfxy(0,4,"SAT:%2d ",GPSInfo.NumOfSats);
450
                            HoTT_printfxy(10,4,"DIST:%3dm",GPSInfo.HomeDistance/10);
451
                            HoTT_printfxy(10,4,"DIST:%3dm",GPSInfo.HomeDistance/10);
451
                                switch (GPSInfo.SatFix)
452
                                switch (GPSInfo.SatFix)
452
                                {
453
                                {
453
                                        case SATFIX_3D:
454
                                        case SATFIX_3D:
454
                                                        if(GPSInfo.Flags & FLAG_DIFFSOLN) HoTT_printfxy(7,4,"D ")
455
                                                        if(GPSInfo.Flags & FLAG_DIFFSOLN) HoTT_printfxy(7,4,"D ")
455
                                                        else HoTT_printfxy(7,4,"3D");
456
                                                        else HoTT_printfxy(7,4,"3D");
456
                                                break;
457
                                                break;
457
                                        default:
458
                                        default:
458
                                                HoTT_printfxy_BLINK(7,4,"!!");
459
                                                HoTT_printfxy_BLINK(7,4,"!!");
459
                                                break;
460
                                                break;
460
                                }      
461
                                }      
461
                        }
462
                        }
462
                        else
463
                        else
463
                        {                    
464
                        {                    
464
                                Hott_ClearLine(4);
465
                                Hott_ClearLine(4);
465
                        }
466
                        }
466
                        break;
467
                        break;
467
        case 5:
468
        case 5:
468
                        if(NaviDataOkay)
469
                        if(NaviDataOkay)
469
                        {
470
                        {
470
                        if(show_mag)
471
                        if(show_mag)
471
                          {
472
                          {
472
                                HoTT_printfxy(0,5,"MAG:%3u%% ",EarthMagneticField);
473
                                HoTT_printfxy(0,5,"MAG:%3u%% ",EarthMagneticField);
473
                            HoTT_printfxy(12,5,"HM:%3d%c %c", GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter);
474
                            HoTT_printfxy(12,5,"HM:%3d%c %c", GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter);
474
                                HoTT_printfxy(9,5,"incl:%2d%c(%2i)",EarthMagneticInclination, HoTT_GRAD,EarthMagneticInclinationTheoretic);
475
                                HoTT_printfxy(9,5,"incl:%2d%c(%2i)",EarthMagneticInclination, HoTT_GRAD,EarthMagneticInclinationTheoretic);
475
              }
476
              }
476
                         else
477
                         else
477
                          {
478
                          {
478
                                HoTT_printfxy(0,5,"    %2um/s:  HM:%3d%c %c",GPSInfo.Speed, GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter);
479
                                HoTT_printfxy(0,5,"    %2um/s:  HM:%3d%c %c",GPSInfo.Speed, GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter);
479
                          }    
480
                          }    
480
            }
481
            }
481
                        else Hott_ClearLine(5);
482
                        else Hott_ClearLine(5);
482
                        break;
483
                        break;
483
        case 6:
484
        case 6:
484
                        break;
485
                        break;
485
        case 7: if(NC_ErrorCode)
486
        case 7: if(NC_ErrorCode)
486
                  {
487
                  {
487
                           if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER)
488
                           if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER)
488
                            {
489
                            {
489
                             Hott_ClearLine(7);
490
                             Hott_ClearLine(7);
490
                             HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode);
491
                             HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode);
491
                            }
492
                            }
492
                                else
493
                                else
493
                                {
494
                                {
494
                                 HoTT_printfxy(0,7,"ERR: ");     _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);};
495
                                 HoTT_printfxy(0,7,"ERR: ");     _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);};
495
                                }
496
                                }
496
                        else
497
                        else
497
                        if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!")
498
                        if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!")
498
                        else HoTT_printfxy(0,7," www.MikroKopter.de  ");
499
                        else HoTT_printfxy(0,7," www.MikroKopter.de  ");
499
                        break;
500
                        break;
500
        case 8: //ASCIIPacket.WarnBeep = HoTT_Waring();
501
        case 8: //ASCIIPacket.WarnBeep = HoTT_Waring();
501
                        // ASCIIPacket.WarnBeep = Parameter_UserParam1;
502
                        // ASCIIPacket.WarnBeep = Parameter_UserParam1;
502
        case 9:
503
        case 9:
503
        case 10:
504
        case 10:
504
        case 11:
505
        case 11:
505
        case 12:
506
        case 12:
506
        case 13:
507
        case 13:
507
        case 14:  
508
        case 14:  
508
        case 15:  
509
        case 15:  
509
        case 16:  
510
        case 16:  
510
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_mag) show_mag = 0; else show_mag = 1;}
511
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_mag) show_mag = 0; else show_mag = 1;}
511
                        else
512
                        else
512
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 1; line = 0;};
513
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 1; line = 0;};
513
                        HottKeyboard = 0;
514
                        HottKeyboard = 0;
514
                        break;
515
                        break;
515
   default:  line = 0;
516
   default:  line = 0;
516
                        break;
517
                        break;
517
  }
518
  }
518
  else
519
  else
519
  if(page == 1)
520
  if(page == 1)
520
  switch(line++)
521
  switch(line++)
521
  {
522
  {
522
        case 0:  
523
        case 0:  
523
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
524
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
524
                         HoTT_printfxy_BLINK(0,0," %2i:%02i  %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity)
525
                         HoTT_printfxy_BLINK(0,0," %2i:%02i  %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity)
525
            else   HoTT_printfxy(0,0," %2i:%02i  %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity);                         
526
            else   HoTT_printfxy(0,0," %2i:%02i  %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity);                         
526
                        break;
527
                        break;
527
        case 1:  
528
        case 1:  
528
                        HoTT_printfxy(0,1,"DIR:%3d%c",KompassValue, HoTT_GRAD);
529
                        HoTT_printfxy(0,1,"DIR:%3d%c",KompassValue, HoTT_GRAD);
529
                        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
530
                        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
530
                          {
531
                          {
531
                           if(HoehenReglerAktiv)        HoTT_printfxy_INV(10,1,"ALT:%4im", (int16_t)(HoehenWert/100))
532
                           if(HoehenReglerAktiv)        HoTT_printfxy_INV(10,1,"ALT:%4im", (int16_t)(HoehenWert/100))
532
                           else                                         HoTT_printfxy(10,1,"ALT:%4im", (int16_t)(HoehenWert/100))
533
                           else                                         HoTT_printfxy(10,1,"ALT:%4im", (int16_t)(HoehenWert/100))
533
                           }
534
                           }
534
            else    HoTT_printfxy(10,1,"ALT:---- ");
535
            else    HoTT_printfxy(10,1,"ALT:---- ");
535
                        HoTT_printfxy(20,1,"%c",VarioCharacter);
536
                        HoTT_printfxy(20,1,"%c",VarioCharacter);
536
            break;
537
            break;
537
        case 2:
538
        case 2:
538
                        if(NaviDataOkay)
539
                        if(NaviDataOkay)
539
                        {
540
                        {
540
                          HoTT_printfxy(1,2,"HM:%3d%c  DIST:%3dm %c", GPSInfo.HomeBearing, HoTT_GRAD, GPSInfo.HomeDistance/10, NC_GPS_ModeCharacter);
541
                          HoTT_printfxy(1,2,"HM:%3d%c  DIST:%3dm %c", GPSInfo.HomeBearing, HoTT_GRAD, GPSInfo.HomeDistance/10, NC_GPS_ModeCharacter);
541
            }
542
            }
542
                        else
543
                        else
543
                        {
544
                        {
544
                         Hott_ClearLine(2);
545
                         Hott_ClearLine(2);
545
                        }
546
                        }
546
                        break;
547
                        break;
547
        case 3:
548
        case 3:
548
                        HoTT_printfxy(0,3,"PWR:%2i.%1iA (%iW) ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10,Capacity.ActualPower);
549
                        HoTT_printfxy(0,3,"PWR:%2i.%1iA (%iW) ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10,Capacity.ActualPower);
549
                        if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(19,3,"CF") else HoTT_printfxy(19,3,"  ");
550
                        if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(19,3,"CF") else HoTT_printfxy(19,3,"  ");
550
                        break;
551
                        break;
551
        case 4:  
552
        case 4:  
552
                        if(NaviDataOkay)
553
                        if(NaviDataOkay)
553
                        {
554
                        {
554
                                HoTT_printfxy(0,4,"GPS:%2um/s SAT:%d ",GPSInfo.Speed,GPSInfo.NumOfSats);
555
                                HoTT_printfxy(0,4,"GPS:%2um/s SAT:%d ",GPSInfo.Speed,GPSInfo.NumOfSats);
555
                                switch (GPSInfo.SatFix)
556
                                switch (GPSInfo.SatFix)
556
                                {
557
                                {
557
                                        case SATFIX_3D:
558
                                        case SATFIX_3D:
558
                                                HoTT_printfxy(16,4,"  3D ");
559
                                                HoTT_printfxy(16,4,"  3D ");
559
                                                break;
560
                                                break;
560
                                        //case SATFIX_2D:
561
                                        //case SATFIX_2D:
561
                                        //case SATFIX_NONE:
562
                                        //case SATFIX_NONE:
562
                                        default:
563
                                        default:
563
                                                HoTT_printfxy_BLINK(16,4,"NOFIX");
564
                                                HoTT_printfxy_BLINK(16,4,"NOFIX");
564
                                                break;
565
                                                break;
565
                                }      
566
                                }      
566
                                if(GPSInfo.Flags & FLAG_DIFFSOLN)
567
                                if(GPSInfo.Flags & FLAG_DIFFSOLN)
567
                                {
568
                                {
568
                                        HoTT_printfxy(16,4,"DGPS ");
569
                                        HoTT_printfxy(16,4,"DGPS ");
569
                                }
570
                                }
570
                        }
571
                        }
571
                        else
572
                        else
572
                        {                    //012345678901234567890
573
                        {                    //012345678901234567890
573
                                HoTT_printfxy(0,4,"   No NaviCtrl       ");
574
                                HoTT_printfxy(0,4,"   No NaviCtrl       ");
574
                        }
575
                        }
575
                        break;
576
                        break;
576
        case 5:
577
        case 5:
577
                        if(show_current)
578
                        if(show_current)
578
                         {
579
                         {
579
                                HoTT_printfxy(0,5,"%2i.%i %2i.%i %2i.%i %2i.%iA", Motor[0].Current/10,Motor[0].Current%10,Motor[1].Current/10,Motor[1].Current%10,Motor[2].Current/10,Motor[2].Current%10,Motor[3].Current/10,Motor[3].Current%10);
580
                                HoTT_printfxy(0,5,"%2i.%i %2i.%i %2i.%i %2i.%iA", Motor[0].Current/10,Motor[0].Current%10,Motor[1].Current/10,Motor[1].Current%10,Motor[2].Current/10,Motor[2].Current%10,Motor[3].Current/10,Motor[3].Current%10);
580
                         }
581
                         }
581
                         else
582
                         else
582
                         {
583
                         {
583
                                HoTT_printfxy(0,5,"%3i %3i %3i %3i%cC", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature,HoTT_GRAD);
584
                                HoTT_printfxy(0,5,"%3i %3i %3i %3i%cC", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature,HoTT_GRAD);
584
                         }
585
                         }
585
                        break;
586
                        break;
586
        case 6:
587
        case 6:
587
                        if(show_current)
588
                        if(show_current)
588
                         {
589
                         {
589
                    if(RequiredMotors == 4) Hott_ClearLine(6);
590
                    if(RequiredMotors == 4) Hott_ClearLine(6);
590
                                else
591
                                else
591
                                if(RequiredMotors == 6)  HoTT_printfxy(0,6,"%2i.%i %2i.%iA", Motor[4].Current/10,Motor[4].Current%10,Motor[5].Current/10,Motor[5].Current%10)
592
                                if(RequiredMotors == 6)  HoTT_printfxy(0,6,"%2i.%i %2i.%iA", Motor[4].Current/10,Motor[4].Current%10,Motor[5].Current/10,Motor[5].Current%10)
592
                                else
593
                                else
593
                                if(RequiredMotors > 6)   HoTT_printfxy(0,6,"%2i.%i %2i.%i %2i.%i %2i.%iA", Motor[4].Current/10,Motor[4].Current%10,Motor[5].Current/10,Motor[5].Current%10,Motor[6].Current/10,Motor[6].Current%10,Motor[7].Current/10,Motor[7].Current%10);
594
                                if(RequiredMotors > 6)   HoTT_printfxy(0,6,"%2i.%i %2i.%i %2i.%i %2i.%iA", Motor[4].Current/10,Motor[4].Current%10,Motor[5].Current/10,Motor[5].Current%10,Motor[6].Current/10,Motor[6].Current%10,Motor[7].Current/10,Motor[7].Current%10);
594
             }
595
             }
595
                         else
596
                         else
596
                         {
597
                         {
597
                    if(RequiredMotors == 4) Hott_ClearLine(6);
598
                    if(RequiredMotors == 4) Hott_ClearLine(6);
598
                                else
599
                                else
599
                                if(RequiredMotors == 6)  HoTT_printfxy(0,6,"%3i %3i%cC        ", Motor[4].Temperature, Motor[5].Temperature,HoTT_GRAD)
600
                                if(RequiredMotors == 6)  HoTT_printfxy(0,6,"%3i %3i%cC        ", Motor[4].Temperature, Motor[5].Temperature,HoTT_GRAD)
600
                                else
601
                                else
601
                                if(RequiredMotors > 6)   HoTT_printfxy(0,6,"%3i %3i %3i %3i%cC", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature,HoTT_GRAD);
602
                                if(RequiredMotors > 6)   HoTT_printfxy(0,6,"%3i %3i %3i %3i%cC", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature,HoTT_GRAD);
602
             }
603
             }
603
                        break;
604
                        break;
604
        case 7: if(NC_ErrorCode)
605
        case 7: if(NC_ErrorCode)
605
                  {
606
                  {
606
                           if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER)
607
                           if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER)
607
                            {
608
                            {
608
                             Hott_ClearLine(7);
609
                             Hott_ClearLine(7);
609
                             HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode);
610
                             HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode);
610
                            }
611
                            }
611
                                else
612
                                else
612
                                {
613
                                {
613
                                 HoTT_printfxy(0,7,"ERR: ");     _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);};
614
                                 HoTT_printfxy(0,7,"ERR: ");     _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);};
614
                                }
615
                                }
615
                        else
616
                        else
616
                        if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!")
617
                        if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!")
617
                        else HoTT_printfxy(0,7," www.MikroKopter.de  ");
618
                        else HoTT_printfxy(0,7," www.MikroKopter.de  ");
618
                        break;
619
                        break;
619
        case 8: // ASCIIPacket.WarnBeep = HoTT_Waring();
620
        case 8: // ASCIIPacket.WarnBeep = HoTT_Waring();
620
                        // ASCIIPacket.WarnBeep = Parameter_UserParam1;
621
                        // ASCIIPacket.WarnBeep = Parameter_UserParam1;
621
        case 9:
622
        case 9:
622
        case 10:
623
        case 10:
623
        case 11:
624
        case 11:
624
        case 12:
625
        case 12:
625
        case 13:
626
        case 13:
626
        case 14:  
627
        case 14:  
627
        case 15:  
628
        case 15:  
628
        case 16:  
629
        case 16:  
629
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_current) show_current = 0; else show_current = 1;   Hott_ClearLine(5);  Hott_ClearLine(6);}
630
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_current) show_current = 0; else show_current = 1;   Hott_ClearLine(5);  Hott_ClearLine(6);}
630
                        else
631
                        else
631
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 2; line = 0;}
632
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 2; line = 0;}
632
                        else
633
                        else
633
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 0; line = 0;}
634
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 0; line = 0;}
634
//if(HottKeyboard) HoTT_printfxy(15,6,"%KEY:%02x ",HottKeyboard);
635
//if(HottKeyboard) HoTT_printfxy(15,6,"%KEY:%02x ",HottKeyboard);
635
                        HottKeyboard = 0;
636
                        HottKeyboard = 0;
636
                        break;
637
                        break;
637
   default:  line = 0;
638
   default:  line = 0;
638
                        break;
639
                        break;
639
  }
640
  }
640
  else
641
  else
641
  if(page == 2)
642
  if(page == 2)
642
  switch(line++)
643
  switch(line++)
643
  {
644
  {
644
        case 0:  
645
        case 0:  
645
                        HoTT_printfxy_INV(0,0,"Setting:%u %s ",GetActiveParamSet(),EE_Parameter.Name);
646
                        HoTT_printfxy_INV(0,0,"Setting:%u %s ",GetActiveParamSet(),EE_Parameter.Name);
646
                        break;
647
                        break;
647
    case 1: HoTT_printfxy(0,1,"Min:%2i.%1iV %s ",BattLowVoltageWarning/10, BattLowVoltageWarning%10, Mixer.Name);
648
    case 1: HoTT_printfxy(0,1,"Min:%2i.%1iV %s ",BattLowVoltageWarning/10, BattLowVoltageWarning%10, Mixer.Name);
648
                        break;
649
                        break;
649
    case 2:  HoTT_printfxy(0,2,"ALT:");
650
    case 2:  HoTT_printfxy(0,2,"ALT:");
650
                 if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
651
                 if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
651
                 {
652
                 {
652
                          if(!(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER)) HoTT_printf("POTI:%3u ", Parameter_HoehenSchalter)
653
                          if(!(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER)) HoTT_printf("POTI:%3u ", Parameter_HoehenSchalter)
653
                          else
654
                          else
654
                          {
655
                          {
655
                           if(Parameter_HoehenSchalter > 50) HoTT_printf("(ON)  ") else HoTT_printf("(OFF) ");
656
                           if(Parameter_HoehenSchalter > 50) HoTT_printf("(ON)  ") else HoTT_printf("(OFF) ");
656
                           if((Parameter_ExtraConfig & CFG2_HEIGHT_LIMIT)) HoTT_printf("LIMIT", Parameter_HoehenSchalter)
657
                           if((Parameter_ExtraConfig & CFG2_HEIGHT_LIMIT)) HoTT_printf("LIMIT", Parameter_HoehenSchalter)
657
                           else HoTT_printf("VARIO", Parameter_HoehenSchalter);
658
                           else HoTT_printf("VARIO", Parameter_HoehenSchalter);
658
                          }
659
                          }
659
                         }
660
                         }
660
                        else
661
                        else
661
                                HoTT_printf("DISABLED");
662
                                HoTT_printf("DISABLED");
662
                        break;
663
                        break;
663
    case 3: HoTT_printfxy(0,3,"CF:");
664
    case 3: HoTT_printfxy(0,3,"CF:");
664
                        if(!EE_Parameter.CareFreeModeControl) HoTT_printf("DISABLED")
665
                        if(!EE_Parameter.CareFreeModeControl) HoTT_printf("DISABLED")
665
                        else
666
                        else
666
                         {
667
                         {
667
                          if(CareFree)  HoTT_printf(" (ON) ") else HoTT_printf(" (OFF)");
668
                          if(CareFree)  HoTT_printf(" (ON) ") else HoTT_printf(" (OFF)");
668
                          if(EE_Parameter.ExtraConfig & CFG_LEARNABLE_CAREFREE) HoTT_printf(" TEACH");
669
                          if(EE_Parameter.ExtraConfig & CFG_LEARNABLE_CAREFREE) HoTT_printf(" TEACH");
669
                         }
670
                         }
670
                        break;
671
                        break;
671
    case 4: HoTT_printfxy(0,4,"GPS:");
672
    case 4: HoTT_printfxy(0,4,"GPS:");
672
                    if(!(Parameter_GlobalConfig & CFG_GPS_AKTIV)) HoTT_printf("DISABLED")
673
                    if(!(Parameter_GlobalConfig & CFG_GPS_AKTIV)) HoTT_printf("DISABLED")
673
                        else
674
                        else
674
                         {
675
                         {
675
                          CHK_POTI(tmp,EE_Parameter.NaviGpsModeControl);
676
                          CHK_POTI(tmp,EE_Parameter.NaviGpsModeControl);
676
                          if(tmp < 50) HoTT_printf("(FREE)")
677
                          if(tmp < 50) HoTT_printf("(FREE)")
677
                          else
678
                          else
678
                          if(tmp >= 180) HoTT_printf("(HOME)")
679
                          if(tmp >= 180) HoTT_printf("(HOME)")
679
                          else
680
                          else
680
                          if(EE_Parameter.ExtraConfig & CFG_GPS_AID) HoTT_printf("(AID) ")
681
                          if(EE_Parameter.ExtraConfig & CFG_GPS_AID) HoTT_printf("(AID) ")
681
                          else HoTT_printf("(HOLD)")
682
                          else HoTT_printf("(HOLD)")
682
                         }
683
                         }
683
                        if(EE_Parameter.FailSafeTime) HoTT_printfxy(10,4," FS:%usek ",EE_Parameter.FailSafeTime)
684
                        if(EE_Parameter.FailSafeTime) HoTT_printfxy(10,4," FS:%usek ",EE_Parameter.FailSafeTime)
684
 
685
 
685
                        break;
686
                        break;
686
    case 5: HoTT_printfxy(0,5,"HOME ALT:");
687
    case 5: HoTT_printfxy(0,5,"HOME ALT:");
687
                        if(EE_Parameter.ComingHomeAltitude) HoTT_printf("%um",EE_Parameter.ComingHomeAltitude) else HoTT_printf("HOLD ");
688
                        if(EE_Parameter.ComingHomeAltitude) HoTT_printf("%um",EE_Parameter.ComingHomeAltitude) else HoTT_printf("HOLD ");
688
                        break;
689
                        break;
689
        case 6:
690
        case 6:
690
                        if(!show_poti)
691
                        if(!show_poti)
691
                         {
692
                         {
692
              HoTT_printfxy(0,6,"Ni:%4i Ro:%4i C:%3i",PPM_in[EE_Parameter.Kanalbelegung[K_NICK]],PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]], Parameter_ServoNickControl);
693
              HoTT_printfxy(0,6,"Ni:%4i Ro:%4i C:%3i",PPM_in[EE_Parameter.Kanalbelegung[K_NICK]],PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]], Parameter_ServoNickControl);
693
                      HoTT_printfxy(0,7,"Gs:%4i Ya:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]+127,PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]);
694
                      HoTT_printfxy(0,7,"Gs:%4i Ya:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]+127,PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]);
694
                         }
695
                         }
695
                        else
696
                        else
696
                         {
697
                         {
697
              HoTT_printfxy(0,6,"P1:%4i P2:%4i 3:%3i",Poti1,Poti2, Poti3);
698
              HoTT_printfxy(0,6,"P1:%4i P2:%4i 3:%3i",Poti1,Poti2, Poti3);
698
                      HoTT_printfxy(0,7,"P4:%4i P5:%4i 6:%3i",Poti4,Poti5, Poti6);
699
                      HoTT_printfxy(0,7,"P4:%4i P5:%4i 6:%3i",Poti4,Poti5, Poti6);
699
                         }
700
                         }
700
 
701
 
701
                        break;
702
                        break;
702
    case 7: //HoTT_printfxy(0,6,"WARNINGS:");
703
    case 7: //HoTT_printfxy(0,6,"WARNINGS:");
703
                        if(HoTTBlink)
704
                        if(HoTTBlink)
704
                        {
705
                        {
705
                         LIBFC_HoTT_SetPos(6 * 21);
706
                         LIBFC_HoTT_SetPos(6 * 21);
706
                         if(!(Parameter_GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV)) HoTT_printf_BLINK("COUPLING OFF! ");
707
                         if(!(Parameter_GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV)) HoTT_printf_BLINK("COUPLING OFF! ");
707
                         if(EE_Parameter.BitConfig & (CFG_LOOP_LINKS | CFG_LOOP_RECHTS | CFG_LOOP_UNTEN | CFG_LOOP_OBEN)) HoTT_printf_BLINK("LOOPING! ");
708
                         if(EE_Parameter.BitConfig & (CFG_LOOP_LINKS | CFG_LOOP_RECHTS | CFG_LOOP_UNTEN | CFG_LOOP_OBEN)) HoTT_printf_BLINK("LOOPING! ");
708
                         if(Parameter_GlobalConfig & CFG_HEADING_HOLD) HoTT_printf_BLINK("HH! ");
709
                         if(Parameter_GlobalConfig & CFG_HEADING_HOLD) HoTT_printf_BLINK("HH! ");
709
                         if(!(Parameter_GlobalConfig & CFG_KOMPASS_AKTIV)) HoTT_printf_BLINK("COMPASS OFF! ");
710
                         if(!(Parameter_GlobalConfig & CFG_KOMPASS_AKTIV)) HoTT_printf_BLINK("COMPASS OFF! ");
710
                        }
711
                        }
711
                        break;
712
                        break;
712
    case 8: //ASCIIPacket.WarnBeep = HoTT_Waring();
713
    case 8: //ASCIIPacket.WarnBeep = HoTT_Waring();
713
                        break;
714
                        break;
714
    case 9:
715
    case 9:
715
    case 10:
716
    case 10:
716
    case 11:
717
    case 11:
717
    case 12:
718
    case 12:
718
    case 13:
719
    case 13:
719
    case 14:
720
    case 14:
720
    case 15:
721
    case 15:
721
    case 16:
722
    case 16:
722
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_poti) show_poti = 0; else show_poti = 1;   Hott_ClearLine(6);  Hott_ClearLine(7);}
723
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_poti) show_poti = 0; else show_poti = 1;   Hott_ClearLine(6);  Hott_ClearLine(7);}
723
                        else
724
                        else
724
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 3; line = 0;}
725
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 3; line = 0;}
725
                        else
726
                        else
726
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 1; line = 0;};
727
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 1; line = 0;};
727
                        HottKeyboard = 0;
728
                        HottKeyboard = 0;
728
                        break;
729
                        break;
729
   default:  line = 0;
730
   default:  line = 0;
730
                        break;
731
                        break;
731
  }
732
  }
732
  else
733
  else
733
  if(page == 3)
734
  if(page == 3)
734
  switch(line++)
735
  switch(line++)
735
  {
736
  {
736
        case 0:  
737
        case 0:  
737
                        HoTT_printfxy(0,2,"Speak:");
738
                        HoTT_printfxy(0,2,"Speak:");
738
                        break;
739
                        break;
739
        case 1:  
740
        case 1:  
740
                        if(GetParamByte(PID_SPEAK_HOTT_CFG) & 0x01) HoTT_printfxy_INV(7,2,"All Messages ")
741
                        if(GetParamByte(PID_SPEAK_HOTT_CFG) & 0x01) HoTT_printfxy_INV(7,2,"All Messages ")
741
                        else                    HoTT_printfxy_INV(7,2,"Warnings only");
742
                        else                    HoTT_printfxy_INV(7,2,"Warnings only");
742
                        break;
743
                        break;
743
        case 2:  
744
        case 2:  
744
                        HoTT_printfxy(1,4,"Use (set) to select");
745
                        HoTT_printfxy(1,4,"Use (set) to select");
745
                        break;
746
                        break;
746
    default:
747
    default:
747
                        if(HottKeyboard == HOTT_KEY_SET)
748
                        if(HottKeyboard == HOTT_KEY_SET)
748
                         {
749
                         {
749
                          SetParamByte(PID_SPEAK_HOTT_CFG, GetParamByte(PID_SPEAK_HOTT_CFG) ^ 0x01);
750
                          SetParamByte(PID_SPEAK_HOTT_CFG, GetParamByte(PID_SPEAK_HOTT_CFG) ^ 0x01);
750
                         }
751
                         }
751
                        else
752
                        else
752
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 2; line = 0;};
753
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 2; line = 0;};
753
                        HottKeyboard = 0;
754
                        HottKeyboard = 0;
754
                        line = 0;
755
                        line = 0;
755
                        break;
756
                        break;
756
  }
757
  }
757
  else page = 0;
758
  else page = 0;
758
}
759
}
759
 
760
 
760
#endif
761
#endif
761
 
762
 
762
 
763
 
763
       
764
       
764
 
765