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