Subversion Repositories FlightCtrl

Rev

Rev 2344 | Rev 2418 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2344 Rev 2345
1
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2
// + Software Nutzungsbedingungen (english version: see below)
2
// + Software Nutzungsbedingungen (english version: see below)
3
// + www.MikroKopter.com
3
// + www.MikroKopter.com
4
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5
// + der Fa. HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland - nachfolgend Lizenzgeber genannt -
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
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 
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.
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.
9
// + Der Einsatz dieser Software ist nur auf oder mit Produkten des Lizenzgebers zulässig.
10
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11
// + Die vom Lizenzgeber gelieferte Software ist urheberrechtlich geschützt. Alle Rechte an der Software sowie an sonstigen im
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.
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
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.
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
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.
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
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 
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.
19
// + des Mitverschuldens offen.
20
// + Der Kunde trifft angemessene Vorkehrungen für den Fall, dass die Software ganz oder teilweise nicht ordnungsgemäß arbeitet.
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.
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.
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
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.
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.
25
// + *) Die räumliche Nutzung bezieht sich nur auf den Einsatzort, nicht auf die Reichweite der programmierten Software.
26
// + #### ENDE DER NUTZUNGSBEDINGUNGEN ####'
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.
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
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
28
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
29
// + Software LICENSING TERMS
29
// + Software LICENSING TERMS
30
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
30
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31
// + of HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland, Germany - the Licensor -
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 
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*.
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.
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
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
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.
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
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.
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
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
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
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
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.
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
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.
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
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.
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.
49
// + *) The territory aspect only refers to the place where the Software is used, not its programmed range.
50
// + #### END OF LICENSING TERMS ####
50
// + #### END OF LICENSING TERMS ####
51
// + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de.
51
// + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de.
52
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
52
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
53
#include "jetimenu.h"
53
#include "jetimenu.h"
54
#include "libfc.h"
54
#include "libfc.h"
55
#include "printf_P.h"
55
#include "printf_P.h"
56
#include "main.h"
56
#include "main.h"
57
#include "spi.h"
57
#include "spi.h"
58
#include "capacity.h"
58
#include "capacity.h"
59
#include "hottmenu.h"
59
#include "hottmenu.h"
60
 
60
 
61
#define JETIBOX_KEY_RIGHT       0x1F
61
#define JETIBOX_KEY_RIGHT       0x1F
62
#define JETIBOX_KEY_UP          0x2F
62
#define JETIBOX_KEY_UP          0x2F
63
#define JETIBOX_KEY_DOWN        0x4F
63
#define JETIBOX_KEY_DOWN        0x4F
64
#define JETIBOX_KEY_LEFT        0x8F
64
#define JETIBOX_KEY_LEFT        0x8F
65
#define JETIBOX_KEY_NONE        0x0F
65
#define JETIBOX_KEY_NONE        0x0F
66
#define JETIBOX_KEY_UNDEF       0x00
66
#define JETIBOX_KEY_UNDEF       0x00
67
 
67
 
68
#define JetiBox_printfxy(x,y,format, args...)  { LIBFC_JetiBox_SetPos(y * 16 + x); _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);}
68
#define JetiBox_printfxy(x,y,format, args...)  { LIBFC_JetiBox_SetPos(y * 16 + x); _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);}
69
#define JetiBox_printf(format, args...)        {  _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);}
69
#define JetiBox_printf(format, args...)        {  _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);}
70
 
70
 
71
// -----------------------------------------------------------
71
// -----------------------------------------------------------
72
// the menu functions
72
// the menu functions
73
// -----------------------------------------------------------
73
// -----------------------------------------------------------
74
void Menu_Status(uint8_t key)
74
void Menu_Status(uint8_t key)
75
{                                               //0123456789ABCDEF
75
{                                               //0123456789ABCDEF
76
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
76
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
77
        JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10);
77
        JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10);
78
        if(NaviDataOkay)
78
        if(NaviDataOkay)
79
        {
79
        {
80
                JetiBox_printfxy(6,0,"%3d%c %03dm%c",ErsatzKompassInGrad, 0xDF, GPSInfo.HomeDistance/10,NC_GPS_ModeCharacter);
80
                JetiBox_printfxy(6,0,"%3d%c %03dm%c",ErsatzKompassInGrad, 0xDF, GPSInfo.HomeDistance/10,NC_GPS_ModeCharacter);
81
        }
81
        }
82
        else
82
        else
83
        {
83
        {
84
                JetiBox_printfxy(6,0,"Status");
84
                JetiBox_printfxy(6,0,"Status");
85
        }
85
        }
86
 
86
 
87
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
87
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
88
        if(NC_ErrorCode)
88
        if(NC_ErrorCode)
89
        {
89
        {
90
         static unsigned int timer;
90
         static unsigned int timer;
91
         static char toggle = 1;
91
         static char toggle = 1;
92
     
92
     
93
         if(CheckDelay(timer)) { if(toggle) toggle = 0; else toggle = 1; timer = SetDelay(1500);};
93
         if(CheckDelay(timer)) { if(toggle) toggle = 0; else toggle = 1; timer = SetDelay(1500);};
94
     if(toggle)
94
     if(toggle)
95
          {
95
          {
96
       LIBFC_JetiBox_SetPos(0);
96
       LIBFC_JetiBox_SetPos(0);
97
           _printf_P(&LIBFC_JetiBox_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);
97
           _printf_P(&LIBFC_JetiBox_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);
98
          }
98
          }
99
          else
99
          else
100
          {
100
          {
101
           JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode);
101
           JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode);
102
//         if(MotorenEin) JetiBeep = 'O'; 
102
//         if(MotorenEin) JetiBeep = 'O'; 
103
          }
103
          }
104
        }
104
        }
105
        else
105
        else
106
        if(ShowSettingName)
106
        if(ShowSettingNameTime)
107
        {
107
        {
108
         ShowSettingName--;
-
 
109
         LIBFC_JetiBox_Clear();
108
         LIBFC_JetiBox_Clear();
110
         JetiBox_printfxy(0,1,"Set%d:%s  ",ActiveParamSet,EE_Parameter.Name);
109
         JetiBox_printfxy(0,1,"Set%d:%s  ",ActiveParamSet,EE_Parameter.Name);
111
         return; // nichts weiter ausgeben
110
         return; // nichts weiter ausgeben
112
        }
111
        }
113
 
112
 
114
#else
113
#else
115
        if(NC_ErrorCode) { JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); if(MotorenEin) JetiBeep = 'S';};
114
        if(NC_ErrorCode) { JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); if(MotorenEin) JetiBeep = 'S';};
116
#endif
115
#endif
117
        JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60);
116
        JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60);
118
        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
117
        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
119
        {
118
        {
120
                JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter);
119
                JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter);
121
        }
120
        }
122
#endif
121
#endif
123
}
122
}
124
 
123
 
125
 
124
 
126
void Menu_Temperature(uint8_t key)
125
void Menu_Temperature(uint8_t key)
127
{                       //0123456789ABCDEF
126
{                       //0123456789ABCDEF
128
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
127
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
129
  JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature);
128
  JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature);
130
  JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature);
129
  JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature);
131
  if(RequiredMotors <= 4)
130
  if(RequiredMotors <= 4)
132
        {
131
        {
133
         JetiBox_printfxy(0,1,"Temperatures    ");
132
         JetiBox_printfxy(0,1,"Temperatures    ");
134
    }
133
    }
135
        else
134
        else
136
    if(RequiredMotors <= 6)
135
    if(RequiredMotors <= 6)
137
        {
136
        {
138
         JetiBox_printfxy(8,1,"\%cC     ",0xdf);
137
         JetiBox_printfxy(8,1,"\%cC     ",0xdf);
139
        }
138
        }
140
 
139
 
141
#endif
140
#endif
142
}
141
}
143
 
142
 
144
void Menu_Battery(uint8_t key)
143
void Menu_Battery(uint8_t key)
145
{                       //0123456789ABCDEF
144
{                       //0123456789ABCDEF
146
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
145
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
147
        JetiBox_printfxy(0,0,"%2i.%1iV %3i.%1iA", UBat/10, UBat%10, Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
146
        JetiBox_printfxy(0,0,"%2i.%1iV %3i.%1iA", UBat/10, UBat%10, Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
148
        JetiBox_printfxy(0,1,"%4iW %6imAh",Capacity.ActualPower, Capacity.UsedCapacity);
147
        JetiBox_printfxy(0,1,"%4iW %6imAh",Capacity.ActualPower, Capacity.UsedCapacity);
149
#endif
148
#endif
150
}
149
}
151
 
150
 
152
void Magnet_Values(uint8_t key)
151
void Magnet_Values(uint8_t key)
153
{                       //0123456789ABCDEF
152
{                       //0123456789ABCDEF
154
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
153
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
155
        JetiBox_printfxy(0,0,"Magnet:%3i%% %3i%c",EarthMagneticField, KompassValue,0xDF);
154
        JetiBox_printfxy(0,0,"Magnet:%3i%% %3i%c",EarthMagneticField, KompassValue,0xDF);
156
        JetiBox_printfxy(0,1,"Incli.:%3i%c (%i) ",EarthMagneticInclination, 0xDF,EarthMagneticInclinationTheoretic);
155
        JetiBox_printfxy(0,1,"Incli.:%3i%c (%i) ",EarthMagneticInclination, 0xDF,EarthMagneticInclinationTheoretic);
157
#endif
156
#endif
158
}
157
}
159
 
158
 
160
 
159
 
161
void Menu_PosInfo(uint8_t key)
160
void Menu_PosInfo(uint8_t key)
162
{
161
{
163
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
162
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
164
        if(NaviDataOkay)
163
        if(NaviDataOkay)
165
        {
164
        {
166
                JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats);
165
                JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats);
167
                switch (GPSInfo.SatFix)
166
                switch (GPSInfo.SatFix)
168
                {
167
                {
169
                        case SATFIX_3D:
168
                        case SATFIX_3D:
170
                                JetiBox_printfxy(12,0,"  3D");
169
                                JetiBox_printfxy(12,0,"  3D");
171
                                break;
170
                                break;
172
//                      case SATFIX_2D:
171
//                      case SATFIX_2D:
173
//                      case SATFIX_NONE:
172
//                      case SATFIX_NONE:
174
                        default:
173
                        default:
175
                                JetiBox_printfxy(12,0,"NoFx");
174
                                JetiBox_printfxy(12,0,"NoFx");
176
                                break;
175
                                break;
177
                }
176
                }
178
                if(GPSInfo.Flags & FLAG_DIFFSOLN)
177
                if(GPSInfo.Flags & FLAG_DIFFSOLN)
179
                {
178
                {
180
                        JetiBox_printfxy(12,0,"DGPS");
179
                        JetiBox_printfxy(12,0,"DGPS");
181
                }
180
                }
182
                JetiBox_printfxy(0,1,"Home:%3dm %3d%c %c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF,NC_GPS_ModeCharacter);
181
                JetiBox_printfxy(0,1,"Home:%3dm %3d%c %c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF,NC_GPS_ModeCharacter);
183
        }
182
        }
184
        else
183
        else
185
        {                     //0123456789ABCDEF
184
        {                     //0123456789ABCDEF
186
                JetiBox_printfxy(2,0,"No NaviCtrl!");
185
                JetiBox_printfxy(2,0,"No NaviCtrl!");
187
        }
186
        }
188
#endif
187
#endif
189
}
188
}
190
 
189
 
191
 
190
 
192
// -----------------------------------------------------------
191
// -----------------------------------------------------------
193
// the menu topology
192
// the menu topology
194
// -----------------------------------------------------------
193
// -----------------------------------------------------------
195
typedef void (*pFctMenu) (uint8_t);  // the menu item handler function pointer
194
typedef void (*pFctMenu) (uint8_t);  // the menu item handler function pointer
196
 
195
 
197
typedef struct{
196
typedef struct{
198
  int8_t left;
197
  int8_t left;
199
  int8_t right;
198
  int8_t right;
200
  int8_t up;
199
  int8_t up;
201
  int8_t down;
200
  int8_t down;
202
  pFctMenu pHandler;
201
  pFctMenu pHandler;
203
} MENU_ENTRY;
202
} MENU_ENTRY;
204
 
203
 
205
 
204
 
206
// the menu navigation structure
205
// the menu navigation structure
207
/*                                              |
206
/*                                              |
208
 
207
 
209
3 - 0 - 1 - 2 - 3 - 0
208
3 - 0 - 1 - 2 - 3 - 0
210
 
209
 
211
*/
210
*/
212
 
211
 
213
const MENU_ENTRY JetiBox_Menu[] PROGMEM=
212
const MENU_ENTRY JetiBox_Menu[] PROGMEM=
214
{ // l  r  u  d  pHandler
213
{ // l  r  u  d  pHandler
215
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
214
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
216
        {4, 1, 0, 0, &Menu_Status },    // 0
215
        {4, 1, 0, 0, &Menu_Status },    // 0
217
        {0, 2, 1, 1, &Menu_Temperature },       // 1
216
        {0, 2, 1, 1, &Menu_Temperature },       // 1
218
        {1, 3, 2, 2, &Menu_Battery },   // 2
217
        {1, 3, 2, 2, &Menu_Battery },   // 2
219
        {2, 4, 3, 3, &Menu_PosInfo },   // 3
218
        {2, 4, 3, 3, &Menu_PosInfo },   // 3
220
        {3, 0, 4, 4, &Magnet_Values }   // 4
219
        {3, 0, 4, 4, &Magnet_Values }   // 4
221
#endif
220
#endif
222
};
221
};
223
 
222
 
224
// -----------------------------------------------------------
223
// -----------------------------------------------------------
225
// Update display buffer
224
// Update display buffer
226
// -----------------------------------------------------------
225
// -----------------------------------------------------------
227
unsigned char JetiBox_Update(unsigned char key)
226
unsigned char JetiBox_Update(unsigned char key)
228
{
227
{
229
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
228
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
230
        static uint8_t item = 0, last_item = 0; // the menu item
229
        static uint8_t item = 0, last_item = 0; // the menu item
231
        static uint8_t updateDelay = 1;
230
        static uint8_t updateDelay = 1;
232
 
231
 
233
        // navigate within the menu by key action
232
        // navigate within the menu by key action
234
        last_item = item;
233
        last_item = item;
235
        switch(key)
234
        switch(key)
236
        {
235
        {
237
                case JETIBOX_KEY_LEFT:
236
                case JETIBOX_KEY_LEFT:
238
                        //if (item == 0) return (1);                                                                    // switch back to jeti expander menu
237
                        //if (item == 0) return (1);                                                                    // switch back to jeti expander menu
239
                        // else 
238
                        // else 
240
                         item = pgm_read_byte(&JetiBox_Menu[item].left);                //trigger to left menu item
239
                         item = pgm_read_byte(&JetiBox_Menu[item].left);                //trigger to left menu item
241
                        break;
240
                        break;
242
                case JETIBOX_KEY_RIGHT:
241
                case JETIBOX_KEY_RIGHT:
243
                        item = pgm_read_byte(&JetiBox_Menu[item].right);        //trigger to right menu item
242
                        item = pgm_read_byte(&JetiBox_Menu[item].right);        //trigger to right menu item
244
                        break;
243
                        break;
245
                case JETIBOX_KEY_UP:
244
                case JETIBOX_KEY_UP:
246
                        item = pgm_read_byte(&JetiBox_Menu[item].up);           //trigger to up menu item
245
                        item = pgm_read_byte(&JetiBox_Menu[item].up);           //trigger to up menu item
247
                        break;
246
                        break;
248
                case JETIBOX_KEY_DOWN:
247
                case JETIBOX_KEY_DOWN:
249
                        item = pgm_read_byte(&JetiBox_Menu[item].down);         //trigger to down menu item
248
                        item = pgm_read_byte(&JetiBox_Menu[item].down);         //trigger to down menu item
250
                        break;
249
                        break;
251
                default:
250
                default:
252
                        break;
251
                        break;
253
        }
252
        }
254
        // if the menu item has been changed, do not pass the key to the item handler
253
        // if the menu item has been changed, do not pass the key to the item handler
255
        // to avoid jumping over to items
254
        // to avoid jumping over to items
256
        if(item != last_item) key = JETIBOX_KEY_UNDEF;
255
        if(item != last_item) key = JETIBOX_KEY_UNDEF;
257
 
256
 
258
        if (updateDelay++ & 0x01)
257
        if (updateDelay++ & 0x01)
259
        {      
258
        {      
260
 
259
 
261
                LIBFC_JetiBox_Clear();
260
                LIBFC_JetiBox_Clear();
262
                //execute menu item handler
261
                //execute menu item handler
263
                ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key);
262
                ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key);
264
        }      
263
        }      
265
#endif
264
#endif
266
        return (0);
265
        return (0);
267
}
266
}
268
 
267
 
269
 
268