Subversion Repositories FlightCtrl

Rev

Rev 2531 | Rev 2540 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2050 holgerb 1
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2
// + www.MikroKopter.com
3
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
// + Software Nutzungsbedingungen (english version: see below)
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
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.
9
// + Der Einsatz dieser Software ist nur auf oder mit Produkten des Lizenzgebers zulässig.
10
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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.
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.
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.
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 
19
// + des Mitverschuldens offen.
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.
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
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.
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.
28
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
29
// + Software LICENSING TERMS
30
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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 
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.
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
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
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
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
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.
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.
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.
49
// + *) The territory aspect only refers to the place where the Software is used, not its programmed range.
50
// + #### END OF LICENSING TERMS ####
51
// + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de.
52
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1917 holgerb 53
#include "libfc.h"
54
#include "printf_P.h"
55
#include "main.h"
56
#include "spi.h"
57
#include "capacity.h"
58
 
2426 holgerb 59
unsigned char NaviData_WaypointIndex = 0;
60
unsigned char NaviData_WaypointNumber = 0, NaviData_TargetHoldTime = 0, ToNC_Load_WP_List = 0, NaviData_MaxWpListIndex = 0;
2438 holgerb 61
unsigned char ToNC_Load_SingePoint = 0, ToNC_Store_SingePoint = 0;
2426 holgerb 62
char WPL_Name[10];// = {"         \0"};
1925 holgerb 63
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
64
 
1920 holgerb 65
#define HoTT_printf(format, args...)                    {  _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);}
2527 holgerb 66
#define HoTT_printfxy(x,y,format, args...)              { LIBFC_HoTT_SetPos((y) * 21 + (x)); _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);}
67
#define HoTT_printfxy_INV(x,y,format, args...)          { LIBFC_HoTT_SetPos((y) * 21 + (x)); _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);}
68
#define HoTT_printfxy_BLINK(x,y,format, args...)        { LIBFC_HoTT_SetPos((y) * 21 + (x)); _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);}
1921 holgerb 69
#define HoTT_printf_BLINK(format, args...)              { _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);}
70
#define HoTT_printf_INV(format, args...)                        { _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);}
1917 holgerb 71
 
1919 holgerb 72
#define VOICE_MINIMALE_EINGANSSPANNUNG    16
73
#define VOICE_BEEP                         5
1920 holgerb 74
#define HoTT_GRAD       96
75
#define HoTT_LINKS      123
76
#define HoTT_RECHTS 124
77
#define HoTT_OBEN       125
78
#define HoTT_UNTEN      126
1917 holgerb 79
 
1949 holgerb 80
#define HOTT_KEY_RIGHT  1
81
#define HOTT_KEY_DOWN   2
82
#define HOTT_KEY_UP     4
83
#define HOTT_KEY_SET    6
84
#define HOTT_KEY_LEFT   8
85
 
2322 holgerb 86
#define VARIO_ZERO 30000
2178 holgerb 87
unsigned int NaviData_TargetDistance = 0;
88
 
2373 holgerb 89
unsigned char MaxBlTemperture = 0;
90
unsigned char MinBlTemperture = 0;
91
unsigned char HottestBl = 0;
92
 
1943 holgerb 93
GPSPacket_t GPSPacket;
94
VarioPacket_t VarioPacket;
95
ASCIIPacket_t ASCIIPacket;
96
ElectricAirPacket_t ElectricAirPacket;
97
HoTTGeneral_t HoTTGeneral;
2090 holgerb 98
unsigned char SpeakHoTT = SPEAK_MIKROKOPTER;
2345 holgerb 99
unsigned char ToNC_SpeakHoTT = 0, ShowSettingNameTime = 0;
1944 holgerb 100
int HoTTVarioMeter = 0;
2090 holgerb 101
const char PROGMEM MIKROKOPTER[] =      {"     MikroKopter     "};
2120 holgerb 102
const char PROGMEM UNDERVOLTAGE[] =     {" !! LiPo voltage !!  "};
2390 holgerb 103
const char PROGMEM LANDING[] =      {" !!   LANDING    !!  "};
2475 holgerb 104
const char PROGMEM SIMULATION[] =       {"  SIMULATION active  "};
105
const char PROGMEM BOAT_MODE[] =        {" MikroKopter (Boat)  "};
2344 holgerb 106
const char PROGMEM SETTING[] =  {"Set  :"};
1930 holgerb 107
const char PROGMEM NC_ERROR_TEXT[MAX_ERR_NUMBER][17] =
108
{
109
//0123456789123456
110
 "No Error        \0",  // 0
111
 "Not compatible  \0",  // 1
112
 "MK3Mag not compa\0",  // 2
113
 "No FC communicat\0",  // 3
2188 holgerb 114
 "Compass communic\0",  // 4
1930 holgerb 115
 "GPS communicatio\0",  // 5
116
 "compass value   \0",  // 6
117
 "RC Signal lost  \0",  // 7
118
 "FC spi rx error \0",  // 8
119
 "No NC communicat\0",  // 9
120
 "FC Nick Gyro    \0",  // 10
121
 "FC Roll Gyro    \0",  // 11
122
 "FC Yaw Gyro     \0",  // 12
123
 "FC Nick ACC     \0",  // 13
124
 "FC Roll ACC     \0",  // 14
125
 "FC Z-ACC        \0",  // 15
126
 "Pressure sensor \0",  // 16
1936 holgerb 127
 "I2C FC->BL-Ctrl \0",  // 17
1930 holgerb 128
 "Bl Missing      \0",  // 18
129
 "Mixer Error     \0",  // 19
1937 holgerb 130
 "Carefree Error  \0",  // 20
1944 holgerb 131
 "GPS Fix lost    \0",  // 21
1948 holgerb 132
 "Magnet Error    \0",  // 22
133
 "Motor restart   \0",  // 23
2008 holgerb 134
 "BL Limitation   \0",  // 24
135
 "GPS Range       \0",  // 25
2009 holgerb 136
 "No SD-Card      \0",  // 26
137
 "SD-Logging error\0",  // 27
2034 holgerb 138
 "Flying range!   \0",  // 28
2146 holgerb 139
 "Max Altitude!   \0",  // 29
2186 holgerb 140
 "No GPS fix      \0",  // 30
2388 holgerb 141
 "compass not cal.\0",  // 31
2408 holgerb 142
 "BL-Selftest     \0",  // 32
143
 "no ext. compass \0",  // 33
2531 holgerb 144
 "compass sensor  \0",  // 34
145
 "Failsafe postion\0",  // 35
146
 "No Redundancy!  \0",  // 36
147
 "Redundancy test \0"   // 37
148
 
1930 holgerb 149
};
1919 holgerb 150
 
2090 holgerb 151
 
152
const char PROGMEM HOTT_ERROR[MAX_ERR_NUMBER][2] =
153
{       // 1 -> only in flight   0 -> also on ground
154
//0123456789123456
155
         {0,0},// "No Error        \0",  // 0
2531 holgerb 156
         {SPEAK_ERROR,0},               // "Not compatible  \0",        // 1
157
         {SPEAK_ERROR,0},               // "MK3Mag not compa\0",        // 2
158
         {SPEAK_ERR_NAVI,1},    // "No FC communicat\0",        // 3
159
         {SPEAK_ERR_COMPASS,1}, // "MK3Mag communica\0",        // 4
160
         {SPEAK_ERR_GPS,0},             // "GPS communicatio\0",        // 5
161
         {SPEAK_ERR_COMPASS,1}, // "compass value   \0",        // 6
162
         {SPEAK_ERR_RECEICER,0},// "RC Signal lost  \0",        // 7
163
         {SPEAK_ERR_NAVI,0},    // "FC spi rx error \0",        // 8
164
         {SPEAK_ERR_NAVI,0},    // "No NC communicat\0",        // 9
165
         {SPEAK_ERR_SENSOR,0},  // "FC Nick Gyro    \0",        // 10
166
         {SPEAK_ERR_SENSOR,0},  // "FC Roll Gyro    \0",        // 11
167
         {SPEAK_ERR_SENSOR,0},  // "FC Yaw Gyro     \0",        // 12
168
         {SPEAK_ERR_SENSOR,0},  // "FC Nick ACC     \0",        // 13
169
         {SPEAK_ERR_SENSOR,0},  // "FC Roll ACC     \0",        // 14
170
         {SPEAK_ERR_SENSOR,0},  // "FC Z-ACC        \0",        // 15
171
         {SPEAK_ERR_SENSOR,0},  // "Pressure sensor \0",        // 16
172
         {SPEAK_ERR_DATABUS,1}, // "I2C FC->BL-Ctrl \0",        // 17
173
         {SPEAK_ERR_DATABUS,1}, // "Bl Missing      \0",        // 18
174
         {SPEAK_ERROR,0},               // "Mixer Error     \0",        // 19
175
         {SPEAK_CF_OFF,1},              // "Carefree Error  \0",        // 20
176
         {SPEAK_GPS_FIX,1},             // "GPS Fix lost    \0",        // 21
177
         {SPEAK_ERR_COMPASS,0}, // "Magnet Error    \0",        // 22
178
         {SPEAK_ERR_MOTOR,1},   // "Motor restart   \0",        // 23
179
         {SPEAK_MAX_TEMPERAT,1},// "BL Limitation   \0",        // 24
180
         {SPEAK_MAX_RANGE,1},   // "GPS Range       \0",        // 25
181
         {SPEAK_ERROR,1},               // "No SD-Card      \0",        // 26
182
         {SPEAK_ERROR,1},               // "SD-Logging error\0",        // 27
183
         {SPEAK_MAX_RANGE,1},   // "Flying range!   \0",        // 28
184
         {SPEAK_MAX_ALTITUD,1}, // "Max Altitude!   \0"         // 29
185
         {SPEAK_GPS_FIX,1},             // "No GPS fix      \0"         // 30
186
         {SPEAK_ERR_CALIBARTION,0},// "compass not cal."        // 31
187
         {SPEAK_ERR_MOTOR,0},   // "BL-Selftest     \0"         // 32
188
         {SPEAK_ERR_COMPASS,0}, // "no ext. compass"            // 33
189
         {SPEAK_ERR_COMPASS,0}, // "compass sensor"             // 34
190
         {SPEAK_ERROR,1},               // "Failsafe postion0",         // 35
191
         {SPEAK_ERROR,0},               // "No Redundancy!",            // 36
192
         {0,0}                                  // "Redundancy test",           // 37
2090 holgerb 193
};
194
 
2527 holgerb 195
/*
196
//------------------------------------------------------------------------------------------
197
// HoTT-Plus
198
//------------------------------------------------------------------------------------------
199
char dummy=0;
200
const Parameter_List_t Parameter_List[] =
201
{ //offset,min,max,name,variable
202
        {127, 0, 247,"SP1", (unsigned char *) &PPM_in[13] },
203
        {127, 0, 247,"SP2", (unsigned char *) &PPM_in[14] },   
204
        {127, 0, 247,"SP3", (unsigned char *) &PPM_in[15] },   
205
        {127, 0, 247,"SP4", (unsigned char *) &PPM_in[16] },   
206
        {  0, 0, 247,"HD ", (unsigned char *) &EE_Parameter.Luftdruck_D },
207
        {  0, 0, 247,"HP ", (unsigned char *) &EE_Parameter.Hoehe_P },
208
        {  0, 0, 247,"HA ", (unsigned char *) &EE_Parameter.Hoehe_ACC_Wirkung },
209
        {  0, 0, 247,"HM ", (unsigned char *) &EE_Parameter.Hoehe_MinGas },
210
        {  0, 0, 247,"HV ", (unsigned char *) &EE_Parameter.Hoehe_HoverBand },
211
        {  0, 0, 247,"HG ", (unsigned char *) &EE_Parameter.Hoehe_Verstaerkung },
212
        {  0, 0, 247,"NG ", (unsigned char *) &EE_Parameter.NotGas },
213
        {  0, 0, 247,"StP", (unsigned char *) &EE_Parameter.Stick_P },
214
        {  0, 0, 247,"StD", (unsigned char *) &EE_Parameter.Stick_D },
215
        {  0, 0, 247,"SGP", (unsigned char *) &EE_Parameter.StickGier_P },
216
        {  0, 0, 247,"DrC", (unsigned char *) &EE_Parameter.Driftkomp },
217
        {  0, 0, 247,"GYP", (unsigned char *) &EE_Parameter.Gyro_P },
218
        {  0, 0, 247,"GYD", (unsigned char *) &EE_Parameter.Gyro_D },
219
        {  0, 0, 247,"GYI", (unsigned char *) &EE_Parameter.Gyro_I },
220
        {  0, 0, 247,"MaI", (unsigned char *) &EE_Parameter.I_Faktor },
221
        {  0, 0, 247,"GGP", (unsigned char *) &EE_Parameter.Gyro_Gier_P },
222
        {  0, 0, 247,"GGI", (unsigned char *) &EE_Parameter.Gyro_Gier_I },
223
        {  0, 0,  15,"GSt", (unsigned char *) &EE_Parameter.Gyro_Stability },
224
        {  0, 0, 247,"DSt", (unsigned char *) &EE_Parameter.DynamicStability },
225
        {  0, 0, 247,"NGG", (unsigned char *) &EE_Parameter.NaviGpsGain },
226
        {  0, 0, 247,"NWC", (unsigned char *) &EE_Parameter.NaviWindCorrection },
227
        {  0, 0, 247,"NSC", (unsigned char *) &EE_Parameter.NaviAccCompensation },
228
        {  0, 0, 247,"NAL", (unsigned char *) &EE_Parameter.NaviAngleLimitation },
229
        {  0, 0, 247,"NP ", (unsigned char *) &EE_Parameter.NaviGpsP },
230
        {  0, 0, 247,"ND ", (unsigned char *) &EE_Parameter.NaviGpsI },
231
        {  0, 0, 247,"NI ", (unsigned char *) &EE_Parameter.NaviGpsD },
232
        {  0, 0, 247,"LGL", (unsigned char *) &EE_Parameter.LoopGasLimit },
233
        {  0, 0, 247,"LHy", (unsigned char *) &EE_Parameter.LoopHysterese },
234
        {  0, 0, 247,"LTh", (unsigned char *) &EE_Parameter.LoopThreshold },
235
        {  0, 0,   0,"   ", (unsigned char *) &dummy },
236
        {  0, 0, 247,"FGP", (unsigned char *) &EE_Parameter.AchsKopplung1},
237
        {  0, 0, 247,"FNR", (unsigned char *) &EE_Parameter.AchsKopplung2},
238
        {  0, 0, 247,"CYC", (unsigned char *) &EE_Parameter.CouplingYawCorrection},
239
        {  0, 0, 247,"MSH", (unsigned char *) &EE_Parameter.MotorSmooth},
240
        {  0, 0, 247,"NCT", (unsigned char *) &EE_Parameter.ServoNickControl },
241
        {  0, 0, 247,"NCP", (unsigned char *) &EE_Parameter.ServoNickComp },
242
        {  0, 0, 247,"RCT", (unsigned char *) &EE_Parameter.ServoRollControl },
243
        {  0, 0, 247,"RCP", (unsigned char *) &EE_Parameter.ServoRollComp }
244
};
245
unsigned char settingdest = 0;
246
//------------------------------------------------------------------------------------------
247
// HoTT-Plus
248
//------------------------------------------------------------------------------------------
249
*/
1943 holgerb 250
void GetHottestBl(void)
251
{
252
 static unsigned char search = 0,tmp_max,tmp_min,who;
253
                if(Motor[search].Temperature > tmp_max) { tmp_max = Motor[search].Temperature; who = search;}
254
                else
255
                if(Motor[search].Temperature) if(Motor[search].Temperature < tmp_min) tmp_min = Motor[search].Temperature;
2373 holgerb 256
                if(++search >= MAX_MOTORS)
1943 holgerb 257
                {
258
                 search = 0;
2373 holgerb 259
                 if(tmp_min != 255) MinBlTemperture = tmp_min; else MinBlTemperture = 0;
260
                 MaxBlTemperture = tmp_max;
1943 holgerb 261
                 HottestBl = who;
262
                 tmp_min = 255;
263
                 tmp_max = 0;
264
                 who = 0;
265
                 }
266
}
267
 
1919 holgerb 268
//---------------------------------------------------------------
1917 holgerb 269
void Hott_ClearLine(unsigned char line)
270
{
271
 HoTT_printfxy(0,line,"                     ");
272
}
1919 holgerb 273
//---------------------------------------------------------------
1917 holgerb 274
 
2178 holgerb 275
 
1919 holgerb 276
unsigned char HoTT_Waring(void)
277
{
2090 holgerb 278
  unsigned char status = 0;
279
  static char old_status = 0;
280
  static int repeat;
2531 holgerb 281
//if(Parameter_UserParam1) SpeakHoTT = Parameter_UserParam1;
2190 holgerb 282
  ToNC_SpeakHoTT = SpeakHoTT;
2390 holgerb 283
  if(FC_StatusFlags & FC_STATUS_LOWBAT)
284
   {
285
    if(LowVoltageLandingActive && (EE_Parameter.Receiver == RECEIVER_HOTT)) status = SPEAK_LANDING;
286
        else status = VOICE_MINIMALE_EINGANSSPANNUNG; // Jeti hat kein wort: "LANDEN"
2408 holgerb 287
        if(SpeakHoTT && old_status == VOICE_MINIMALE_EINGANSSPANNUNG) status = SpeakHoTT; // das soll auch noch durch kommen
2390 holgerb 288
   }   
2090 holgerb 289
  else
2408 holgerb 290
  if(NC_ErrorCode && NC_ErrorCode < MAX_ERR_NUMBER)     // Fehlercodes
2090 holgerb 291
   {
292
    if(MotorenEin || !pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][1])) status = pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][0]);
293
   }
2263 holgerb 294
  if(!status)    // Sprachansagen
2091 holgerb 295
   {
2263 holgerb 296
//      if(!(GetParamByte(PID_SPEAK_HOTT_CFG) & 0x01)) SpeakHoTT = 0;  // is the voice wanted?
297
    if(!(EE_Parameter.GlobalConfig3 & CFG3_SPEAK_ALL)) SpeakHoTT = 0;  // is the voice wanted?
2091 holgerb 298
    else status = SpeakHoTT;
2190 holgerb 299
   }
300
   else ToNC_SpeakHoTT = status;
2090 holgerb 301
 
2390 holgerb 302
  if(old_status == status) // Gleichen Fehler nur alle 4 sek bringen
2090 holgerb 303
   {
304
    if(!CheckDelay(repeat)) return(0);
2390 holgerb 305
        repeat = SetDelay(4000);
2090 holgerb 306
   }
307
   else repeat = SetDelay(2000);
308
 
309
  if(status)
310
   {
311
    if(status == SpeakHoTT) SpeakHoTT = 0;
312
   }   
313
  old_status = status;
2120 holgerb 314
//  DebugOut.Analog[16] = status;
2090 holgerb 315
  return(status);
1919 holgerb 316
}
317
 
2178 holgerb 318
/*
319
unsigned char HoTTErrorCode(void)
320
{
321
 return(NC_ErrorCode);
322
}
323
*/
1919 holgerb 324
//---------------------------------------------------------------
1942 holgerb 325
void NC_Fills_HoTT_Telemety(void)
1940 holgerb 326
{
2034 holgerb 327
 unsigned char *ptr = NULL;
1940 holgerb 328
 unsigned char max = 0,i,z;
329
 switch(FromNaviCtrl.Param.Byte[11])
330
  {
331
   case HOTT_VARIO_PACKET_ID:
332
                ptr = (unsigned char *) &VarioPacket;
333
                max = sizeof(VarioPacket);
334
                break;
335
   case HOTT_GPS_PACKET_ID:
336
                ptr = (unsigned char *) &GPSPacket;
337
                max = sizeof(GPSPacket);
338
                break;
339
   case HOTT_ELECTRIC_AIR_PACKET_ID:
340
                ptr = (unsigned char *) &ElectricAirPacket;
341
                max = sizeof(ElectricAirPacket);
342
                break;
1943 holgerb 343
   case HOTT_GENERAL_PACKET_ID:
344
                ptr = (unsigned char *) &HoTTGeneral;
345
                max = sizeof(HoTTGeneral);
346
                break;
2377 holgerb 347
   case JETI_GPS_PACKET_ID1:
348
                ptr = (unsigned char *) &JetiExData[14].Value;
349
                max = sizeof(JetiExData[14].Value);
350
                break;
351
   case JETI_GPS_PACKET_ID2:
352
                ptr = (unsigned char *) &JetiExData[15].Value;
353
                max = sizeof(JetiExData[15].Value);
354
                break;
2424 holgerb 355
   case HOTT_WPL_NAME:
356
                ptr = (unsigned char *) WPL_Name;
357
                max = sizeof(WPL_Name)-1;
358
                break;
359
 
1940 holgerb 360
  }
361
 z = FromNaviCtrl.Param.Byte[0]; // Data allocation
362
 
363
 for(i=0; i < FromNaviCtrl.Param.Byte[1]; i++)
364
  {
365
   if(z >= max) break;
366
   ptr[z] = FromNaviCtrl.Param.Byte[2+i];
367
   z++;
368
  }
369
}
370
 
1942 holgerb 371
unsigned int BuildHoTT_Vario(void)
372
{
2322 holgerb 373
 unsigned int tmp = VARIO_ZERO;
1944 holgerb 374
 if(VarioCharacter == '+' || VarioCharacter == '-')
375
  {
2322 holgerb 376
   tmp = VARIO_ZERO + (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 3;
377
   if(tmp < VARIO_ZERO && tmp > VARIO_ZERO - 50) tmp = VARIO_ZERO - 50; // weil es sonst erst bei < 0,5m/sek piept
1944 holgerb 378
  }
1942 holgerb 379
 else
1944 holgerb 380
 if((VarioCharacter == ' ') && (FC_StatusFlags & FC_STATUS_FLY))
381
  {
2322 holgerb 382
   tmp = VARIO_ZERO + HoTTVarioMeter;
383
   if(tmp > VARIO_ZERO)
1944 holgerb 384
    {
2322 holgerb 385
     if(tmp < VARIO_ZERO + 100) tmp = VARIO_ZERO;
1944 holgerb 386
         else tmp -= 100;
387
        }
2322 holgerb 388
   if(tmp < VARIO_ZERO)
1944 holgerb 389
    {
2322 holgerb 390
     if(tmp > VARIO_ZERO - 100) tmp = VARIO_ZERO;
1944 holgerb 391
         else tmp += 100;
392
        }
393
  }
394
 else
2322 holgerb 395
 if(VarioCharacter == '^') tmp = VARIO_ZERO + FromNC_AltitudeSpeed * 10;
1944 holgerb 396
 else
2322 holgerb 397
 if(VarioCharacter == 'v') tmp = VARIO_ZERO - FromNC_AltitudeSpeed * 10;
1942 holgerb 398
 return(tmp);
399
}
400
 
1940 holgerb 401
//---------------------------------------------------------------
1919 holgerb 402
unsigned char HoTT_Telemety(unsigned char packet_request)
403
{
2475 holgerb 404
 unsigned char i = 0;
2531 holgerb 405
 static unsigned char SpeechMessage = 0;
2090 holgerb 406
  //Debug("rqst: %02X",packet_request);
2420 holgerb 407
 
1919 holgerb 408
 switch(packet_request)
409
 {
410
  case HOTT_VARIO_PACKET_ID:
2531 holgerb 411
                if(GPSPacket.WarnBeep == SpeechMessage) SpeechMessage = HoTT_Waring(); // Achtung: das ist richtig hier, damit der Varioton schon vorher abgestellt wird
412
 
1921 holgerb 413
                VarioPacket.Altitude = HoehenWert/100 + 500;  
2531 holgerb 414
                if(!SpeechMessage) VarioPacket.m_sec = BuildHoTT_Vario(); else VarioPacket.m_sec = VARIO_ZERO;
1943 holgerb 415
                VarioPacket.m_3sec = VarioPacket.m_sec;
416
                VarioPacket.m_10sec = VarioPacket.m_sec;
1919 holgerb 417
                if (VarioPacket.Altitude < VarioPacket.MinAltitude) VarioPacket.MinAltitude = VarioPacket.Altitude;
418
                if (VarioPacket.Altitude > VarioPacket.MaxAltitude) VarioPacket.MaxAltitude = VarioPacket.Altitude;            
2090 holgerb 419
                VarioPacket.WarnBeep = 0;//HoTT_Waring();
1919 holgerb 420
                HoTT_DataPointer = (unsigned char *) &VarioPacket;
2090 holgerb 421
        VarioPacket.FreeCharacters[0] = VarioCharacter;
422
    if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) VarioPacket.FreeCharacters[1] = 'C'; else VarioPacket.FreeCharacters[1] = ' ';
423
//      VarioPacket.FreeCharacters[2] = ' ';
424
    if(NC_ErrorCode)
425
         {
426
                VarioPacket.Text[0] = NC_ErrorCode/10 + '0';
427
                VarioPacket.Text[1] = NC_ErrorCode%10 + '0';
428
                VarioPacket.Text[2] = ':';
2183 holgerb 429
                for(i=0; i<16;i++) VarioPacket.Text[i+3] = pgm_read_byte(&NC_ERROR_TEXT[NC_ErrorCode][i]);
2388 holgerb 430
                VarioPacket.Text[19] = ' ';
431
                VarioPacket.Text[20] = ' ';
2090 holgerb 432
         }
2120 holgerb 433
         else
2390 holgerb 434
         if(LowVoltageLandingActive) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&LANDING[i]); // no Error
435
     else
2120 holgerb 436
         if(FC_StatusFlags & FC_STATUS_LOWBAT) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&UNDERVOLTAGE[i]); // no Error
2348 holgerb 437
         else
438
         if(ShowSettingNameTime) // no Error
439
         {                  
440
          for(i=0; i<sizeof(SETTING);i++) VarioPacket.Text[i] = pgm_read_byte(&SETTING[i]);
441
      VarioPacket.Text[4] = '0' + ActiveParamSet;
442
          for(i=0; i<sizeof(EE_Parameter.Name);i++) VarioPacket.Text[i+7] = EE_Parameter.Name[i]; // no Error
2475 holgerb 443
      if(FC_StatusFlags3 & FC_STATUS3_BOAT)
444
                {
445
         VarioPacket.Text[17] = 'B';
446
         VarioPacket.Text[18] = 'O';
447
         VarioPacket.Text[19] = 'A';
448
         VarioPacket.Text[20] = 'T';
449
                }
450
          else
451
                {
452
         VarioPacket.Text[18] = ' ';
453
         VarioPacket.Text[19] = ' ';
454
         VarioPacket.Text[20] = ' ';
455
                }
2348 holgerb 456
         }
2120 holgerb 457
         else    
2178 holgerb 458
     if(NaviData_WaypointNumber)
459
         {    
460
          unsigned int tmp_int;
461
      unsigned char tmp;
462
      VarioPacket.Text[0] = 'W'; VarioPacket.Text[1] = 'P';
463
      VarioPacket.Text[2] = ' ';
464
      VarioPacket.Text[3] = '0'+(NaviData_WaypointIndex) / 10;
465
      VarioPacket.Text[4] = '0'+(NaviData_WaypointIndex) % 10;
466
      VarioPacket.Text[5] = '/';
467
      VarioPacket.Text[6] = '0'+(NaviData_WaypointNumber) / 10;
468
      VarioPacket.Text[7] = '0'+(NaviData_WaypointNumber) % 10;
469
      VarioPacket.Text[8] = ' ';
470
          tmp_int = NaviData_TargetDistance;
471
      if(tmp_int > 1000) { VarioPacket.Text[9] = '0'+(tmp_int) / 1000; tmp_int %= 1000;}
472
          else VarioPacket.Text[9] = ' ';
473
      if(tmp_int > 100) { VarioPacket.Text[10] = '0'+(tmp_int) / 100; tmp_int %= 100;}
474
          else VarioPacket.Text[10] = ' ';
475
      VarioPacket.Text[11] = '0'+(tmp_int) / 10;
476
      VarioPacket.Text[12] = '0'+(tmp_int) % 10;
477
      VarioPacket.Text[13] = 'm';
478
      VarioPacket.Text[14] = ' ';
479
      tmp = NaviData_TargetHoldTime;
480
          if(tmp > 100) { VarioPacket.Text[15] = '0'+(tmp) / 100; tmp %= 100;} else VarioPacket.Text[15] = ' ';
481
      VarioPacket.Text[16] = '0'+(tmp) / 10;
482
      VarioPacket.Text[17] = '0'+(tmp) % 10;
483
      VarioPacket.Text[18] = 's';
484
      VarioPacket.Text[19] = ' ';
2407 holgerb 485
      VarioPacket.Text[20] = ' ';
2178 holgerb 486
         }
487
         else
2475 holgerb 488
         if(NC_To_FC_Flags & NC_TO_FC_SIMULATION_ACTIVE)
489
         {
490
          for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&SIMULATION[i]);
491
         }
492
         else
2355 holgerb 493
         if(!CalibrationDone)
2344 holgerb 494
         {
2355 holgerb 495
          for(i=0; i<17;i++) VarioPacket.Text[i] = pgm_read_byte(&MIKROKOPTER[i+2]); // no Error and not calibrated
496
      VarioPacket.Text[16] = '0'+VERSION_MAJOR;
497
      VarioPacket.Text[17] = '.';
498
      VarioPacket.Text[18] = '0'+VERSION_MINOR/10;
499
      VarioPacket.Text[19] = '0'+VERSION_MINOR%10;
500
      VarioPacket.Text[20] = 'a'+VERSION_PATCH;
2344 holgerb 501
         }
2355 holgerb 502
         else
503
         {
2475 holgerb 504
          if(FC_StatusFlags3 & FC_STATUS3_BOAT) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&BOAT_MODE[i]); // no Error
505
          else  for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&MIKROKOPTER[i]); // no Error
2531 holgerb 506
          if(FC_StatusFlags3 & FC_STATUS3_REDUNDANCE_AKTIVE)  VarioPacket.Text[0] = 'R';
2355 holgerb 507
         }
1919 holgerb 508
                return(sizeof(VarioPacket));
509
                break;
1921 holgerb 510
 
1919 holgerb 511
  case HOTT_GPS_PACKET_ID:
2186 holgerb 512
                GPSPacket.Altitude = HoehenWert/100 + 500;  
1943 holgerb 513
//              GPSPacket.Distance = GPSInfo.HomeDistance/10;  // macht die NC
514
//              GPSPacket.Heading = GPSInfo.HomeBearing/2;     // macht die NC
515
//              GPSPacket.Speed = (GPSInfo.Speed * 36) / 10;   // macht die NC
2531 holgerb 516
                GPSPacket.WarnBeep = SpeechMessage;
2322 holgerb 517
                if(!GPSPacket.WarnBeep) GPSPacket.m_sec = BuildHoTT_Vario(); else GPSPacket.m_sec = VARIO_ZERO;
1921 holgerb 518
                GPSPacket.m_3sec = 120;
2090 holgerb 519
                GPSPacket.NumOfSats = GPSInfo.NumOfSats;
520
                if(GPSInfo.Flags & FLAG_DIFFSOLN) GPSPacket.SatFix = 'D';
521
                else
522
        if(GPSInfo.SatFix == SATFIX_3D) GPSPacket.SatFix = ' ';
523
                else GPSPacket.SatFix = '!';
1919 holgerb 524
                HoTT_DataPointer = (unsigned char *) &GPSPacket;
2090 holgerb 525
                GPSPacket.FreeCharacters[0] = NC_GPS_ModeCharacter;
526
                GPSPacket.FreeCharacters[2] = GPSPacket.SatFix;
527
                GPSPacket.HomeDirection = GPSInfo.HomeBearing / 2;//230;
1919 holgerb 528
                return(sizeof(GPSPacket));  
529
                break;
530
  case HOTT_ELECTRIC_AIR_PACKET_ID:
1943 holgerb 531
                GetHottestBl();
1940 holgerb 532
                ElectricAirPacket.Altitude = HoehenWert/100 + 500;
1921 holgerb 533
                ElectricAirPacket.Battery1 = UBat;
1940 holgerb 534
                ElectricAirPacket.Battery2 = UBat;
2437 holgerb 535
                ElectricAirPacket.VoltageCell1 = CompassCorrected / 2;
1943 holgerb 536
                ElectricAirPacket.VoltageCell8 = ElectricAirPacket.VoltageCell1;
1944 holgerb 537
                ElectricAirPacket.VoltageCell6 = GPSInfo.HomeBearing / 2;
1943 holgerb 538
                ElectricAirPacket.VoltageCell7 = GPSInfo.HomeDistance/20;
1944 holgerb 539
                ElectricAirPacket.VoltageCell13 = ElectricAirPacket.VoltageCell6;
1943 holgerb 540
                ElectricAirPacket.VoltageCell14 = ElectricAirPacket.VoltageCell7;
2531 holgerb 541
        if(!SpeechMessage) ElectricAirPacket.m_sec = BuildHoTT_Vario(); else ElectricAirPacket.m_sec = VARIO_ZERO;
1940 holgerb 542
                ElectricAirPacket.m_3sec = 120;
543
                ElectricAirPacket.InputVoltage = UBat;
2373 holgerb 544
                ElectricAirPacket.Temperature1 = MinBlTemperture + 20;
545
                ElectricAirPacket.Temperature2 = MaxBlTemperture + 20;
1940 holgerb 546
                ElectricAirPacket.Capacity = Capacity.UsedCapacity/10;
2531 holgerb 547
                ElectricAirPacket.WarnBeep = 0;//HoTT_Waring();
548
//ElectricAirPacket.WarnBeep = SpeechMessage;
1940 holgerb 549
                ElectricAirPacket.Current = Capacity.ActualCurrent;
1919 holgerb 550
                HoTT_DataPointer = (unsigned char *) &ElectricAirPacket;
2090 holgerb 551
                ElectricAirPacket.FlightTimeMinutes = FlugSekunden / 60;
552
                ElectricAirPacket.FlightTimeSeconds = FlugSekunden % 60;
1919 holgerb 553
                return(sizeof(ElectricAirPacket));
554
                break;
1943 holgerb 555
  case HOTT_GENERAL_PACKET_ID:
556
                GetHottestBl();
557
                HoTTGeneral.Rpm = GPSInfo.HomeDistance/100;
2437 holgerb 558
                HoTTGeneral.VoltageCell1 = CompassCorrected / 2;
2373 holgerb 559
                HoTTGeneral.VoltageCell2 = KompassValue / 2;
560
                //HoTTGeneral.VoltageCell3 = Magnetstaerke -> macht NC
561
                //HoTTGeneral.VoltageCell4 = Inclinition -> macht NC
562
                HoTTGeneral.VoltageCell5 = DebugOut.Analog[28]; // I2C ErrorCounter
1944 holgerb 563
                HoTTGeneral.VoltageCell6 = GPSInfo.HomeBearing / 2;
2373 holgerb 564
                if(UBat > BattLowVoltageWarning + 2) HoTTGeneral.FuelPercent = (UBat - (BattLowVoltageWarning + 2)) * 3;
1943 holgerb 565
                else HoTTGeneral.FuelPercent = 0;
2373 holgerb 566
                if(HoTTGeneral.FuelPercent > 100) HoTTGeneral.FuelPercent = 100;
567
                HoTTGeneral.FuelCapacity = NC_ErrorCode;//HoehenWert/100; // Oelpegel
568
//              if(HoTTGeneral.FuelCapacity < 0) HoTTGeneral.FuelCapacity = 0;
1943 holgerb 569
                HoTTGeneral.Altitude = HoehenWert/100 + 500;
570
                HoTTGeneral.Battery1 = UBat;
571
                HoTTGeneral.Battery2 = UBat;
2531 holgerb 572
                if(!SpeechMessage) HoTTGeneral.m_sec =  BuildHoTT_Vario(); else  HoTTGeneral.m_sec = VARIO_ZERO;
573
                HoTTGeneral.m_3sec = 120 + SpeechMessage;
1943 holgerb 574
                HoTTGeneral.InputVoltage = UBat;
2373 holgerb 575
                HoTTGeneral.Temperature1 = MinBlTemperture + 20;
576
                HoTTGeneral.Temperature2 = MaxBlTemperture + 20;
1943 holgerb 577
                HoTTGeneral.Capacity = Capacity.UsedCapacity/10;
2531 holgerb 578
HoTTGeneral.WarnBeep = 0;
1943 holgerb 579
                HoTTGeneral.Current = Capacity.ActualCurrent;
2178 holgerb 580
//HoTTGeneral.ErrorNumber = HoTTErrorCode();
1943 holgerb 581
                HoTT_DataPointer = (unsigned char *) &HoTTGeneral;
582
                return(sizeof(HoTTGeneral));
583
                break;
1919 holgerb 584
  default: return(0);
585
  }            
586
}
587
 
588
//---------------------------------------------------------------
1917 holgerb 589
void HoTT_Menu(void)
590
{
2420 holgerb 591
 static unsigned char line, page = 0,show_current = 0,show_mag = 0, show_poti = 0;
1921 holgerb 592
 unsigned char tmp;
1944 holgerb 593
 HoTTVarioMeter = (HoTTVarioMeter * 7 + VarioMeter) / 8;
2420 holgerb 594
 
595
// if(HottKeyboard) {beeptime = 1000;};  
1944 holgerb 596
 
2420 holgerb 597
 switch(page)
598
 {
599
  case 0:
1933 holgerb 600
  switch(line++)
1917 holgerb 601
  {
1919 holgerb 602
        case 0:  
1923 holgerb 603
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
1939 holgerb 604
                         HoTT_printfxy_BLINK(0,0,"  %2i.%1iV  ",UBat/10, UBat%10)
605
                        else
606
                         HoTT_printfxy(0,0,"  %2i.%1iV  ",UBat/10, UBat%10)
607
 
608
                        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
609
                          {
610
                           if(HoehenReglerAktiv)        HoTT_printfxy_INV(10,0,"ALT:%4im %c", (int16_t)(HoehenWert/100),VarioCharacter)
611
                           else                                         HoTT_printfxy(10,0,"ALT:%4im  ", (int16_t)(HoehenWert/100))
612
                           }
613
            else    HoTT_printfxy(10,0,"ALT:---- ");
614
                        break;
615
        case 1:  
616
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
617
                         HoTT_printfxy_BLINK(0,1,"  %2i:%02i  ",FlugSekunden/60,FlugSekunden%60)
618
            else   HoTT_printfxy(0,1,"  %2i:%02i  ",FlugSekunden/60,FlugSekunden%60);                      
2437 holgerb 619
                        HoTT_printfxy(10,1,"DIR: %3d%c",CompassCorrected, HoTT_GRAD);
1949 holgerb 620
                        if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(20,1,"C") else HoTT_printfxy(20,1," ");
1939 holgerb 621
            break;
622
        case 2:
623
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
624
                         HoTT_printfxy_BLINK(0,2,"  %5i  ",Capacity.UsedCapacity)
625
            else   HoTT_printfxy(0,2,"  %5i  ",Capacity.UsedCapacity);                     
1940 holgerb 626
                        HoTT_printfxy(12,2,"I:%2i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
1939 holgerb 627
                        break;
628
        case 3:
2072 holgerb 629
                        HoTT_printfxy(9,0,":");
630
                        HoTT_printfxy(9,1,":");
631
                        HoTT_printfxy(9,2,":");
1939 holgerb 632
                        HoTT_printfxy(0,3,"---------+-----------");
2072 holgerb 633
 
634
//                      HoTT_printfxy(0,3,"---------------------");
1939 holgerb 635
                        HoTT_printfxy(0,6,"---------------------");
636
                        break;
637
        case 4:  
638
                        if(NaviDataOkay)
639
                        {
2072 holgerb 640
                                HoTT_printfxy(9,4,":");
1939 holgerb 641
                                HoTT_printfxy(0,4,"SAT:%2d ",GPSInfo.NumOfSats);
642
                            HoTT_printfxy(10,4,"DIST:%3dm",GPSInfo.HomeDistance/10);
643
                                switch (GPSInfo.SatFix)
644
                                {
645
                                        case SATFIX_3D:
646
                                                        if(GPSInfo.Flags & FLAG_DIFFSOLN) HoTT_printfxy(7,4,"D ")
647
                                                        else HoTT_printfxy(7,4,"3D");
648
                                                break;
649
                                        default:
1943 holgerb 650
                                                HoTT_printfxy_BLINK(7,4,"!!");
1939 holgerb 651
                                                break;
652
                                }      
653
                        }
654
                        else
1944 holgerb 655
                        {                    
1940 holgerb 656
                                Hott_ClearLine(4);
1939 holgerb 657
                        }
658
                        break;
659
        case 5:
660
                        if(NaviDataOkay)
661
                        {
1972 holgerb 662
                        if(show_mag)
663
                          {
664
                                HoTT_printfxy(0,5,"MAG:%3u%% ",EarthMagneticField);
1939 holgerb 665
                            HoTT_printfxy(12,5,"HM:%3d%c %c", GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter);
1972 holgerb 666
                                HoTT_printfxy(9,5,"incl:%2d%c(%2i)",EarthMagneticInclination, HoTT_GRAD,EarthMagneticInclinationTheoretic);
667
              }
668
                         else
669
                          {
2072 holgerb 670
                                HoTT_printfxy(0,5,"    %2um/s:  HM:%3d%c %c",GPSInfo.Speed, GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter);
1972 holgerb 671
                          }    
1939 holgerb 672
            }
1940 holgerb 673
                        else Hott_ClearLine(5);
1939 holgerb 674
                        break;
675
        case 6:
676
                        break;
677
        case 7: if(NC_ErrorCode)
678
                  {
679
                           if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER)
680
                            {
681
                             Hott_ClearLine(7);
682
                             HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode);
683
                            }
684
                                else
685
                                {
686
                                 HoTT_printfxy(0,7,"ERR: ");     _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);};
687
                                }
2120 holgerb 688
                        else
689
                        if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!")
1939 holgerb 690
                        else HoTT_printfxy(0,7," www.MikroKopter.de  ");
691
                        break;
2090 holgerb 692
        case 8: //ASCIIPacket.WarnBeep = HoTT_Waring();
1939 holgerb 693
                        // ASCIIPacket.WarnBeep = Parameter_UserParam1;
694
        case 9:
695
        case 10:
696
        case 11:
697
        case 12:
698
        case 13:
699
        case 14:  
700
        case 15:  
701
        case 16:  
2440 holgerb 702
                        if(HottKeyboard == HOTT_KEY_DOWN) { LIBFC_HoTT_Clear(); page = 5; line = 0;}
703
                        else
1972 holgerb 704
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_mag) show_mag = 0; else show_mag = 1;}
705
                        else
1949 holgerb 706
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 1; line = 0;};
1939 holgerb 707
                        HottKeyboard = 0;
708
                        break;
709
   default:  line = 0;
710
                        break;
711
  }
2420 holgerb 712
  break;
713
  case 1:
1939 holgerb 714
  switch(line++)
715
  {
716
        case 0:  
717
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
1923 holgerb 718
                         HoTT_printfxy_BLINK(0,0," %2i:%02i  %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity)
719
            else   HoTT_printfxy(0,0," %2i:%02i  %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity);                         
1917 holgerb 720
                        break;
721
        case 1:  
2437 holgerb 722
                        HoTT_printfxy(0,1,"DIR:%3d%c",CompassCorrected, HoTT_GRAD);
1917 holgerb 723
                        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
1920 holgerb 724
                          {
725
                           if(HoehenReglerAktiv)        HoTT_printfxy_INV(10,1,"ALT:%4im", (int16_t)(HoehenWert/100))
726
                           else                                         HoTT_printfxy(10,1,"ALT:%4im", (int16_t)(HoehenWert/100))
727
                           }
728
            else    HoTT_printfxy(10,1,"ALT:---- ");
729
                        HoTT_printfxy(20,1,"%c",VarioCharacter);
1917 holgerb 730
            break;
731
        case 2:
732
                        if(NaviDataOkay)
733
                        {
1923 holgerb 734
                          HoTT_printfxy(1,2,"HM:%3d%c  DIST:%3dm %c", GPSInfo.HomeBearing, HoTT_GRAD, GPSInfo.HomeDistance/10, NC_GPS_ModeCharacter);
1917 holgerb 735
            }
736
                        else
737
                        {
1923 holgerb 738
                         Hott_ClearLine(2);
1917 holgerb 739
                        }
740
                        break;
1923 holgerb 741
        case 3:
742
                        HoTT_printfxy(0,3,"PWR:%2i.%1iA (%iW) ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10,Capacity.ActualPower);
1949 holgerb 743
                        if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(19,3,"CF") else HoTT_printfxy(19,3,"  ");
1923 holgerb 744
                        break;
1917 holgerb 745
        case 4:  
746
                        if(NaviDataOkay)
747
                        {
1919 holgerb 748
                                HoTT_printfxy(0,4,"GPS:%2um/s SAT:%d ",GPSInfo.Speed,GPSInfo.NumOfSats);
1917 holgerb 749
                                switch (GPSInfo.SatFix)
750
                                {
751
                                        case SATFIX_3D:
752
                                                HoTT_printfxy(16,4,"  3D ");
753
                                                break;
1925 holgerb 754
                                        //case SATFIX_2D:
755
                                        //case SATFIX_NONE:
1917 holgerb 756
                                        default:
1925 holgerb 757
                                                HoTT_printfxy_BLINK(16,4,"NOFIX");
1917 holgerb 758
                                                break;
759
                                }      
760
                                if(GPSInfo.Flags & FLAG_DIFFSOLN)
761
                                {
762
                                        HoTT_printfxy(16,4,"DGPS ");
763
                                }
764
                        }
765
                        else
766
                        {                    //012345678901234567890
1930 holgerb 767
                                HoTT_printfxy(0,4,"   No NaviCtrl       ");
1917 holgerb 768
                        }
769
                        break;
770
        case 5:
1949 holgerb 771
                        if(show_current)
772
                         {
2386 holgerb 773
//                              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);
774
                                HoTT_printfxy(0,5,"%2i.%i %2i.%i %2i.%i %2i.%iA", BL3_Current(0)/10,BL3_Current(0)%10,BL3_Current(1)/10,BL3_Current(1)%10,BL3_Current(2)/10,BL3_Current(2)%10,BL3_Current(3)/10,BL3_Current(3)%10);
1949 holgerb 775
                         }
776
                         else
777
                         {
778
                                HoTT_printfxy(0,5,"%3i %3i %3i %3i%cC", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature,HoTT_GRAD);
779
                         }
1917 holgerb 780
                        break;
781
        case 6:
1949 holgerb 782
                        if(show_current)
783
                         {
1917 holgerb 784
                    if(RequiredMotors == 4) Hott_ClearLine(6);
785
                                else
2386 holgerb 786
//                              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)
787
                                if(RequiredMotors == 6)  HoTT_printfxy(0,6,"%2i.%i %2i.%iA", BL3_Current(4)/10,BL3_Current(4)%10, BL3_Current(5)/10,BL3_Current(5)%10)
1949 holgerb 788
                                else
2386 holgerb 789
//                              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);
790
                                if(RequiredMotors > 6)   HoTT_printfxy(0,6,"%2i.%i %2i.%i %2i.%i %2i.%iA", BL3_Current(4)/10,BL3_Current(4)%10,BL3_Current(5)/10,BL3_Current(5)%10,BL3_Current(6)/10,BL3_Current(6)%10,BL3_Current(7)/10,BL3_Current(7)%10,BL3_Current(8)/10,BL3_Current(8)%10);
1949 holgerb 791
             }
792
                         else
793
                         {
794
                    if(RequiredMotors == 4) Hott_ClearLine(6);
795
                                else
1923 holgerb 796
                                if(RequiredMotors == 6)  HoTT_printfxy(0,6,"%3i %3i%cC        ", Motor[4].Temperature, Motor[5].Temperature,HoTT_GRAD)
1917 holgerb 797
                                else
1923 holgerb 798
                                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);
1949 holgerb 799
             }
1917 holgerb 800
                        break;
1930 holgerb 801
        case 7: if(NC_ErrorCode)
802
                  {
803
                           if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER)
804
                            {
805
                             Hott_ClearLine(7);
806
                             HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode);
807
                            }
808
                                else
809
                                {
810
                                 HoTT_printfxy(0,7,"ERR: ");     _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);};
811
                                }
2120 holgerb 812
                        else
813
                        if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!")
1937 holgerb 814
                        else HoTT_printfxy(0,7," www.MikroKopter.de  ");
1917 holgerb 815
                        break;
2090 holgerb 816
        case 8: // ASCIIPacket.WarnBeep = HoTT_Waring();
1919 holgerb 817
                        // ASCIIPacket.WarnBeep = Parameter_UserParam1;
1921 holgerb 818
        case 9:
1917 holgerb 819
        case 10:
820
        case 11:
821
        case 12:
822
        case 13:
1919 holgerb 823
        case 14:  
824
        case 15:  
825
        case 16:  
1949 holgerb 826
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_current) show_current = 0; else show_current = 1;   Hott_ClearLine(5);  Hott_ClearLine(6);}
827
                        else
2527 holgerb 828
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;}
1949 holgerb 829
                        else
2527 holgerb 830
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;}
1949 holgerb 831
//if(HottKeyboard) HoTT_printfxy(15,6,"%KEY:%02x ",HottKeyboard);
1921 holgerb 832
                        HottKeyboard = 0;
833
                        break;
1933 holgerb 834
   default:  line = 0;
1921 holgerb 835
                        break;
836
  }
2420 holgerb 837
  break;
838
  case 2:
1933 holgerb 839
  switch(line++)
1921 holgerb 840
  {
841
        case 0:  
2344 holgerb 842
                        HoTT_printfxy_INV(0,0,"Setting:%u %s ",ActiveParamSet,EE_Parameter.Name);
1921 holgerb 843
                        break;
844
    case 1: HoTT_printfxy(0,1,"Min:%2i.%1iV %s ",BattLowVoltageWarning/10, BattLowVoltageWarning%10, Mixer.Name);
845
                        break;
1923 holgerb 846
    case 2:  HoTT_printfxy(0,2,"ALT:");
1921 holgerb 847
                 if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
848
                 {
849
                          if(!(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER)) HoTT_printf("POTI:%3u ", Parameter_HoehenSchalter)
850
                          else
851
                          {
852
                           if(Parameter_HoehenSchalter > 50) HoTT_printf("(ON)  ") else HoTT_printf("(OFF) ");
853
                           if((Parameter_ExtraConfig & CFG2_HEIGHT_LIMIT)) HoTT_printf("LIMIT", Parameter_HoehenSchalter)
854
                           else HoTT_printf("VARIO", Parameter_HoehenSchalter);
855
                          }
856
                         }
857
                        else
858
                                HoTT_printf("DISABLED");
859
                        break;
1923 holgerb 860
    case 3: HoTT_printfxy(0,3,"CF:");
2342 holgerb 861
                        if(!EE_Parameter.CareFreeChannel) HoTT_printf("DISABLED")
1921 holgerb 862
                        else
863
                         {
864
                          if(CareFree)  HoTT_printf(" (ON) ") else HoTT_printf(" (OFF)");
865
                          if(EE_Parameter.ExtraConfig & CFG_LEARNABLE_CAREFREE) HoTT_printf(" TEACH");
866
                         }
867
                        break;
1923 holgerb 868
    case 4: HoTT_printfxy(0,4,"GPS:");
869
                    if(!(Parameter_GlobalConfig & CFG_GPS_AKTIV)) HoTT_printf("DISABLED")
870
                        else
871
                         {
2342 holgerb 872
                          tmp = GetChannelValue(EE_Parameter.NaviGpsModeChannel);
1923 holgerb 873
                          if(tmp < 50) HoTT_printf("(FREE)")
874
                          else
875
                          if(tmp >= 180) HoTT_printf("(HOME)")
876
                          else
877
                          if(EE_Parameter.ExtraConfig & CFG_GPS_AID) HoTT_printf("(AID) ")
878
                          else HoTT_printf("(HOLD)")
879
                         }
880
                        if(EE_Parameter.FailSafeTime) HoTT_printfxy(10,4," FS:%usek ",EE_Parameter.FailSafeTime)
881
 
882
                        break;
883
    case 5: HoTT_printfxy(0,5,"HOME ALT:");
884
                        if(EE_Parameter.ComingHomeAltitude) HoTT_printf("%um",EE_Parameter.ComingHomeAltitude) else HoTT_printf("HOLD ");
885
                        break;
1921 holgerb 886
        case 6:
1982 holgerb 887
                        if(!show_poti)
888
                         {
2496 holgerb 889
              HoTT_printfxy(0,6,"Ni:%4i Ro:%4i C:%3i",ChannelNick,ChannelRoll, Parameter_ServoNickControl);
890
                      HoTT_printfxy(0,7,"Gs:%4i Ya:%4i ",ChannelGas+127,ChannelYaw);
1982 holgerb 891
                         }
892
                        else
893
                         {
894
              HoTT_printfxy(0,6,"P1:%4i P2:%4i 3:%3i",Poti1,Poti2, Poti3);
895
                      HoTT_printfxy(0,7,"P4:%4i P5:%4i 6:%3i",Poti4,Poti5, Poti6);
896
                         }
897
 
1921 holgerb 898
                        break;
899
    case 7: //HoTT_printfxy(0,6,"WARNINGS:");
900
                        if(HoTTBlink)
901
                        {
902
                         LIBFC_HoTT_SetPos(6 * 21);
903
                         if(!(Parameter_GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV)) HoTT_printf_BLINK("COUPLING OFF! ");
904
                         if(EE_Parameter.BitConfig & (CFG_LOOP_LINKS | CFG_LOOP_RECHTS | CFG_LOOP_UNTEN | CFG_LOOP_OBEN)) HoTT_printf_BLINK("LOOPING! ");
905
                         if(Parameter_GlobalConfig & CFG_HEADING_HOLD) HoTT_printf_BLINK("HH! ");
906
                         if(!(Parameter_GlobalConfig & CFG_KOMPASS_AKTIV)) HoTT_printf_BLINK("COMPASS OFF! ");
907
                        }
908
                        break;
2090 holgerb 909
    case 8: //ASCIIPacket.WarnBeep = HoTT_Waring();
1921 holgerb 910
                        break;
911
    case 9:
912
    case 10:
913
    case 11:
914
    case 12:
915
    case 13:
916
    case 14:
917
    case 15:
918
    case 16:
1982 holgerb 919
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_poti) show_poti = 0; else show_poti = 1;   Hott_ClearLine(6);  Hott_ClearLine(7);}
920
                        else
2527 holgerb 921
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;}
2418 holgerb 922
                        else
2527 holgerb 923
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;};
1921 holgerb 924
                        HottKeyboard = 0;
925
                        break;
1933 holgerb 926
   default:  line = 0;
1917 holgerb 927
                        break;
928
  }
2420 holgerb 929
  break;
930
  case 3:
2418 holgerb 931
  switch(line++)
932
  {
2438 holgerb 933
        static unsigned char load_waypoint_tmp2 = 1, changed2;
2418 holgerb 934
        case 0:  
935
                        HoTT_printfxy(0,0,"Load Waypoints");
2420 holgerb 936
                        HoTT_printfxy(0,1,"(Relative Positions)");
937
//                      HoTT_printfxy(0,1,"(Absolute)"); 
2418 holgerb 938
                        break;
2420 holgerb 939
    case 1:
940
                        if(NaviData_WaypointNumber)     HoTT_printfxy(0,6,"Active WP:%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber)
941
                        else HoTT_printfxy(0,6,"No WPs active     ")
2418 holgerb 942
                        break;
943
    case 2:
2420 holgerb 944
                         HoTT_printfxy(0,7,"%2i.%1iV ",UBat/10, UBat%10)
2424 holgerb 945
                         HoTT_printfxy(11,7,"%s",WPL_Name)
2420 holgerb 946
    case 3:
947
    case 4:
948
    case 5:
949
                        if(load_waypoint_tmp2)
2418 holgerb 950
                         {
2420 holgerb 951
                          if(changed2 && HoTTBlink) HoTT_printfxy(10,3,"   ")
952
                          else HoTT_printfxy(10,3,"%2i   ",load_waypoint_tmp2);
953
                          HoTT_printfxy(0,3,"Load list:")
2418 holgerb 954
                         }
955
                        else
956
                         {
957
                          HoTT_printfxy(0,3,"Load list: -- ");
958
                         }
2420 holgerb 959
                         if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,4,"No SD-Card   ")
960
                         else
961
                         {
2425 holgerb 962
                          if(GPSInfo.SatFix == SATFIX_3D)
963
                           {
964
                            if(changed2 && load_waypoint_tmp2) HoTT_printfxy(0,4,"(Set -> Load)")
965
                            else HoTT_printfxy(0,4,"             ");
966
                                if(HottKeyboard == HOTT_KEY_SET) { if(load_waypoint_tmp2) ToNC_Load_WP_List = load_waypoint_tmp2 | 128; changed2 = 0;}
967
                           } else HoTT_printfxy(0,4,"!No GPS-Fix! ");
2420 holgerb 968
                         }
969
                        if(HottKeyboard == HOTT_KEY_UP && load_waypoint_tmp2 < NaviData_MaxWpListIndex) { changed2 = 1; load_waypoint_tmp2++;HoTTBlink = 0;}
970
                        if(HottKeyboard == HOTT_KEY_DOWN && load_waypoint_tmp2 > 1) { changed2 = 1; load_waypoint_tmp2--;HoTTBlink = 0;};
2527 holgerb 971
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;}
972
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;};
2418 holgerb 973
                        HottKeyboard = 0;
974
                        break;
975
   default:  line = 0;
976
                        break;
977
  }
2420 holgerb 978
  break;
979
  case 4:
2418 holgerb 980
  switch(line++)
981
  {
2438 holgerb 982
        static unsigned char load_waypoint_tmp = 1, changed;
2418 holgerb 983
        case 0:  
984
                        HoTT_printfxy(0,0,"Load Waypoints");
2420 holgerb 985
                        HoTT_printfxy(0,1,"(Fixed Positions)");
2418 holgerb 986
                        break;
2420 holgerb 987
    case 1:
988
                        if(NaviData_WaypointNumber)     HoTT_printfxy(0,6,"Active WP:%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber)
989
                        else HoTT_printfxy(0,6,"No WPs active    ")
2418 holgerb 990
                        break;
991
    case 2:
2420 holgerb 992
                         HoTT_printfxy(0,7,"%2i.%1iV ",UBat/10, UBat%10)
2424 holgerb 993
                         HoTT_printfxy(11,7,"%s",WPL_Name)
2420 holgerb 994
    case 3:
995
    case 4:
996
    case 5:
2438 holgerb 997
                        HoTT_printfxy(0,3,"Load list:")
2420 holgerb 998
                        if(load_waypoint_tmp)
2418 holgerb 999
                         {
2420 holgerb 1000
                          if(changed && HoTTBlink) HoTT_printfxy(10,3,"   ")
1001
                          else HoTT_printfxy(10,3,"%2d (FIX)",load_waypoint_tmp);
2418 holgerb 1002
                         }
1003
                        else
1004
                         {
2438 holgerb 1005
                          HoTT_printfxy(10,3," --")
2418 holgerb 1006
                         }
2420 holgerb 1007
 
1008
                         if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,4,"No SD-Card   ")
1009
                         else
1010
                         {
2425 holgerb 1011
                            if(changed && load_waypoint_tmp) HoTT_printfxy(0,4,"(Set -> Load)")
1012
                            else HoTT_printfxy(0,4,"             ");
1013
                         }
2420 holgerb 1014
                        if(HottKeyboard == HOTT_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { changed = 1; load_waypoint_tmp++; HoTTBlink = 0;}
1015
                        if(HottKeyboard == HOTT_KEY_DOWN && load_waypoint_tmp > 1) { changed = 1; load_waypoint_tmp--; HoTTBlink = 0;};
1016
                        if(HottKeyboard == HOTT_KEY_SET) { if(load_waypoint_tmp) ToNC_Load_WP_List = load_waypoint_tmp; changed = 0;}
2438 holgerb 1017
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;}
1018
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;};
2418 holgerb 1019
                        HottKeyboard = 0;
1020
                        break;
1021
   default:  line = 0;
1022
                        break;
1023
  }
2420 holgerb 1024
  break;
2438 holgerb 1025
  case 5:
1026
  switch(line++)
1027
  {
1028
    static unsigned char wp_tmp, changed;
1029
        case 0:  
1030
                        HoTT_printfxy(0,0,"Store single Position");
1031
//                      HoTT_printfxy(0,1,"(Fixed Positions)"); 
1032
                        break;
1033
    case 1:
1034
                    HoTT_printfxy(0,2," %2i.%1iV ",UBat/10, UBat%10)
1035
                        HoTT_printfxy(0,3," %2i:%02i ",FlugSekunden/60,FlugSekunden%60);                           
1036
//                      HoTT_printfxy(0,4,"Dist:%3dm",NaviData_TargetDistance)
1037
                        break;
1038
    case 2:
1039
                        HoTT_printfxy(11,2,"ALT:%4im", (int16_t)(HoehenWert/100))              
1040
                        HoTT_printfxy(11,3,"DIR: %3d%c",CompassCorrected, HoTT_GRAD);
1041
                        HoTT_printfxy(11,4,"Cam: %3i",Parameter_ServoNickControl);
1042
                        break;
1043
    case 3:
1044
    case 4:
1045
    case 5:
1046
                    HoTT_printfxy(0,6,"Store point:")
1047
                        if(wp_tmp)
1048
                         {
1049
                          if(changed && HoTTBlink) HoTT_printfxy(13,6,"   ")
1050
                          else HoTT_printfxy(13,6,"%2d ",wp_tmp);
1051
                         }
1052
                        else
1053
                         {
2439 holgerb 1054
                          HoTT_printfxy(13,6,"--")
2438 holgerb 1055
                         }
2439 holgerb 1056
 
1057
                    if(GPSInfo.SatFix == SATFIX_3D)
1058
                    {
2438 holgerb 1059
                         if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,7,"No SD-Card   ")
1060
                         else
1061
                         {
1062
                            if(changed && wp_tmp) HoTT_printfxy(0,7,"(Set -> Store)")
1063
                            else Hott_ClearLine(7);
1064
                         }
2439 holgerb 1065
                         if(HottKeyboard == HOTT_KEY_SET) { if(wp_tmp) ToNC_Store_SingePoint = wp_tmp; changed = 0;}
1066
                    }
1067
            else HoTT_printfxy(0,7,"!No GPS-Fix! ");
1068
 
2438 holgerb 1069
                        if(HottKeyboard == HOTT_KEY_UP && wp_tmp < NaviData_MaxWpListIndex) { changed = 1; wp_tmp++; HoTTBlink = 0;}
1070
                        if(HottKeyboard == HOTT_KEY_DOWN && wp_tmp > 1) { changed = 1; wp_tmp--; HoTTBlink = 0;};
1071
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;}
1072
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;};
1073
                        HottKeyboard = 0;
1074
                        break;
1075
   default:  line = 0;
1076
                        break;
1077
  }
1078
  break;
1079
  case 6:
1080
  switch(line++)
1081
  {
1082
    static unsigned char wp_tmp, changed;
1083
        case 0:  
1084
                        HoTT_printfxy(0,0,"Load single Position");
1085
//                      HoTT_printfxy(0,1,"(Fixed Positions)"); 
1086
                        break;
1087
    case 1:
1088
                    HoTT_printfxy(0,2," %2i.%1iV ",UBat/10, UBat%10)
1089
                        HoTT_printfxy(0,3," %2i:%02i ",FlugSekunden/60,FlugSekunden%60);                           
1090
//                      HoTT_printfxy(0,4,"Dist:%3dm",NaviData_TargetDistance)
2439 holgerb 1091
                    if(NaviData_WaypointNumber) HoTT_printfxy(0,5,"WP:%2d/%d Dist:%3dm ",NaviData_WaypointIndex,NaviData_WaypointNumber,NaviData_TargetDistance)
2438 holgerb 1092
                    else Hott_ClearLine(5);
1093
                        break;
1094
    case 2:
2439 holgerb 1095
                        if(FromNC_AltitudeSpeed)
1096
                          HoTT_printfxy(8,2,"ALT:%4i/%im ", (int16_t)(HoehenWert/100),(int16_t)(FromNC_AltitudeSetpoint/100))
1097
                        else
1098
                          HoTT_printfxy(8,2,"ALT:%4im    ",(int16_t)(HoehenWert/100))
1099
 
1100
                        HoTT_printfxy(8,3,"DIR: %3d%c",CompassCorrected, HoTT_GRAD);
1101
                        HoTT_printfxy(8,4,"Cam: %3i",Parameter_ServoNickControl);
2438 holgerb 1102
                        break;
1103
//                       HoTT_printfxy(11,7,"%s",WPL_Name)
1104
    case 3:
2440 holgerb 1105
    case 4:                                      
2438 holgerb 1106
    case 5:
1107
                  if(HottKeyboard) DebugOut.Analog[17]++;
1108
                  HoTT_printfxy(0,6,"load point:")
1109
                        if(wp_tmp)
1110
                         {
1111
                          if(changed && HoTTBlink) HoTT_printfxy(11,6,"   ")
1112
                          else HoTT_printfxy(11,6,"%2d",wp_tmp);
1113
                         }
1114
                        else
1115
                         {
2440 holgerb 1116
                          HoTT_printfxy(11,6,"--")
2438 holgerb 1117
                         }
1118
 
1119
                         if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,7,"No SD-Card   ")
1120
                         else
1121
                         {
1122
                            if(changed && wp_tmp) HoTT_printfxy(0,7,"(Set -> Load)")
2439 holgerb 1123
                            else
1124
                                {
1125
                                 Hott_ClearLine(7);
1126
                                 if(NaviData_WaypointNumber) HoTT_printfxy(0,7,"%s",WPL_Name);
1127
                                }
2438 holgerb 1128
                         }
1129
                        if(HottKeyboard == HOTT_KEY_UP && wp_tmp < NaviData_MaxWpListIndex) { changed = 1; wp_tmp++; HoTTBlink = 0;}
1130
                        if(HottKeyboard == HOTT_KEY_DOWN && wp_tmp > 1) { changed = 1; wp_tmp--; HoTTBlink = 0;};
1131
                        if(HottKeyboard == HOTT_KEY_SET) { if(wp_tmp) ToNC_Load_SingePoint = wp_tmp; changed = 0;}
2527 holgerb 1132
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;}
2438 holgerb 1133
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;};
1134
                        HottKeyboard = 0;
1135
                        break;
1136
   default:  line = 0;
1137
                        break;
1138
  }
1139
  break;
2527 holgerb 1140
  case 7:
1141
  switch(line++)
1142
  {
1143
        static unsigned char i=0,test=0,set=0;
1144
 
1145
        case 0: HoTT_printfxy(0,0,"Motortest / Setpoints");break;
1146
        case 1: //HoTT_printfxy(0,1,"Motor Setpoint Strom ");
1147
    case 2:
1148
    case 3:
1149
        case 4: i=((line-2)*2)+1;
1150
                        if(MotorenEin)
1151
                        {
1152
                                HoTT_printfxy(0,line,"M%i=%2i%2i.%iA M%i=%2i%2i.%iA",i,Motor[i-1].SetPoint,Motor[i-1].Current/10,Motor[i-1].Current%10,i+1,Motor[i].SetPoint,Motor[i].Current/10,Motor[i].Current%10);
1153
                        }
1154
                        else
1155
                        {
1156
                                HoTT_printfxy(0,line,"M%i=%2i%2i.%iA M%i=%2i%2i.%iA",i,MotorTest[i-1],Motor[i-1].Current/10,Motor[i-1].Current%10,i+1,MotorTest[i],Motor[i].Current/10,Motor[i].Current%10);
1157
                        }
1158
                        break;
1159
    case 5: if(test)
1160
                        {
1161
                                HoTT_printfxy(0,6,"!!!Motortest Aktiv!!!");
1162
                        }
1163
        case 6: if(test)
1164
                        {
1165
                                PC_MotortestActive = 254;
1166
                                HoTT_printfxy(0,7,"Motor %i",test);
1167
                                MotorTest[test-1]=set;
1168
                        }
1169
    case 7:
1170
    case 8:
1171
    case 9:
1172
    case 10:
1173
    case 11:
1174
    case 12:
1175
    case 13:
1176
    case 14:
1177
    case 15:
1178
    case 16:
1179
                        if(HottKeyboard == HOTT_KEY_RIGHT)
1180
                        {
1181
                                if(test)
1182
                                {
1183
                                        set=0;
1184
                                        MotorTest[test-1]=set;
1185
                                        if(test<8) test++;
1186
                                }
1187
                                else
1188
                                {
1189
                                        LIBFC_HoTT_Clear();
1190
                                        page--;
1191
                                        line=0;
1192
                                }
1193
                        }                              
1194
                        else
1195
                        if(HottKeyboard == HOTT_KEY_LEFT)
1196
                        {
1197
                                if(test)
1198
                                {
1199
                                        set=0;
1200
                                        MotorTest[test-1]=set;
1201
                                        if(test>1) test--;
1202
                                }
1203
                                else
1204
                                {
1205
                                        LIBFC_HoTT_Clear();
1206
                                        page++;
1207
                                        line = 0;
1208
                                }
1209
                        }
1210
                        else
1211
                        if((HottKeyboard == HOTT_KEY_UP) && (set <98 ) && test) set+=2;//GESCHW
1212
                        else
1213
                        if((HottKeyboard == HOTT_KEY_DOWN) && (set >0  ) && test) set-=2;
1214
                        else
1215
                        if((HottKeyboard == HOTT_KEY_SET) &&  !MotorenEin)
1216
                        {
1217
                                if(test) test = 0; else test = 1;
1218
                                set=0;
1219
                                Hott_ClearLine(6);  Hott_ClearLine(7);
1220
                        }
1221
                        HottKeyboard = 0;
1222
                        break;
1223
   default:  line = 0;
1224
                        break;
1225
        //HoTT_printfxy(10 ,line,"I");
1226
        //line++;
1227
  }
1228
  break;
1229
  case 8:
1230
  switch(line++)
1231
  {
1232
#define MD_OFF 1
1233
#define MD_CAL 2
1234
#define MD_SAV 3
1235
        static unsigned char mode=MD_OFF,cursor=MD_OFF;
1236
 
1237
        case 0: HoTT_printfxy(0,0,"ACC calibration");break;
2537 holgerb 1238
        case 1: HoTT_printfxy(0,2,"ACC:   N:%3i R:%3i ",NeutralAccX,NeutralAccY);
1239
        case 2: HoTT_printfxy(0,3,"Stick:   (%i/%i)     ",ChannelNick,ChannelRoll);
1240
        case 3: if(ChannelNick || ChannelRoll)  HoTT_printfxy(7,3,"!!");
1241
                        break;
2527 holgerb 1242
        case 4: HoTT_printfxy(2,4,"Off");break;
1243
    case 5: HoTT_printfxy(2,5,"Calibrate");break;
2537 holgerb 1244
        case 6: HoTT_printfxy(2,6,"Save          ");
1245
                        if(mode == MD_SAV && cursor == MD_SAV)
1246
                         {
1247
                          HoTT_printfxy(7,6,"(SET)");
1248
                         }
1249
                        else if((mode == MD_CAL) && !((NC_GPS_ModeCharacter == ' ') || (NC_GPS_ModeCharacter == '/') || (NC_GPS_ModeCharacter == '-')))
1250
                         {
1251
                                HoTT_printfxy(2,6,"Swich GPS off!");   
1252
                         }     
2527 holgerb 1253
                        break;
1254
    case 7:
1255
    case 8: HoTT_printfxy(0,cursor+3,">");break;
1256
    case 9: HoTT_printfxy(1,mode+3,"*");break;
1257
    case 10:
1258
    case 11:
1259
    case 12:
1260
    case 13:
1261
    case 14:
1262
    case 15:
1263
    case 16:
1264
                        if(HottKeyboard == HOTT_KEY_RIGHT)
1265
                        {
1266
                                switch(mode)
1267
                                {
1268
                                        case MD_OFF: LIBFC_HoTT_Clear();
1269
                                                        page--; // leave menu
1270
                                                        line = 0;
1271
                                                        break;
1272
                                        case MD_CAL: NeutralAccY++;
1273
                                                        break;
1274
                                        case MD_SAV: break;
1275
                                        default: mode=MD_OFF;break;
1276
                                }
1277
                        }
1278
                        else
1279
                        if(HottKeyboard == HOTT_KEY_LEFT)
1280
                        {
1281
                                switch(mode)
1282
                                {
1283
                                        case MD_OFF: LIBFC_HoTT_Clear();
1284
                                                        page++;  // leave menu
1285
                                                        line = 0;
1286
                                                        break;
1287
                                        case MD_CAL: NeutralAccY--;
1288
                                                        break;
1289
                                        case MD_SAV: break;
1290
                                        default: mode=MD_OFF;
1291
                                                        break;
1292
                                }                              
1293
                        }
1294
                        else
1295
                        if(HottKeyboard == HOTT_KEY_UP)
1296
                        {
1297
                                switch(mode)
1298
                                {
1299
                                        case MD_CAL: NeutralAccX++;
1300
                                                        break;
1301
                                        case MD_OFF:
1302
                                        case MD_SAV: if(cursor>1) {HoTT_printfxy(0,cursor+3," ");cursor--;}
1303
                                                        HoTT_printfxy(2,6,"     ");
1304
                                                        break;
1305
                                        default: mode=MD_OFF;
1306
                                                        break;
1307
                                }
1308
                        }
1309
                        else
1310
                        if(HottKeyboard == HOTT_KEY_DOWN)
1311
                        {
1312
                                switch(mode)
1313
                                {
1314
                                        case MD_CAL:    NeutralAccX--;
1315
                                                                break;
1316
                                        case MD_SAV:
1317
                                        case MD_OFF:    if(cursor<MD_SAV) {HoTT_printfxy(0,cursor+3," ");cursor++;}
1318
                                                                break;
1319
                                        default:        mode=MD_OFF;
1320
                                                                break;
1321
                                }
1322
                        }
1323
                        else
1324
                        if(HottKeyboard == HOTT_KEY_SET)
1325
                        {
1326
                                switch(mode)
1327
                                {
1328
                                        case MD_OFF: HoTT_printfxy(1,mode+3," ");
1329
                                                        mode = cursor;
1330
                                                        if(mode == MD_CAL && !EE_Parameter.Driftkomp) EE_Parameter.Driftkomp = 6; // enables the Gyro-Drift compensation to make sure that a litlte calibration error won't effect the attitude
1331
                                                        break;
1332
                                        case MD_CAL: HoTT_printfxy(1,mode+3," ");
1333
                                                        mode = MD_OFF;
1334
                                                        break;
1335
                                        case MD_SAV:
1336
                                                        Hott_ClearLine(7);
1337
                                                        if(cursor == MD_SAV)
1338
                                                        {
1339
                                                                if(!MotorenEin)
1340
                                                                {
2537 holgerb 1341
/*                                                                      BoatNeutralNick = AdNeutralNick;
1342
                                                                        BoatNeutralRoll = AdNeutralRoll;
1343
                                                                        BoatNeutralGier = AdNeutralGier;
2527 holgerb 1344
                                                                        SetParamWord(PID_ACC_NICK, (uint16_t)NeutralAccX);
1345
                                                                        SetParamWord(PID_ACC_ROLL, (uint16_t)NeutralAccY);
1346
                                                                        SetParamWord(PID_GYRO_NICK,(uint16_t)BoatNeutralNick);
1347
                                                                        SetParamWord(PID_GYRO_ROLL,(uint16_t)BoatNeutralRoll);
1348
                                                                        SetParamWord(PID_GYRO_YAW,(uint16_t)BoatNeutralGier);
2537 holgerb 1349
*/
1350
                                                                        StoreNeutralToEeprom();
2527 holgerb 1351
                                                                        HoTT_printfxy(7,6," okay ");
1352
                                                                        HoTT_printfxy(1,mode+3," ");
1353
                                                                        mode = MD_OFF;
1354
                                                                }
1355
                                                                else
1356
                                                                {
1357
                                                                        HoTT_printfxy(0,7,"Motors running!!!");
1358
                                                                        mode = MD_OFF;
1359
                                                                }
1360
                                                        }
1361
                                                        else
1362
                                                        {
1363
                                                                HoTT_printfxy(1,mode+3," ");
1364
                                                                mode=cursor;
1365
                                                        }
1366
                                                        break;
1367
                                        default: mode=MD_OFF;
1368
                                                        break;
1369
                                }
1370
                        }
1371
                        HottKeyboard = 0;
1372
                        break;
1373
   default:  line = 0;
1374
                        break;
1375
        //HoTT_printfxy(10 ,line,"I");
1376
        //line++;
1377
  }
1378
  break;
1379
/*
1380
//------------------------------------------------------------------------------------------
1381
// HoTT-Plus
1382
//------------------------------------------------------------------------------------------
1383
  case 9:
1384
  switch(line++)
1385
  {
1386
        case 0: HoTT_printfxy(0,0,"I2C Schwerpunkt GAS");
1387
                        break;
1388
        case 1: HoTT_printfxy(0,1,"I2C%3i%3i%3i%3i",Motor[0].State & MOTOR_STATE_ERROR_MASK,Motor[1].State & MOTOR_STATE_ERROR_MASK, Motor[2].State & MOTOR_STATE_ERROR_MASK, Motor[3].State & MOTOR_STATE_ERROR_MASK);
1389
                        break;
1390
    case 2: HoTT_printfxy(0,2,"   %3i%3i%3i%3i",Motor[4].State & MOTOR_STATE_ERROR_MASK,Motor[5].State & MOTOR_STATE_ERROR_MASK, Motor[6].State & MOTOR_STATE_ERROR_MASK, Motor[7].State & MOTOR_STATE_ERROR_MASK);
1391
                        break;
1392
 
1393
        case 3:  {                       //0123456789ABCDEF
1394
                                int r=0;
1395
                                int n=0;
1396
                                int g=0;
1397
                                n=SummeNick >> 9;
1398
                                r=SummeRoll >> 9;
1399
                                g=Mess_Integral_Gier >> 9;
1400
 
1401
                                HoTT_printfxy(0,5,"%3iN   %3iR   %3iG",n ,r ,g);
1402
                        }
1403
 
1404
                        break;
1405
    case 4: {                       //0123456789ABCDEF
1406
                                HoTT_printfxy(0,4,"+  ^   +  <");
1407
                        }
1408
                        break;
1409
    case 5: {                       //0123456789ABCDEF
1410
                                HoTT_printfxy(0,6,"-  v   -  >");
1411
                        }
1412
                        break;
1413
        case 6: HoTT_printfxy(0,7,"%3i=HG/4 %3i=Gas",HoverGas/4,StickGas);
1414
 
1415
                        break;
1416
    case 7:
1417
    case 8:
1418
    case 9:
1419
    case 10:
1420
    case 11:
1421
    case 12:
1422
    case 13:
1423
    case 14:
1424
    case 15:
1425
    case 16:
1426
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;}
1427
                        else
1428
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;}
1429
                        HottKeyboard = 0;
1430
                        break;
1431
   default:  line = 0;
1432
                        break;
1433
  }
1434
  break;
1435
//---------------------------------------------------------------------------------------------------
1436
  case 10:
1437
{  
1438
        static signed char i=0,j=0,Changepos=0;                  
1439
 
1440
        if(line==9)
1441
        {
1442
                line=0;
1443
                if(HottKeyboard == HOTT_KEY_SET   ) { if(Changepos) Changepos = 0; else Changepos = 1;}
1444
                else
1445
                if(Changepos)
1446
                {
1447
                        unsigned char temp=0;
1448
                        temp=(Changepos+j)-1;
1449
                        if((HottKeyboard == HOTT_KEY_RIGHT) && !((unsigned char)(*Parameter_List[temp].Variable + Parameter_List[temp].offset) >= Parameter_List[temp].max )) {*Parameter_List[temp].Variable += 1;}
1450
                        else
1451
                        if((HottKeyboard == HOTT_KEY_LEFT) && !((unsigned char)(*Parameter_List[temp].Variable + Parameter_List[temp].offset) <= Parameter_List[temp].min )) {*Parameter_List[temp].Variable -= 1;}
1452
                        else
1453
                        if(HottKeyboard == HOTT_KEY_UP  )
1454
                        {
1455
                                Changepos--;
1456
                                line = Changepos/2;
1457
                                if(Changepos< 1       ) {Changepos=16;}
1458
                        }
1459
                        else
1460
                        if(HottKeyboard == HOTT_KEY_DOWN)
1461
                        {
1462
                                Changepos++;
1463
                                line = Changepos/2;
1464
                                if(Changepos >= 17       ) {Changepos=1;}
1465
                        }
1466
                }
1467
                else
1468
                {
1469
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;}
1470
                        else
1471
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;}
1472
                        else
1473
                        if(HottKeyboard == HOTT_KEY_UP  )
1474
                        {
1475
                                j-=16;
1476
                                line = 0;
1477
                                if(j< 0       ) {j=0;}
1478
                        }
1479
                        else
1480
                        if(HottKeyboard == HOTT_KEY_DOWN)
1481
                        {
1482
                                LIBFC_HoTT_Clear();
1483
                                j+=16;
1484
                                line = 0;
1485
                                if(j+14> MAXPARAM       ) {j=MAXPARAM-15;}
1486
                        }
1487
                }
1488
 
1489
                Debug("line=%i Changepos=%i j=%i Key=%i",line,Changepos,j,HottKeyboard);
1490
                HottKeyboard = 0;
1491
        }
1492
 
1493
        HoTT_printfxy(10 ,line,"I");
1494
        i=(line*2)+(j);
1495
        if(Changepos==(line*2)+1)
1496
        {
1497
                HoTT_printfxy(0 ,line,">%3i=%-5.5s%",(unsigned char)(*Parameter_List[i  ].Variable + Parameter_List[i  ].offset),&Parameter_List[i  ].name);
1498
        }
1499
        else
1500
        {
1501
                HoTT_printfxy(0 ,line," %3i=%-5.5s%",(unsigned char)(*Parameter_List[i  ].Variable + Parameter_List[i  ].offset),&Parameter_List[i  ].name);
1502
        }
1503
        if(Changepos==(line*2)+2)
1504
        {
1505
                HoTT_printfxy(11,line,">%3i=%-5.5s%",(unsigned char)(*Parameter_List[i+1].Variable + Parameter_List[i+1].offset),&Parameter_List[i+1].name);
1506
        }
1507
        else
1508
        {
1509
                HoTT_printfxy(11,line," %3i=%-5.5s%",(unsigned char)(*Parameter_List[i+1].Variable + Parameter_List[i+1].offset),&Parameter_List[i+1].name);
1510
        }
1511
 
1512
        line++;
1513
 
1514
}
1515
  break;
1516
  case 11:
1517
  switch(line++)
1518
  {
1519
        case 0: HoTT_printfxy(0,0,"Setting speichern");
1520
                        break;
1521
        case 1: HoTT_printfxy(0,1,"Setting%1i= %-11.11s",GetActiveParamSet(),EE_Parameter.Name);
1522
                        break;                    //123456789012345678901
1523
    case 2: HoTT_printfxy(0,2,"Speichern nach Set %i",settingdest);
1524
                        break;
1525
    case 3: HoTT_printfxy(0,4,"\"SET\" zum speichern");
1526
                        break;
1527
    case 4: HoTT_printfxy(0,5,"^ v zum auswaehlen");
1528
                        break;
1529
    case 5:  HoTT_printfxy(0,6," HOTT+ sponsored  by ");
1530
                        break;
1531
        case 6:  HoTT_printfxy(0,7,"--- Flyinghigh.ch ---");
1532
                        break;
1533
    case 7:
1534
    case 8:
1535
    case 9:
1536
    case 10:
1537
    case 11:
1538
    case 12:
1539
    case 13:
1540
    case 14:
1541
    case 15:
1542
    case 16:
1543
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;}
1544
                        else
1545
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;}
1546
                        else
1547
                        if((HottKeyboard == HOTT_KEY_UP) & (settingdest <5 )) settingdest++;
1548
                        else
1549
                        if((HottKeyboard == HOTT_KEY_DOWN) & (settingdest >1  )) settingdest--;
1550
                        else
1551
                        if((HottKeyboard == HOTT_KEY_SET) &&  !MotorenEin)
1552
                        {
1553
                                ParamSet_WriteToEEProm(settingdest);
1554
                                //JetiBeep = jetibeepcode[GetActiveParamSet()-1];
1555
                                Piep(GetActiveParamSet(),120);
1556
                                HoTT_printfxy(0,7,"Gespeichert!");  
1557
                        }
1558
                        HottKeyboard = 0;
1559
                        break;
1560
   default:  line = 0;
1561
                        break;
1562
  }
1563
  break;
1564
//------------------------------------------------------------------------------------------
1565
 // HoTT-Plus
1566
//------------------------------------------------------------------------------------------
1567
*/
2420 holgerb 1568
  default:  page = 0;
1569
  break;
1570
 }
1917 holgerb 1571
}
1572
 
1925 holgerb 1573
#endif
1917 holgerb 1574
 
1575
 
1576