Subversion Repositories FlightCtrl

Rev

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