Subversion Repositories FlightCtrl

Rev

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

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