Subversion Repositories FlightCtrl

Rev

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

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