Subversion Repositories FlightCtrl

Rev

Rev 2440 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2050 holgerb 1
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2
// + www.MikroKopter.com
3
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
// + Software Nutzungsbedingungen (english version: see below)
5
// + der Fa. HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland - nachfolgend Lizenzgeber genannt -
6
// + Der Lizenzgeber räumt dem Kunden ein nicht-ausschließliches, zeitlich und räumlich* unbeschränktes Recht ein, die im den
7
// + Mikrocontroller verwendete Firmware für die Hardware Flight-Ctrl, Navi-Ctrl, BL-Ctrl, MK3Mag & PC-Programm MikroKopter-Tool 
8
// + - nachfolgend Software genannt - nur für private Zwecke zu nutzen.
9
// + Der Einsatz dieser Software ist nur auf oder mit Produkten des Lizenzgebers zulässig.
10
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11
// + Die vom Lizenzgeber gelieferte Software ist urheberrechtlich geschützt. Alle Rechte an der Software sowie an sonstigen im
12
// + Rahmen der Vertragsanbahnung und Vertragsdurchführung überlassenen Unterlagen stehen im Verhältnis der Vertragspartner ausschließlich dem Lizenzgeber zu.
13
// + Die in der Software enthaltenen Copyright-Vermerke, Markenzeichen, andere Rechtsvorbehalte, Seriennummern sowie
14
// + sonstige der Programmidentifikation dienenden Merkmale dürfen vom Kunden nicht verändert oder unkenntlich gemacht werden.
15
// + Der Kunde trifft angemessene Vorkehrungen für den sicheren Einsatz der Software. Er wird die Software gründlich auf deren
16
// + Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt.
17
// + Die Haftung des Lizenzgebers wird - soweit gesetzlich zulässig - begrenzt in Höhe des typischen und vorhersehbaren
18
// + Schadens. Die gesetzliche Haftung bei Personenschäden und nach dem Produkthaftungsgesetz bleibt unberührt. Dem Lizenzgeber steht jedoch der Einwand 
19
// + des Mitverschuldens offen.
20
// + Der Kunde trifft angemessene Vorkehrungen für den Fall, dass die Software ganz oder teilweise nicht ordnungsgemäß arbeitet.
21
// + Er wird die Software gründlich auf deren Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt.
22
// + Der Kunde wird er seine Daten vor Einsatz der Software nach dem Stand der Technik sichern.
23
// + Der Kunde ist darüber unterrichtet, dass der Lizenzgeber seine Daten im zur Vertragsdurchführung erforderlichen Umfang
24
// + und auf Grundlage der Datenschutzvorschriften erhebt, speichert, verarbeitet und, sofern notwendig, an Dritte übermittelt.
25
// + *) Die räumliche Nutzung bezieht sich nur auf den Einsatzort, nicht auf die Reichweite der programmierten Software.
26
// + #### ENDE DER NUTZUNGSBEDINGUNGEN ####'
27
// +  Hinweis: Informationen über erweiterte Nutzungsrechte (wie z.B. Nutzung für nicht-private Zwecke) sind auf Anfrage per Email an info(@)hisystems.de verfügbar.
28
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
29
// + Software LICENSING TERMS
30
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31
// + of HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland, Germany - the Licensor -
32
// + The Licensor grants the customer a non-exclusive license to use the microcontroller firmware of the Flight-Ctrl, Navi-Ctrl, BL-Ctrl, and MK3Mag hardware 
33
// + (the Software) exclusively for private purposes. The License is unrestricted with respect to time and territory*.
34
// + The Software may only be used with the Licensor's products.
35
// + The Software provided by the Licensor is protected by copyright. With respect to the relationship between the parties to this
36
// + agreement, all rights pertaining to the Software and other documents provided during the preparation and execution of this
37
// + agreement shall be the property of the Licensor.
38
// + The information contained in the Software copyright notices, trademarks, other legal reservations, serial numbers and other
39
// + features that can be used to identify the program may not be altered or defaced by the customer.
40
// + The customer shall be responsible for taking reasonable precautions
41
// + for the safe use of the Software. The customer shall test the Software thoroughly regarding its suitability for the
42
// + intended purpose before implementing it for actual operation. The Licensor's liability shall be limited to the extent of typical and
43
// + foreseeable damage to the extent permitted by law, notwithstanding statutory liability for bodily injury and product
44
// + liability. However, the Licensor shall be entitled to the defense of contributory negligence.
45
// + The customer will take adequate precautions in the case, that the software is not working properly. The customer will test
46
// + the software for his purpose before any operational usage. The customer will backup his data before using the software.
47
// + The customer understands that the Licensor collects, stores and processes, and, where required, forwards, customer data
48
// + to third parties to the extent necessary for executing the agreement, subject to applicable data protection and privacy regulations.
49
// + *) The territory aspect only refers to the place where the Software is used, not its programmed range.
50
// + #### END OF LICENSING TERMS ####
51
// + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de.
52
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1917 holgerb 53
#include "libfc.h"
54
#include "printf_P.h"
55
#include "main.h"
56
#include "spi.h"
57
#include "capacity.h"
58
 
2426 holgerb 59
unsigned char NaviData_WaypointIndex = 0;
60
unsigned char NaviData_WaypointNumber = 0, NaviData_TargetHoldTime = 0, ToNC_Load_WP_List = 0, NaviData_MaxWpListIndex = 0;
2438 holgerb 61
unsigned char ToNC_Load_SingePoint = 0, ToNC_Store_SingePoint = 0;
2426 holgerb 62
char WPL_Name[10];// = {"         \0"};
1925 holgerb 63
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
64
 
1920 holgerb 65
#define HoTT_printf(format, args...)                    {  _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);}
66
#define HoTT_printfxy(x,y,format, args...)              { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);}
67
#define HoTT_printfxy_INV(x,y,format, args...)          { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);}
68
#define HoTT_printfxy_BLINK(x,y,format, args...)        { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);}
1921 holgerb 69
#define HoTT_printf_BLINK(format, args...)              { _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);}
70
#define HoTT_printf_INV(format, args...)                        { _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);}
1917 holgerb 71
 
1919 holgerb 72
#define VOICE_MINIMALE_EINGANSSPANNUNG    16
73
#define VOICE_BEEP                         5
1920 holgerb 74
#define HoTT_GRAD       96
75
#define HoTT_LINKS      123
76
#define HoTT_RECHTS 124
77
#define HoTT_OBEN       125
78
#define HoTT_UNTEN      126
1917 holgerb 79
 
1949 holgerb 80
#define HOTT_KEY_RIGHT  1
81
#define HOTT_KEY_DOWN   2
82
#define HOTT_KEY_UP     4
83
#define HOTT_KEY_SET    6
84
#define HOTT_KEY_LEFT   8
85
 
2322 holgerb 86
#define VARIO_ZERO 30000
2178 holgerb 87
unsigned int NaviData_TargetDistance = 0;
88
 
2373 holgerb 89
unsigned char MaxBlTemperture = 0;
90
unsigned char MinBlTemperture = 0;
91
unsigned char HottestBl = 0;
92
 
1943 holgerb 93
GPSPacket_t GPSPacket;
94
VarioPacket_t VarioPacket;
95
ASCIIPacket_t ASCIIPacket;
96
ElectricAirPacket_t ElectricAirPacket;
97
HoTTGeneral_t HoTTGeneral;
2090 holgerb 98
unsigned char SpeakHoTT = SPEAK_MIKROKOPTER;
2345 holgerb 99
unsigned char ToNC_SpeakHoTT = 0, ShowSettingNameTime = 0;
1944 holgerb 100
int HoTTVarioMeter = 0;
2090 holgerb 101
const char PROGMEM MIKROKOPTER[] =      {"     MikroKopter     "};
2120 holgerb 102
const char PROGMEM UNDERVOLTAGE[] =     {" !! LiPo voltage !!  "};
2390 holgerb 103
const char PROGMEM LANDING[] =      {" !!   LANDING    !!  "};
2344 holgerb 104
const char PROGMEM SETTING[] =  {"Set  :"};
1930 holgerb 105
const char PROGMEM NC_ERROR_TEXT[MAX_ERR_NUMBER][17] =
106
{
107
//0123456789123456
108
 "No Error        \0",  // 0
109
 "Not compatible  \0",  // 1
110
 "MK3Mag not compa\0",  // 2
111
 "No FC communicat\0",  // 3
2188 holgerb 112
 "Compass communic\0",  // 4
1930 holgerb 113
 "GPS communicatio\0",  // 5
114
 "compass value   \0",  // 6
115
 "RC Signal lost  \0",  // 7
116
 "FC spi rx error \0",  // 8
117
 "No NC communicat\0",  // 9
118
 "FC Nick Gyro    \0",  // 10
119
 "FC Roll Gyro    \0",  // 11
120
 "FC Yaw Gyro     \0",  // 12
121
 "FC Nick ACC     \0",  // 13
122
 "FC Roll ACC     \0",  // 14
123
 "FC Z-ACC        \0",  // 15
124
 "Pressure sensor \0",  // 16
1936 holgerb 125
 "I2C FC->BL-Ctrl \0",  // 17
1930 holgerb 126
 "Bl Missing      \0",  // 18
127
 "Mixer Error     \0",  // 19
1937 holgerb 128
 "Carefree Error  \0",  // 20
1944 holgerb 129
 "GPS Fix lost    \0",  // 21
1948 holgerb 130
 "Magnet Error    \0",  // 22
131
 "Motor restart   \0",  // 23
2008 holgerb 132
 "BL Limitation   \0",  // 24
133
 "GPS Range       \0",  // 25
2009 holgerb 134
 "No SD-Card      \0",  // 26
135
 "SD-Logging error\0",  // 27
2034 holgerb 136
 "Flying range!   \0",  // 28
2146 holgerb 137
 "Max Altitude!   \0",  // 29
2186 holgerb 138
 "No GPS fix      \0",  // 30
2388 holgerb 139
 "compass not cal.\0",  // 31
2408 holgerb 140
 "BL-Selftest     \0",  // 32
141
 "no ext. compass \0",  // 33
142
 "compass sensor  \0"   // 34
1930 holgerb 143
};
1919 holgerb 144
 
2090 holgerb 145
 
146
const char PROGMEM HOTT_ERROR[MAX_ERR_NUMBER][2] =
147
{       // 1 -> only in flight   0 -> also on ground
148
//0123456789123456
149
         {0,0},// "No Error        \0",  // 0
2388 holgerb 150
         {SPEAK_ERROR,0},               // "Not compatible  \0",  // 1
151
         {SPEAK_ERROR,0},               // "MK3Mag not compa\0",  // 2
152
         {SPEAK_ERR_NAVI,1},    // "No FC communicat\0",  // 3
153
         {SPEAK_ERR_COMPASS,1}, // "MK3Mag communica\0",  // 4
154
         {SPEAK_ERR_GPS,0},             // "GPS communicatio\0",  // 5
155
         {SPEAK_ERR_COMPASS,1}, // "compass value   \0",  // 6
2090 holgerb 156
         {SPEAK_ERR_RECEICER,0},// "RC Signal lost  \0",  // 7
2388 holgerb 157
         {SPEAK_ERR_NAVI,0},    // "FC spi rx error \0",  // 8
158
         {SPEAK_ERR_NAVI,0},    // "No NC communicat\0",  // 9
159
         {SPEAK_ERR_SENSOR,0},  // "FC Nick Gyro    \0",  // 10
160
         {SPEAK_ERR_SENSOR,0},  // "FC Roll Gyro    \0",  // 11
161
         {SPEAK_ERR_SENSOR,0},  // "FC Yaw Gyro     \0",  // 12
162
         {SPEAK_ERR_SENSOR,0},  // "FC Nick ACC     \0",  // 13
163
         {SPEAK_ERR_SENSOR,0},  // "FC Roll ACC     \0",  // 14
164
         {SPEAK_ERR_SENSOR,0},  // "FC Z-ACC        \0",  // 15
165
         {SPEAK_ERR_SENSOR,0},  // "Pressure sensor \0",  // 16
166
         {SPEAK_ERR_DATABUS,1}, // "I2C FC->BL-Ctrl \0",  // 17
167
         {SPEAK_ERR_DATABUS,1}, // "Bl Missing      \0",  // 18
168
         {SPEAK_ERROR,0},               // "Mixer Error     \0",  // 19
169
         {SPEAK_CF_OFF,1},              // "Carefree Error  \0",  // 20
170
         {SPEAK_GPS_FIX,1},             // "GPS Fix lost    \0",  // 21
171
         {SPEAK_ERR_COMPASS,0}, // "Magnet Error    \0",  // 22
172
         {SPEAK_ERR_MOTOR,1},   // "Motor restart   \0",  // 23
2090 holgerb 173
         {SPEAK_MAX_TEMPERAT,1},// "BL Limitation   \0",  // 24
2388 holgerb 174
         {SPEAK_MAX_RANGE,1},   // "GPS Range       \0",  // 25
175
         {SPEAK_ERROR,1},               // "No SD-Card      \0",  // 26
176
         {SPEAK_ERROR,1},               // "SD-Logging error\0",  // 27
177
         {SPEAK_MAX_RANGE,1},   // "Flying range!   \0",  // 28
178
         {SPEAK_MAX_ALTITUD,1}, // "Max Altitude!   \0"   // 29
179
         {SPEAK_GPS_FIX,1},             // "No GPS fix      \0"   // 30
180
         {SPEAK_ERR_CALIBARTION,0},// "compass not cal." // 31
2408 holgerb 181
         {SPEAK_ERR_MOTOR,0},   // "BL-Selftest     \0"   // 32
182
         {SPEAK_ERR_COMPASS,0}, // "no ext. compass"     // 33
183
         {SPEAK_ERR_COMPASS,0}  // "compass sensor"      // 34
2090 holgerb 184
};
185
 
186
 
1943 holgerb 187
void GetHottestBl(void)
188
{
189
 static unsigned char search = 0,tmp_max,tmp_min,who;
190
                if(Motor[search].Temperature > tmp_max) { tmp_max = Motor[search].Temperature; who = search;}
191
                else
192
                if(Motor[search].Temperature) if(Motor[search].Temperature < tmp_min) tmp_min = Motor[search].Temperature;
2373 holgerb 193
                if(++search >= MAX_MOTORS)
1943 holgerb 194
                {
195
                 search = 0;
2373 holgerb 196
                 if(tmp_min != 255) MinBlTemperture = tmp_min; else MinBlTemperture = 0;
197
                 MaxBlTemperture = tmp_max;
1943 holgerb 198
                 HottestBl = who;
199
                 tmp_min = 255;
200
                 tmp_max = 0;
201
                 who = 0;
202
                 }
203
}
204
 
1919 holgerb 205
//---------------------------------------------------------------
1917 holgerb 206
void Hott_ClearLine(unsigned char line)
207
{
208
 HoTT_printfxy(0,line,"                     ");
209
}
1919 holgerb 210
//---------------------------------------------------------------
1917 holgerb 211
 
2178 holgerb 212
 
1919 holgerb 213
unsigned char HoTT_Waring(void)
214
{
2090 holgerb 215
  unsigned char status = 0;
216
  static char old_status = 0;
217
  static int repeat;
2120 holgerb 218
//if(Parameter_UserParam1) return(Parameter_UserParam1); 
2190 holgerb 219
  ToNC_SpeakHoTT = SpeakHoTT;
2390 holgerb 220
  if(FC_StatusFlags & FC_STATUS_LOWBAT)
221
   {
222
    if(LowVoltageLandingActive && (EE_Parameter.Receiver == RECEIVER_HOTT)) status = SPEAK_LANDING;
223
        else status = VOICE_MINIMALE_EINGANSSPANNUNG; // Jeti hat kein wort: "LANDEN"
2408 holgerb 224
        if(SpeakHoTT && old_status == VOICE_MINIMALE_EINGANSSPANNUNG) status = SpeakHoTT; // das soll auch noch durch kommen
2390 holgerb 225
   }   
2090 holgerb 226
  else
2408 holgerb 227
  if(NC_ErrorCode && NC_ErrorCode < MAX_ERR_NUMBER)     // Fehlercodes
2090 holgerb 228
   {
229
    if(MotorenEin || !pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][1])) status = pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][0]);
230
   }
2263 holgerb 231
  if(!status)    // Sprachansagen
2091 holgerb 232
   {
2263 holgerb 233
//      if(!(GetParamByte(PID_SPEAK_HOTT_CFG) & 0x01)) SpeakHoTT = 0;  // is the voice wanted?
234
    if(!(EE_Parameter.GlobalConfig3 & CFG3_SPEAK_ALL)) SpeakHoTT = 0;  // is the voice wanted?
2091 holgerb 235
    else status = SpeakHoTT;
2190 holgerb 236
   }
237
   else ToNC_SpeakHoTT = status;
2090 holgerb 238
 
2390 holgerb 239
  if(old_status == status) // Gleichen Fehler nur alle 4 sek bringen
2090 holgerb 240
   {
241
    if(!CheckDelay(repeat)) return(0);
2390 holgerb 242
        repeat = SetDelay(4000);
2090 holgerb 243
   }
244
   else repeat = SetDelay(2000);
245
 
246
  if(status)
247
   {
248
    if(status == SpeakHoTT) SpeakHoTT = 0;
249
   }   
250
  old_status = status;
2120 holgerb 251
//  DebugOut.Analog[16] = status;
2090 holgerb 252
  return(status);
1919 holgerb 253
}
254
 
2178 holgerb 255
/*
256
unsigned char HoTTErrorCode(void)
257
{
258
 return(NC_ErrorCode);
259
}
260
*/
1919 holgerb 261
//---------------------------------------------------------------
1942 holgerb 262
void NC_Fills_HoTT_Telemety(void)
1940 holgerb 263
{
2034 holgerb 264
 unsigned char *ptr = NULL;
1940 holgerb 265
 unsigned char max = 0,i,z;
266
 switch(FromNaviCtrl.Param.Byte[11])
267
  {
268
   case HOTT_VARIO_PACKET_ID:
269
                ptr = (unsigned char *) &VarioPacket;
270
                max = sizeof(VarioPacket);
271
                break;
272
   case HOTT_GPS_PACKET_ID:
273
                ptr = (unsigned char *) &GPSPacket;
274
                max = sizeof(GPSPacket);
275
                break;
276
   case HOTT_ELECTRIC_AIR_PACKET_ID:
277
                ptr = (unsigned char *) &ElectricAirPacket;
278
                max = sizeof(ElectricAirPacket);
279
                break;
1943 holgerb 280
   case HOTT_GENERAL_PACKET_ID:
281
                ptr = (unsigned char *) &HoTTGeneral;
282
                max = sizeof(HoTTGeneral);
283
                break;
2377 holgerb 284
   case JETI_GPS_PACKET_ID1:
285
                ptr = (unsigned char *) &JetiExData[14].Value;
286
                max = sizeof(JetiExData[14].Value);
287
                break;
288
   case JETI_GPS_PACKET_ID2:
289
                ptr = (unsigned char *) &JetiExData[15].Value;
290
                max = sizeof(JetiExData[15].Value);
291
                break;
2424 holgerb 292
   case HOTT_WPL_NAME:
293
                ptr = (unsigned char *) WPL_Name;
294
                max = sizeof(WPL_Name)-1;
295
                break;
296
 
1940 holgerb 297
  }
298
 z = FromNaviCtrl.Param.Byte[0]; // Data allocation
299
 
300
 for(i=0; i < FromNaviCtrl.Param.Byte[1]; i++)
301
  {
302
   if(z >= max) break;
303
   ptr[z] = FromNaviCtrl.Param.Byte[2+i];
304
   z++;
305
  }
306
}
307
 
1942 holgerb 308
unsigned int BuildHoTT_Vario(void)
309
{
2322 holgerb 310
 unsigned int tmp = VARIO_ZERO;
1944 holgerb 311
 if(VarioCharacter == '+' || VarioCharacter == '-')
312
  {
2322 holgerb 313
   tmp = VARIO_ZERO + (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 3;
314
   if(tmp < VARIO_ZERO && tmp > VARIO_ZERO - 50) tmp = VARIO_ZERO - 50; // weil es sonst erst bei < 0,5m/sek piept
1944 holgerb 315
  }
1942 holgerb 316
 else
1944 holgerb 317
 if((VarioCharacter == ' ') && (FC_StatusFlags & FC_STATUS_FLY))
318
  {
2322 holgerb 319
   tmp = VARIO_ZERO + HoTTVarioMeter;
320
   if(tmp > VARIO_ZERO)
1944 holgerb 321
    {
2322 holgerb 322
     if(tmp < VARIO_ZERO + 100) tmp = VARIO_ZERO;
1944 holgerb 323
         else tmp -= 100;
324
        }
2322 holgerb 325
   if(tmp < VARIO_ZERO)
1944 holgerb 326
    {
2322 holgerb 327
     if(tmp > VARIO_ZERO - 100) tmp = VARIO_ZERO;
1944 holgerb 328
         else tmp += 100;
329
        }
330
  }
331
 else
2322 holgerb 332
 if(VarioCharacter == '^') tmp = VARIO_ZERO + FromNC_AltitudeSpeed * 10;
1944 holgerb 333
 else
2322 holgerb 334
 if(VarioCharacter == 'v') tmp = VARIO_ZERO - FromNC_AltitudeSpeed * 10;
1942 holgerb 335
 return(tmp);
336
}
337
 
1940 holgerb 338
//---------------------------------------------------------------
1919 holgerb 339
unsigned char HoTT_Telemety(unsigned char packet_request)
340
{
2322 holgerb 341
 unsigned char i;
2090 holgerb 342
  //Debug("rqst: %02X",packet_request);
2420 holgerb 343
 
1919 holgerb 344
 switch(packet_request)
345
 {
346
  case HOTT_VARIO_PACKET_ID:
2322 holgerb 347
                GPSPacket.WarnBeep = HoTT_Waring(); // Achtung: das ist richtig hier, damit der Varioton schon vorher abgestellt wird
1921 holgerb 348
                VarioPacket.Altitude = HoehenWert/100 + 500;  
2322 holgerb 349
                if(!GPSPacket.WarnBeep) VarioPacket.m_sec = BuildHoTT_Vario(); else VarioPacket.m_sec = VARIO_ZERO;
1943 holgerb 350
                VarioPacket.m_3sec = VarioPacket.m_sec;
351
                VarioPacket.m_10sec = VarioPacket.m_sec;
1919 holgerb 352
                if (VarioPacket.Altitude < VarioPacket.MinAltitude) VarioPacket.MinAltitude = VarioPacket.Altitude;
353
                if (VarioPacket.Altitude > VarioPacket.MaxAltitude) VarioPacket.MaxAltitude = VarioPacket.Altitude;            
2090 holgerb 354
                VarioPacket.WarnBeep = 0;//HoTT_Waring();
1919 holgerb 355
                HoTT_DataPointer = (unsigned char *) &VarioPacket;
2090 holgerb 356
        VarioPacket.FreeCharacters[0] = VarioCharacter;
357
    if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) VarioPacket.FreeCharacters[1] = 'C'; else VarioPacket.FreeCharacters[1] = ' ';
358
//      VarioPacket.FreeCharacters[2] = ' ';
359
    if(NC_ErrorCode)
360
         {
361
                VarioPacket.Text[0] = NC_ErrorCode/10 + '0';
362
                VarioPacket.Text[1] = NC_ErrorCode%10 + '0';
363
                VarioPacket.Text[2] = ':';
2183 holgerb 364
                for(i=0; i<16;i++) VarioPacket.Text[i+3] = pgm_read_byte(&NC_ERROR_TEXT[NC_ErrorCode][i]);
2388 holgerb 365
                VarioPacket.Text[19] = ' ';
366
                VarioPacket.Text[20] = ' ';
2090 holgerb 367
         }
2120 holgerb 368
         else
2390 holgerb 369
         if(LowVoltageLandingActive) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&LANDING[i]); // no Error
370
     else
2120 holgerb 371
         if(FC_StatusFlags & FC_STATUS_LOWBAT) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&UNDERVOLTAGE[i]); // no Error
2348 holgerb 372
         else
373
         if(ShowSettingNameTime) // no Error
374
         {                  
375
          for(i=0; i<sizeof(SETTING);i++) VarioPacket.Text[i] = pgm_read_byte(&SETTING[i]);
376
      VarioPacket.Text[4] = '0' + ActiveParamSet;
377
          for(i=0; i<sizeof(EE_Parameter.Name);i++) VarioPacket.Text[i+7] = EE_Parameter.Name[i]; // no Error
378
      VarioPacket.Text[18] = ' ';
379
      VarioPacket.Text[19] = ' ';
380
      VarioPacket.Text[20] = ' ';
381
         }
2120 holgerb 382
         else    
2178 holgerb 383
     if(NaviData_WaypointNumber)
384
         {    
385
          unsigned int tmp_int;
386
      unsigned char tmp;
387
      VarioPacket.Text[0] = 'W'; VarioPacket.Text[1] = 'P';
388
      VarioPacket.Text[2] = ' ';
389
      VarioPacket.Text[3] = '0'+(NaviData_WaypointIndex) / 10;
390
      VarioPacket.Text[4] = '0'+(NaviData_WaypointIndex) % 10;
391
      VarioPacket.Text[5] = '/';
392
      VarioPacket.Text[6] = '0'+(NaviData_WaypointNumber) / 10;
393
      VarioPacket.Text[7] = '0'+(NaviData_WaypointNumber) % 10;
394
      VarioPacket.Text[8] = ' ';
395
          tmp_int = NaviData_TargetDistance;
396
      if(tmp_int > 1000) { VarioPacket.Text[9] = '0'+(tmp_int) / 1000; tmp_int %= 1000;}
397
          else VarioPacket.Text[9] = ' ';
398
      if(tmp_int > 100) { VarioPacket.Text[10] = '0'+(tmp_int) / 100; tmp_int %= 100;}
399
          else VarioPacket.Text[10] = ' ';
400
      VarioPacket.Text[11] = '0'+(tmp_int) / 10;
401
      VarioPacket.Text[12] = '0'+(tmp_int) % 10;
402
      VarioPacket.Text[13] = 'm';
403
      VarioPacket.Text[14] = ' ';
404
      tmp = NaviData_TargetHoldTime;
405
          if(tmp > 100) { VarioPacket.Text[15] = '0'+(tmp) / 100; tmp %= 100;} else VarioPacket.Text[15] = ' ';
406
      VarioPacket.Text[16] = '0'+(tmp) / 10;
407
      VarioPacket.Text[17] = '0'+(tmp) % 10;
408
      VarioPacket.Text[18] = 's';
409
      VarioPacket.Text[19] = ' ';
2407 holgerb 410
      VarioPacket.Text[20] = ' ';
2178 holgerb 411
         }
412
         else
2355 holgerb 413
         if(!CalibrationDone)
2344 holgerb 414
         {
2355 holgerb 415
          for(i=0; i<17;i++) VarioPacket.Text[i] = pgm_read_byte(&MIKROKOPTER[i+2]); // no Error and not calibrated
416
      VarioPacket.Text[16] = '0'+VERSION_MAJOR;
417
      VarioPacket.Text[17] = '.';
418
      VarioPacket.Text[18] = '0'+VERSION_MINOR/10;
419
      VarioPacket.Text[19] = '0'+VERSION_MINOR%10;
420
      VarioPacket.Text[20] = 'a'+VERSION_PATCH;
2344 holgerb 421
         }
2355 holgerb 422
         else
423
         {
424
          for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&MIKROKOPTER[i]); // no Error
2418 holgerb 425
if(RedundanceBlOperation) VarioPacket.Text[0] = 'R';
2355 holgerb 426
         }
1919 holgerb 427
                return(sizeof(VarioPacket));
428
                break;
1921 holgerb 429
 
1919 holgerb 430
  case HOTT_GPS_PACKET_ID:
2186 holgerb 431
                GPSPacket.Altitude = HoehenWert/100 + 500;  
1943 holgerb 432
//              GPSPacket.Distance = GPSInfo.HomeDistance/10;  // macht die NC
433
//              GPSPacket.Heading = GPSInfo.HomeBearing/2;     // macht die NC
434
//              GPSPacket.Speed = (GPSInfo.Speed * 36) / 10;   // macht die NC
2322 holgerb 435
//      GPSPacket.WarnBeep = HoTT_Waring();                //(wird jetzt weiter oben gemacht)
436
                if(!GPSPacket.WarnBeep) GPSPacket.m_sec = BuildHoTT_Vario(); else GPSPacket.m_sec = VARIO_ZERO;
1921 holgerb 437
                GPSPacket.m_3sec = 120;
2090 holgerb 438
                GPSPacket.NumOfSats = GPSInfo.NumOfSats;
439
                if(GPSInfo.Flags & FLAG_DIFFSOLN) GPSPacket.SatFix = 'D';
440
                else
441
        if(GPSInfo.SatFix == SATFIX_3D) GPSPacket.SatFix = ' ';
442
                else GPSPacket.SatFix = '!';
1919 holgerb 443
                HoTT_DataPointer = (unsigned char *) &GPSPacket;
2090 holgerb 444
                GPSPacket.FreeCharacters[0] = NC_GPS_ModeCharacter;
445
                GPSPacket.FreeCharacters[2] = GPSPacket.SatFix;
446
                GPSPacket.HomeDirection = GPSInfo.HomeBearing / 2;//230;
1919 holgerb 447
                return(sizeof(GPSPacket));  
448
                break;
449
  case HOTT_ELECTRIC_AIR_PACKET_ID:
1943 holgerb 450
                GetHottestBl();
1940 holgerb 451
                ElectricAirPacket.Altitude = HoehenWert/100 + 500;
1921 holgerb 452
                ElectricAirPacket.Battery1 = UBat;
1940 holgerb 453
                ElectricAirPacket.Battery2 = UBat;
2437 holgerb 454
                ElectricAirPacket.VoltageCell1 = CompassCorrected / 2;
1943 holgerb 455
                ElectricAirPacket.VoltageCell8 = ElectricAirPacket.VoltageCell1;
1944 holgerb 456
                ElectricAirPacket.VoltageCell6 = GPSInfo.HomeBearing / 2;
1943 holgerb 457
                ElectricAirPacket.VoltageCell7 = GPSInfo.HomeDistance/20;
1944 holgerb 458
                ElectricAirPacket.VoltageCell13 = ElectricAirPacket.VoltageCell6;
1943 holgerb 459
                ElectricAirPacket.VoltageCell14 = ElectricAirPacket.VoltageCell7;
2322 holgerb 460
        if(!GPSPacket.WarnBeep) ElectricAirPacket.m_sec = BuildHoTT_Vario(); else ElectricAirPacket.m_sec = VARIO_ZERO;
1940 holgerb 461
                ElectricAirPacket.m_3sec = 120;
462
                ElectricAirPacket.InputVoltage = UBat;
2373 holgerb 463
                ElectricAirPacket.Temperature1 = MinBlTemperture + 20;
464
                ElectricAirPacket.Temperature2 = MaxBlTemperture + 20;
1940 holgerb 465
                ElectricAirPacket.Capacity = Capacity.UsedCapacity/10;
2373 holgerb 466
//              ElectricAirPacket.WarnBeep = 0;//HoTT_Waring();
467
ElectricAirPacket.WarnBeep = GPSPacket.WarnBeep;
1940 holgerb 468
                ElectricAirPacket.Current = Capacity.ActualCurrent;
1919 holgerb 469
                HoTT_DataPointer = (unsigned char *) &ElectricAirPacket;
2090 holgerb 470
                ElectricAirPacket.FlightTimeMinutes = FlugSekunden / 60;
471
                ElectricAirPacket.FlightTimeSeconds = FlugSekunden % 60;
1919 holgerb 472
                return(sizeof(ElectricAirPacket));
473
                break;
1943 holgerb 474
  case HOTT_GENERAL_PACKET_ID:
475
                GetHottestBl();
476
                HoTTGeneral.Rpm = GPSInfo.HomeDistance/100;
2437 holgerb 477
                HoTTGeneral.VoltageCell1 = CompassCorrected / 2;
2373 holgerb 478
                HoTTGeneral.VoltageCell2 = KompassValue / 2;
479
                //HoTTGeneral.VoltageCell3 = Magnetstaerke -> macht NC
480
                //HoTTGeneral.VoltageCell4 = Inclinition -> macht NC
481
                HoTTGeneral.VoltageCell5 = DebugOut.Analog[28]; // I2C ErrorCounter
1944 holgerb 482
                HoTTGeneral.VoltageCell6 = GPSInfo.HomeBearing / 2;
2373 holgerb 483
                if(UBat > BattLowVoltageWarning + 2) HoTTGeneral.FuelPercent = (UBat - (BattLowVoltageWarning + 2)) * 3;
1943 holgerb 484
                else HoTTGeneral.FuelPercent = 0;
2373 holgerb 485
                if(HoTTGeneral.FuelPercent > 100) HoTTGeneral.FuelPercent = 100;
486
                HoTTGeneral.FuelCapacity = NC_ErrorCode;//HoehenWert/100; // Oelpegel
487
//              if(HoTTGeneral.FuelCapacity < 0) HoTTGeneral.FuelCapacity = 0;
1943 holgerb 488
                HoTTGeneral.Altitude = HoehenWert/100 + 500;
489
                HoTTGeneral.Battery1 = UBat;
490
                HoTTGeneral.Battery2 = UBat;
2322 holgerb 491
                if(!GPSPacket.WarnBeep) HoTTGeneral.m_sec =  BuildHoTT_Vario(); else  HoTTGeneral.m_sec = VARIO_ZERO;
2373 holgerb 492
                HoTTGeneral.m_3sec = 120 + GPSPacket.WarnBeep;
1943 holgerb 493
                HoTTGeneral.InputVoltage = UBat;
2373 holgerb 494
                HoTTGeneral.Temperature1 = MinBlTemperture + 20;
495
                HoTTGeneral.Temperature2 = MaxBlTemperture + 20;
1943 holgerb 496
                HoTTGeneral.Capacity = Capacity.UsedCapacity/10;
2090 holgerb 497
                HoTTGeneral.WarnBeep = 0;//HoTT_Waring();
1943 holgerb 498
                HoTTGeneral.Current = Capacity.ActualCurrent;
2178 holgerb 499
//HoTTGeneral.ErrorNumber = HoTTErrorCode();
1943 holgerb 500
                HoTT_DataPointer = (unsigned char *) &HoTTGeneral;
501
                return(sizeof(HoTTGeneral));
502
                break;
1919 holgerb 503
  default: return(0);
504
  }            
505
}
506
 
507
//---------------------------------------------------------------
1917 holgerb 508
void HoTT_Menu(void)
509
{
2420 holgerb 510
 static unsigned char line, page = 0,show_current = 0,show_mag = 0, show_poti = 0;
1921 holgerb 511
 unsigned char tmp;
1944 holgerb 512
 HoTTVarioMeter = (HoTTVarioMeter * 7 + VarioMeter) / 8;
2420 holgerb 513
 
514
// if(HottKeyboard) {beeptime = 1000;};  
1944 holgerb 515
 
2420 holgerb 516
 switch(page)
517
 {
518
  case 0:
1933 holgerb 519
  switch(line++)
1917 holgerb 520
  {
1919 holgerb 521
        case 0:  
1923 holgerb 522
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
1939 holgerb 523
                         HoTT_printfxy_BLINK(0,0,"  %2i.%1iV  ",UBat/10, UBat%10)
524
                        else
525
                         HoTT_printfxy(0,0,"  %2i.%1iV  ",UBat/10, UBat%10)
526
 
527
                        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
528
                          {
529
                           if(HoehenReglerAktiv)        HoTT_printfxy_INV(10,0,"ALT:%4im %c", (int16_t)(HoehenWert/100),VarioCharacter)
530
                           else                                         HoTT_printfxy(10,0,"ALT:%4im  ", (int16_t)(HoehenWert/100))
531
                           }
532
            else    HoTT_printfxy(10,0,"ALT:---- ");
533
                        break;
534
        case 1:  
535
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
536
                         HoTT_printfxy_BLINK(0,1,"  %2i:%02i  ",FlugSekunden/60,FlugSekunden%60)
537
            else   HoTT_printfxy(0,1,"  %2i:%02i  ",FlugSekunden/60,FlugSekunden%60);                      
2437 holgerb 538
                        HoTT_printfxy(10,1,"DIR: %3d%c",CompassCorrected, HoTT_GRAD);
1949 holgerb 539
                        if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(20,1,"C") else HoTT_printfxy(20,1," ");
1939 holgerb 540
            break;
541
        case 2:
542
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
543
                         HoTT_printfxy_BLINK(0,2,"  %5i  ",Capacity.UsedCapacity)
544
            else   HoTT_printfxy(0,2,"  %5i  ",Capacity.UsedCapacity);                     
1940 holgerb 545
                        HoTT_printfxy(12,2,"I:%2i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
1939 holgerb 546
                        break;
547
        case 3:
2072 holgerb 548
                        HoTT_printfxy(9,0,":");
549
                        HoTT_printfxy(9,1,":");
550
                        HoTT_printfxy(9,2,":");
1939 holgerb 551
                        HoTT_printfxy(0,3,"---------+-----------");
2072 holgerb 552
 
553
//                      HoTT_printfxy(0,3,"---------------------");
1939 holgerb 554
                        HoTT_printfxy(0,6,"---------------------");
555
                        break;
556
        case 4:  
557
                        if(NaviDataOkay)
558
                        {
2072 holgerb 559
                                HoTT_printfxy(9,4,":");
1939 holgerb 560
                                HoTT_printfxy(0,4,"SAT:%2d ",GPSInfo.NumOfSats);
561
                            HoTT_printfxy(10,4,"DIST:%3dm",GPSInfo.HomeDistance/10);
562
                                switch (GPSInfo.SatFix)
563
                                {
564
                                        case SATFIX_3D:
565
                                                        if(GPSInfo.Flags & FLAG_DIFFSOLN) HoTT_printfxy(7,4,"D ")
566
                                                        else HoTT_printfxy(7,4,"3D");
567
                                                break;
568
                                        default:
1943 holgerb 569
                                                HoTT_printfxy_BLINK(7,4,"!!");
1939 holgerb 570
                                                break;
571
                                }      
572
                        }
573
                        else
1944 holgerb 574
                        {                    
1940 holgerb 575
                                Hott_ClearLine(4);
1939 holgerb 576
                        }
577
                        break;
578
        case 5:
579
                        if(NaviDataOkay)
580
                        {
1972 holgerb 581
                        if(show_mag)
582
                          {
583
                                HoTT_printfxy(0,5,"MAG:%3u%% ",EarthMagneticField);
1939 holgerb 584
                            HoTT_printfxy(12,5,"HM:%3d%c %c", GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter);
1972 holgerb 585
                                HoTT_printfxy(9,5,"incl:%2d%c(%2i)",EarthMagneticInclination, HoTT_GRAD,EarthMagneticInclinationTheoretic);
586
              }
587
                         else
588
                          {
2072 holgerb 589
                                HoTT_printfxy(0,5,"    %2um/s:  HM:%3d%c %c",GPSInfo.Speed, GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter);
1972 holgerb 590
                          }    
1939 holgerb 591
            }
1940 holgerb 592
                        else Hott_ClearLine(5);
1939 holgerb 593
                        break;
594
        case 6:
595
                        break;
596
        case 7: if(NC_ErrorCode)
597
                  {
598
                           if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER)
599
                            {
600
                             Hott_ClearLine(7);
601
                             HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode);
602
                            }
603
                                else
604
                                {
605
                                 HoTT_printfxy(0,7,"ERR: ");     _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);};
606
                                }
2120 holgerb 607
                        else
608
                        if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!")
1939 holgerb 609
                        else HoTT_printfxy(0,7," www.MikroKopter.de  ");
610
                        break;
2090 holgerb 611
        case 8: //ASCIIPacket.WarnBeep = HoTT_Waring();
1939 holgerb 612
                        // ASCIIPacket.WarnBeep = Parameter_UserParam1;
613
        case 9:
614
        case 10:
615
        case 11:
616
        case 12:
617
        case 13:
618
        case 14:  
619
        case 15:  
620
        case 16:  
2440 holgerb 621
                        if(HottKeyboard == HOTT_KEY_DOWN) { LIBFC_HoTT_Clear(); page = 5; line = 0;}
622
                        else
1972 holgerb 623
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_mag) show_mag = 0; else show_mag = 1;}
624
                        else
1949 holgerb 625
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 1; line = 0;};
1939 holgerb 626
                        HottKeyboard = 0;
627
                        break;
628
   default:  line = 0;
629
                        break;
630
  }
2420 holgerb 631
  break;
632
  case 1:
1939 holgerb 633
  switch(line++)
634
  {
635
        case 0:  
636
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
1923 holgerb 637
                         HoTT_printfxy_BLINK(0,0," %2i:%02i  %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity)
638
            else   HoTT_printfxy(0,0," %2i:%02i  %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity);                         
1917 holgerb 639
                        break;
640
        case 1:  
2437 holgerb 641
                        HoTT_printfxy(0,1,"DIR:%3d%c",CompassCorrected, HoTT_GRAD);
1917 holgerb 642
                        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
1920 holgerb 643
                          {
644
                           if(HoehenReglerAktiv)        HoTT_printfxy_INV(10,1,"ALT:%4im", (int16_t)(HoehenWert/100))
645
                           else                                         HoTT_printfxy(10,1,"ALT:%4im", (int16_t)(HoehenWert/100))
646
                           }
647
            else    HoTT_printfxy(10,1,"ALT:---- ");
648
                        HoTT_printfxy(20,1,"%c",VarioCharacter);
1917 holgerb 649
            break;
650
        case 2:
651
                        if(NaviDataOkay)
652
                        {
1923 holgerb 653
                          HoTT_printfxy(1,2,"HM:%3d%c  DIST:%3dm %c", GPSInfo.HomeBearing, HoTT_GRAD, GPSInfo.HomeDistance/10, NC_GPS_ModeCharacter);
1917 holgerb 654
            }
655
                        else
656
                        {
1923 holgerb 657
                         Hott_ClearLine(2);
1917 holgerb 658
                        }
659
                        break;
1923 holgerb 660
        case 3:
661
                        HoTT_printfxy(0,3,"PWR:%2i.%1iA (%iW) ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10,Capacity.ActualPower);
1949 holgerb 662
                        if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(19,3,"CF") else HoTT_printfxy(19,3,"  ");
1923 holgerb 663
                        break;
1917 holgerb 664
        case 4:  
665
                        if(NaviDataOkay)
666
                        {
1919 holgerb 667
                                HoTT_printfxy(0,4,"GPS:%2um/s SAT:%d ",GPSInfo.Speed,GPSInfo.NumOfSats);
1917 holgerb 668
                                switch (GPSInfo.SatFix)
669
                                {
670
                                        case SATFIX_3D:
671
                                                HoTT_printfxy(16,4,"  3D ");
672
                                                break;
1925 holgerb 673
                                        //case SATFIX_2D:
674
                                        //case SATFIX_NONE:
1917 holgerb 675
                                        default:
1925 holgerb 676
                                                HoTT_printfxy_BLINK(16,4,"NOFIX");
1917 holgerb 677
                                                break;
678
                                }      
679
                                if(GPSInfo.Flags & FLAG_DIFFSOLN)
680
                                {
681
                                        HoTT_printfxy(16,4,"DGPS ");
682
                                }
683
                        }
684
                        else
685
                        {                    //012345678901234567890
1930 holgerb 686
                                HoTT_printfxy(0,4,"   No NaviCtrl       ");
1917 holgerb 687
                        }
688
                        break;
689
        case 5:
1949 holgerb 690
                        if(show_current)
691
                         {
2386 holgerb 692
//                              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);
693
                                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 694
                         }
695
                         else
696
                         {
697
                                HoTT_printfxy(0,5,"%3i %3i %3i %3i%cC", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature,HoTT_GRAD);
698
                         }
1917 holgerb 699
                        break;
700
        case 6:
1949 holgerb 701
                        if(show_current)
702
                         {
1917 holgerb 703
                    if(RequiredMotors == 4) Hott_ClearLine(6);
704
                                else
2386 holgerb 705
//                              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)
706
                                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 707
                                else
2386 holgerb 708
//                              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);
709
                                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 710
             }
711
                         else
712
                         {
713
                    if(RequiredMotors == 4) Hott_ClearLine(6);
714
                                else
1923 holgerb 715
                                if(RequiredMotors == 6)  HoTT_printfxy(0,6,"%3i %3i%cC        ", Motor[4].Temperature, Motor[5].Temperature,HoTT_GRAD)
1917 holgerb 716
                                else
1923 holgerb 717
                                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 718
             }
1917 holgerb 719
                        break;
1930 holgerb 720
        case 7: if(NC_ErrorCode)
721
                  {
722
                           if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER)
723
                            {
724
                             Hott_ClearLine(7);
725
                             HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode);
726
                            }
727
                                else
728
                                {
729
                                 HoTT_printfxy(0,7,"ERR: ");     _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);};
730
                                }
2120 holgerb 731
                        else
732
                        if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!")
1937 holgerb 733
                        else HoTT_printfxy(0,7," www.MikroKopter.de  ");
1917 holgerb 734
                        break;
2090 holgerb 735
        case 8: // ASCIIPacket.WarnBeep = HoTT_Waring();
1919 holgerb 736
                        // ASCIIPacket.WarnBeep = Parameter_UserParam1;
1921 holgerb 737
        case 9:
1917 holgerb 738
        case 10:
739
        case 11:
740
        case 12:
741
        case 13:
1919 holgerb 742
        case 14:  
743
        case 15:  
744
        case 16:  
1949 holgerb 745
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_current) show_current = 0; else show_current = 1;   Hott_ClearLine(5);  Hott_ClearLine(6);}
746
                        else
747
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 2; line = 0;}
748
                        else
749
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 0; line = 0;}
750
//if(HottKeyboard) HoTT_printfxy(15,6,"%KEY:%02x ",HottKeyboard);
1921 holgerb 751
                        HottKeyboard = 0;
752
                        break;
1933 holgerb 753
   default:  line = 0;
1921 holgerb 754
                        break;
755
  }
2420 holgerb 756
  break;
757
  case 2:
1933 holgerb 758
  switch(line++)
1921 holgerb 759
  {
760
        case 0:  
2344 holgerb 761
                        HoTT_printfxy_INV(0,0,"Setting:%u %s ",ActiveParamSet,EE_Parameter.Name);
1921 holgerb 762
                        break;
763
    case 1: HoTT_printfxy(0,1,"Min:%2i.%1iV %s ",BattLowVoltageWarning/10, BattLowVoltageWarning%10, Mixer.Name);
764
                        break;
1923 holgerb 765
    case 2:  HoTT_printfxy(0,2,"ALT:");
1921 holgerb 766
                 if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
767
                 {
768
                          if(!(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER)) HoTT_printf("POTI:%3u ", Parameter_HoehenSchalter)
769
                          else
770
                          {
771
                           if(Parameter_HoehenSchalter > 50) HoTT_printf("(ON)  ") else HoTT_printf("(OFF) ");
772
                           if((Parameter_ExtraConfig & CFG2_HEIGHT_LIMIT)) HoTT_printf("LIMIT", Parameter_HoehenSchalter)
773
                           else HoTT_printf("VARIO", Parameter_HoehenSchalter);
774
                          }
775
                         }
776
                        else
777
                                HoTT_printf("DISABLED");
778
                        break;
1923 holgerb 779
    case 3: HoTT_printfxy(0,3,"CF:");
2342 holgerb 780
                        if(!EE_Parameter.CareFreeChannel) HoTT_printf("DISABLED")
1921 holgerb 781
                        else
782
                         {
783
                          if(CareFree)  HoTT_printf(" (ON) ") else HoTT_printf(" (OFF)");
784
                          if(EE_Parameter.ExtraConfig & CFG_LEARNABLE_CAREFREE) HoTT_printf(" TEACH");
785
                         }
786
                        break;
1923 holgerb 787
    case 4: HoTT_printfxy(0,4,"GPS:");
788
                    if(!(Parameter_GlobalConfig & CFG_GPS_AKTIV)) HoTT_printf("DISABLED")
789
                        else
790
                         {
2342 holgerb 791
                          tmp = GetChannelValue(EE_Parameter.NaviGpsModeChannel);
1923 holgerb 792
                          if(tmp < 50) HoTT_printf("(FREE)")
793
                          else
794
                          if(tmp >= 180) HoTT_printf("(HOME)")
795
                          else
796
                          if(EE_Parameter.ExtraConfig & CFG_GPS_AID) HoTT_printf("(AID) ")
797
                          else HoTT_printf("(HOLD)")
798
                         }
799
                        if(EE_Parameter.FailSafeTime) HoTT_printfxy(10,4," FS:%usek ",EE_Parameter.FailSafeTime)
800
 
801
                        break;
802
    case 5: HoTT_printfxy(0,5,"HOME ALT:");
803
                        if(EE_Parameter.ComingHomeAltitude) HoTT_printf("%um",EE_Parameter.ComingHomeAltitude) else HoTT_printf("HOLD ");
804
                        break;
1921 holgerb 805
        case 6:
1982 holgerb 806
                        if(!show_poti)
807
                         {
808
              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);
809
                      HoTT_printfxy(0,7,"Gs:%4i Ya:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]+127,PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]);
810
                         }
811
                        else
812
                         {
813
              HoTT_printfxy(0,6,"P1:%4i P2:%4i 3:%3i",Poti1,Poti2, Poti3);
814
                      HoTT_printfxy(0,7,"P4:%4i P5:%4i 6:%3i",Poti4,Poti5, Poti6);
815
                         }
816
 
1921 holgerb 817
                        break;
818
    case 7: //HoTT_printfxy(0,6,"WARNINGS:");
819
                        if(HoTTBlink)
820
                        {
821
                         LIBFC_HoTT_SetPos(6 * 21);
822
                         if(!(Parameter_GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV)) HoTT_printf_BLINK("COUPLING OFF! ");
823
                         if(EE_Parameter.BitConfig & (CFG_LOOP_LINKS | CFG_LOOP_RECHTS | CFG_LOOP_UNTEN | CFG_LOOP_OBEN)) HoTT_printf_BLINK("LOOPING! ");
824
                         if(Parameter_GlobalConfig & CFG_HEADING_HOLD) HoTT_printf_BLINK("HH! ");
825
                         if(!(Parameter_GlobalConfig & CFG_KOMPASS_AKTIV)) HoTT_printf_BLINK("COMPASS OFF! ");
826
                        }
827
                        break;
2090 holgerb 828
    case 8: //ASCIIPacket.WarnBeep = HoTT_Waring();
1921 holgerb 829
                        break;
830
    case 9:
831
    case 10:
832
    case 11:
833
    case 12:
834
    case 13:
835
    case 14:
836
    case 15:
837
    case 16:
1982 holgerb 838
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_poti) show_poti = 0; else show_poti = 1;   Hott_ClearLine(6);  Hott_ClearLine(7);}
839
                        else
2418 holgerb 840
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 3; line = 0;}
841
                        else
1949 holgerb 842
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 1; line = 0;};
1921 holgerb 843
                        HottKeyboard = 0;
844
                        break;
1933 holgerb 845
   default:  line = 0;
1917 holgerb 846
                        break;
847
  }
2420 holgerb 848
  break;
849
  case 3:
2418 holgerb 850
  switch(line++)
851
  {
2438 holgerb 852
        static unsigned char load_waypoint_tmp2 = 1, changed2;
2418 holgerb 853
        case 0:  
854
                        HoTT_printfxy(0,0,"Load Waypoints");
2420 holgerb 855
                        HoTT_printfxy(0,1,"(Relative Positions)");
856
//                      HoTT_printfxy(0,1,"(Absolute)"); 
2418 holgerb 857
                        break;
2420 holgerb 858
    case 1:
859
                        if(NaviData_WaypointNumber)     HoTT_printfxy(0,6,"Active WP:%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber)
860
                        else HoTT_printfxy(0,6,"No WPs active     ")
2418 holgerb 861
                        break;
862
    case 2:
2420 holgerb 863
                         HoTT_printfxy(0,7,"%2i.%1iV ",UBat/10, UBat%10)
2424 holgerb 864
                         HoTT_printfxy(11,7,"%s",WPL_Name)
2420 holgerb 865
    case 3:
866
    case 4:
867
    case 5:
868
                        if(load_waypoint_tmp2)
2418 holgerb 869
                         {
2420 holgerb 870
                          if(changed2 && HoTTBlink) HoTT_printfxy(10,3,"   ")
871
                          else HoTT_printfxy(10,3,"%2i   ",load_waypoint_tmp2);
872
                          HoTT_printfxy(0,3,"Load list:")
2418 holgerb 873
                         }
874
                        else
875
                         {
876
                          HoTT_printfxy(0,3,"Load list: -- ");
877
                         }
2420 holgerb 878
                         if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,4,"No SD-Card   ")
879
                         else
880
                         {
2425 holgerb 881
                          if(GPSInfo.SatFix == SATFIX_3D)
882
                           {
883
                            if(changed2 && load_waypoint_tmp2) HoTT_printfxy(0,4,"(Set -> Load)")
884
                            else HoTT_printfxy(0,4,"             ");
885
                                if(HottKeyboard == HOTT_KEY_SET) { if(load_waypoint_tmp2) ToNC_Load_WP_List = load_waypoint_tmp2 | 128; changed2 = 0;}
886
                           } else HoTT_printfxy(0,4,"!No GPS-Fix! ");
2420 holgerb 887
                         }
888
                        if(HottKeyboard == HOTT_KEY_UP && load_waypoint_tmp2 < NaviData_MaxWpListIndex) { changed2 = 1; load_waypoint_tmp2++;HoTTBlink = 0;}
889
                        if(HottKeyboard == HOTT_KEY_DOWN && load_waypoint_tmp2 > 1) { changed2 = 1; load_waypoint_tmp2--;HoTTBlink = 0;};
2418 holgerb 890
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 4; line = 0;}
891
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 2; line = 0;};
892
                        HottKeyboard = 0;
893
                        break;
894
   default:  line = 0;
895
                        break;
896
  }
2420 holgerb 897
  break;
898
  case 4:
2418 holgerb 899
  switch(line++)
900
  {
2438 holgerb 901
        static unsigned char load_waypoint_tmp = 1, changed;
2418 holgerb 902
        case 0:  
903
                        HoTT_printfxy(0,0,"Load Waypoints");
2420 holgerb 904
                        HoTT_printfxy(0,1,"(Fixed Positions)");
2418 holgerb 905
                        break;
2420 holgerb 906
    case 1:
907
                        if(NaviData_WaypointNumber)     HoTT_printfxy(0,6,"Active WP:%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber)
908
                        else HoTT_printfxy(0,6,"No WPs active    ")
2418 holgerb 909
                        break;
910
    case 2:
2420 holgerb 911
                         HoTT_printfxy(0,7,"%2i.%1iV ",UBat/10, UBat%10)
2424 holgerb 912
                         HoTT_printfxy(11,7,"%s",WPL_Name)
2420 holgerb 913
    case 3:
914
    case 4:
915
    case 5:
2438 holgerb 916
                        HoTT_printfxy(0,3,"Load list:")
2420 holgerb 917
                        if(load_waypoint_tmp)
2418 holgerb 918
                         {
2420 holgerb 919
                          if(changed && HoTTBlink) HoTT_printfxy(10,3,"   ")
920
                          else HoTT_printfxy(10,3,"%2d (FIX)",load_waypoint_tmp);
2418 holgerb 921
                         }
922
                        else
923
                         {
2438 holgerb 924
                          HoTT_printfxy(10,3," --")
2418 holgerb 925
                         }
2420 holgerb 926
 
927
                         if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,4,"No SD-Card   ")
928
                         else
929
                         {
2425 holgerb 930
                            if(changed && load_waypoint_tmp) HoTT_printfxy(0,4,"(Set -> Load)")
931
                            else HoTT_printfxy(0,4,"             ");
932
                         }
2420 holgerb 933
                        if(HottKeyboard == HOTT_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { changed = 1; load_waypoint_tmp++; HoTTBlink = 0;}
934
                        if(HottKeyboard == HOTT_KEY_DOWN && load_waypoint_tmp > 1) { changed = 1; load_waypoint_tmp--; HoTTBlink = 0;};
935
                        if(HottKeyboard == HOTT_KEY_SET) { if(load_waypoint_tmp) ToNC_Load_WP_List = load_waypoint_tmp; changed = 0;}
2438 holgerb 936
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;}
937
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;};
2418 holgerb 938
                        HottKeyboard = 0;
939
                        break;
940
   default:  line = 0;
941
                        break;
942
  }
2420 holgerb 943
  break;
2438 holgerb 944
  case 5:
945
  switch(line++)
946
  {
947
    static unsigned char wp_tmp, changed;
948
        case 0:  
949
                        HoTT_printfxy(0,0,"Store single Position");
950
//                      HoTT_printfxy(0,1,"(Fixed Positions)"); 
951
                        break;
952
    case 1:
953
                    HoTT_printfxy(0,2," %2i.%1iV ",UBat/10, UBat%10)
954
                        HoTT_printfxy(0,3," %2i:%02i ",FlugSekunden/60,FlugSekunden%60);                           
955
//                      HoTT_printfxy(0,4,"Dist:%3dm",NaviData_TargetDistance)
956
                        break;
957
    case 2:
958
                        HoTT_printfxy(11,2,"ALT:%4im", (int16_t)(HoehenWert/100))              
959
                        HoTT_printfxy(11,3,"DIR: %3d%c",CompassCorrected, HoTT_GRAD);
960
                        HoTT_printfxy(11,4,"Cam: %3i",Parameter_ServoNickControl);
961
                        break;
962
    case 3:
963
    case 4:
964
    case 5:
965
                    HoTT_printfxy(0,6,"Store point:")
966
                        if(wp_tmp)
967
                         {
968
                          if(changed && HoTTBlink) HoTT_printfxy(13,6,"   ")
969
                          else HoTT_printfxy(13,6,"%2d ",wp_tmp);
970
                         }
971
                        else
972
                         {
2439 holgerb 973
                          HoTT_printfxy(13,6,"--")
2438 holgerb 974
                         }
2439 holgerb 975
 
976
                    if(GPSInfo.SatFix == SATFIX_3D)
977
                    {
2438 holgerb 978
                         if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,7,"No SD-Card   ")
979
                         else
980
                         {
981
                            if(changed && wp_tmp) HoTT_printfxy(0,7,"(Set -> Store)")
982
                            else Hott_ClearLine(7);
983
                         }
2439 holgerb 984
                         if(HottKeyboard == HOTT_KEY_SET) { if(wp_tmp) ToNC_Store_SingePoint = wp_tmp; changed = 0;}
985
                    }
986
            else HoTT_printfxy(0,7,"!No GPS-Fix! ");
987
 
2438 holgerb 988
                        if(HottKeyboard == HOTT_KEY_UP && wp_tmp < NaviData_MaxWpListIndex) { changed = 1; wp_tmp++; HoTTBlink = 0;}
989
                        if(HottKeyboard == HOTT_KEY_DOWN && wp_tmp > 1) { changed = 1; wp_tmp--; HoTTBlink = 0;};
990
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;}
991
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;};
992
                        HottKeyboard = 0;
993
                        break;
994
   default:  line = 0;
995
                        break;
996
  }
997
  break;
998
  case 6:
999
  switch(line++)
1000
  {
1001
    static unsigned char wp_tmp, changed;
1002
        case 0:  
1003
                        HoTT_printfxy(0,0,"Load single Position");
1004
//                      HoTT_printfxy(0,1,"(Fixed Positions)"); 
1005
                        break;
1006
    case 1:
1007
                    HoTT_printfxy(0,2," %2i.%1iV ",UBat/10, UBat%10)
1008
                        HoTT_printfxy(0,3," %2i:%02i ",FlugSekunden/60,FlugSekunden%60);                           
1009
//                      HoTT_printfxy(0,4,"Dist:%3dm",NaviData_TargetDistance)
2439 holgerb 1010
                    if(NaviData_WaypointNumber) HoTT_printfxy(0,5,"WP:%2d/%d Dist:%3dm ",NaviData_WaypointIndex,NaviData_WaypointNumber,NaviData_TargetDistance)
2438 holgerb 1011
                    else Hott_ClearLine(5);
1012
                        break;
1013
    case 2:
2439 holgerb 1014
                        if(FromNC_AltitudeSpeed)
1015
                          HoTT_printfxy(8,2,"ALT:%4i/%im ", (int16_t)(HoehenWert/100),(int16_t)(FromNC_AltitudeSetpoint/100))
1016
                        else
1017
                          HoTT_printfxy(8,2,"ALT:%4im    ",(int16_t)(HoehenWert/100))
1018
 
1019
                        HoTT_printfxy(8,3,"DIR: %3d%c",CompassCorrected, HoTT_GRAD);
1020
                        HoTT_printfxy(8,4,"Cam: %3i",Parameter_ServoNickControl);
2438 holgerb 1021
                        break;
1022
//                       HoTT_printfxy(11,7,"%s",WPL_Name)
1023
    case 3:
2440 holgerb 1024
    case 4:                                      
2438 holgerb 1025
    case 5:
1026
                  if(HottKeyboard) DebugOut.Analog[17]++;
1027
                  HoTT_printfxy(0,6,"load point:")
1028
                        if(wp_tmp)
1029
                         {
1030
                          if(changed && HoTTBlink) HoTT_printfxy(11,6,"   ")
1031
                          else HoTT_printfxy(11,6,"%2d",wp_tmp);
1032
                         }
1033
                        else
1034
                         {
2440 holgerb 1035
                          HoTT_printfxy(11,6,"--")
2438 holgerb 1036
                         }
1037
 
1038
                         if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,7,"No SD-Card   ")
1039
                         else
1040
                         {
1041
                            if(changed && wp_tmp) HoTT_printfxy(0,7,"(Set -> Load)")
2439 holgerb 1042
                            else
1043
                                {
1044
                                 Hott_ClearLine(7);
1045
                                 if(NaviData_WaypointNumber) HoTT_printfxy(0,7,"%s",WPL_Name);
1046
                                }
2438 holgerb 1047
                         }
1048
                        if(HottKeyboard == HOTT_KEY_UP && wp_tmp < NaviData_MaxWpListIndex) { changed = 1; wp_tmp++; HoTTBlink = 0;}
1049
                        if(HottKeyboard == HOTT_KEY_DOWN && wp_tmp > 1) { changed = 1; wp_tmp--; HoTTBlink = 0;};
1050
                        if(HottKeyboard == HOTT_KEY_SET) { if(wp_tmp) ToNC_Load_SingePoint = wp_tmp; changed = 0;}
1051
//                      if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;}
1052
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;};
1053
                        HottKeyboard = 0;
1054
                        break;
1055
   default:  line = 0;
1056
                        break;
1057
  }
1058
  break;
2420 holgerb 1059
  default:  page = 0;
1060
  break;
1061
 }
1917 holgerb 1062
}
1063
 
1925 holgerb 1064
#endif
1917 holgerb 1065
 
1066
 
1067