Subversion Repositories FlightCtrl

Rev

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