Subversion Repositories FlightCtrl

Rev

Go to most recent revision | Details | 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
 
1943 holgerb 82
GPSPacket_t GPSPacket;
83
VarioPacket_t VarioPacket;
84
ASCIIPacket_t ASCIIPacket;
85
ElectricAirPacket_t ElectricAirPacket;
86
HoTTGeneral_t HoTTGeneral;
1944 holgerb 87
int HoTTVarioMeter = 0;
1943 holgerb 88
 
1930 holgerb 89
const char PROGMEM NC_ERROR_TEXT[MAX_ERR_NUMBER][17] =
90
{
91
//0123456789123456
92
 "No Error        \0",  // 0
93
 "Not compatible  \0",  // 1
94
 "MK3Mag not compa\0",  // 2
95
 "No FC communicat\0",  // 3
96
 "MK3Mag communica\0",  // 4
97
 "GPS communicatio\0",  // 5
98
 "compass value   \0",  // 6
99
 "RC Signal lost  \0",  // 7
100
 "FC spi rx error \0",  // 8
101
 "No NC communicat\0",  // 9
102
 "FC Nick Gyro    \0",  // 10
103
 "FC Roll Gyro    \0",  // 11
104
 "FC Yaw Gyro     \0",  // 12
105
 "FC Nick ACC     \0",  // 13
106
 "FC Roll ACC     \0",  // 14
107
 "FC Z-ACC        \0",  // 15
108
 "Pressure sensor \0",  // 16
1936 holgerb 109
 "I2C FC->BL-Ctrl \0",  // 17
1930 holgerb 110
 "Bl Missing      \0",  // 18
111
 "Mixer Error     \0",  // 19
1937 holgerb 112
 "Carefree Error  \0",  // 20
1944 holgerb 113
 "GPS Fix lost    \0",  // 21
1948 holgerb 114
 "Magnet Error    \0",  // 22
115
 "Motor restart   \0",  // 23
2008 holgerb 116
 "BL Limitation   \0",  // 24
117
 "GPS Range       \0",  // 25
2009 holgerb 118
 "No SD-Card      \0",  // 26
119
 "SD-Logging error\0",  // 27
2034 holgerb 120
 "Flying range!   \0",  // 28
121
 "Max Altitude!   \0"   // 29
1930 holgerb 122
};
1919 holgerb 123
 
1943 holgerb 124
unsigned char MaxBlTempertaure = 0;
125
unsigned char MinBlTempertaure = 0;
126
unsigned char HottestBl = 0;
127
 
128
void GetHottestBl(void)
129
{
130
 static unsigned char search = 0,tmp_max,tmp_min,who;
131
                if(Motor[search].Temperature > tmp_max) { tmp_max = Motor[search].Temperature; who = search;}
132
                else
133
                if(Motor[search].Temperature) if(Motor[search].Temperature < tmp_min) tmp_min = Motor[search].Temperature;
134
                if(++search > MAX_MOTORS)
135
                {
136
                 search = 0;
137
                 if(tmp_min != 255) MinBlTempertaure = tmp_min; else MinBlTempertaure = 0;
138
                 MaxBlTempertaure = tmp_max;
139
                 HottestBl = who;
140
                 tmp_min = 255;
141
                 tmp_max = 0;
142
                 who = 0;
143
                 }
144
}
145
 
1919 holgerb 146
//---------------------------------------------------------------
1917 holgerb 147
void Hott_ClearLine(unsigned char line)
148
{
149
 HoTT_printfxy(0,line,"                     ");
150
}
1919 holgerb 151
//---------------------------------------------------------------
1917 holgerb 152
 
1919 holgerb 153
unsigned char HoTT_Waring(void)
154
{
155
  if(FC_StatusFlags & FC_STATUS_LOWBAT) return(VOICE_MINIMALE_EINGANSSPANNUNG);
1933 holgerb 156
  if(MotorenEin && NC_ErrorCode)                return(VOICE_BEEP);
2008 holgerb 157
//if(Parameter_UserParam1) return(Parameter_UserParam1);
1919 holgerb 158
  return(0);
159
}
160
 
161
//---------------------------------------------------------------
1942 holgerb 162
void NC_Fills_HoTT_Telemety(void)
1940 holgerb 163
{
2034 holgerb 164
 unsigned char *ptr = NULL;
1940 holgerb 165
 unsigned char max = 0,i,z;
166
 switch(FromNaviCtrl.Param.Byte[11])
167
  {
168
   case HOTT_VARIO_PACKET_ID:
169
                ptr = (unsigned char *) &VarioPacket;
170
                max = sizeof(VarioPacket);
171
                break;
172
   case HOTT_GPS_PACKET_ID:
173
                ptr = (unsigned char *) &GPSPacket;
174
                max = sizeof(GPSPacket);
175
                break;
176
   case HOTT_ELECTRIC_AIR_PACKET_ID:
177
                ptr = (unsigned char *) &ElectricAirPacket;
178
                max = sizeof(ElectricAirPacket);
179
                break;
1943 holgerb 180
   case HOTT_GENERAL_PACKET_ID:
181
                ptr = (unsigned char *) &HoTTGeneral;
182
                max = sizeof(HoTTGeneral);
183
                break;
1940 holgerb 184
  }
185
 z = FromNaviCtrl.Param.Byte[0]; // Data allocation
186
 
187
 for(i=0; i < FromNaviCtrl.Param.Byte[1]; i++)
188
  {
189
   if(z >= max) break;
190
   ptr[z] = FromNaviCtrl.Param.Byte[2+i];
191
   z++;
192
  }
193
}
194
 
1942 holgerb 195
unsigned int BuildHoTT_Vario(void)
196
{
1944 holgerb 197
 unsigned int tmp = 30000;
198
 if(VarioCharacter == '+' || VarioCharacter == '-')
199
  {
200
   tmp = 30000 + (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 3;
201
   if(tmp < 30000 && tmp > 30000 - 50) tmp = 30000 - 50; // weil es sonst erst bei < 0,5m/sek piept
202
  }
1942 holgerb 203
 else
1944 holgerb 204
 if((VarioCharacter == ' ') && (FC_StatusFlags & FC_STATUS_FLY))
205
  {
206
   tmp = 30000 + HoTTVarioMeter;
207
   if(tmp > 30000)
208
    {
209
     if(tmp < 30000 + 100) tmp = 30000;
210
         else tmp -= 100;
211
        }
212
   if(tmp < 30000)
213
    {
214
     if(tmp > 30000 - 100) tmp = 30000;
215
         else tmp += 100;
216
        }
217
  }
218
 else
219
 if(VarioCharacter == '^') tmp = 30000 + FromNC_AltitudeSpeed * 10;
220
 else
221
 if(VarioCharacter == 'v') tmp = 30000 - FromNC_AltitudeSpeed * 10;
222
 
1942 holgerb 223
 return(tmp);
224
}
225
 
1943 holgerb 226
 
1940 holgerb 227
//---------------------------------------------------------------
1919 holgerb 228
unsigned char HoTT_Telemety(unsigned char packet_request)
229
{
230
 switch(packet_request)
231
 {
232
  case HOTT_VARIO_PACKET_ID:
1921 holgerb 233
                VarioPacket.Altitude = HoehenWert/100 + 500;  
1942 holgerb 234
                VarioPacket.m_sec = BuildHoTT_Vario();
1943 holgerb 235
                VarioPacket.m_3sec = VarioPacket.m_sec;
236
                VarioPacket.m_10sec = VarioPacket.m_sec;
1919 holgerb 237
                if (VarioPacket.Altitude < VarioPacket.MinAltitude) VarioPacket.MinAltitude = VarioPacket.Altitude;
238
                if (VarioPacket.Altitude > VarioPacket.MaxAltitude) VarioPacket.MaxAltitude = VarioPacket.Altitude;            
239
                VarioPacket.WarnBeep = HoTT_Waring();
240
                HoTT_DataPointer = (unsigned char *) &VarioPacket;
241
                return(sizeof(VarioPacket));
242
                break;
1921 holgerb 243
 
1919 holgerb 244
  case HOTT_GPS_PACKET_ID:
1921 holgerb 245
                GPSPacket.Altitude = HoehenWert/100 + 500;  
1943 holgerb 246
//              GPSPacket.Distance = GPSInfo.HomeDistance/10;  // macht die NC
247
//              GPSPacket.Heading = GPSInfo.HomeBearing/2;     // macht die NC
248
//              GPSPacket.Speed = (GPSInfo.Speed * 36) / 10;   // macht die NC
1942 holgerb 249
                GPSPacket.m_sec = BuildHoTT_Vario();
1921 holgerb 250
                GPSPacket.m_3sec = 120;
251
                GPSPacket.m_10sec = 0;
1919 holgerb 252
                GPSPacket.WarnBeep = HoTT_Waring();
253
                HoTT_DataPointer = (unsigned char *) &GPSPacket;
254
                return(sizeof(GPSPacket));  
255
                break;
256
  case HOTT_ELECTRIC_AIR_PACKET_ID:
1943 holgerb 257
                GetHottestBl();
1940 holgerb 258
                ElectricAirPacket.Altitude = HoehenWert/100 + 500;
1921 holgerb 259
                ElectricAirPacket.Battery1 = UBat;
1940 holgerb 260
                ElectricAirPacket.Battery2 = UBat;
1943 holgerb 261
                ElectricAirPacket.VoltageCell1 = ErsatzKompassInGrad / 2;
262
                ElectricAirPacket.VoltageCell8 = ElectricAirPacket.VoltageCell1;
1944 holgerb 263
                ElectricAirPacket.VoltageCell6 = GPSInfo.HomeBearing / 2;
1943 holgerb 264
                ElectricAirPacket.VoltageCell7 = GPSInfo.HomeDistance/20;
1944 holgerb 265
                ElectricAirPacket.VoltageCell13 = ElectricAirPacket.VoltageCell6;
1943 holgerb 266
                ElectricAirPacket.VoltageCell14 = ElectricAirPacket.VoltageCell7;
1942 holgerb 267
                ElectricAirPacket.m_sec = BuildHoTT_Vario();
1940 holgerb 268
                ElectricAirPacket.m_3sec = 120;
269
                ElectricAirPacket.InputVoltage = UBat;
1943 holgerb 270
                ElectricAirPacket.Temperature1 = MinBlTempertaure + 20;
271
                ElectricAirPacket.Temperature2 = MaxBlTempertaure + 20;
1940 holgerb 272
                ElectricAirPacket.Capacity = Capacity.UsedCapacity/10;
1919 holgerb 273
                ElectricAirPacket.WarnBeep = HoTT_Waring();
1940 holgerb 274
                ElectricAirPacket.Current = Capacity.ActualCurrent;
1919 holgerb 275
                HoTT_DataPointer = (unsigned char *) &ElectricAirPacket;
276
                return(sizeof(ElectricAirPacket));
277
                break;
1943 holgerb 278
  case HOTT_GENERAL_PACKET_ID:
279
                GetHottestBl();
280
                HoTTGeneral.Rpm = GPSInfo.HomeDistance/100;
281
                HoTTGeneral.VoltageCell1 = ErsatzKompassInGrad / 2;
1944 holgerb 282
                HoTTGeneral.VoltageCell6 = GPSInfo.HomeBearing / 2;
1943 holgerb 283
                if(UBat > BattLowVoltageWarning + 5) HoTTGeneral.FuelPercent = (UBat - (BattLowVoltageWarning + 6)) * 3;
284
                else HoTTGeneral.FuelPercent = 0;
1944 holgerb 285
                HoTTGeneral.FuelCapacity = HoehenWert/100;
286
                if(HoTTGeneral.FuelCapacity < 0) HoTTGeneral.FuelCapacity = 0;
1943 holgerb 287
                HoTTGeneral.Altitude = HoehenWert/100 + 500;
288
                HoTTGeneral.Battery1 = UBat;
289
                HoTTGeneral.Battery2 = UBat;
290
                HoTTGeneral.m_sec =  BuildHoTT_Vario();
291
                HoTTGeneral.m_3sec = 120;
292
                HoTTGeneral.InputVoltage = UBat;
293
                HoTTGeneral.Temperature1 = MinBlTempertaure + 20;
294
                HoTTGeneral.Temperature2 = MaxBlTempertaure + 20;
295
                HoTTGeneral.Capacity = Capacity.UsedCapacity/10;
296
                HoTTGeneral.WarnBeep = HoTT_Waring();
297
                HoTTGeneral.Current = Capacity.ActualCurrent;
298
                HoTT_DataPointer = (unsigned char *) &HoTTGeneral;
299
                return(sizeof(HoTTGeneral));
300
                break;
1919 holgerb 301
  default: return(0);
302
  }            
303
}
304
 
305
//---------------------------------------------------------------
1917 holgerb 306
void HoTT_Menu(void)
307
{
1982 holgerb 308
 static unsigned char line, page = 0,show_current = 0,show_mag = 0, show_poti = 0;
1921 holgerb 309
 unsigned char tmp;
1944 holgerb 310
 HoTTVarioMeter = (HoTTVarioMeter * 7 + VarioMeter) / 8;
311
 
1921 holgerb 312
 if(page == 0)
1933 holgerb 313
  switch(line++)
1917 holgerb 314
  {
1919 holgerb 315
        case 0:  
1923 holgerb 316
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
1939 holgerb 317
                         HoTT_printfxy_BLINK(0,0,"  %2i.%1iV  ",UBat/10, UBat%10)
318
                        else
319
                         HoTT_printfxy(0,0,"  %2i.%1iV  ",UBat/10, UBat%10)
320
 
321
                        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
322
                          {
323
                           if(HoehenReglerAktiv)        HoTT_printfxy_INV(10,0,"ALT:%4im %c", (int16_t)(HoehenWert/100),VarioCharacter)
324
                           else                                         HoTT_printfxy(10,0,"ALT:%4im  ", (int16_t)(HoehenWert/100))
325
                           }
326
            else    HoTT_printfxy(10,0,"ALT:---- ");
327
                        break;
328
        case 1:  
329
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
330
                         HoTT_printfxy_BLINK(0,1,"  %2i:%02i  ",FlugSekunden/60,FlugSekunden%60)
331
            else   HoTT_printfxy(0,1,"  %2i:%02i  ",FlugSekunden/60,FlugSekunden%60);                      
1941 holgerb 332
                        HoTT_printfxy(10,1,"DIR: %3d%c",ErsatzKompassInGrad, HoTT_GRAD);
1949 holgerb 333
                        if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(20,1,"C") else HoTT_printfxy(20,1," ");
1939 holgerb 334
            break;
335
        case 2:
336
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
337
                         HoTT_printfxy_BLINK(0,2,"  %5i  ",Capacity.UsedCapacity)
338
            else   HoTT_printfxy(0,2,"  %5i  ",Capacity.UsedCapacity);                     
1940 holgerb 339
                        HoTT_printfxy(12,2,"I:%2i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
1939 holgerb 340
                        break;
341
        case 3:
342
                        HoTT_printfxy(9,0,"I");
343
                        HoTT_printfxy(9,1,"I");
344
                        HoTT_printfxy(9,2,"I");
345
                        HoTT_printfxy(0,3,"---------+-----------");
346
                        HoTT_printfxy(0,6,"---------------------");
347
                        break;
348
        case 4:  
349
                        if(NaviDataOkay)
350
                        {
1940 holgerb 351
                        HoTT_printfxy(9,4,"I");
1939 holgerb 352
                                HoTT_printfxy(0,4,"SAT:%2d ",GPSInfo.NumOfSats);
353
                            HoTT_printfxy(10,4,"DIST:%3dm",GPSInfo.HomeDistance/10);
354
                                switch (GPSInfo.SatFix)
355
                                {
356
                                        case SATFIX_3D:
357
                                                        if(GPSInfo.Flags & FLAG_DIFFSOLN) HoTT_printfxy(7,4,"D ")
358
                                                        else HoTT_printfxy(7,4,"3D");
359
                                                break;
360
                                        default:
1943 holgerb 361
                                                HoTT_printfxy_BLINK(7,4,"!!");
1939 holgerb 362
                                                break;
363
                                }      
364
                        }
365
                        else
1944 holgerb 366
                        {                    
1940 holgerb 367
                                Hott_ClearLine(4);
1939 holgerb 368
                        }
369
                        break;
370
        case 5:
371
                        if(NaviDataOkay)
372
                        {
1972 holgerb 373
                        if(show_mag)
374
                          {
375
                                HoTT_printfxy(0,5,"MAG:%3u%% ",EarthMagneticField);
1939 holgerb 376
                            HoTT_printfxy(12,5,"HM:%3d%c %c", GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter);
1972 holgerb 377
                                HoTT_printfxy(9,5,"incl:%2d%c(%2i)",EarthMagneticInclination, HoTT_GRAD,EarthMagneticInclinationTheoretic);
378
              }
379
                         else
380
                          {
381
                        HoTT_printfxy(9,5,"I");
382
                                HoTT_printfxy(0,5,"    %2um/s",GPSInfo.Speed,GPSInfo.NumOfSats);
383
                            HoTT_printfxy(11,5," HM:%3d%c %c", GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter);
384
                          }    
1939 holgerb 385
            }
1940 holgerb 386
                        else Hott_ClearLine(5);
1939 holgerb 387
                        break;
388
        case 6:
389
                        break;
390
        case 7: if(NC_ErrorCode)
391
                  {
392
                           if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER)
393
                            {
394
                             Hott_ClearLine(7);
395
                             HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode);
396
                            }
397
                                else
398
                                {
399
                                 HoTT_printfxy(0,7,"ERR: ");     _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);};
400
                                }
401
                        else HoTT_printfxy(0,7," www.MikroKopter.de  ");
402
                        break;
403
        case 8: ASCIIPacket.WarnBeep = HoTT_Waring();
404
                        // ASCIIPacket.WarnBeep = Parameter_UserParam1;
405
        case 9:
406
        case 10:
407
        case 11:
408
        case 12:
409
        case 13:
410
        case 14:  
411
        case 15:  
412
        case 16:  
1972 holgerb 413
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_mag) show_mag = 0; else show_mag = 1;}
414
                        else
1949 holgerb 415
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 1; line = 0;};
1939 holgerb 416
                        HottKeyboard = 0;
417
                        break;
418
   default:  line = 0;
419
                        break;
420
  }
421
  else
422
  if(page == 1)
423
  switch(line++)
424
  {
425
        case 0:  
426
                if(FC_StatusFlags & FC_STATUS_LOWBAT)
1923 holgerb 427
                         HoTT_printfxy_BLINK(0,0," %2i:%02i  %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity)
428
            else   HoTT_printfxy(0,0," %2i:%02i  %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity);                         
1917 holgerb 429
                        break;
430
        case 1:  
1921 holgerb 431
                        HoTT_printfxy(0,1,"DIR:%3d%c",KompassValue, HoTT_GRAD);
1917 holgerb 432
                        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
1920 holgerb 433
                          {
434
                           if(HoehenReglerAktiv)        HoTT_printfxy_INV(10,1,"ALT:%4im", (int16_t)(HoehenWert/100))
435
                           else                                         HoTT_printfxy(10,1,"ALT:%4im", (int16_t)(HoehenWert/100))
436
                           }
437
            else    HoTT_printfxy(10,1,"ALT:---- ");
438
                        HoTT_printfxy(20,1,"%c",VarioCharacter);
1917 holgerb 439
            break;
440
        case 2:
441
                        if(NaviDataOkay)
442
                        {
1923 holgerb 443
                          HoTT_printfxy(1,2,"HM:%3d%c  DIST:%3dm %c", GPSInfo.HomeBearing, HoTT_GRAD, GPSInfo.HomeDistance/10, NC_GPS_ModeCharacter);
1917 holgerb 444
            }
445
                        else
446
                        {
1923 holgerb 447
                         Hott_ClearLine(2);
1917 holgerb 448
                        }
449
                        break;
1923 holgerb 450
        case 3:
451
                        HoTT_printfxy(0,3,"PWR:%2i.%1iA (%iW) ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10,Capacity.ActualPower);
1949 holgerb 452
                        if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(19,3,"CF") else HoTT_printfxy(19,3,"  ");
1923 holgerb 453
                        break;
1917 holgerb 454
        case 4:  
455
                        if(NaviDataOkay)
456
                        {
1919 holgerb 457
                                HoTT_printfxy(0,4,"GPS:%2um/s SAT:%d ",GPSInfo.Speed,GPSInfo.NumOfSats);
1917 holgerb 458
                                switch (GPSInfo.SatFix)
459
                                {
460
                                        case SATFIX_3D:
461
                                                HoTT_printfxy(16,4,"  3D ");
462
                                                break;
1925 holgerb 463
                                        //case SATFIX_2D:
464
                                        //case SATFIX_NONE:
1917 holgerb 465
                                        default:
1925 holgerb 466
                                                HoTT_printfxy_BLINK(16,4,"NOFIX");
1917 holgerb 467
                                                break;
468
                                }      
469
                                if(GPSInfo.Flags & FLAG_DIFFSOLN)
470
                                {
471
                                        HoTT_printfxy(16,4,"DGPS ");
472
                                }
473
                        }
474
                        else
475
                        {                    //012345678901234567890
1930 holgerb 476
                                HoTT_printfxy(0,4,"   No NaviCtrl       ");
1917 holgerb 477
                        }
478
                        break;
479
        case 5:
1949 holgerb 480
                        if(show_current)
481
                         {
482
                                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);
483
                         }
484
                         else
485
                         {
486
                                HoTT_printfxy(0,5,"%3i %3i %3i %3i%cC", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature,HoTT_GRAD);
487
                         }
1917 holgerb 488
                        break;
489
        case 6:
1949 holgerb 490
                        if(show_current)
491
                         {
1917 holgerb 492
                    if(RequiredMotors == 4) Hott_ClearLine(6);
493
                                else
1949 holgerb 494
                                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)
495
                                else
496
                                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);
497
             }
498
                         else
499
                         {
500
                    if(RequiredMotors == 4) Hott_ClearLine(6);
501
                                else
1923 holgerb 502
                                if(RequiredMotors == 6)  HoTT_printfxy(0,6,"%3i %3i%cC        ", Motor[4].Temperature, Motor[5].Temperature,HoTT_GRAD)
1917 holgerb 503
                                else
1923 holgerb 504
                                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 505
             }
1917 holgerb 506
                        break;
1930 holgerb 507
        case 7: if(NC_ErrorCode)
508
                  {
509
                           if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER)
510
                            {
511
                             Hott_ClearLine(7);
512
                             HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode);
513
                            }
514
                                else
515
                                {
516
                                 HoTT_printfxy(0,7,"ERR: ");     _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);};
517
                                }
1937 holgerb 518
                        else HoTT_printfxy(0,7," www.MikroKopter.de  ");
1917 holgerb 519
                        break;
1919 holgerb 520
        case 8: ASCIIPacket.WarnBeep = HoTT_Waring();
521
                        // ASCIIPacket.WarnBeep = Parameter_UserParam1;
1921 holgerb 522
        case 9:
1917 holgerb 523
        case 10:
524
        case 11:
525
        case 12:
526
        case 13:
1919 holgerb 527
        case 14:  
528
        case 15:  
529
        case 16:  
1949 holgerb 530
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_current) show_current = 0; else show_current = 1;   Hott_ClearLine(5);  Hott_ClearLine(6);}
531
                        else
532
                        if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 2; line = 0;}
533
                        else
534
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 0; line = 0;}
535
//if(HottKeyboard) HoTT_printfxy(15,6,"%KEY:%02x ",HottKeyboard);
1921 holgerb 536
                        HottKeyboard = 0;
537
                        break;
1933 holgerb 538
   default:  line = 0;
1921 holgerb 539
                        break;
540
  }
541
  else
1939 holgerb 542
  if(page == 2)
1933 holgerb 543
  switch(line++)
1921 holgerb 544
  {
545
        case 0:  
546
                        HoTT_printfxy_INV(0,0,"Setting:%u %s ",GetActiveParamSet(),EE_Parameter.Name);
547
                        break;
548
    case 1: HoTT_printfxy(0,1,"Min:%2i.%1iV %s ",BattLowVoltageWarning/10, BattLowVoltageWarning%10, Mixer.Name);
549
                        break;
1923 holgerb 550
    case 2:  HoTT_printfxy(0,2,"ALT:");
1921 holgerb 551
                 if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
552
                 {
553
                          if(!(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER)) HoTT_printf("POTI:%3u ", Parameter_HoehenSchalter)
554
                          else
555
                          {
556
                           if(Parameter_HoehenSchalter > 50) HoTT_printf("(ON)  ") else HoTT_printf("(OFF) ");
557
                           if((Parameter_ExtraConfig & CFG2_HEIGHT_LIMIT)) HoTT_printf("LIMIT", Parameter_HoehenSchalter)
558
                           else HoTT_printf("VARIO", Parameter_HoehenSchalter);
559
                          }
560
                         }
561
                        else
562
                                HoTT_printf("DISABLED");
563
                        break;
1923 holgerb 564
    case 3: HoTT_printfxy(0,3,"CF:");
1921 holgerb 565
                        if(!EE_Parameter.CareFreeModeControl) HoTT_printf("DISABLED")
566
                        else
567
                         {
568
                          if(CareFree)  HoTT_printf(" (ON) ") else HoTT_printf(" (OFF)");
569
                          if(EE_Parameter.ExtraConfig & CFG_LEARNABLE_CAREFREE) HoTT_printf(" TEACH");
570
                         }
571
                        break;
1923 holgerb 572
    case 4: HoTT_printfxy(0,4,"GPS:");
573
                    if(!(Parameter_GlobalConfig & CFG_GPS_AKTIV)) HoTT_printf("DISABLED")
574
                        else
575
                         {
576
                          CHK_POTI(tmp,EE_Parameter.NaviGpsModeControl);
577
                          if(tmp < 50) HoTT_printf("(FREE)")
578
                          else
579
                          if(tmp >= 180) HoTT_printf("(HOME)")
580
                          else
581
                          if(EE_Parameter.ExtraConfig & CFG_GPS_AID) HoTT_printf("(AID) ")
582
                          else HoTT_printf("(HOLD)")
583
                         }
584
                        if(EE_Parameter.FailSafeTime) HoTT_printfxy(10,4," FS:%usek ",EE_Parameter.FailSafeTime)
585
 
586
                        break;
587
    case 5: HoTT_printfxy(0,5,"HOME ALT:");
588
                        if(EE_Parameter.ComingHomeAltitude) HoTT_printf("%um",EE_Parameter.ComingHomeAltitude) else HoTT_printf("HOLD ");
589
                        break;
1921 holgerb 590
        case 6:
1982 holgerb 591
                        if(!show_poti)
592
                         {
593
              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);
594
                      HoTT_printfxy(0,7,"Gs:%4i Ya:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]+127,PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]);
595
                         }
596
                        else
597
                         {
598
              HoTT_printfxy(0,6,"P1:%4i P2:%4i 3:%3i",Poti1,Poti2, Poti3);
599
                      HoTT_printfxy(0,7,"P4:%4i P5:%4i 6:%3i",Poti4,Poti5, Poti6);
600
                         }
601
 
1921 holgerb 602
                        break;
603
    case 7: //HoTT_printfxy(0,6,"WARNINGS:");
604
                        if(HoTTBlink)
605
                        {
606
                         LIBFC_HoTT_SetPos(6 * 21);
607
                         if(!(Parameter_GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV)) HoTT_printf_BLINK("COUPLING OFF! ");
608
                         if(EE_Parameter.BitConfig & (CFG_LOOP_LINKS | CFG_LOOP_RECHTS | CFG_LOOP_UNTEN | CFG_LOOP_OBEN)) HoTT_printf_BLINK("LOOPING! ");
609
                         if(Parameter_GlobalConfig & CFG_HEADING_HOLD) HoTT_printf_BLINK("HH! ");
610
                         if(!(Parameter_GlobalConfig & CFG_KOMPASS_AKTIV)) HoTT_printf_BLINK("COMPASS OFF! ");
611
                        }
612
                        break;
613
    case 8: ASCIIPacket.WarnBeep = HoTT_Waring();
614
                        break;
615
    case 9:
616
    case 10:
617
    case 11:
618
    case 12:
619
    case 13:
620
    case 14:
621
    case 15:
622
    case 16:
1982 holgerb 623
                        if(HottKeyboard == HOTT_KEY_SET) { if(show_poti) show_poti = 0; else show_poti = 1;   Hott_ClearLine(6);  Hott_ClearLine(7);}
624
                        else
1949 holgerb 625
                        if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 1; line = 0;};
1921 holgerb 626
                        HottKeyboard = 0;
627
                        break;
1933 holgerb 628
   default:  line = 0;
1917 holgerb 629
                        break;
630
  }
1921 holgerb 631
  else page = 0;
1917 holgerb 632
}
633
 
1925 holgerb 634
#endif
1917 holgerb 635
 
636
 
637