Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2136 | - | 1 | /***************************************************************************** |
2 | * Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
||
3 | * Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
||
4 | * Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
||
5 | * Copyright (C) 2011 Harald Bongartz * |
||
6 | * * |
||
7 | * This program is free software; you can redistribute it and/or modify * |
||
8 | * it under the terms of the GNU General Public License as published by * |
||
9 | * the Free Software Foundation; either version 2 of the License. * |
||
10 | * * |
||
11 | * This program is distributed in the hope that it will be useful, * |
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
14 | * GNU General Public License for more details. * |
||
15 | * * |
||
16 | * You should have received a copy of the GNU General Public License * |
||
17 | * along with this program; if not, write to the * |
||
18 | * Free Software Foundation, Inc., * |
||
19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
20 | * * |
||
21 | * * |
||
22 | * Credits to: * |
||
23 | * Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
||
24 | * http://www.mikrokopter.de * |
||
25 | * Gregor "killagreg" Stobrawa for his version of the MK code * |
||
26 | * Thomas Kaiser "thkais" for the original project. See * |
||
27 | * http://www.ft-fanpage.de/mikrokopter/ * |
||
28 | * http://forum.mikrokopter.de/topic-4061-1.html * |
||
29 | * Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
||
30 | * http://www.mylifesucks.de/oss/c-osd/ * |
||
31 | * Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
||
32 | *****************************************************************************/ |
||
33 | |||
34 | //############################################################################ |
||
35 | //# HISTORY setup.c |
||
36 | //# |
||
37 | //# |
||
38 | //# 03.08.2015 CB |
||
39 | //# - add: FollowMe Setup um Distance und Azimuth erweitert |
||
40 | //# |
||
41 | //# 27.06.2014 OG |
||
42 | //# - chg: Setup_MAIN() - Reihenfolge von GPS-Maus/FollowMe/Tracking geaendert |
||
43 | //# |
||
44 | //# 25.06.2014 OG |
||
45 | //# - chg: Text von GPS_SHOWDEV |
||
46 | //# - chg: Setup_FollowMe() - deaktiviert/auskommentiert: FME_REFRESH |
||
47 | //# - chg: Setup_GPSMouse() - deaktiviert/auskommentiert: GPS_TYPE, GPS_ACTIVE |
||
48 | //# |
||
49 | //# 24.06.2014 OG |
||
50 | //# - chg: Setup_GPSMouse() angepasst auf geaendertes GPSMouse_ShowData() |
||
51 | //# |
||
52 | //# 22.06.2014 OG |
||
53 | //# - del: verschiedene weitere Modul-Variablen entfernt weil nicht benoetigt |
||
54 | //# - del: Variable CheckGPS |
||
55 | //# - del: BT_ShowGPSData() - ist jetzt als GPSMouse_ShowData() in gps/gpsmouse.c |
||
56 | //# - chg: BT_ShowGPSData() - Parameter und Rueckgabe |
||
57 | //# - del: BT_ShowGPSData_OLD |
||
58 | //# |
||
59 | //# 21.06.2014 CB |
||
60 | //# - chg: BT_SearchDevices - Timeoutanzeige bei Devicesuche |
||
61 | //# |
||
62 | //# 16.06.2014 OG |
||
63 | //# - chg: BT_ShowGPSData() - neues Layout und Anzeige fuer "XCnt" (=RX-Count) |
||
64 | //# hinzugefuegt; XCnt zeigt die Anzahl empfangener GPS-Datenpakete an |
||
65 | //# und ist ein Indikator wie schnell die BT-GPS Maus Daten sendet |
||
66 | //# |
||
67 | //# 13.06.2014 OG |
||
68 | //# - chg: Setup_PKTGeneric() - neue Einstellung "PKT aus nach" |
||
69 | //# - del: ChangeWi_SV2() |
||
70 | //# |
||
71 | //# 12.06.2014 OG |
||
72 | //# - del: Reset_EEprom() - ist jetzt als PKT_Reset_EEprom() in pkt.c |
||
73 | //# |
||
74 | //# 11.06.2014 OG |
||
75 | //# - fix: Edit_generic() funktioniert jetzt auch, wenn kein vorgelagertes |
||
76 | //# Menue vorhanden ist (ggf. muss das Label angepasst werden) |
||
77 | //# |
||
78 | //# 10.06.2014 OG |
||
79 | //# - chg: verschiedene Funktionen umgestellt auf Wi232_Initalize() |
||
80 | //# |
||
81 | //# 08.06.2014 OG |
||
82 | //# - add: Setup_MKConnection() - hier ist auch das setzen der Baudrate Wi232/BT |
||
83 | //# hin verschoben worden (war vorher im Wi.232 Bereicch) |
||
84 | //# |
||
85 | //# 06.06.2014 OG |
||
86 | //# - chg: Setup_WI232_MenuCreate()... Eintraege geloescht... |
||
87 | //# |
||
88 | //# 04.06.2014 OG |
||
89 | //# - chg: Setup_PKTGeneric() eine Menue-Trennlinie hinter Sommerzeit eingefuegt |
||
90 | //# |
||
91 | //# 01.06.2014 OG |
||
92 | //# - chg: Edit_LED_Form() Parameter 'Text' entfernt und auf strGetOSDOLD() |
||
93 | //# umgestellt |
||
94 | //# - add: include "../osd/osdold_messages.h" |
||
95 | //# |
||
96 | //# 31.05.2014 OG |
||
97 | //# - chg: Edit_String() - Parameter 'Text' entfernt; angepasst auf neue |
||
98 | //# Titelzeile; PKT_CtrlHook integriert; PKT Lipo-Anzeige; |
||
99 | //# auf 'redraw' umgestellt |
||
100 | //# |
||
101 | //# 30.05.2014 OG |
||
102 | //# - chg: Edit_LipoOffset() - umgeschrieben auf neues Layout, Code optimiert, |
||
103 | //# Increment jetzt +/-50 (statt vorher 20), Offset bis 15000 (statt 10000) |
||
104 | //# - chg: Edit_LipoOffset() - keine Parameter mehr, keine Rueckgabe |
||
105 | //# |
||
106 | //# 29.05.2014 OG |
||
107 | //# - chg: Setup_OSD() umgestellt auf Menuetexte statt strGet() mit Textaenderung |
||
108 | //# |
||
109 | //# 28.05.2014 OG |
||
110 | //# - chg: Setup's auf das neue Edit_generic() umgestellt |
||
111 | //# - chg: Edit_generic() - geaenderte Aufrufparameter |
||
112 | //# (Text enfernt da vom Menue geerbt; optionale Hilfstexte moeglich) |
||
113 | //# |
||
114 | //# 27.05.2014 OG |
||
115 | //# - del: Edit_generic_int(), Edit_printout_int() - nicht mehr benoetigt da |
||
116 | //# anhaengende Werte umgemappt auf Edit_generic() |
||
117 | //# |
||
118 | //# 26.05.2014 OG |
||
119 | //# - chg: Menuetext TIME_ZONE ergaenzt um "UTC" |
||
120 | //# - chg: Setup_MAIN() - neue Anordnung der Menueeintraege mit Trennlinien |
||
121 | //# - chg: Setup_OSDScreens() - OSDSCREEN_WAYPOINTS hinzugefuegt |
||
122 | //# - chg: Text "LCD aus nach..." nach "LCD aus nach" |
||
123 | //# - chg: Text "PKT allgemein" geaendert auf "PKT Allgemein" |
||
124 | //# - del: PKT_LCDINVERS inkl. Sprachen |
||
125 | //# - chg: Setup_PKTGeneric() - PKT_LCDINVERS (Config.LCD_DisplayMode) entfernt, |
||
126 | //# nicht mehr unterstuetzt |
||
127 | //# - chg: Edit_printout() - Hilfstexte CHANGENORMREV1 und 2 fuer NormRev entfernt |
||
128 | //# |
||
129 | //# 23.05.2014 OG |
||
130 | //# - add: Edit_generic() - Anzeige Titel mit PKT_TitleFromMenuItem() |
||
131 | //# - fix: Setup_PKTGeneric() - PKT_LCDINVERS (Config.LCD_DisplayMode) |
||
132 | //# Edit-Range umgestellt von 0,4 auf 0,1 |
||
133 | //# |
||
134 | //# 11.05.2014 OG |
||
135 | //# - chg: die Setup-Menues umgestellt auf MenuCtrl_SetTitleFromParentItem() |
||
136 | //# -> die Menues 'erben' damit ihren Titel vom aufrufenden Menuepunkt |
||
137 | //# - chg: ein paar Menuetexte fuer Setup_MAIN() |
||
138 | //# |
||
139 | //# 18.04.2014 OG |
||
140 | //# - chg: Setup_PKTGeneric() - PKT_BRIGHTNESS rausgenommen da es aktuell auch |
||
141 | //# nicht mehr mit PKT 3.9m Hardware geht (spart ca. 650 Bytes) |
||
142 | //# - chg: Text von "Tracking Servos" gekuerzt auf "Tracking" |
||
143 | //# |
||
144 | //# 09.04.2014 OG |
||
145 | //# - chg: Edit_printout() Text von WlanMode 'Nein' auf 'Aus' geaendert |
||
146 | //# |
||
147 | //# 04.04.2014 OG |
||
148 | //# - chg: Edit_String() auf ShowTitle_P() umgestellt |
||
149 | //# - del: Edit_ShowTitle_P() |
||
150 | //# - chg: in versch. Funktionen Titel-Strings fuer Edit_String() gekuerzt |
||
151 | //# - chg: Edit_String() auf Edit_ShowTitle_P() umgestellt |
||
152 | //# |
||
153 | //# 02.04.2014 OG |
||
154 | //# - add: Edit_ShowTitle_P() |
||
155 | //# - add: Edit_printout(): WlanMode (Aus, AP-Mode, AdHoc) |
||
156 | //# - chg: Edit_printout(): Code-Optimierung |
||
157 | //# |
||
158 | //# 01.04.2014 OG |
||
159 | //# - add: Unterstuetzung fuer BLE (Bluetooth 4 Low Energy Zusatzmodul an SV2) |
||
160 | //# - chg: PCB_WiFlyPatch umbenannt zu PCB_SV2RxTxPatch |
||
161 | //# |
||
162 | //# 30.03.2014 OG |
||
163 | //# - chg: Sprache Hollaendisch vollstaendig entfernt |
||
164 | //# - chg: MenuCtrl_PushML_P() umgestellt auf MenuCtrl_PushML2_P() |
||
165 | //# |
||
166 | //# 27.03.2014 OG |
||
167 | //# - chg: Setup_PKTGeneric(), Edit_printout() Sprache "Niederländisch" nicht mehr waehlbar |
||
168 | //# |
||
169 | //# 04.02.2014 OG |
||
170 | //# - chg: kleine Layoutaenderung von 'PKT_Akku' in Edit_printout() |
||
171 | //# - add: PKT_CtrlHook() in Edit_generic(), Edit_generic_int(), Edit_LipoOffset() eingebaut |
||
172 | //# - add: kleiner Hilfetext in Edit_printout() bei Aenderung von Einstellung |
||
173 | //# "LCD Normal/Invers" bzgl. PKT neu starten nach Aenderung |
||
174 | //# - chg: Anzeige von Edit_LipoOffset() geaendert und fix vom springen der |
||
175 | //# Eingabe wenn Wert geaendert wird |
||
176 | //# |
||
177 | //# 03.02.2014 OG |
||
178 | //# - add: SHOWCELLU in Setup_OSD() ("zeige Zellensp.") |
||
179 | //# |
||
180 | //# 30.01.2014 OG |
||
181 | //# - add: Unterstuetzung fuer USE_BLUETOOTH |
||
182 | //# |
||
183 | //# 29.07.2013 Cebra |
||
184 | //# - chg: Fehler in Setup_WI232_MenuCreate, MenuCtrl_Push_P( WI_INSTALLED.. war auskommentiert, dadurch Fehler im Menu bei nicht |
||
185 | //# aktivem Wi232 |
||
186 | //# |
||
187 | //# 18.07.2013 Cebra |
||
188 | //# - chg: Edit_PKT_Accu entfernt, Edit_generic erweitert |
||
189 | //# |
||
190 | //# 15.07.2013 Cebra |
||
191 | //# - add: Edit_Printout um Wlan Security erweitert |
||
192 | //# |
||
193 | //# 07.07.2013 OG |
||
194 | //# - add: Setup_OSDScreens(), Mark_OSDScreen(), Edit_OSDScreen() |
||
195 | //# |
||
196 | //# 04.07.2013 Cebra |
||
197 | //# - chg: Setupmenü um Wlan erweitert |
||
198 | //# |
||
199 | //# 02.07.2013 Cebra |
||
200 | //# - chg: Edit_String, geändert für die Nutzung von SSID und Wlan Passwort |
||
201 | //# |
||
202 | //# 30.06.2013 OG |
||
203 | //# - del: Setup_OSD(): OSDS_HOMEVIEW |
||
204 | //# |
||
205 | //# 26.06.2013 OG |
||
206 | //# - del: USE_PKT_STARTINFO |
||
207 | //# |
||
208 | //# 24.06.2013 OG |
||
209 | //# - chg: vor dem editieren des Bluetooth Namens bt_fixname() eingefuegt |
||
210 | //# |
||
211 | //# 24.06.2013 OG |
||
212 | //# - fix: Edit_String(): Fehlermeldung bei EDIT_BT_NAME wenn erstes Zeichen = Space |
||
213 | //# - chg: Edit_String(): Code-Layout und diverses |
||
214 | //# - chg: Setup_BTM222(): Bearbeitung von BT_NAME geaendert |
||
215 | //# - chg: Setup_BTM222(): Menuetexte geaendert |
||
216 | //# - chg: Setup_MAIN(): Text im Setup-Hauptmenue von "BTM-222" auf "Bluetooth" geaendert |
||
217 | //# |
||
218 | //# 21.06.2013 OG |
||
219 | //# - fix: Menuetext GPSMouse "Zeige Geräteliste" (Anzeige "ä" korrigiert) |
||
220 | //# |
||
221 | //# 15.06.2013 OG |
||
222 | //# - add: "zeige MK-Setting" in Setup_OSD() hinzugefuegt |
||
223 | //# |
||
224 | //# 15.06.2013 OG |
||
225 | //# - chg: Umstrukturierungen am OSD-Setup |
||
226 | //# - chg: OSD Empfangsausfall von Setup_PKTGeneric() nach Setup_OSD() verschoben |
||
227 | //# |
||
228 | //# 13.06.2013 OG |
||
229 | //# - del: Setup_Time() - jetzt in Setup_PKTGeneric() |
||
230 | //# - del: Setup_PKTAccu() - jetzt in Setup_PKTGeneric() |
||
231 | //# - del: SETUP_PKTDEBUG in Setup_MAIN() entfernt (auskommentiert, wenn notwendig ggf. mit einem Debug define regeln) |
||
232 | //# - chg: diverse Aenderungen in Menutexten |
||
233 | //# - fix: keine LCD-Helligkeitseinstellung bei HW 3.9x mehr durch Abfrage von PCB_Version |
||
234 | //# |
||
235 | //# 31.05.2013 cebra |
||
236 | //# - chg: Umlaute, soweit gefunden, korrigiert |
||
237 | //# |
||
238 | //# 30.05.2013 cebra |
||
239 | //# - chg: doppelte Texte auf #define umgestellt |
||
240 | //# |
||
241 | //# 24.05.2013 OG |
||
242 | //# - chg: etliche Aenderungen rund um Bluetooth/BT-GPS Maus fuer bessere |
||
243 | //# Usebility, Code-Einsparung und Code-Lesbarkeit |
||
244 | //# - add: Wait4KeyOK() |
||
245 | //# - chg: Aufrufe von MenuCtrl_Push() umgestellt auf MenuCtrl_PushML_P() |
||
246 | //# |
||
247 | //# 22.05.2013 OG |
||
248 | //# - chg: umgestellt auf menuctrl: BT_SelectDevice() |
||
249 | //# |
||
250 | //# 22.05.2013 OG |
||
251 | //# - chg: umgestellt auf menuctrl: Setup_Time(), Setup_FollowMe(), Setup_OSD() |
||
252 | //# - chg: weitere Speicheroptimierungen fuer USE_* |
||
253 | //# - chg: Menu_Setup() umbenannt zu Setup_MAIN() |
||
254 | //# |
||
255 | //# 20.05.2013 OG |
||
256 | //# - chg: umgestellt auf menuctrl: Menu_Setup(), Setup_PKTGeneric(), Setup_WI232() |
||
257 | //# Setup_BTM222(), Setup_PKTAccu(), Setup_GPSMouse() |
||
258 | //# - add: GPSMouse_ShowData() |
||
259 | //# |
||
260 | //# 19.05.2013 OG |
||
261 | //# - chg: Aufruf von Update_PKT() umgestellt auf PKT_Update() |
||
262 | //# |
||
263 | //# 17.05.2013 OG |
||
264 | //# - chg: umgestellt auf utils/menuold.h |
||
265 | //# |
||
266 | //# 16.05.2013 Cebra |
||
267 | //# - chg: Fehler bei On/Off Settings |
||
268 | //# |
||
269 | //# 05.05.2013 Cebra |
||
270 | //# - add: PKT Zeitsetup |
||
271 | //# |
||
272 | //# 19.04.2013 Cebra |
||
273 | //# - chg: Fehlerbehandlung im GPS Menü für den Fall das kein BTM22 eingebaut oder GPS-Device konfiguriert |
||
274 | //# |
||
275 | //# 16.04.2013 Cebra |
||
276 | //# - chg: PROGMEM angepasst auf neue avr-libc und GCC, prog_char depreciated |
||
277 | //# |
||
278 | //# 12.04.2013 Cebra |
||
279 | //# - chg: edit_generic um Sprungfaktor erweitert, erm�glicht bei hohen Werten einen schnelleren Wertewechsel |
||
280 | //# |
||
281 | //# 03.04.2013 Cebra |
||
282 | //# - chg: find/replace Fehler bei lcd_puts_at beseitigt, GPS und BT-Maus Bereich |
||
283 | //# |
||
284 | //# 02.04.2013 Cebra |
||
285 | //# - chg: Textfehler bei der Einstellung "Verbindung zum MK" beseitigt |
||
286 | //# |
||
287 | //# 04.03.2013 Cebra |
||
288 | //# - del: OSD-Sreenmode ,is no longer necessary, last OSD-Screen is saved at shutdown |
||
289 | //# |
||
290 | //# 27.03.2013 Cebra |
||
291 | //# - chg: Fehler bei der Menüsteuerung behoben |
||
292 | //############################################################################ |
||
293 | |||
294 | |||
295 | #include "../cpu.h" |
||
296 | #include <avr/io.h> |
||
297 | #include <avr/interrupt.h> |
||
298 | #include <avr/pgmspace.h> |
||
299 | #include <string.h> |
||
300 | #include <util/delay.h> |
||
301 | #include "../main.h" |
||
302 | #include "../setup/setup.h" |
||
303 | #include "../lcd/lcd.h" |
||
304 | #include "../timer/timer.h" |
||
305 | #include "../wi232/Wi232.h" |
||
306 | #include "../bluetooth/bluetooth.h" |
||
307 | #include "../connect.h" |
||
308 | #include "../lipo/lipo.h" |
||
309 | #include "../messages.h" |
||
310 | #include "../eeprom/eeprom.h" |
||
311 | #include "../tracking/tracking.h" |
||
312 | #include "../uart/uart1.h" |
||
313 | #include "../sound/pwmsine8bit.h" |
||
314 | #include "../tracking/servo_setup.h" |
||
315 | #include "../bluetooth/error.h" |
||
316 | #include "../stick/stick_setup.h" |
||
317 | #include "../utils/menuctrl.h" |
||
318 | #include "../utils/xutils.h" |
||
319 | #include "../pkt/pkt.h" |
||
320 | #include "../osd/osd.h" |
||
321 | #include "../wifly/wifly_setup.h" |
||
322 | #include "../gps/gpsmouse.h" |
||
323 | #include "../utils/scrollbox.h" |
||
324 | #include "../osd/osdold_messages.h" |
||
325 | |||
326 | |||
327 | uint8_t edit = 0; |
||
328 | uint16_t Pre; |
||
329 | char EditString[21]; |
||
330 | uint8_t length_tmp; |
||
331 | uint8_t Old_Baudrate; //Merkzelle für alte Baudrate |
||
332 | |||
333 | |||
334 | //############################################################################ |
||
335 | //############################################################################ |
||
336 | |||
337 | //----------------------------- |
||
338 | // Setup_Main() |
||
339 | //----------------------------- |
||
340 | #define SETUP_MKCONNECTION 1 |
||
341 | #define SETUP_PKTCONFIG 2 |
||
342 | #define SETUP_WI232 3 |
||
343 | #define SETUP_BTM222 4 |
||
344 | #define SETUP_SERVOCONFIG 5 |
||
345 | #define SETUP_OSDVIEW 6 |
||
346 | #define SETUP_TIME 7 |
||
347 | #define SETUP_GPSMAUS 8 |
||
348 | #define SETUP_FOLLOWME 9 |
||
349 | #define SETUP_JOYSTICK 10 |
||
350 | #define SETUP_PKTAKKU 11 |
||
351 | #define SETUP_PKTUPDATE 12 |
||
352 | #define SETUP_PKTDEBUG 13 |
||
353 | #define SETUP_EEPROMRESET 14 |
||
354 | #define SETUP_WIFLY 15 |
||
355 | #define SETUP_OSDSCREENS 16 |
||
356 | #define SETUP_BLE 17 |
||
357 | |||
358 | |||
359 | static const char SETUP_MKCONNECTION_de[] PROGMEM = "Verbindung MK"; |
||
360 | static const char SETUP_MKCONNECTION_en[] PROGMEM = "connection MK"; |
||
361 | |||
362 | static const char SETUP_PKTCONFIG_de[] PROGMEM = "PKT Allgemein"; |
||
363 | static const char SETUP_PKTCONFIG_en[] PROGMEM = "PKT general"; |
||
364 | |||
365 | static const char SETUP_WI232_de[] PROGMEM = "Wi.232"; |
||
366 | #define SETUP_WI232_en SETUP_WI232_de |
||
367 | |||
368 | static const char SETUP_BTM222_de[] PROGMEM = "Bluetooth"; |
||
369 | #define SETUP_BTM222_en SETUP_BTM222_de |
||
370 | |||
371 | static const char SETUP_BLE_de[] PROGMEM = "Bluetooth BLE"; |
||
372 | #define SETUP_BLE_en SETUP_BLE_de |
||
373 | |||
374 | static const char SETUP_WIFLY_de[] PROGMEM = "WLAN WiFly"; |
||
375 | #define SETUP_WIFLY_en SETUP_WIFLY_de |
||
376 | |||
377 | static const char SETUP_SERVOCONFIG_de[] PROGMEM = "Tracking"; |
||
378 | #define SETUP_SERVOCONFIG_en SETUP_SERVOCONFIG_de |
||
379 | |||
380 | static const char SETUP_OSDVIEW_de[] PROGMEM = "OSD Anzeige"; |
||
381 | static const char SETUP_OSDVIEW_en[] PROGMEM = "OSD display"; |
||
382 | |||
383 | static const char SETUP_OSDSCREENS_de[] PROGMEM = "OSD Screens"; |
||
384 | static const char SETUP_OSDSCREENS_en[] PROGMEM = "OSD screens"; |
||
385 | |||
386 | static const char SETUP_GPSMAUS_de[] PROGMEM = "GPS Maus"; |
||
387 | static const char SETUP_GPSMAUS_en[] PROGMEM = "GPS mouse"; |
||
388 | |||
389 | static const char SETUP_FOLLOWME_de[] PROGMEM = "Follow Me"; |
||
390 | #define SETUP_FOLLOWME_en SETUP_FOLLOWME_de |
||
391 | |||
392 | static const char SETUP_JOYSTICK_de[] PROGMEM = "Joystick"; |
||
393 | #define SETUP_JOYSTICK_en SETUP_JOYSTICK_de |
||
394 | |||
395 | static const char SETUP_PKTUPDATE_de[] PROGMEM = "PKT Update"; |
||
396 | #define SETUP_PKTUPDATE_en SETUP_PKTUPDATE_de |
||
397 | |||
398 | static const char SETUP_PKTDEBUG_de[] PROGMEM = "Debug PKT"; |
||
399 | #define SETUP_PKTDEBUG_en SETUP_PKTDEBUG_de |
||
400 | |||
401 | static const char SETUP_EEPROMRESET_de[] PROGMEM = "PKT Reset"; |
||
402 | #define SETUP_EEPROMRESET_en SETUP_EEPROMRESET_de |
||
403 | |||
404 | //############################################################################ |
||
405 | |||
406 | //----------------------------- |
||
407 | // Setup_PKTGeneric() ("PKT allgemein") |
||
408 | //----------------------------- |
||
409 | #define PKT_LANGUAGE 3 |
||
410 | #define PKT_LIGHTOFF 4 |
||
411 | #define PKT_BRIGHTNESS 5 |
||
412 | #define PKT_CONTRAST 6 |
||
413 | #define PKT_SOUNDMODUL 9 |
||
414 | #define PKT_BEEPER 10 |
||
415 | #define PKT_VOLUME 11 |
||
416 | #define PKT_ACCUTYPE 12 |
||
417 | #define PKT_ACCUMEASURE 13 |
||
418 | #define TIME_ZONE 14 |
||
419 | #define TIME_SUMMER 15 |
||
420 | #define PKT_PKTOFF 16 |
||
421 | |||
422 | |||
423 | static const char LANGUAGE_de[] PROGMEM = "Sprache"; |
||
424 | static const char LANGUAGE_en[] PROGMEM = "language"; |
||
425 | |||
426 | static const char TIME_ZONE_de[] PROGMEM = "Zeitzone UTC"; |
||
427 | static const char TIME_ZONE_en[] PROGMEM = "time zone UTC"; |
||
428 | |||
429 | static const char TIME_SUMMER_de[] PROGMEM = "Sommerzeit"; |
||
430 | static const char TIME_SUMMER_en[] PROGMEM = "summer time"; |
||
431 | |||
432 | static const char PKT_PKTOFF_de[] PROGMEM = "PKT aus nach"; |
||
433 | static const char PKT_PKTOFF_en[] PROGMEM = "PKT off after"; |
||
434 | |||
435 | static const char LIGHTOFF_de[] PROGMEM = "LCD aus nach"; |
||
436 | static const char LIGHTOFF_en[] PROGMEM = "LCD off after"; |
||
437 | |||
438 | //static const char BRIGHTNESS_de[] PROGMEM = "LCD Helligkeit"; |
||
439 | //static const char BRIGHTNESS_en[] PROGMEM = "LCD brightness"; |
||
440 | |||
441 | static const char CONTRAST_de[] PROGMEM = "LCD Kontrast"; |
||
442 | static const char CONTRAST_en[] PROGMEM = "LCD contrast"; |
||
443 | |||
444 | static const char BEEPER_de[] PROGMEM = "Hardware Beeper"; |
||
445 | #define BEEPER_en BEEPER_de |
||
446 | |||
447 | #ifdef USE_SOUND |
||
448 | static const char SOUNDMODUL_de[] PROGMEM = "Soundmodul"; |
||
449 | static const char SOUNDMODUL_en[] PROGMEM = "Soundmodule"; |
||
450 | |||
451 | static const char VOLUME_de[] PROGMEM = "Lautstärke Sound"; |
||
452 | static const char VOLUME_en[] PROGMEM = "Volume Sound"; |
||
453 | #endif |
||
454 | |||
455 | static const char ACCUTYPE_de[] PROGMEM = "Akku Typ"; |
||
456 | static const char ACCUTYPE_en[] PROGMEM = "Accu type"; |
||
457 | |||
458 | static const char ACCUMEASURE_de[] PROGMEM = "Akku Messung"; |
||
459 | static const char ACCUMEASURE_en[] PROGMEM = "Accu measure"; |
||
460 | |||
461 | //############################################################################ |
||
462 | |||
463 | //----------------------------- |
||
464 | // Setup_MKConnection() |
||
465 | //----------------------------- |
||
466 | |||
467 | #define MKCONN_CONNECTION 1 |
||
468 | #define MKCONN_BAUDRATE 2 |
||
469 | |||
470 | #define MKCONN_CONNECTION_de SETUP_MKCONNECTION_de |
||
471 | #define MKCONN_CONNECTION_en SETUP_MKCONNECTION_en |
||
472 | |||
473 | static const char MKCONN_BAUDRATE_de[] PROGMEM = "Baudrate Wi232/BT"; |
||
474 | #define MKCONN_BAUDRATE_en MKCONN_BAUDRATE_de |
||
475 | |||
476 | |||
477 | //############################################################################ |
||
478 | |||
479 | //----------------------------- |
||
480 | // Setup_WI232() |
||
481 | //----------------------------- |
||
482 | #define WI_INSTALLED 1 |
||
483 | #define WI_TXRX 2 |
||
484 | #define WI_GROUP 3 |
||
485 | #define WI_MODE 4 |
||
486 | #define WI_TIMEOUT 5 |
||
487 | #define WI_MTU 6 |
||
488 | #define WI_INIT 7 |
||
489 | #define WI_PCCONFIG 8 |
||
490 | |||
491 | static const char WI_INSTALLED_de[] PROGMEM = "Modul eingebaut"; |
||
492 | static const char WI_INSTALLED_en[] PROGMEM = "module built in"; |
||
493 | |||
494 | static const char WI_TXRX_de[] PROGMEM = "TX/RX Kanal"; |
||
495 | static const char WI_TXRX_en[] PROGMEM = "TX/RX Channel"; |
||
496 | |||
497 | static const char WI_GROUP_de[] PROGMEM = "NetW. Gruppe"; |
||
498 | static const char WI_GROUP_en[] PROGMEM = "NetW. Group"; |
||
499 | |||
500 | static const char WI_MODE_de[] PROGMEM = "NetW. Mode"; |
||
501 | #define WI_MODE_en WI_MODE_de |
||
502 | |||
503 | static const char WI_TIMEOUT_de[] PROGMEM = "TX Timeout"; |
||
504 | #define WI_TIMEOUT_en WI_TIMEOUT_de |
||
505 | |||
506 | static const char WI_MTU_de[] PROGMEM = "TX MTU"; |
||
507 | #define WI_MTU_en WI_MTU_de |
||
508 | |||
509 | static const char WI_INIT_de[] PROGMEM = "Initialisieren"; |
||
510 | static const char WI_INIT_en[] PROGMEM = "initialize"; |
||
511 | |||
512 | static const char WI_PCCONFIG_de[] PROGMEM = "Konfig. mit PC"; |
||
513 | static const char WI_PCCONFIG_en[] PROGMEM = "config. with PC"; |
||
514 | |||
515 | |||
516 | //############################################################################ |
||
517 | |||
518 | //----------------------------- |
||
519 | // Setup_BTM222() (Bluetooth) |
||
520 | //----------------------------- |
||
521 | #define BT_INSTALLED 1 |
||
522 | #define BT_NAME 2 |
||
523 | #define BT_PIN 3 |
||
524 | #define BT_INIT 4 |
||
525 | #define BT_MAC 5 |
||
526 | #define BT_REID 6 |
||
527 | #define BT_PCCONFIG 7 |
||
528 | #define BT_SHOWCONFIG 8 |
||
529 | |||
530 | #define BT_INSTALLED_de WI_INSTALLED_de |
||
531 | #define BT_INSTALLED_en WI_INSTALLED_en |
||
532 | |||
533 | static const char BT_NAME_de[] PROGMEM = "BT Name"; |
||
534 | static const char BT_NAME_en[] PROGMEM = "BT name"; |
||
535 | |||
536 | static const char BT_PIN_de[] PROGMEM = "BT Pin"; |
||
537 | static const char BT_PIN_en[] PROGMEM = "BT pin"; |
||
538 | |||
539 | #define BT_INIT_de WI_INIT_de |
||
540 | #define BT_INIT_en WI_INIT_en |
||
541 | |||
542 | static const char BT_MAC_de[] PROGMEM = "zeige BT MAC"; |
||
543 | static const char BT_MAC_en[] PROGMEM = "show BT MAC"; |
||
544 | |||
545 | static const char BT_REID_de[] PROGMEM = "RE-ID Notiz"; |
||
546 | #define BT_REID_en BT_REID_de |
||
547 | |||
548 | #define BT_PCCONFIG_de WI_PCCONFIG_de |
||
549 | #define BT_PCCONFIG_en WI_PCCONFIG_en |
||
550 | |||
551 | static const char BT_SHOWCONFIG_de[] PROGMEM = "zeige BT Konfig"; |
||
552 | static const char BT_SHOWCONFIG_en[] PROGMEM = "show BT config"; |
||
553 | |||
554 | //############################################################################ |
||
555 | |||
556 | //----------------------------- |
||
557 | // Setup_BLE() (Bluetooth 4 Low Energy) |
||
558 | //----------------------------- |
||
559 | #define BLE_INSTALLED 1 |
||
560 | |||
561 | // Text ist in messages.c: MODULE_EXIST |
||
562 | |||
563 | |||
564 | //############################################################################ |
||
565 | |||
566 | //----------------------------- |
||
567 | // Setup_GPSMouse() |
||
568 | //----------------------------- |
||
569 | #define GPS_DEVICES 1 |
||
570 | #define GPS_SEARCH 2 |
||
571 | #define GPS_TYPE 3 |
||
572 | #define GPS_ACTIVE 4 |
||
573 | #define GPS_SHOWDEV 5 |
||
574 | #define GPS_DATA 6 |
||
575 | |||
576 | |||
577 | static const char GPS_SEARCH_de[] PROGMEM = "suche GPS-Maus"; |
||
578 | static const char GPS_SEARCH_en[] PROGMEM = "search GPS-mouse"; |
||
579 | |||
580 | static const char GPS_DEVICES_de[] PROGMEM = "Geräteliste"; |
||
581 | static const char GPS_DEVICES_en[] PROGMEM = "devicelist"; |
||
582 | |||
583 | static const char GPS_SHOWDEV_de[] PROGMEM = "aktuelle Maus"; |
||
584 | static const char GPS_SHOWDEV_en[] PROGMEM = "act. GPS-mouse"; |
||
585 | |||
586 | static const char GPS_DATA_de[] PROGMEM = "GPS-Maus Daten"; |
||
587 | static const char GPS_DATA_en[] PROGMEM = "GPS-mouse data"; |
||
588 | |||
589 | static const char GPS_TYPE_de[] PROGMEM = "GPS-Maus Typ"; // aktuell nicht verwendet |
||
590 | static const char GPS_TYPE_en[] PROGMEM = "GPS-mouse typ"; |
||
591 | |||
592 | static const char GPS_ACTIVE_de[] PROGMEM = "GPS-Maus aktiv"; // aktuell nicht verwendet |
||
593 | static const char GPS_ACTIVE_en[] PROGMEM = "GPS-mouse activ"; |
||
594 | |||
595 | |||
596 | //############################################################################ |
||
597 | |||
598 | //----------------------------- |
||
599 | // Setup_FollowMe() |
||
600 | //----------------------------- |
||
601 | #define FME_DISTANCE 1 |
||
602 | #define FME_SPEED 2 |
||
603 | #define FME_RADIUS 3 |
||
604 | #define FME_AZIMUTH 4 |
||
605 | |||
606 | static const char FME_DISTANCE_de[] PROGMEM = "FollowMe Abstand"; |
||
607 | static const char FME_DISTANCE_en[] PROGMEM = "followMe distance"; |
||
608 | |||
609 | static const char FME_AZIMUTH_de[] PROGMEM = "FollowMe Winkel"; |
||
610 | static const char FME_AZIMUTH_en[] PROGMEM = "followMe angle"; |
||
611 | |||
612 | static const char FME_SPEED_de[] PROGMEM = "FollowMe Speed"; |
||
613 | #define FME_SPEED_en FME_SPEED_de |
||
614 | |||
615 | static const char FME_RADIUS_de[] PROGMEM = "Toleranz Radius"; |
||
616 | static const char FME_RADIUS_en[] PROGMEM = "tolerance radius"; |
||
617 | |||
618 | |||
619 | |||
620 | |||
621 | //############################################################################ |
||
622 | |||
623 | //----------------------------- |
||
624 | // Setup_OSD() |
||
625 | //----------------------------- |
||
626 | #define OSDS_SHOWCELLU 1 |
||
627 | #define OSDS_LOWBAT 2 |
||
628 | #define OSDS_RCERROR 3 |
||
629 | #define OSDS_MKSETTING 4 |
||
630 | #define OSDS_MAH 5 |
||
631 | #define OSDS_DATASV2 6 |
||
632 | #define OSDS_OUTFORMAT 7 |
||
633 | #define OSDS_OUTPOLARITY 8 |
||
634 | #define OSDS_FALLSPEED 9 |
||
635 | #define OSDS_VARIOBEEP 10 |
||
636 | #define OSDS_VOLTBAR 11 |
||
637 | |||
638 | |||
639 | static const char OSDS_LOWBAT_de[] PROGMEM = "Warn Unterspannung"; |
||
640 | static const char OSDS_LOWBAT_en[] PROGMEM = "Warn LowBat"; |
||
641 | |||
642 | static const char OSDS_MAH_de[] PROGMEM = "Warn mAh"; |
||
643 | static const char OSDS_MAH_en[] PROGMEM = "Warn mAh"; |
||
644 | |||
645 | static const char OSDS_RCERROR_de[] PROGMEM = "Warn RC-Fehler"; |
||
646 | static const char OSDS_RCERROR_en[] PROGMEM = "Warn RC-Error"; |
||
647 | |||
648 | static const char OSDS_SHOWCELLU_de[] PROGMEM = "zeige Zellspannung"; |
||
649 | static const char OSDS_SHOWCELLU_en[] PROGMEM = "show cell voltage"; |
||
650 | |||
651 | static const char OSDS_MKSETTING_de[] PROGMEM = "zeige MK Setting"; |
||
652 | static const char OSDS_MKSETTING_en[] PROGMEM = "show mk setting"; |
||
653 | |||
654 | static const char OSDS_DATASV2_de[] PROGMEM = "Navi Daten an SV2"; |
||
655 | static const char OSDS_DATASV2_en[] PROGMEM = "Navi data to SV2"; |
||
656 | |||
657 | |||
658 | #ifdef USE_OSD_SCREEN_OLD |
||
659 | static const char OSDS_OUTFORMAT_de[] PROGMEM = "OUT1/2 Format"; |
||
660 | static const char OSDS_OUTFORMAT_en[] PROGMEM = "OUT1/2 format"; |
||
661 | |||
662 | static const char OSDS_FALLSPEED_de[] PROGMEM = "Max. Sinkrate m/s"; |
||
663 | static const char OSDS_FALLSPEED_en[] PROGMEM = "max fallspeed m/s"; |
||
664 | |||
665 | static const char OSDS_VARIOBEEP_de[] PROGMEM = "Variometer Beep"; |
||
666 | static const char OSDS_VARIOBEEP_en[] PROGMEM = "Variometer beep"; |
||
667 | |||
668 | static const char OSDS_OUTPOLARITY_de[] PROGMEM = "OUT1/2 Polarität"; |
||
669 | static const char OSDS_OUTPOLARITY_en[] PROGMEM = "OUT1/2 polarity"; |
||
670 | |||
671 | static const char OSDS_VOLTBAR_de[] PROGMEM = "Volt Balken"; |
||
672 | static const char OSDS_VOLTBAR_en[] PROGMEM = "volt bargraph"; |
||
673 | #endif |
||
674 | |||
675 | |||
676 | |||
677 | //############################################################################ |
||
678 | |||
679 | |||
680 | //############################################################################ |
||
681 | //# Allgemeines |
||
682 | //############################################################################ |
||
683 | |||
684 | //-------------------------------------------------------------- |
||
685 | //-------------------------------------------------------------- |
||
686 | void Wait4KeyOK( void ) |
||
687 | { |
||
688 | set_beep( 60, 0xffff, BeepNormal); |
||
689 | lcd_printp_at(19, 7, strGet(OK) , MNORMAL); |
||
690 | while( !get_key_press(1 << KEY_ENTER) ) PKT_CtrlHook(); // PKT-Update usw... |
||
691 | clear_key_all(); |
||
692 | } |
||
693 | |||
694 | |||
695 | //-------------------------------------------------------------- |
||
696 | //-------------------------------------------------------------- |
||
697 | void Wait4KeyENDE( uint8_t beep ) |
||
698 | { |
||
699 | if( beep ) set_beep( 60, 0xffff, BeepNormal); |
||
700 | lcd_printp_at(12, 7, strGet(ENDE) , MNORMAL); |
||
701 | while( !get_key_press(1 << KEY_ESC) ) |
||
702 | { |
||
703 | show_Lipo(); |
||
704 | PKT_CtrlHook(); // PKT-Update usw... |
||
705 | } |
||
706 | clear_key_all(); |
||
707 | } |
||
708 | |||
709 | |||
710 | //############################################################################ |
||
711 | //# BT-Funktionen (GPS-Maus) |
||
712 | //############################################################################ |
||
713 | |||
714 | #ifdef USE_BLUETOOTH |
||
715 | |||
716 | //-------------------------------------------------------------- |
||
717 | // BT_CheckBTM222() |
||
718 | // |
||
719 | // prueft ob das Bluetooth Modul im PKT installiert ist |
||
720 | //-------------------------------------------------------------- |
||
721 | uint8_t BT_CheckBTM222( void ) |
||
722 | { |
||
723 | if( !Config.UseBT ) |
||
724 | { |
||
725 | // PKT_Message_P( text, error, timeout, beep, clearscreen) |
||
726 | PKT_Message_P( strGet(STR_NOBTM222), true, 1000, true, true); // 1000 = max. 10 Sekunden anzeigen; "kein BTM222 vorh." |
||
727 | return false; // -> kein BTM222 eingebaut |
||
728 | } |
||
729 | |||
730 | return true; |
||
731 | } |
||
732 | |||
733 | |||
734 | |||
735 | //-------------------------------------------------------------- |
||
736 | // BT_SelectDevice() |
||
737 | // |
||
738 | // Auswahl eines BT-Device aus einer Liste von BT-Devices |
||
739 | //-------------------------------------------------------------- |
||
740 | void BT_SelectDevice( void ) |
||
741 | { |
||
742 | uint8_t itemid; |
||
743 | uint8_t event; |
||
744 | uint8_t i; |
||
745 | |||
746 | //------------------------------- |
||
747 | // BTM222 Modul vorhanden? |
||
748 | //------------------------------- |
||
749 | if( !BT_CheckBTM222() ) return; |
||
750 | |||
751 | |||
752 | //------------------------------- |
||
753 | // BT Device-Suche durchgefuert? |
||
754 | //------------------------------- |
||
755 | if( bt_devicecount == 0 ) |
||
756 | { |
||
757 | // PKT_Message_P( text, error, timeout, beep, clearscreen) |
||
758 | PKT_Message_P( PSTR("Suche durchführen!"), true, 1000, true, true); // 1000 = max. 10 Sekunden anzeigen; "kein BTM222 vorh." |
||
759 | return; |
||
760 | } |
||
761 | |||
762 | |||
763 | //--------------- |
||
764 | // Create |
||
765 | //--------------- |
||
766 | MenuCtrl_Create(); |
||
767 | MenuCtrl_SetTitle_P( strGet(STR_BT_DEVICES) ); // "BT Geräte" |
||
768 | |||
769 | //--------------- |
||
770 | // Menuitems |
||
771 | //--------------- |
||
772 | for( i = 0; i < bt_devicecount; i++ ) |
||
773 | { |
||
774 | MenuCtrl_Push( i, MENU_ITEM, NOFUNC, device_list[i].DevName ); |
||
775 | |||
776 | if( strncmp(device_list[i].mac,Config.gps_UsedMac,14) == 0 ) |
||
777 | MenuCtrl_ItemMark( i, true ); // aktuelles BT-Device markieren |
||
778 | } |
||
779 | |||
780 | //--------------- |
||
781 | // Control |
||
782 | //--------------- |
||
783 | event = MenuCtrl_Control( MENUCTRL_EVENT ); |
||
784 | |||
785 | if( event == MENUEVENT_ITEM ) |
||
786 | { |
||
787 | itemid = MenuCtrl_GetItemId(); // welcher Menu-Punkt (ID) |
||
788 | strncpy( Config.gps_UsedMac , device_list[itemid].mac , 14); |
||
789 | strncpy( Config.gps_UsedDevName, device_list[itemid].DevName, 20); |
||
790 | } |
||
791 | |||
792 | //--------------- |
||
793 | // Destroy |
||
794 | //--------------- |
||
795 | MenuCtrl_Destroy(); |
||
796 | } |
||
797 | |||
798 | |||
799 | |||
800 | //-------------------------------------------------------------- |
||
801 | // BT_SearchDevices() |
||
802 | // |
||
803 | // sucht BT-Devices |
||
804 | //-------------------------------------------------------------- |
||
805 | void BT_SearchDevices( void ) |
||
806 | { |
||
807 | uint8_t wahl; |
||
808 | |||
809 | char *title; |
||
810 | |||
811 | //------------------- |
||
812 | // 1. Frage: suchen? |
||
813 | //------------------- |
||
814 | if( Config.gps_UsedDevName[0] != 0 ) // ist eine BT GPS-Maus bereits vorhanden? |
||
815 | title = Config.gps_UsedDevName; // dann zeige im Titel den Namen der GPS-Maus an |
||
816 | else |
||
817 | title = "BT Devices"; |
||
818 | |||
819 | set_beep( 50, 0xffff, BeepNormal); |
||
820 | |||
821 | //wahl = PKT_AskX( asktype, text1, text2, text_progmem, headline, headline_progmem, title, title_progmem) |
||
822 | wahl = PKT_AskX( ASK_END_START, strGet(STR_SEARCH_BT_ASK), strGet(STR_BT_SEARCHTIME), true, MenuCtrl_GetItemText(), true, title, false); // "BT Geräte suchen?" |
||
823 | |||
824 | |||
825 | //------------------- |
||
826 | // 2. BT suchen |
||
827 | //------------------- |
||
828 | if( wahl ) |
||
829 | { |
||
830 | if( BT_CheckBTM222() ) |
||
831 | { |
||
832 | //PKT_Title_P( text, lShowLipo, clearscreen ) |
||
833 | PKT_Title_P( PSTR("BT Suche"), true, true ); |
||
834 | |||
835 | lcdx_printp_center( 2, strGet(STR_SEARCH_BT), MNORMAL, 0,1); // "suche BT Geräte" |
||
836 | |||
837 | //PKT_Gauge_Begin( 0 ); // Gauge: 0 = Default fuer y verwenden |
||
838 | |||
839 | set_BTOn(); |
||
840 | bt_downlink_init(); |
||
841 | |||
842 | lcd_printp_at( 11, 7, strGet(KEYCANCEL), MNORMAL); // Keyline: "Abbr." bzw "Cancel" |
||
843 | bt_searchDevice(); |
||
844 | |||
845 | set_BTOff(); |
||
846 | |||
847 | //PKT_Gauge_End(); // Gauge: Ende |
||
848 | |||
849 | if( bt_devicecount==0 ) |
||
850 | { |
||
851 | //PKT_Message_P( text, error, timeout, beep, clearscreen) |
||
852 | PKT_Message_P( strGet(STR_NO_BT_FOUND), true, 2000, true, true); |
||
853 | } |
||
854 | else |
||
855 | { |
||
856 | set_beep( 50, 0xffff, BeepNormal); |
||
857 | BT_SelectDevice(); |
||
858 | } |
||
859 | } |
||
860 | } |
||
861 | } |
||
862 | |||
863 | |||
864 | #endif // end: #ifdef USE_BLUETOOTH |
||
865 | |||
866 | |||
867 | |||
868 | |||
869 | //############################################################################ |
||
870 | //# Edit-Funktionen |
||
871 | //############################################################################ |
||
872 | |||
873 | |||
874 | //-------------------------------------------------------------- |
||
875 | // Ausgabe von Werten fuer Edit_generic() |
||
876 | //-------------------------------------------------------------- |
||
877 | void Edit_generic_printout( int16_t Value, int16_t min, int16_t max, uint8_t what, int8_t yoffs) |
||
878 | { |
||
879 | const char *pStr = 0; // PGM |
||
880 | const char *pstr = 0; // RAM |
||
881 | //uint8_t x = 0; |
||
882 | //uint8_t y = 3; |
||
883 | |||
884 | |||
885 | switch( what ) |
||
886 | { |
||
887 | case Show_uint3: pstr = buffered_sprintf_P( PSTR("%3d"), Value ); |
||
888 | break; |
||
889 | |||
890 | |||
891 | case Show_uint5: pstr = buffered_sprintf_P( PSTR("%5d"), Value ); |
||
892 | break; |
||
893 | |||
894 | |||
895 | case Show_uint10th: pstr = buffered_sprintf_P( PSTR("%2.1d"), Value ); |
||
896 | break; |
||
897 | |||
898 | |||
899 | case MK_Connection: switch( Value ) |
||
900 | { |
||
901 | case 0: pStr = PSTR("Wi.232"); break; |
||
902 | case 1: pStr = strGet(KABEL); break; |
||
903 | } |
||
904 | |||
905 | if( (Value == 0) && (Config.UseWi == false) ) |
||
906 | { |
||
907 | lcd_rect_round( 0, 37, 127, 21-6, 1, R2); // Rahmen |
||
908 | lcdx_printp_center( 6, strGet(STR_WI232_ACTIVATE), MNORMAL, 0,-7); // "aktiviere Wi.232!" |
||
909 | } |
||
910 | else |
||
911 | { |
||
912 | lcd_frect( 0, 37, 127, 21-6, 0); // Hilfebereich loeschen |
||
913 | } |
||
914 | break; |
||
915 | |||
916 | |||
917 | case GPSMOUSE: switch( Value ) |
||
918 | { |
||
919 | case GPS_Bluetoothmouse1: pStr = PSTR("BT-Mouse"); break; |
||
920 | case GPS_Mikrokopter: pStr = PSTR("Mikrokopter"); break; |
||
921 | default: pStr = PSTR("unknown"); |
||
922 | } |
||
923 | break; |
||
924 | |||
925 | |||
926 | case Wi_Netmode: switch( Value ) |
||
927 | { |
||
928 | case false: pStr = strGet(SLAVE); break; |
||
929 | case true : pStr = strGet(NORMAL); break; |
||
930 | } |
||
931 | break; |
||
932 | |||
933 | |||
934 | |||
935 | case OnOff: switch( Value ) |
||
936 | { |
||
937 | case 0: pStr = strGet(OFF); break; |
||
938 | case 1: pStr = strGet(ON); break; |
||
939 | } |
||
940 | break; |
||
941 | |||
942 | |||
943 | case YesNo: switch( Value ) |
||
944 | { |
||
945 | case 0: pStr = strGet(NOO); break; |
||
946 | case 1: pStr = strGet(YES); break; |
||
947 | } |
||
948 | break; |
||
949 | |||
950 | |||
951 | case WlanMode: switch( Value ) |
||
952 | { |
||
953 | case 0: pStr = strGet(OFF); break; |
||
954 | case 1: pStr = PSTR("AP-Mode"); break; |
||
955 | case 2: pStr = PSTR("AdHoc"); break; |
||
956 | } |
||
957 | break; |
||
958 | |||
959 | |||
960 | |||
961 | case NormRev: switch( Value ) // wird noch von stick/stick_setup.c verwendet |
||
962 | { |
||
963 | case 0 : pStr = strGet(NORMAL); break; |
||
964 | case 1 : pStr = strGet(REVERSE); break; |
||
965 | } |
||
966 | break; |
||
967 | |||
968 | |||
969 | case Kontrast: if( Value >= max ) |
||
970 | { |
||
971 | Value = max; |
||
972 | set_beep( 200, 0x0080, BeepNormal); |
||
973 | } |
||
974 | |||
975 | if( Value == min ) |
||
976 | { |
||
977 | Value = min; |
||
978 | set_beep( 200, 0x0080, BeepNormal); |
||
979 | } |
||
980 | |||
981 | lcd_set_contrast( Value ); |
||
982 | |||
983 | pstr = buffered_sprintf_P( PSTR("%3d"), Value ); |
||
984 | break; |
||
985 | |||
986 | |||
987 | case Baudrate: pstr = buffered_sprintf_P( PSTR("%ld"), Baud_to_uint32(Value) ); |
||
988 | break; |
||
989 | |||
990 | |||
991 | case Language: switch( Value ) |
||
992 | { |
||
993 | case 0: pStr = strGet(DEUTSCH); break; |
||
994 | case 1: pStr = strGet(ENGLISCH); break; |
||
995 | } |
||
996 | break; |
||
997 | |||
998 | |||
999 | case Sticktype: switch( Value ) |
||
1000 | { |
||
1001 | case false: pStr = strGet(POTI); break; |
||
1002 | case true : pStr = strGet(TASTER); break; |
||
1003 | } |
||
1004 | break; |
||
1005 | |||
1006 | |||
1007 | /* |
||
1008 | case WlanSecurity: // Anmerkung 02.04.2014 OG: wird aktuell nicht benoetigt weil anders geloest |
||
1009 | switch (Value) |
||
1010 | { |
||
1011 | case 0x0 : lcd_printp_at(15, 2, PSTR("Adhoc"), 0); |
||
1012 | break; |
||
1013 | case 0x1 : lcd_printp_at(15, 2, PSTR("WPA "), 0); |
||
1014 | break; |
||
1015 | } |
||
1016 | break; |
||
1017 | */ |
||
1018 | |||
1019 | case PKT_Akku: switch( Value ) |
||
1020 | { |
||
1021 | case true : pStr = PSTR("Lipo"); break; |
||
1022 | case false: pStr = PSTR("LiIon"); break; |
||
1023 | } |
||
1024 | break; |
||
1025 | } // end: switch( what ) |
||
1026 | |||
1027 | |||
1028 | |||
1029 | //lcdx_printf_at_P( uint8_t x, uint8_t y, uint8_t mode, int8_t xoffs, int8_t yoffs, const char *format, ... ) |
||
1030 | |||
1031 | if( pStr ) lcdx_printf_at_P( 0, 3, MNORMAL, 0,yoffs, PSTR("> %16S"), pStr ); // PGM |
||
1032 | if( pstr ) lcdx_printf_at_P( 0, 3, MNORMAL, 0,yoffs, PSTR("> %16s"), pstr ); // RAM |
||
1033 | } |
||
1034 | |||
1035 | |||
1036 | |||
1037 | |||
1038 | //-------------------------------------------------------------- |
||
1039 | // int16_t Edit_generic( Value, min, max, what, Addfactor, strHelp1, strHelp2) |
||
1040 | // |
||
1041 | // generische Funktion zum aendern von Setup-Werten |
||
1042 | // |
||
1043 | // PARAMETER: |
||
1044 | // Value: Ausgangswert der zu aendern ist |
||
1045 | // min : minimaler Wert |
||
1046 | // max : maximaler Wert |
||
1047 | // what : Typ des Wertes, abhaengig davon wird der Wert dargestellt, ENUM dafuer in setup.h |
||
1048 | // Addfactor : Sprungwert der beim erhöhen und erniedrigen addiert wird |
||
1049 | // strHelp1 : Hilefetext 1 (PGM) |
||
1050 | // strHelp2 : Hilefetext 2 (PGM) |
||
1051 | //S |
||
1052 | // RUECKGABE: |
||
1053 | // int16_t Return : Ergebnis der Veraenderung des Wertes |
||
1054 | //-------------------------------------------------------------- |
||
1055 | int16_t Edit_generic( int16_t Value, int16_t min, int16_t max, uint8_t what, uint8_t Addfactor, const char *strHelp1, const char *strHelp2 ) |
||
1056 | { |
||
1057 | uint8_t redraw = true; |
||
1058 | uint8_t noCancel = false; |
||
1059 | int8_t yoffs = 0; // yoffs fuer das Edit-Label |
||
1060 | int8_t yoffsV = 4; // yoffs fuer den Eingabebereich |
||
1061 | const char *pStr; |
||
1062 | |||
1063 | Pre = Value; |
||
1064 | |||
1065 | do |
||
1066 | { |
||
1067 | //------------------------ |
||
1068 | // Screen neu zeichnen |
||
1069 | //------------------------ |
||
1070 | if( redraw ) |
||
1071 | { |
||
1072 | PKT_TitleFromMenuItem( true ); // Titel mit PKT-LiPo Anzeige und clearcsreen |
||
1073 | |||
1074 | |||
1075 | //------------------------ |
||
1076 | // Platz reservieren fuer |
||
1077 | // spezielle Typen |
||
1078 | //------------------------ |
||
1079 | if( what == MK_Connection ) |
||
1080 | { |
||
1081 | yoffs = -2; // yoffs fuer das Edit-Label |
||
1082 | yoffsV = 0; // yoffs fuer den Eingabebereich |
||
1083 | } |
||
1084 | |||
1085 | //------------------------ |
||
1086 | // 1 zeiliger Hilfstext |
||
1087 | //------------------------ |
||
1088 | if( strHelp1 != NULL && strHelp2 == NULL ) |
||
1089 | { |
||
1090 | lcd_rect_round( 0, 37, 127, 21-6, 1, R2); // Rahmen |
||
1091 | lcdx_printp_center( 6, strHelp1, MNORMAL, 0,-7); // Hilfe-Text 1 |
||
1092 | yoffs = -2; // yoffs fuer das Edit-Label |
||
1093 | yoffsV = 0; // yoffs fuer den Eingabebereich |
||
1094 | } |
||
1095 | |||
1096 | //------------------------ |
||
1097 | // 2 zeiliger Hilfstext |
||
1098 | //------------------------ |
||
1099 | if( strHelp2 != NULL ) |
||
1100 | { |
||
1101 | lcd_rect_round( 0, 32, 127, 21, 1, R2); // Rahmen |
||
1102 | lcdx_printp_center( 5, strHelp1, MNORMAL, 0,-5); // Hilfe-Text 1 |
||
1103 | lcdx_printp_center( 6, strHelp2, MNORMAL, 0,-5); // Hilfe-Text 2 |
||
1104 | yoffs = -4; // yoffs fuer das Edit-Label |
||
1105 | yoffsV = -2; // yoffs fuer den Eingabebereich |
||
1106 | } |
||
1107 | |||
1108 | //------------------------ |
||
1109 | // Label |
||
1110 | //------------------------ |
||
1111 | pStr = PSTR("???"); |
||
1112 | if( MenuCtrl_GetMenuIndex() >= 0 ) pStr = MenuCtrl_GetItemText(); // das Label wird vom Menueeintrag uebernommen (Menuetext muss im PGM sein!) |
||
1113 | else |
||
1114 | { |
||
1115 | if( what == Language ) // Ausnahme: wird ggf. beim Start vom PKT von HAL_HW3_9.c aufgerufen |
||
1116 | { |
||
1117 | pStr = strGetLanguage( LANGUAGE_de, LANGUAGE_en); |
||
1118 | noCancel = true; |
||
1119 | } |
||
1120 | } |
||
1121 | lcdx_printf_at_P( 0, 2, MNORMAL, 0,yoffs, PSTR("%S:"), pStr ); // Ausgabe des Labels |
||
1122 | |||
1123 | |||
1124 | lcd_printp_at( 0, 7, strGet(KEYLINE5) , MNORMAL); // Keyline: <- -> Abbr. OK |
||
1125 | if( noCancel ) lcd_printp_at(11, 7, PSTR(" "), MNORMAL); // Keyline: "Abbr." loeschen wenn noCancel |
||
1126 | |||
1127 | Edit_generic_printout( Value, min, max, what, yoffsV); // aktuellen Eingabewert anzeigen |
||
1128 | redraw = false; |
||
1129 | } |
||
1130 | |||
1131 | |||
1132 | //------------------------ |
||
1133 | // PKT CtrlHook |
||
1134 | //------------------------ |
||
1135 | if( PKT_CtrlHook() ) |
||
1136 | { |
||
1137 | redraw = true; |
||
1138 | } |
||
1139 | |||
1140 | |||
1141 | //------------------------ |
||
1142 | // Key: PLUS |
||
1143 | //------------------------ |
||
1144 | if( (get_key_press(1 << KEY_PLUS) || get_key_long_rpt_sp((1 << KEY_PLUS), 2)) ) |
||
1145 | { |
||
1146 | if( Value <= (max-Addfactor) ) Value = Value + Addfactor; |
||
1147 | else Value = min; |
||
1148 | |||
1149 | Edit_generic_printout( Value, min, max, what, yoffsV); |
||
1150 | } |
||
1151 | |||
1152 | |||
1153 | //------------------------ |
||
1154 | // Key: MINUS |
||
1155 | //------------------------ |
||
1156 | if( (get_key_press(1 << KEY_MINUS) || get_key_long_rpt_sp((1 << KEY_MINUS), 2)) ) |
||
1157 | { |
||
1158 | if( Value >= (min + Addfactor) ) Value = Value - Addfactor; |
||
1159 | else Value = max; |
||
1160 | |||
1161 | Edit_generic_printout( Value, min, max, what, yoffsV); |
||
1162 | } |
||
1163 | |||
1164 | |||
1165 | //------------------------ |
||
1166 | // Key: ENTER |
||
1167 | //------------------------ |
||
1168 | if( get_key_press(1 << KEY_ENTER) ) |
||
1169 | { |
||
1170 | return Value; |
||
1171 | } |
||
1172 | |||
1173 | |||
1174 | //------------------------ |
||
1175 | // Key: ESC |
||
1176 | //------------------------ |
||
1177 | if( !noCancel && get_key_press(1 << KEY_ESC) ) // Ende ohne speichern |
||
1178 | { |
||
1179 | break; |
||
1180 | } |
||
1181 | } |
||
1182 | while( true ); |
||
1183 | |||
1184 | get_key_press(KEY_ALL); |
||
1185 | return Pre; |
||
1186 | } |
||
1187 | |||
1188 | |||
1189 | |||
1190 | //-------------------------------------------------------------- |
||
1191 | // bei HW 3.9x geht das nicht mehr wegen dem Platinenlayout |
||
1192 | // bei HW 3.9m geht es theoretisch noch - aber durch einen Bug scheinbar |
||
1193 | // nicht mehr. Kann nur von jemanden mit HW 3.9m repariert werden. |
||
1194 | // ALSO -> raus und Speicher sparen |
||
1195 | //-------------------------------------------------------------- |
||
1196 | /* |
||
1197 | uint8_t Edit_DisplayHelligkeit(uint8_t Value, uint8_t min, uint8_t max) |
||
1198 | { |
||
1199 | float ValCorr = 2.55; // (Value * ValCorr) maximal 255 |
||
1200 | Pre = Value; |
||
1201 | OCR2A = Value * ValCorr; |
||
1202 | |||
1203 | lcd_cls(); |
||
1204 | // lcd_printp_at (0, 2, Text, 0); |
||
1205 | lcdx_printf_at_P( 0, 2, MNORMAL, 0,0, PSTR("%S:"), MenuCtrl_GetItemText() ); // Menuetext muss im PGM sein! (aktuell keine Unterscheidung RAM/PGM) |
||
1206 | write_ndigit_number_u (16, 2, Value, 3, 0,0); |
||
1207 | lcd_printp_at (17, 2, PSTR("%"), 0); |
||
1208 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
1209 | lcd_printp_at(0, 7, strGet(KEYLINE2), 0); |
||
1210 | |||
1211 | do |
||
1212 | { |
||
1213 | write_ndigit_number_u (16, 2,Value, 3, 0,0); |
||
1214 | lcd_frect ((8*0), (8*4), (Value * (16*8) / 100), 6, 1); |
||
1215 | |||
1216 | if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) && (Value < max)) |
||
1217 | { |
||
1218 | Value++; |
||
1219 | |||
1220 | if (Value >= max) |
||
1221 | { |
||
1222 | Value = max; |
||
1223 | set_beep ( 200, 0x0080, BeepNormal); |
||
1224 | } |
||
1225 | else |
||
1226 | OCR2A = Value * ValCorr; |
||
1227 | |||
1228 | } |
||
1229 | |||
1230 | if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) && (Value > min)) |
||
1231 | { |
||
1232 | lcd_frect (((Value - 1) * (16*8) / 100), (8*4), (16*8), 6, 0); |
||
1233 | Value--; |
||
1234 | |||
1235 | if (Value == min) |
||
1236 | { |
||
1237 | Value = min; |
||
1238 | set_beep ( 200, 0x0080, BeepNormal); |
||
1239 | } |
||
1240 | else |
||
1241 | OCR2A = Value * ValCorr; |
||
1242 | |||
1243 | } |
||
1244 | |||
1245 | if (get_key_press (1 << KEY_ENTER)) |
||
1246 | { |
||
1247 | OCR2A = Value * ValCorr; |
||
1248 | Config.LCD_Helligkeit = Value; |
||
1249 | // WriteParameter(); |
||
1250 | edit = 0; |
||
1251 | return Value; |
||
1252 | } |
||
1253 | } |
||
1254 | |||
1255 | while (!get_key_press (1 << KEY_ESC)); |
||
1256 | { |
||
1257 | get_key_press(KEY_ALL); |
||
1258 | OCR2A = Pre * ValCorr; |
||
1259 | Config.LCD_Helligkeit = Pre; |
||
1260 | // WriteParameter(); |
||
1261 | return Pre; |
||
1262 | } |
||
1263 | } |
||
1264 | */ |
||
1265 | |||
1266 | |||
1267 | |||
1268 | //-------------------------------------------------------------- |
||
1269 | //-------------------------------------------------------------- |
||
1270 | uint8_t Edit_String( const char *data, const uint8_t length, uint8_t type) |
||
1271 | { |
||
1272 | uint8_t redraw = true; |
||
1273 | uint8_t x = 1; |
||
1274 | uint8_t I = 0; |
||
1275 | uint8_t lOk = false; |
||
1276 | uint8_t i; |
||
1277 | |||
1278 | |||
1279 | for( i = 0; i < length; i++) |
||
1280 | { |
||
1281 | EditString[i] = data[i]; |
||
1282 | } |
||
1283 | |||
1284 | |||
1285 | do |
||
1286 | { |
||
1287 | //------------------------- |
||
1288 | // Screen zeichnen |
||
1289 | //------------------------- |
||
1290 | if( redraw ) |
||
1291 | { |
||
1292 | PKT_TitleFromMenuItem( true ); // true = showlipo (mit clearscreen) |
||
1293 | |||
1294 | for( i = 0; i < length; i++) |
||
1295 | { |
||
1296 | lcd_putc ( (i*2)+1, 3, EditString[i], MNORMAL); |
||
1297 | lcd_printp_at( (i*2)+2, 3, PSTR(" ") , MNORMAL); |
||
1298 | } |
||
1299 | |||
1300 | lcd_rect( (x*6)-3, (8*3)-2, 10, 10, 1); |
||
1301 | lcd_printp_at(13, 6, PSTR("C"), MNORMAL); |
||
1302 | lcd_printp_at( 0, 7, PSTR(" \x17 \x16 \x19 OK"), MNORMAL); // Keyline |
||
1303 | |||
1304 | redraw = false; |
||
1305 | } |
||
1306 | |||
1307 | |||
1308 | //------------------------- |
||
1309 | // PKT-LiPo anzeigen |
||
1310 | //------------------------- |
||
1311 | show_Lipo(); |
||
1312 | |||
1313 | |||
1314 | //------------------------- |
||
1315 | // PKT Update-Anforderung? |
||
1316 | //------------------------- |
||
1317 | if( PKT_CtrlHook() ) |
||
1318 | { |
||
1319 | redraw = true; |
||
1320 | } |
||
1321 | |||
1322 | |||
1323 | if( (type == EDIT_BT_NAME) || (type == EDIT_SSID) || (type == EDIT_WL_PASSWORD)) // Name |
||
1324 | { |
||
1325 | if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) && EditString[I] < 'z') |
||
1326 | { |
||
1327 | EditString[I]++; |
||
1328 | |||
1329 | if (EditString[I] >= 0x00 && EditString[I] < ' ') |
||
1330 | EditString[I] = ' '; |
||
1331 | |||
1332 | if (EditString[I] > ' ' && EditString[I] < '0') |
||
1333 | EditString[I] = '0'; |
||
1334 | |||
1335 | if (EditString[I] > '9' && EditString[I] < 'A') |
||
1336 | EditString[I] = 'A'; |
||
1337 | |||
1338 | if (EditString[I] > 'Z' && EditString[I] < 'a') |
||
1339 | EditString[I] = 'a'; |
||
1340 | |||
1341 | lcd_putc (x, 3, EditString[I], 0); |
||
1342 | edit = 1; |
||
1343 | } |
||
1344 | |||
1345 | if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) && EditString[I] > ' ') |
||
1346 | { |
||
1347 | EditString[I]--; |
||
1348 | |||
1349 | if (EditString[I] < 'a' && EditString[I] > 'Z') |
||
1350 | EditString[I] = 'Z'; |
||
1351 | |||
1352 | if (EditString[I] < 'A' && EditString[I] > '9') |
||
1353 | EditString[I] = '9'; |
||
1354 | |||
1355 | if (EditString[I] < '0' && EditString[I] > ' ') |
||
1356 | EditString[I] = ' '; |
||
1357 | |||
1358 | lcd_putc (x, 3, EditString[I], 0); |
||
1359 | edit = 1; |
||
1360 | } |
||
1361 | } |
||
1362 | else if( type == EDIT_BT_PIN ) // PIN |
||
1363 | { |
||
1364 | if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) && (EditString[I] < '9')) |
||
1365 | { |
||
1366 | EditString[I]++; |
||
1367 | |||
1368 | if (EditString[I] >= 0x00 && EditString[I] < ' ') |
||
1369 | EditString[I] = ' '; |
||
1370 | |||
1371 | if (EditString[I] > ' ' && EditString[I] < '0') |
||
1372 | EditString[I] = '0'; |
||
1373 | |||
1374 | lcd_putc (x, 3, EditString[I], 0); |
||
1375 | edit = 1; |
||
1376 | } |
||
1377 | |||
1378 | if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) && (EditString[I] > '0')) |
||
1379 | { |
||
1380 | EditString[I]--; |
||
1381 | |||
1382 | if (EditString[I] < 'A' && EditString[I] > '9') |
||
1383 | EditString[I] = '9'; |
||
1384 | |||
1385 | lcd_putc (x, 3, EditString[I], 0); |
||
1386 | edit = 1; |
||
1387 | } |
||
1388 | } |
||
1389 | |||
1390 | if( get_key_long (1 << KEY_ESC)) |
||
1391 | { |
||
1392 | if( type == EDIT_BT_NAME|| type == EDIT_SSID || type == EDIT_WL_PASSWORD) EditString[I] = ' '; // Zeichen loeschen |
||
1393 | if( type == EDIT_BT_PIN) EditString[I] = '0'; // Zeichen setzen |
||
1394 | lcd_putc (x, 3, EditString[I], 0); |
||
1395 | edit = 1; |
||
1396 | } |
||
1397 | |||
1398 | if( get_key_short (1 << KEY_ESC)) |
||
1399 | { |
||
1400 | if( type == EDIT_BT_NAME ) length_tmp = bt_name_length; |
||
1401 | if( type == EDIT_BT_PIN ) length_tmp = bt_pin_length; |
||
1402 | if (type == EDIT_SSID ) length_tmp = wlan_ssid_length; |
||
1403 | if (type == EDIT_WL_PASSWORD ) length_tmp = wlan_password_length; |
||
1404 | |||
1405 | if ((x / 2) + 2 > length_tmp) |
||
1406 | { |
||
1407 | lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 0); |
||
1408 | x = 1; |
||
1409 | lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 1); |
||
1410 | I = 0; |
||
1411 | } |
||
1412 | else |
||
1413 | { |
||
1414 | lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 0); |
||
1415 | x++; |
||
1416 | x++; |
||
1417 | lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 1); |
||
1418 | I++; //Zeiger auf Zeichen |
||
1419 | } |
||
1420 | } |
||
1421 | |||
1422 | if( get_key_press (1 << KEY_ENTER) ) |
||
1423 | { |
||
1424 | lOk = true; |
||
1425 | if( type == EDIT_BT_NAME && EditString[0] == ' ' ) // BT-Name: 1. Zeichen darf nicht Space sein |
||
1426 | { |
||
1427 | lcdx_printp_at( 0, 5, PSTR(" FEHLER! 1. Zeichen! "), MNORMAL, 0,-4); |
||
1428 | set_beep ( 300, 0xf00f, BeepNormal); |
||
1429 | _delay_ms(2000); |
||
1430 | lcd_frect( 0, 5*8-4, 127, 7, 0); // loesche Fehlertext |
||
1431 | |||
1432 | lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 0); // setze Cursor auf Position 1 |
||
1433 | x = 1; |
||
1434 | lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 1); |
||
1435 | I = 0; |
||
1436 | |||
1437 | get_key_press(KEY_ALL); |
||
1438 | lOk = false; |
||
1439 | } |
||
1440 | } |
||
1441 | |||
1442 | } while( !lOk ); |
||
1443 | |||
1444 | return 1; |
||
1445 | } |
||
1446 | |||
1447 | |||
1448 | |||
1449 | //-------------------------------------------------------------- |
||
1450 | // min,max sind in Setup_PKTGeneric() festgelegt |
||
1451 | //-------------------------------------------------------------- |
||
1452 | void Edit_LipoOffset( void ) |
||
1453 | { |
||
1454 | uint8_t redraw = true; |
||
1455 | uint8_t inc = 50; // in diesen Schritten hoch/runter zaehlen |
||
1456 | uint16_t min = 0; // min. Offset Wert |
||
1457 | uint16_t max = 15000; // max. Offset Wert |
||
1458 | uint16_t oldValue; |
||
1459 | |||
1460 | if( Config.Lipo_UOffset % inc ) // ggf. wurde frueher ein anderer Wert fuer das Increment 'inc' verwendet |
||
1461 | Config.Lipo_UOffset = (uint16_t)(Config.Lipo_UOffset/inc)*inc; // hier wird der Wert auf das aktuelle 'inc' angepasst |
||
1462 | |||
1463 | oldValue = Config.Lipo_UOffset; |
||
1464 | |||
1465 | do |
||
1466 | { |
||
1467 | //------------------------- |
||
1468 | // Screen zeichnen |
||
1469 | //------------------------- |
||
1470 | if( redraw ) |
||
1471 | { |
||
1472 | PKT_TitleFromMenuItem( true ); // true = showlipo (mit clearscreen) |
||
1473 | |||
1474 | lcdx_printf_at_P( 0, 2, MNORMAL, 0,-4, PSTR("%S:"), MenuCtrl_GetItemText() ); // Menuetext muss im PGM sein! (aktuell keine Unterscheidung RAM/PGM) |
||
1475 | |||
1476 | lcd_rect_round( 0, 32, 127, 21, 1, R2); // Rahmen |
||
1477 | lcdx_printp_at( 1, 5, strGet(STR_HELP_LIPOOFFSET1), MNORMAL, 0,-5); // Hilfe-Text 1 |
||
1478 | lcdx_printp_at( 1, 6, strGet(STR_HELP_LIPOOFFSET2), MNORMAL, 0,-5); // Hilfe-Text 2 |
||
1479 | lcd_printp_at( 0, 7, strGet(KEYLINE5), MNORMAL); // Keyline |
||
1480 | redraw = false; |
||
1481 | } |
||
1482 | |||
1483 | |||
1484 | //------------------------- |
||
1485 | // Wert ausgeben |
||
1486 | //------------------------- |
||
1487 | lcdx_printf_at_P( 0, 3, MNORMAL, 0,-2, PSTR("> %5d => %1.2dv"), Config.Lipo_UOffset, volt_avg ); |
||
1488 | show_Lipo(); |
||
1489 | |||
1490 | |||
1491 | //------------------------- |
||
1492 | // PKT Update-Anforderung? |
||
1493 | //------------------------- |
||
1494 | if( PKT_CtrlHook() ) |
||
1495 | { |
||
1496 | redraw = true; |
||
1497 | } |
||
1498 | |||
1499 | |||
1500 | //------------------------- |
||
1501 | // Tasten |
||
1502 | //------------------------- |
||
1503 | if( (get_key_press(1 << KEY_PLUS) || get_key_long_rpt_sp((1 << KEY_PLUS),2)) && (Config.Lipo_UOffset < max) ) |
||
1504 | { |
||
1505 | Config.Lipo_UOffset = Config.Lipo_UOffset + inc; |
||
1506 | } |
||
1507 | |||
1508 | if( (get_key_press(1 << KEY_MINUS) || get_key_long_rpt_sp((1 << KEY_MINUS),2)) && (Config.Lipo_UOffset > min) ) |
||
1509 | { |
||
1510 | Config.Lipo_UOffset = Config.Lipo_UOffset - inc; |
||
1511 | } |
||
1512 | |||
1513 | if( get_key_press(1 << KEY_ENTER) ) |
||
1514 | { |
||
1515 | clear_key_all(); |
||
1516 | return; |
||
1517 | } |
||
1518 | |||
1519 | } while( !get_key_press(1 << KEY_ESC) ); |
||
1520 | |||
1521 | clear_key_all(); |
||
1522 | |||
1523 | Config.Lipo_UOffset = oldValue; // Abbruch, orginalen Wert wieder herstellen |
||
1524 | return; |
||
1525 | } |
||
1526 | |||
1527 | |||
1528 | |||
1529 | //-------------------------------------------------------------- |
||
1530 | //-------------------------------------------------------------- |
||
1531 | #ifdef USE_OSD_SCREEN_OLD |
||
1532 | uint8_t Edit_LED_Form (uint8_t Value, uint8_t min, uint8_t max ) |
||
1533 | { |
||
1534 | Pre = Value; |
||
1535 | lcd_cls(); |
||
1536 | |||
1537 | lcd_printp_at(0, 2, strGetOSDOLD(OSD_LED_Form), MNORMAL); |
||
1538 | |||
1539 | switch (Value) |
||
1540 | { |
||
1541 | case 0x1: |
||
1542 | lcd_circle (14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
||
1543 | |||
1544 | lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 3, 0); // l�schen |
||
1545 | lcd_circle (16 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
||
1546 | lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 1, 1); // plus |
||
1547 | break; |
||
1548 | case 0x3 : |
||
1549 | lcd_circle (14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
||
1550 | |||
1551 | lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 3, 1); // schwarz |
||
1552 | break; |
||
1553 | break; |
||
1554 | } |
||
1555 | |||
1556 | lcd_printp_at(0, 7, strGet(KEYLINE2), 0); |
||
1557 | |||
1558 | do |
||
1559 | { |
||
1560 | if ((get_key_press (1 << KEY_PLUS)) && (Value == 1)) |
||
1561 | { |
||
1562 | Value = 3; |
||
1563 | lcd_circle (14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
||
1564 | |||
1565 | lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 3, 1); // schwarz |
||
1566 | } |
||
1567 | |||
1568 | if ((get_key_press (1 << KEY_MINUS)) && (Value == 3)) |
||
1569 | { |
||
1570 | Value = 1; |
||
1571 | lcd_circle (14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
||
1572 | |||
1573 | lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 3, 0); // l�schen |
||
1574 | lcd_circle (16 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
||
1575 | lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 1, 1); // plus |
||
1576 | } |
||
1577 | |||
1578 | if (get_key_press (1 << KEY_ENTER)) |
||
1579 | { |
||
1580 | edit = 1; |
||
1581 | Config.OSD_LEDform = Value; |
||
1582 | // WriteParameter(); |
||
1583 | edit = 0; |
||
1584 | return Value; |
||
1585 | } |
||
1586 | } |
||
1587 | |||
1588 | while (!get_key_press (1 << KEY_ESC)); |
||
1589 | { |
||
1590 | get_key_press(KEY_ALL); |
||
1591 | edit = 0; |
||
1592 | Config.OSD_LEDform = Pre; |
||
1593 | return Pre; |
||
1594 | } |
||
1595 | } |
||
1596 | #endif // USE_OSD_SCREEN_OLD |
||
1597 | |||
1598 | |||
1599 | |||
1600 | //-------------------------------------------------------------- |
||
1601 | // Show_MAC( progmem, headline, mac) |
||
1602 | //-------------------------------------------------------------- |
||
1603 | void Show_MAC( uint8_t progmem, const char *headline, const char *mac ) |
||
1604 | { |
||
1605 | uint8_t i; |
||
1606 | uint8_t z; |
||
1607 | |||
1608 | lcd_cls(); |
||
1609 | PKT_TitleFromMenuItem( true ); |
||
1610 | |||
1611 | if( progmem ) |
||
1612 | lcdx_printp_center( 2, headline, MNORMAL, 0,2); |
||
1613 | else |
||
1614 | lcdx_print_center( 2, (uint8_t *)headline, MNORMAL, 0,2); |
||
1615 | |||
1616 | z = 0; |
||
1617 | for( i = 0; i < 13; i++) |
||
1618 | { |
||
1619 | lcdx_putc( z+2, 5, mac[i], MNORMAL, 0,-1); |
||
1620 | if( (i%2==1) && (i<11) ) |
||
1621 | { |
||
1622 | z++; |
||
1623 | lcdx_printp_at( z+2, 5, PSTR(":"), MNORMAL, 0,-1); |
||
1624 | } |
||
1625 | z++; |
||
1626 | } |
||
1627 | lcd_rect_round( 0, 34, 127, 16, 1, R2); // Rahmen |
||
1628 | Wait4KeyENDE( false ); |
||
1629 | } |
||
1630 | |||
1631 | |||
1632 | |||
1633 | //-------------------------------------------------------------- |
||
1634 | // Setup_OSD() |
||
1635 | //-------------------------------------------------------------- |
||
1636 | void Setup_OSD( void ) |
||
1637 | { |
||
1638 | uint8_t itemid; |
||
1639 | |||
1640 | //--------------- |
||
1641 | // Create |
||
1642 | //--------------- |
||
1643 | MenuCtrl_Create(); |
||
1644 | MenuCtrl_SetTitleFromParentItem(); // "OSD Anzeige" |
||
1645 | |||
1646 | //--------------- |
||
1647 | // Menuitems |
||
1648 | //--------------- |
||
1649 | MenuCtrl_PushML2_P( OSDS_LOWBAT , MENU_ITEM, NOFUNC , OSDS_LOWBAT_de , OSDS_LOWBAT_en ); |
||
1650 | //MenuCtrl_PushML2_P( OSDS_MAH , MENU_ITEM, NOFUNC , OSDS_MAH_de , OSDS_MAH_en ); |
||
1651 | MenuCtrl_PushML2_P( OSDS_RCERROR , MENU_ITEM, NOFUNC , OSDS_RCERROR_de , OSDS_RCERROR_en ); |
||
1652 | |||
1653 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
1654 | |||
1655 | MenuCtrl_PushML2_P( OSDS_SHOWCELLU , MENU_ITEM, NOFUNC , OSDS_SHOWCELLU_de , OSDS_SHOWCELLU_en ); |
||
1656 | MenuCtrl_PushML2_P( OSDS_MKSETTING , MENU_ITEM, NOFUNC , OSDS_MKSETTING_de , OSDS_MKSETTING_en ); |
||
1657 | |||
1658 | #ifdef USE_OSD_SCREEN_OLD |
||
1659 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
1660 | MenuCtrl_PushML2_P( OSDS_FALLSPEED , MENU_ITEM, NOFUNC , OSDS_FALLSPEED_de , OSDS_FALLSPEED_en ); |
||
1661 | MenuCtrl_PushML2_P( OSDS_VARIOBEEP , MENU_ITEM, NOFUNC , OSDS_VARIOBEEP_de , OSDS_VARIOBEEP_en ); |
||
1662 | MenuCtrl_PushML2_P( OSDS_VOLTBAR , MENU_ITEM, NOFUNC , OSDS_VOLTBAR_de , OSDS_VOLTBAR_en ); |
||
1663 | MenuCtrl_PushML2_P( OSDS_OUTFORMAT , MENU_ITEM, NOFUNC , OSDS_OUTFORMAT_de , OSDS_OUTFORMAT_en ); |
||
1664 | MenuCtrl_PushML2_P( OSDS_OUTPOLARITY , MENU_ITEM, NOFUNC , OSDS_OUTPOLARITY_de , OSDS_OUTPOLARITY_en ); |
||
1665 | #endif |
||
1666 | |||
1667 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
1668 | |||
1669 | MenuCtrl_PushML2_P( OSDS_DATASV2 , MENU_ITEM, NOFUNC , OSDS_DATASV2_de , OSDS_DATASV2_en ); |
||
1670 | |||
1671 | |||
1672 | //--------------- |
||
1673 | // Control |
||
1674 | //--------------- |
||
1675 | while( true ) |
||
1676 | { |
||
1677 | MenuCtrl_Control( MENUCTRL_EVENT ); |
||
1678 | |||
1679 | if( MenuCtrl_GetKey() == KEY_ESC ) break; // ENDE |
||
1680 | |||
1681 | itemid = MenuCtrl_GetItemId(); // welcher Menu-Punkt (ID) |
||
1682 | |||
1683 | if( itemid == OSDS_LOWBAT ) { Config.MK_LowBat = Edit_generic( Config.MK_LowBat ,32,255, Show_uint10th,1 ,strGet(STR_HELP_LOWBAT1),strGet(STR_HELP_LOWBAT2)); } |
||
1684 | if( itemid == OSDS_SHOWCELLU ) { Config.OSD_ShowCellU = Edit_generic( Config.OSD_ShowCellU , 0, 1, YesNo,1 ,NULL,NULL); } |
||
1685 | if( itemid == OSDS_MAH ) { Config.OSD_mAh_Warning = Edit_generic( Config.OSD_mAh_Warning , 0,30000, Show_uint5,100 ,NULL,NULL); } |
||
1686 | if( itemid == OSDS_RCERROR ) { Config.OSD_RCErrorbeep = Edit_generic( Config.OSD_RCErrorbeep , 0, 1, OnOff,1 ,NULL,NULL); } |
||
1687 | if( itemid == OSDS_MKSETTING ) { Config.OSD_ShowMKSetting = Edit_generic( Config.OSD_ShowMKSetting, 0, 1, YesNo,1 ,NULL,NULL); } |
||
1688 | if( itemid == OSDS_DATASV2 ) { Config.OSD_SendOSD = Edit_generic( Config.OSD_SendOSD , 0, 1, YesNo,1 ,NULL,NULL); } |
||
1689 | |||
1690 | #ifdef USE_OSD_SCREEN_OLD |
||
1691 | if( itemid == OSDS_FALLSPEED ) { Config.OSD_Fallspeed = Edit_generic( Config.OSD_Fallspeed , 0,247, Show_uint10th,1 ,NULL,NULL); } |
||
1692 | if( itemid == OSDS_VARIOBEEP ) { Config.OSD_VarioBeep = Edit_generic( Config.OSD_VarioBeep , 0, 1, YesNo,1 ,NULL,NULL); } |
||
1693 | if( itemid == OSDS_OUTFORMAT ) { Config.OSD_LEDform = Edit_LED_Form(Config.OSD_LEDform , 1, 3 ); } |
||
1694 | if( itemid == OSDS_OUTPOLARITY ) { Config.OSD_InvertOut = Edit_generic( Config.OSD_InvertOut , 0, 1, YesNo,1 ,NULL,NULL); } |
||
1695 | if( itemid == OSDS_VOLTBAR ) { Config.OSD_LipoBar = Edit_generic( Config.OSD_LipoBar , 0, 1, YesNo,1 ,NULL,NULL); } |
||
1696 | #endif |
||
1697 | } |
||
1698 | |||
1699 | //--------------- |
||
1700 | // Destroy |
||
1701 | //--------------- |
||
1702 | MenuCtrl_Destroy(); |
||
1703 | } |
||
1704 | |||
1705 | |||
1706 | |||
1707 | //-------------------------------------------------------------- |
||
1708 | //-------------------------------------------------------------- |
||
1709 | void Mark_OSDScreen( uint8_t osdscreenid ) |
||
1710 | { |
||
1711 | MenuCtrl_ItemMarkR( osdscreenid, (Config.OSD_UseScreen & (1 << osdscreenid)) != 0 ); |
||
1712 | } |
||
1713 | |||
1714 | |||
1715 | //-------------------------------------------------------------- |
||
1716 | //-------------------------------------------------------------- |
||
1717 | void Edit_OSDScreen( uint8_t osdscreenid ) |
||
1718 | { |
||
1719 | if( (Config.OSD_UseScreen & (1 << osdscreenid)) == 0 ) |
||
1720 | Config.OSD_UseScreen = (Config.OSD_UseScreen | (1 << osdscreenid)); |
||
1721 | else |
||
1722 | Config.OSD_UseScreen = (Config.OSD_UseScreen ^ (1 << osdscreenid)); |
||
1723 | |||
1724 | Mark_OSDScreen( osdscreenid ); |
||
1725 | } |
||
1726 | |||
1727 | |||
1728 | |||
1729 | //-------------------------------------------------------------- |
||
1730 | // Setup_OSDScreens() |
||
1731 | //-------------------------------------------------------------- |
||
1732 | void Setup_OSDScreens( void ) |
||
1733 | { |
||
1734 | uint8_t itemid; |
||
1735 | |||
1736 | //--------------- |
||
1737 | // Create |
||
1738 | //--------------- |
||
1739 | MenuCtrl_Create(); |
||
1740 | MenuCtrl_SetTitleFromParentItem(); // "OSD Screens" |
||
1741 | |||
1742 | //--------------- |
||
1743 | // Menuitems |
||
1744 | //--------------- |
||
1745 | #ifdef USE_OSD_SCREEN_NAVIGATION |
||
1746 | MenuCtrl_Push_P( OSDSCREEN_NAVIGATION, MENU_ITEM, NOFUNC, strGet(STR_OSDSCREEN_NAVIGATION) ); Mark_OSDScreen( OSDSCREEN_NAVIGATION ); |
||
1747 | #endif |
||
1748 | |||
1749 | #ifdef USE_OSD_SCREEN_WAYPOINTS |
||
1750 | MenuCtrl_Push_P( OSDSCREEN_WAYPOINTS , MENU_ITEM, NOFUNC, strGet(STR_OSDSCREEN_WAYPOINTS) ); Mark_OSDScreen( OSDSCREEN_WAYPOINTS ); |
||
1751 | #endif |
||
1752 | |||
1753 | #ifdef USE_OSD_SCREEN_ELECTRIC |
||
1754 | MenuCtrl_Push_P( OSDSCREEN_ELECTRIC , MENU_ITEM, NOFUNC, strGet(STR_OSDSCREEN_ELECTRIC) ); Mark_OSDScreen( OSDSCREEN_ELECTRIC ); |
||
1755 | #endif |
||
1756 | |||
1757 | #ifdef USE_OSD_SCREEN_ELECTRIC_N |
||
1758 | MenuCtrl_Push_P( OSDSCREEN_ELECTRIC , MENU_ITEM, NOFUNC, strGet(STR_OSDSCREEN_ELECTRIC) ); Mark_OSDScreen( OSDSCREEN_ELECTRIC ); |
||
1759 | #endif |
||
1760 | |||
1761 | #ifdef USE_OSD_SCREEN_MKSTATUS |
||
1762 | MenuCtrl_Push_P( OSDSCREEN_MKSTATUS , MENU_ITEM, NOFUNC, strGet(STR_OSDSCREEN_MKSTATUS) ); Mark_OSDScreen( OSDSCREEN_MKSTATUS ); |
||
1763 | #endif |
||
1764 | |||
1765 | #ifdef USE_OSD_SCREEN_USERGPS |
||
1766 | MenuCtrl_Push_P( OSDSCREEN_USERGPS , MENU_ITEM, NOFUNC, strGet(STR_OSDSCREEN_USERGPS) ); Mark_OSDScreen( OSDSCREEN_USERGPS ); |
||
1767 | #endif |
||
1768 | |||
1769 | #ifdef USE_OSD_SCREEN_3DLAGE |
||
1770 | MenuCtrl_Push_P( OSDSCREEN_3DLAGE , MENU_ITEM, NOFUNC, strGet(STR_OSDSCREEN_3DLAGE) ); Mark_OSDScreen( OSDSCREEN_3DLAGE ); |
||
1771 | #endif |
||
1772 | |||
1773 | #ifdef USE_OSD_SCREEN_STATISTIC |
||
1774 | MenuCtrl_Push_P( OSDSCREEN_STATISTICS, MENU_ITEM, NOFUNC, strGet(STR_OSDSCREEN_STATISTIC) ); Mark_OSDScreen( OSDSCREEN_STATISTICS ); |
||
1775 | #endif |
||
1776 | |||
1777 | #ifdef USE_OSD_SCREEN_OLD |
||
1778 | MenuCtrl_Push_P( OSDSCREEN_OSD0, MENU_ITEM, NOFUNC, strGet(STR_OSDSCREEN_OSD0) ); Mark_OSDScreen( OSDSCREEN_OSD0 ); |
||
1779 | MenuCtrl_Push_P( OSDSCREEN_OSD1, MENU_ITEM, NOFUNC, strGet(STR_OSDSCREEN_OSD1) ); Mark_OSDScreen( OSDSCREEN_OSD1 ); |
||
1780 | MenuCtrl_Push_P( OSDSCREEN_OSD2, MENU_ITEM, NOFUNC, strGet(STR_OSDSCREEN_OSD2) ); Mark_OSDScreen( OSDSCREEN_OSD2 ); |
||
1781 | #endif |
||
1782 | |||
1783 | |||
1784 | //--------------- |
||
1785 | // Control |
||
1786 | //--------------- |
||
1787 | while( true ) |
||
1788 | { |
||
1789 | MenuCtrl_Control( MENUCTRL_EVENT ); |
||
1790 | |||
1791 | if( MenuCtrl_GetKey() == KEY_ESC ) break; // ENDE |
||
1792 | |||
1793 | itemid = MenuCtrl_GetItemId(); // welcher Menu-Punkt (ID) |
||
1794 | |||
1795 | Edit_OSDScreen( itemid ); |
||
1796 | } |
||
1797 | |||
1798 | //--------------- |
||
1799 | // Destroy |
||
1800 | //--------------- |
||
1801 | MenuCtrl_Destroy(); |
||
1802 | } |
||
1803 | |||
1804 | |||
1805 | //-------------------------------------------------------------- |
||
1806 | // Setup_FollowMe() |
||
1807 | //-------------------------------------------------------------- |
||
1808 | #ifdef USE_FOLLOWME |
||
1809 | void Setup_FollowMe( void ) |
||
1810 | { |
||
1811 | uint8_t itemid; |
||
1812 | |||
1813 | //--------------- |
||
1814 | // Create |
||
1815 | //--------------- |
||
1816 | MenuCtrl_Create(); |
||
1817 | MenuCtrl_SetTitle_P( PSTR("FollowMe Setup") ); |
||
1818 | |||
1819 | //--------------- |
||
1820 | // Menuitems |
||
1821 | //--------------- |
||
1822 | //-------------------------------------------------------------------------------------------------------- |
||
1823 | // 25.06.2014 OG - auskommentiert weil nicht verwendet. FollowMe wird aktuell ueber die Daten-Updaterate |
||
1824 | // der BT GPS-Maus getriggert! |
||
1825 | //-------------------------------------------------------------------------------------------------------- |
||
1826 | //MenuCtrl_PushML2_P( FME_REFRESH , MENU_ITEM, NOFUNC , FME_REFRESH_de , FME_REFRESH_en ); |
||
1827 | |||
1828 | |||
1829 | |||
1830 | #ifdef USE_FOLLOWME_STEP2 |
||
1831 | MenuCtrl_PushML2_P( FME_DISTANCE, MENU_ITEM, NOFUNC , FME_DISTANCE_de , FME_DISTANCE_en ); |
||
1832 | MenuCtrl_PushML2_P( FME_AZIMUTH , MENU_ITEM, NOFUNC , FME_AZIMUTH_de , FME_AZIMUTH_en ); |
||
1833 | #endif |
||
1834 | MenuCtrl_PushML2_P( FME_SPEED , MENU_ITEM, NOFUNC , FME_SPEED_de , FME_SPEED_en ); |
||
1835 | MenuCtrl_PushML2_P( FME_RADIUS , MENU_ITEM, NOFUNC , FME_RADIUS_de , FME_RADIUS_en ); |
||
1836 | |||
1837 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
1838 | MenuCtrl_PushML2_P( GPS_DATA , MENU_ITEM, NOFUNC , GPS_DATA_de , GPS_DATA_en ); |
||
1839 | |||
1840 | //--------------- |
||
1841 | // Control |
||
1842 | //--------------- |
||
1843 | while( true ) |
||
1844 | { |
||
1845 | MenuCtrl_Control( MENUCTRL_EVENT ); |
||
1846 | |||
1847 | if( MenuCtrl_GetKey() == KEY_ESC ) break; // ENDE |
||
1848 | |||
1849 | itemid = MenuCtrl_GetItemId(); // welcher Menu-Punkt (ID) |
||
1850 | |||
1851 | //if( itemid == FME_REFRESH ) { Config.FM_Refresh = Edit_generic( Config.FM_Refresh ,250,60000, Show_uint3,1 ,NULL,NULL); } |
||
1852 | |||
1853 | if( itemid == FME_DISTANCE) { Config.FM_Distance= Edit_generic( Config.FM_Distance , 0, 100, Show_uint3,1 ,strGet(STR_METERS),NULL); } |
||
1854 | if( itemid == FME_AZIMUTH ) { Config.FM_Azimuth = Edit_generic( Config.FM_Azimuth , 0, 360, Show_uint3,1 ,PSTR("Grad"),NULL); } |
||
1855 | if( itemid == FME_SPEED ) { Config.FM_Speed = Edit_generic( Config.FM_Speed , 0, 100, Show_uint3,1 ,PSTR("0.1 m/s") ,NULL); } |
||
1856 | if( itemid == FME_RADIUS ) { Config.FM_Radius = Edit_generic( Config.FM_Radius , 1, 20, Show_uint3,1 ,strGet(STR_METERS),NULL); } |
||
1857 | |||
1858 | //-------------------- |
||
1859 | // GPS_DATA |
||
1860 | //-------------------- |
||
1861 | if( itemid == GPS_DATA ) |
||
1862 | { |
||
1863 | GPSMouse_ShowData( GPSMOUSE_SHOW_TIME, 0 ); // 0 = beenden mit Verbindungstrennung |
||
1864 | } |
||
1865 | } |
||
1866 | |||
1867 | //--------------- |
||
1868 | // Destroy |
||
1869 | //--------------- |
||
1870 | MenuCtrl_Destroy(); |
||
1871 | } |
||
1872 | #endif // USE_FOLLOWME |
||
1873 | |||
1874 | |||
1875 | |||
1876 | //-------------------------------------------------------------- |
||
1877 | // Setup_GPSMouse() |
||
1878 | //-------------------------------------------------------------- |
||
1879 | #ifdef USE_BLUETOOTH |
||
1880 | |||
1881 | void Setup_GPSMouse( void ) |
||
1882 | { |
||
1883 | uint8_t itemid; |
||
1884 | |||
1885 | //--------------- |
||
1886 | // Create |
||
1887 | //--------------- |
||
1888 | MenuCtrl_Create(); |
||
1889 | MenuCtrl_SetTitleFromParentItem(); // "GPS Maus" |
||
1890 | |||
1891 | //--------------- |
||
1892 | // Menuitems |
||
1893 | //--------------- |
||
1894 | MenuCtrl_PushML2_P( GPS_SEARCH , MENU_ITEM, &BT_SearchDevices , GPS_SEARCH_de , GPS_SEARCH_en ); |
||
1895 | MenuCtrl_PushML2_P( GPS_DEVICES , MENU_ITEM, &BT_SelectDevice , GPS_DEVICES_de , GPS_DEVICES_en ); |
||
1896 | |||
1897 | //-------------------------------------------------------------------------------------------------------- |
||
1898 | // 25.06.2014 OG - auskommentiert weil erstmal nicht weiter benoetigt. Wurde zwar verwendet in tracking.c |
||
1899 | // aber auch dort wurde betroffener Code deaktiviert - siehe Anmerkung tracking.c / PKT_tracking() |
||
1900 | //-------------------------------------------------------------------------------------------------------- |
||
1901 | //MenuCtrl_PushML2_P( GPS_TYPE , MENU_ITEM, NOFUNC , GPS_TYPE_de , GPS_TYPE_en ); |
||
1902 | |||
1903 | //-------------------------------------------------------------------------------------------------------- |
||
1904 | // 25.06.2014 OG - auskommentiert weil nirgendwo verwendet |
||
1905 | //-------------------------------------------------------------------------------------------------------- |
||
1906 | //MenuCtrl_PushML2_P( GPS_ACTIVE , MENU_ITEM, NOFUNC , GPS_ACTIVE_de , GPS_ACTIVE_en ); |
||
1907 | |||
1908 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
1909 | MenuCtrl_PushML2_P( GPS_SHOWDEV , MENU_ITEM, NOFUNC , GPS_SHOWDEV_de , GPS_SHOWDEV_en ); |
||
1910 | MenuCtrl_PushML2_P( GPS_DATA , MENU_ITEM, NOFUNC , GPS_DATA_de , GPS_DATA_en ); |
||
1911 | |||
1912 | |||
1913 | //--------------- |
||
1914 | // Control |
||
1915 | //--------------- |
||
1916 | while( true ) |
||
1917 | { |
||
1918 | MenuCtrl_Control( MENUCTRL_EVENT ); |
||
1919 | |||
1920 | if( MenuCtrl_GetKey() == KEY_ESC ) break; // ENDE |
||
1921 | |||
1922 | itemid = MenuCtrl_GetItemId(); // welcher Menu-Punkt (ID) |
||
1923 | |||
1924 | //-------------------- |
||
1925 | // GPS_TYPE |
||
1926 | //-------------------- |
||
1927 | /* |
||
1928 | if( itemid == GPS_TYPE ) |
||
1929 | { |
||
1930 | Config.gps_UsedGPSMouse = Edit_generic( Config.gps_UsedGPSMouse, 0,1,GPSMOUSE,1 ,NULL,NULL); |
||
1931 | } |
||
1932 | */ |
||
1933 | |||
1934 | //-------------------- |
||
1935 | // GPS_ACTIVE |
||
1936 | //-------------------- |
||
1937 | /* |
||
1938 | if( itemid == GPS_ACTIVE ) |
||
1939 | { |
||
1940 | Config.gps_UseGPS = Edit_generic( Config.gps_UseGPS, 0,1,YesNo,1 ,NULL,NULL); |
||
1941 | } |
||
1942 | */ |
||
1943 | |||
1944 | |||
1945 | //-------------------- |
||
1946 | // GPS_SHOWDEV |
||
1947 | //-------------------- |
||
1948 | if( itemid == GPS_SHOWDEV ) |
||
1949 | { |
||
1950 | //Show_MAC( progmem, headline, mac) |
||
1951 | Show_MAC( false, Config.gps_UsedDevName, Config.gps_UsedMac); |
||
1952 | } |
||
1953 | |||
1954 | |||
1955 | //-------------------- |
||
1956 | // GPS_DATA |
||
1957 | //-------------------- |
||
1958 | if( itemid == GPS_DATA ) |
||
1959 | { |
||
1960 | GPSMouse_ShowData( GPSMOUSE_SHOW_TIME, 0 ); // 0 = beenden mit Verbindungstrennung |
||
1961 | } |
||
1962 | |||
1963 | } |
||
1964 | |||
1965 | //--------------- |
||
1966 | // Destroy |
||
1967 | //--------------- |
||
1968 | MenuCtrl_Destroy(); |
||
1969 | } |
||
1970 | |||
1971 | |||
1972 | |||
1973 | |||
1974 | //-------------------------------------------------------------- |
||
1975 | // zeigt die Konfig des BTM-222 |
||
1976 | //-------------------------------------------------------------- |
||
1977 | void BTM222_Info( void ) |
||
1978 | { |
||
1979 | |||
1980 | lcd_cls(); |
||
1981 | |||
1982 | set_Modul_On( Bluetooth ); |
||
1983 | |||
1984 | if( !ScrollBox_Create(55) ) // max. 55 Zeilen |
||
1985 | return; // kein RAM mehr |
||
1986 | |||
1987 | ScrollBox_Push_P( MNORMAL, PSTR("BTM-222 Config") ); |
||
1988 | ScrollBox_Push_P( MNORMAL, PSTR("") ); |
||
1989 | bt_showsettings(); |
||
1990 | ScrollBox_Push_P( MNORMAL, PSTR("End of Config") ); |
||
1991 | |||
1992 | ScrollBox_Show(); |
||
1993 | ScrollBox_Destroy(); // free memory |
||
1994 | |||
1995 | set_Modul_On( USB ); |
||
1996 | |||
1997 | } |
||
1998 | |||
1999 | |||
2000 | |||
2001 | //-------------------------------------------------------------- |
||
2002 | // Setup_BTM222_MenuCreate() |
||
2003 | // |
||
2004 | // das Menue aendert sich je nachdem ob BTM222 ein- oder |
||
2005 | // ausgeschaltet ist |
||
2006 | //-------------------------------------------------------------- |
||
2007 | void Setup_BTM222_MenuCreate( void ) |
||
2008 | { |
||
2009 | //--------------- |
||
2010 | // Create |
||
2011 | //--------------- |
||
2012 | MenuCtrl_Create(); |
||
2013 | MenuCtrl_SetTitleFromParentItem(); // "Bluetooth" |
||
2014 | |||
2015 | //--------------- |
||
2016 | // Menuitems |
||
2017 | //--------------- |
||
2018 | MenuCtrl_PushML2_P( BT_INSTALLED , MENU_ITEM, NOFUNC , BT_INSTALLED_de , BT_INSTALLED_en ); |
||
2019 | |||
2020 | if( Config.UseBT ) |
||
2021 | { |
||
2022 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
2023 | MenuCtrl_PushML2_P( BT_NAME , MENU_ITEM, NOFUNC , BT_NAME_de , BT_NAME_en ); |
||
2024 | MenuCtrl_PushML2_P( BT_PIN , MENU_ITEM, NOFUNC , BT_PIN_de , BT_PIN_en ); |
||
2025 | MenuCtrl_PushML2_P( BT_REID , MENU_ITEM, NOFUNC , BT_REID_de , BT_REID_en ); |
||
2026 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
2027 | MenuCtrl_PushML2_P( BT_INIT , MENU_ITEM, NOFUNC , BT_INIT_de , BT_INIT_en ); |
||
2028 | MenuCtrl_PushML2_P( BT_PCCONFIG , MENU_ITEM, &Port_FC2CFG_BT , BT_PCCONFIG_de , BT_PCCONFIG_en ); |
||
2029 | MenuCtrl_PushML2_P( BT_SHOWCONFIG, MENU_ITEM, &BTM222_Info , BT_SHOWCONFIG_de, BT_SHOWCONFIG_en); |
||
2030 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
2031 | MenuCtrl_PushML2_P( BT_MAC , MENU_ITEM, NOFUNC , BT_MAC_de , BT_MAC_en ); |
||
2032 | } |
||
2033 | } |
||
2034 | |||
2035 | #endif // end: #ifdef USE_BLUETOOTH |
||
2036 | |||
2037 | |||
2038 | |||
2039 | //-------------------------------------------------------------- |
||
2040 | // Setup_BTM222() |
||
2041 | //-------------------------------------------------------------- |
||
2042 | #ifdef USE_BLUETOOTH |
||
2043 | |||
2044 | void Setup_BTM222( void ) |
||
2045 | { |
||
2046 | uint8_t itemid; |
||
2047 | uint8_t UseBT; |
||
2048 | uint8_t i; |
||
2049 | char string[11]; |
||
2050 | |||
2051 | Setup_BTM222_MenuCreate(); |
||
2052 | |||
2053 | //--------------- |
||
2054 | // Control |
||
2055 | //--------------- |
||
2056 | while( true ) |
||
2057 | { |
||
2058 | MenuCtrl_Control( MENUCTRL_EVENT ); |
||
2059 | |||
2060 | if( MenuCtrl_GetKey() == KEY_ESC ) break; // ENDE |
||
2061 | |||
2062 | itemid = MenuCtrl_GetItemId(); // welcher Menu-Punkt (ID) |
||
2063 | edit = 0; |
||
2064 | |||
2065 | //-------------------- |
||
2066 | // BT_INSTALLED |
||
2067 | //-------------------- |
||
2068 | if( itemid == BT_INSTALLED ) |
||
2069 | { |
||
2070 | UseBT = Config.UseBT; |
||
2071 | Config.UseBT = Edit_generic( Config.UseBT ,0,1, YesNo,1 ,NULL,NULL); |
||
2072 | |||
2073 | if( UseBT != Config.UseBT ) // hat Benutzer Einstellung geaendert? |
||
2074 | { |
||
2075 | if( Config.UseBT ) // BTM222 wurde aktiviert - initialisieren |
||
2076 | { |
||
2077 | BTM222_Initalize(); |
||
2078 | |||
2079 | //if( bt_init() ) |
||
2080 | // Config.BTIsSet = true; |
||
2081 | //else |
||
2082 | // Config.BTIsSet = false; |
||
2083 | } |
||
2084 | |||
2085 | MenuCtrl_Destroy(); // Menue aendern wegen wechsel Wi232 vorhanden / nicht vorhanden |
||
2086 | Setup_BTM222_MenuCreate(); |
||
2087 | continue; |
||
2088 | } |
||
2089 | } |
||
2090 | |||
2091 | |||
2092 | //-------------------- |
||
2093 | // BT_NAME |
||
2094 | //-------------------- |
||
2095 | if( itemid == BT_NAME ) |
||
2096 | { |
||
2097 | bt_fixname(); |
||
2098 | strncpyfill( string, Config.bt_name, bt_name_length+1 ); // bt_name_length=10 + 1 Terminierende 0 |
||
2099 | Edit_String( string, bt_name_length, EDIT_BT_NAME ); |
||
2100 | |||
2101 | if( edit == 1 ) |
||
2102 | { |
||
2103 | strrtrim( EditString); // Leerzeichen rechts entfernen |
||
2104 | //lcd_print_at( 0, 5, EditString, 0); // DEBUG |
||
2105 | //lcdx_printf_at( 17, 5, MNORMAL, 0,0, "%3d", strlen(EditString) ); |
||
2106 | //_delay_ms(8000); |
||
2107 | |||
2108 | strncpy( Config.bt_name, EditString, bt_name_length+1 ); |
||
2109 | } |
||
2110 | } |
||
2111 | |||
2112 | |||
2113 | //-------------------- |
||
2114 | // BT_PIN |
||
2115 | //-------------------- |
||
2116 | if( itemid == BT_PIN ) |
||
2117 | { |
||
2118 | for( i = 0; i < bt_pin_length; i++) |
||
2119 | { |
||
2120 | string[i] = Config.bt_pin[i]; |
||
2121 | } |
||
2122 | string[bt_pin_length] = 0; |
||
2123 | Edit_String( string, bt_pin_length, EDIT_BT_PIN ); |
||
2124 | |||
2125 | if (edit == 1) |
||
2126 | { |
||
2127 | for( i = 0; i < bt_pin_length; i++) |
||
2128 | { |
||
2129 | Config.bt_pin[i] = EditString[i]; |
||
2130 | } |
||
2131 | } |
||
2132 | } |
||
2133 | |||
2134 | |||
2135 | //-------------------- |
||
2136 | // BT_INIT |
||
2137 | //-------------------- |
||
2138 | if( itemid == BT_INIT ) |
||
2139 | { |
||
2140 | //lcd_cls (); |
||
2141 | //Old_Baudrate = Config.PKT_Baudrate; |
||
2142 | |||
2143 | BTM222_Initalize(); |
||
2144 | |||
2145 | /* |
||
2146 | if( bt_init() == true ) |
||
2147 | { |
||
2148 | lcd_printp_at( 0, 3, PSTR("BT Init ok"), MNORMAL); |
||
2149 | WriteBTInitFlag(); |
||
2150 | } |
||
2151 | else |
||
2152 | { |
||
2153 | lcd_printp_at( 0, 3, PSTR("BT Init Error"), MNORMAL); |
||
2154 | Config.BTIsSet = false; |
||
2155 | set_beep( 1000, 0x0040, BeepNormal); |
||
2156 | } |
||
2157 | _delay_ms(2500); // 2.5 Sekunden anzeigen fuer Benutzer |
||
2158 | */ |
||
2159 | } |
||
2160 | |||
2161 | |||
2162 | //-------------------- |
||
2163 | // BT_MAC |
||
2164 | //-------------------- |
||
2165 | if( itemid == BT_MAC ) |
||
2166 | { |
||
2167 | //Show_MAC( progmem, headline, mac) |
||
2168 | Show_MAC( true, PSTR("BTM-222 MAC"), Config.bt_Mac); |
||
2169 | } |
||
2170 | |||
2171 | |||
2172 | //-------------------- |
||
2173 | // BT_REID |
||
2174 | //-------------------- |
||
2175 | if( itemid == BT_REID ) |
||
2176 | { |
||
2177 | for( i = 0; i < RE_ID_length; i++) |
||
2178 | { |
||
2179 | string[i] = Config.RE_ID[i]; |
||
2180 | } |
||
2181 | string[RE_ID_length] = 0; |
||
2182 | Edit_String( string, RE_ID_length, EDIT_BT_PIN ); |
||
2183 | |||
2184 | if( edit == 1 ) |
||
2185 | { |
||
2186 | for( i = 0; i < RE_ID_length; i++) |
||
2187 | { |
||
2188 | Config.RE_ID[i] = EditString[i]; |
||
2189 | } |
||
2190 | } |
||
2191 | } |
||
2192 | |||
2193 | } // end: while( true ) |
||
2194 | |||
2195 | //--------------- |
||
2196 | // Destroy |
||
2197 | //--------------- |
||
2198 | MenuCtrl_Destroy(); |
||
2199 | |||
2200 | } // end: Setup_BTM222() |
||
2201 | |||
2202 | #endif // end: #ifdef USE_BLUETOOTH |
||
2203 | |||
2204 | |||
2205 | |||
2206 | |||
2207 | //-------------------------------------------------------------- |
||
2208 | // Setup_BLE() |
||
2209 | //-------------------------------------------------------------- |
||
2210 | void Setup_BLE( void ) |
||
2211 | { |
||
2212 | uint8_t itemid; |
||
2213 | |||
2214 | //--------------- |
||
2215 | // Create |
||
2216 | //--------------- |
||
2217 | MenuCtrl_Create(); |
||
2218 | MenuCtrl_SetTitleFromParentItem(); // "Bluetooth BLE" |
||
2219 | |||
2220 | //--------------- |
||
2221 | // Menuitems |
||
2222 | //--------------- |
||
2223 | MenuCtrl_Push_P( BLE_INSTALLED, MENU_ITEM, NOFUNC, strGet(MODULE_EXIST) ); |
||
2224 | |||
2225 | |||
2226 | //--------------- |
||
2227 | // Control |
||
2228 | //--------------- |
||
2229 | while( true ) |
||
2230 | { |
||
2231 | MenuCtrl_Control( MENUCTRL_EVENT ); |
||
2232 | |||
2233 | if( MenuCtrl_GetKey() == KEY_ESC ) break; // ENDE |
||
2234 | |||
2235 | itemid = MenuCtrl_GetItemId(); // welcher Menu-Punkt (ID) |
||
2236 | |||
2237 | //-------------------- |
||
2238 | // BT_INSTALLED |
||
2239 | //-------------------- |
||
2240 | if( itemid == BT_INSTALLED ) |
||
2241 | { |
||
2242 | Config.UseBLE = Edit_generic( Config.UseBLE, 0, 1, YesNo, 1 ,strGet(STR_EXTSV2MODULE),NULL); |
||
2243 | } |
||
2244 | } // end: while( true ) |
||
2245 | |||
2246 | //--------------- |
||
2247 | // Destroy |
||
2248 | //--------------- |
||
2249 | MenuCtrl_Destroy(); |
||
2250 | |||
2251 | } // end: Setup_BTM222() |
||
2252 | |||
2253 | |||
2254 | |||
2255 | //-------------------------------------------------------------- |
||
2256 | // Setup_MKConnection() |
||
2257 | //-------------------------------------------------------------- |
||
2258 | void Setup_MKConnection( void ) |
||
2259 | { |
||
2260 | uint8_t itemid; |
||
2261 | uint8_t old; |
||
2262 | |||
2263 | //--------------- |
||
2264 | // Create |
||
2265 | //--------------- |
||
2266 | MenuCtrl_Create(); |
||
2267 | MenuCtrl_SetTitleFromParentItem(); // "Bluetooth BLE" |
||
2268 | |||
2269 | //--------------- |
||
2270 | // Menuitems |
||
2271 | //--------------- |
||
2272 | MenuCtrl_PushML2_P( MKCONN_CONNECTION , MENU_ITEM, NOFUNC , MKCONN_CONNECTION_de , MKCONN_CONNECTION_en ); |
||
2273 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
2274 | MenuCtrl_PushML2_P( MKCONN_BAUDRATE , MENU_ITEM, NOFUNC , MKCONN_BAUDRATE_de , MKCONN_BAUDRATE_en ); |
||
2275 | |||
2276 | |||
2277 | //--------------- |
||
2278 | // Control |
||
2279 | //--------------- |
||
2280 | while( true ) |
||
2281 | { |
||
2282 | MenuCtrl_Control( MENUCTRL_EVENT ); |
||
2283 | |||
2284 | if( MenuCtrl_GetKey() == KEY_ESC ) break; // ENDE |
||
2285 | |||
2286 | itemid = MenuCtrl_GetItemId(); // welcher Menu-Punkt (ID) |
||
2287 | |||
2288 | |||
2289 | //-------------------- |
||
2290 | // MKCONN_CONNECTION |
||
2291 | //-------------------- |
||
2292 | if( itemid == MKCONN_CONNECTION ) |
||
2293 | { |
||
2294 | old = Config.U02SV2; |
||
2295 | Config.U02SV2 = Edit_generic( Config.U02SV2, 0, 1, MK_Connection,1, NULL,NULL); |
||
2296 | |||
2297 | if( Config.U02SV2 != old ) // Verbindung geaendert? |
||
2298 | { |
||
2299 | if( Config.U02SV2 == 1 ) Change_Output( Uart02FC ); // 1 = Kabel |
||
2300 | else Change_Output( Uart02Wi ); // 0 = Wi.232 |
||
2301 | } |
||
2302 | |||
2303 | if( (Config.U02SV2 == 0) && (Config.UseWi == false) ) // FEHLER: Wi.232 nicht aktiviert (Config.U02SV2 = 0 -> entspricht Wi.232) |
||
2304 | { |
||
2305 | //PKT_Message_P( text , error, timeout, beep, clear) |
||
2306 | PKT_Message_P( strGet(STR_WI232_ACTIVATE), true , 3000 , true, true); |
||
2307 | } |
||
2308 | } |
||
2309 | |||
2310 | |||
2311 | //-------------------- |
||
2312 | // MKCONN_BAUDRATE |
||
2313 | //-------------------- |
||
2314 | if( itemid == MKCONN_BAUDRATE ) |
||
2315 | { |
||
2316 | old = Config.PKT_Baudrate; |
||
2317 | Config.PKT_Baudrate = Edit_generic( Config.PKT_Baudrate ,1,6,Baudrate,1 ,PSTR("Standard: ! 57600 !"),NULL); |
||
2318 | |||
2319 | if( Config.PKT_Baudrate != old ) |
||
2320 | { |
||
2321 | // Wi.232 umkonfigurieren |
||
2322 | if( Config.UseWi ) |
||
2323 | { |
||
2324 | Wi232_Initalize(); |
||
2325 | } |
||
2326 | |||
2327 | // BTM222 umkonfigurieren |
||
2328 | #ifdef USE_BLUETOOTH |
||
2329 | if( Config.UseBT ) |
||
2330 | { |
||
2331 | //set_BTOn(); |
||
2332 | BTM222_Initalize(); |
||
2333 | //set_BTOff(); |
||
2334 | } |
||
2335 | #endif // end: #ifdef USE_BLUETOOTH |
||
2336 | } |
||
2337 | } |
||
2338 | |||
2339 | } // end: while( true ) |
||
2340 | |||
2341 | //--------------- |
||
2342 | // Destroy |
||
2343 | //--------------- |
||
2344 | MenuCtrl_Destroy(); |
||
2345 | |||
2346 | } // end: Setup_BTM222() |
||
2347 | |||
2348 | |||
2349 | |||
2350 | |||
2351 | //-------------------------------------------------------------- |
||
2352 | // Setup_WI232_MenuCreate() |
||
2353 | // |
||
2354 | // das Menue aendert sich je nachdem ob Wi.232 ein- oder |
||
2355 | // ausgeschaltet ist |
||
2356 | //-------------------------------------------------------------- |
||
2357 | void Setup_WI232_MenuCreate( void ) |
||
2358 | { |
||
2359 | //--------------- |
||
2360 | // Create |
||
2361 | //--------------- |
||
2362 | MenuCtrl_Create(); |
||
2363 | MenuCtrl_SetTitleFromParentItem(); // "Wi.232" |
||
2364 | |||
2365 | //--------------- |
||
2366 | // Menuitems |
||
2367 | //--------------- |
||
2368 | MenuCtrl_Push_P( WI_INSTALLED , MENU_ITEM, NOFUNC , strGet(CONNECT13) ); |
||
2369 | |||
2370 | if( Config.UseWi ) |
||
2371 | { |
||
2372 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
2373 | MenuCtrl_PushML2_P( WI_TXRX , MENU_ITEM, NOFUNC , WI_TXRX_de , WI_TXRX_en ); |
||
2374 | MenuCtrl_PushML2_P( WI_GROUP , MENU_ITEM, NOFUNC , WI_GROUP_de , WI_GROUP_en ); |
||
2375 | |||
2376 | // 06.06.2014 OG |
||
2377 | //MenuCtrl_PushML2_P( WI_MODE , MENU_ITEM, NOFUNC , WI_MODE_de , WI_MODE_en ); |
||
2378 | //MenuCtrl_PushML2_P( WI_TIMEOUT , MENU_ITEM, NOFUNC , WI_TIMEOUT_de , WI_TIMEOUT_en ); |
||
2379 | //MenuCtrl_PushML2_P( WI_MTU , MENU_ITEM, NOFUNC , WI_MTU_de , WI_MTU_en ); |
||
2380 | |||
2381 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
2382 | MenuCtrl_PushML2_P( WI_INIT , MENU_ITEM, NOFUNC , WI_INIT_de , WI_INIT_en ); |
||
2383 | |||
2384 | //MenuCtrl_PushML2_P( WI_PCCONFIG , MENU_ITEM, &Port_USB2CFG_Wi , WI_PCCONFIG_de , WI_PCCONFIG_en ); |
||
2385 | MenuCtrl_PushML2_P( WI_PCCONFIG , MENU_ITEM, &Wi232_ConfigPC , WI_PCCONFIG_de , WI_PCCONFIG_en ); |
||
2386 | |||
2387 | |||
2388 | } |
||
2389 | } |
||
2390 | |||
2391 | |||
2392 | |||
2393 | //-------------------------------------------------------------- |
||
2394 | // Setup_WI232() |
||
2395 | //-------------------------------------------------------------- |
||
2396 | void Setup_WI232( void ) |
||
2397 | { |
||
2398 | uint8_t itemid; |
||
2399 | uint8_t UseWi; |
||
2400 | |||
2401 | Setup_WI232_MenuCreate(); |
||
2402 | |||
2403 | //--------------- |
||
2404 | // Control |
||
2405 | //--------------- |
||
2406 | while( true ) |
||
2407 | { |
||
2408 | MenuCtrl_Control( MENUCTRL_EVENT ); |
||
2409 | |||
2410 | if( MenuCtrl_GetKey() == KEY_ESC ) break; // ENDE |
||
2411 | |||
2412 | itemid = MenuCtrl_GetItemId(); // welcher Menu-Punkt (ID) |
||
2413 | edit = 0; |
||
2414 | |||
2415 | if( itemid == WI_TXRX ) { Config.WiTXRXChannel = Edit_generic( Config.WiTXRXChannel , 0, 5, Show_uint3,1 ,NULL,NULL); } |
||
2416 | if( itemid == WI_GROUP ) { Config.WiNetworkGroup = Edit_generic( Config.WiNetworkGroup , 0, 127, Show_uint3,1 ,NULL,NULL); } |
||
2417 | //if( itemid == WI_MODE ) { Config.WiNetworkMode = Edit_generic( Config.WiNetworkMode , 0, 1, Wi_Netmode,1 ,NULL,NULL); } |
||
2418 | //if( itemid == WI_TIMEOUT ) { Config.WiTXTO = Edit_generic( Config.WiTXTO , 0, 127, Show_uint3,1 ,NULL,NULL); } |
||
2419 | //if( itemid == WI_MTU ) { Config.WiUartMTU = Edit_generic( Config.WiUartMTU , 0, 127, Show_uint3,1 ,NULL,NULL); } |
||
2420 | if( itemid == WI_INIT ) { Wi232_Initalize(); } |
||
2421 | |||
2422 | //-------------------- |
||
2423 | // WI_INSTALLED |
||
2424 | //-------------------- |
||
2425 | if( itemid == WI_INSTALLED ) |
||
2426 | { |
||
2427 | UseWi = Config.UseWi; |
||
2428 | Config.UseWi = Edit_generic( Config.UseWi, 0,1, YesNo,1, NULL,NULL); |
||
2429 | if( UseWi != Config.UseWi ) // hat Benutzer Einstellung geaendert? |
||
2430 | { |
||
2431 | if( Config.UseWi ) |
||
2432 | Wi232_Initalize(); // Wi232 wurde aktiviert: init |
||
2433 | |||
2434 | MenuCtrl_Destroy(); // Menue aendern wegen wechsel Wi232 vorhanden / nicht vorhanden |
||
2435 | Setup_WI232_MenuCreate(); |
||
2436 | continue; |
||
2437 | } |
||
2438 | } |
||
2439 | } |
||
2440 | |||
2441 | //--------------- |
||
2442 | // Destroy |
||
2443 | //--------------- |
||
2444 | MenuCtrl_Destroy(); |
||
2445 | } |
||
2446 | |||
2447 | |||
2448 | |||
2449 | //-------------------------------------------------------------- |
||
2450 | // Setup_PKTGeneric() |
||
2451 | // |
||
2452 | // entspricht "PKT allgemein" |
||
2453 | //-------------------------------------------------------------- |
||
2454 | void Setup_PKTGeneric( void ) |
||
2455 | { |
||
2456 | uint8_t itemid; |
||
2457 | uint8_t old; |
||
2458 | |||
2459 | //--------------- |
||
2460 | // Create |
||
2461 | //--------------- |
||
2462 | MenuCtrl_Create(); |
||
2463 | |||
2464 | //--------------- |
||
2465 | // Einstellungen |
||
2466 | //--------------- |
||
2467 | MenuCtrl_SetTitleFromParentItem(); // "PKT allgemein" |
||
2468 | //MenuCtrl_SetCycle( false ); |
||
2469 | //MenuCtrl_SetShowBatt( false ); |
||
2470 | //MenuCtrl_SetBeep( true ); |
||
2471 | |||
2472 | //--------------- |
||
2473 | // Menuitems |
||
2474 | //--------------- |
||
2475 | MenuCtrl_PushML2_P( PKT_LANGUAGE , MENU_ITEM, NOFUNC , LANGUAGE_de , LANGUAGE_en ); |
||
2476 | MenuCtrl_PushML2_P( TIME_ZONE , MENU_ITEM, NOFUNC , TIME_ZONE_de , TIME_ZONE_en ); |
||
2477 | MenuCtrl_PushML2_P( TIME_SUMMER , MENU_ITEM, NOFUNC , TIME_SUMMER_de , TIME_SUMMER_en ); |
||
2478 | |||
2479 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
2480 | |||
2481 | MenuCtrl_PushML2_P( PKT_PKTOFF , MENU_ITEM, NOFUNC , PKT_PKTOFF_de , PKT_PKTOFF_en ); |
||
2482 | MenuCtrl_PushML2_P( PKT_LIGHTOFF , MENU_ITEM, NOFUNC , LIGHTOFF_de , LIGHTOFF_en ); |
||
2483 | |||
2484 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
2485 | |||
2486 | // 18.04.2014 OG: rausgenommen da es aktuell auch nicht mehr mit PKT 3.9m Hardware geht |
||
2487 | //if( PCB_Version == PKT39m ) // Helligkeit nur bei PKT39m - bei der PKT39x geht das nicht mehr |
||
2488 | // MenuCtrl_PushML2_P( PKT_BRIGHTNESS , MENU_ITEM, NOFUNC , BRIGHTNESS_de , BRIGHTNESS_en ); |
||
2489 | |||
2490 | MenuCtrl_PushML2_P( PKT_CONTRAST , MENU_ITEM, NOFUNC , CONTRAST_de , CONTRAST_en ); |
||
2491 | MenuCtrl_PushML2_P( PKT_BEEPER , MENU_ITEM, NOFUNC , BEEPER_de , BEEPER_en ); |
||
2492 | |||
2493 | #ifdef USE_SOUND |
||
2494 | MenuCtrl_PushML2_P( PKT_SOUNDMODUL , MENU_ITEM, NOFUNC , SOUNDMODUL_de , SOUNDMODUL_en ); |
||
2495 | MenuCtrl_PushML2_P( PKT_VOLUME , MENU_ITEM, NOFUNC , VOLUME_de , VOLUME_en ); |
||
2496 | #endif |
||
2497 | |||
2498 | MenuCtrl_PushML2_P( PKT_ACCUTYPE , MENU_ITEM, NOFUNC , ACCUTYPE_de , ACCUTYPE_en ); |
||
2499 | MenuCtrl_PushML2_P( PKT_ACCUMEASURE , MENU_ITEM, NOFUNC , ACCUMEASURE_de , ACCUMEASURE_en ); |
||
2500 | |||
2501 | //--------------- |
||
2502 | // Control |
||
2503 | //--------------- |
||
2504 | while( true ) |
||
2505 | { |
||
2506 | MenuCtrl_Control( MENUCTRL_EVENT ); |
||
2507 | |||
2508 | if( MenuCtrl_GetKey() == KEY_ESC ) break; |
||
2509 | |||
2510 | itemid = MenuCtrl_GetItemId(); // welcher Menu-Punkt (ID) |
||
2511 | |||
2512 | if( itemid == PKT_LANGUAGE ) |
||
2513 | { |
||
2514 | old = Config.DisplayLanguage; |
||
2515 | Config.DisplayLanguage = Edit_generic( Config.DisplayLanguage , 0, 1, Language,1, NULL,NULL); |
||
2516 | |||
2517 | if( old != Config.DisplayLanguage ) |
||
2518 | { |
||
2519 | PKT_Ask_Restart( strGetLanguage(LANGUAGE_de,LANGUAGE_en) ); |
||
2520 | } |
||
2521 | } |
||
2522 | |||
2523 | if( itemid == TIME_ZONE ) Config.timezone = Edit_generic( Config.timezone ,-12, 12, Show_uint3,1, PSTR("+1 = Berlin "),PSTR("-5 = New York")); |
||
2524 | if( itemid == TIME_SUMMER ) Config.summertime = Edit_generic( Config.summertime , 0, 1, YesNo,1, NULL,NULL); |
||
2525 | if( itemid == PKT_LIGHTOFF ) Config.DisplayTimeout = Edit_generic( Config.DisplayTimeout , 0,254, Show_uint3,1, strGet(STR_HELP_PKTOFFTIME1),NULL); |
||
2526 | if( itemid == PKT_PKTOFF ) Config.PKTOffTimeout = Edit_generic( Config.PKTOffTimeout , 0,254, Show_uint3,1, strGet(STR_HELP_PKTOFFTIME1),NULL); |
||
2527 | if( itemid == PKT_BEEPER ) Config.HWBeeper = Edit_generic( Config.HWBeeper , 0, 1, YesNo,1, NULL,NULL); |
||
2528 | if( itemid == PKT_SOUNDMODUL ) Config.HWSound = Edit_generic( Config.HWSound , 0, 1, YesNo,1, NULL,NULL); |
||
2529 | if( itemid == PKT_VOLUME ) Config.Volume = Edit_generic( Config.Volume , 0, 50, Show_uint3,1, NULL,NULL); |
||
2530 | if( itemid == PKT_CONTRAST ) { Config.LCD_Kontrast = Edit_generic( Config.LCD_Kontrast , 10, 40, Kontrast,1, NULL,NULL); |
||
2531 | lcd_set_contrast( Config.LCD_Kontrast ); |
||
2532 | } |
||
2533 | |||
2534 | //if( itemid == PKT_BRIGHTNESS ) Config.LCD_Helligkeit = Edit_DisplayHelligkeit(Config.LCD_Helligkeit,0,100); |
||
2535 | if( itemid == PKT_ACCUTYPE ) Config.PKT_Accutyp = Edit_generic( Config.PKT_Accutyp , 0, 1, PKT_Akku,1, NULL,NULL); |
||
2536 | if( itemid == PKT_ACCUMEASURE ) Edit_LipoOffset(); |
||
2537 | } |
||
2538 | |||
2539 | //--------------- |
||
2540 | // Destroy |
||
2541 | //--------------- |
||
2542 | MenuCtrl_Destroy(); |
||
2543 | } |
||
2544 | |||
2545 | |||
2546 | |||
2547 | //-------------------------------------------------------------- |
||
2548 | // Setup_Main() |
||
2549 | // |
||
2550 | // Das Hauptmenue fuer das gesamte Setup |
||
2551 | //-------------------------------------------------------------- |
||
2552 | void Setup_MAIN( void ) |
||
2553 | { |
||
2554 | uint8_t itemid; |
||
2555 | |||
2556 | //--------------- |
||
2557 | // Create |
||
2558 | //--------------- |
||
2559 | MenuCtrl_Create(); |
||
2560 | |||
2561 | //--------------- |
||
2562 | // Einstellungen |
||
2563 | //--------------- |
||
2564 | MenuCtrl_SetTitleFromParentItem(); // "PKT Setup" |
||
2565 | //MenuCtrl_SetTitle_P( PSTR("PKT Setup") ); |
||
2566 | //MenuCtrl_SetCycle( false ); |
||
2567 | //MenuCtrl_SetShowBatt( false ); |
||
2568 | //MenuCtrl_SetBeep( true ); |
||
2569 | |||
2570 | //--------------- |
||
2571 | // Menuitems |
||
2572 | //--------------- |
||
2573 | MenuCtrl_PushML2_P( SETUP_PKTCONFIG , MENU_SUB , &Setup_PKTGeneric , SETUP_PKTCONFIG_de , SETUP_PKTCONFIG_en ); |
||
2574 | MenuCtrl_PushML2_P( SETUP_OSDVIEW , MENU_SUB , &Setup_OSD , SETUP_OSDVIEW_de , SETUP_OSDVIEW_en ); |
||
2575 | MenuCtrl_PushML2_P( SETUP_OSDSCREENS , MENU_SUB , &Setup_OSDScreens , SETUP_OSDSCREENS_de , SETUP_OSDSCREENS_en ); |
||
2576 | |||
2577 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
2578 | |||
2579 | MenuCtrl_PushML2_P( SETUP_MKCONNECTION , MENU_SUB , &Setup_MKConnection , SETUP_MKCONNECTION_de , SETUP_MKCONNECTION_en ); |
||
2580 | |||
2581 | MenuCtrl_PushML2_P( SETUP_WI232 , MENU_SUB , &Setup_WI232 , SETUP_WI232_de , SETUP_WI232_en ); |
||
2582 | |||
2583 | #ifdef USE_BLUETOOTH |
||
2584 | MenuCtrl_PushML2_P( SETUP_BTM222 , MENU_SUB , &Setup_BTM222 , SETUP_BTM222_de , SETUP_BTM222_en ); |
||
2585 | #endif |
||
2586 | |||
2587 | #if (defined(USE_SV2MODULE_BLE) || defined(USE_WLAN)) |
||
2588 | if( PCB_SV2RxTxPatch ) // nur sichtbar mit SV2 Patch! |
||
2589 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
2590 | #endif |
||
2591 | |||
2592 | #ifdef USE_SV2MODULE_BLE |
||
2593 | if( PCB_SV2RxTxPatch ) // nur sichtbar mit SV2 Patch! |
||
2594 | MenuCtrl_PushML2_P( SETUP_BLE , MENU_SUB , &Setup_BLE , SETUP_BLE_de , SETUP_BLE_en ); |
||
2595 | #endif |
||
2596 | |||
2597 | #ifdef USE_WLAN |
||
2598 | if( PCB_SV2RxTxPatch ) // nur sichtbar mit SV2 Patch! |
||
2599 | MenuCtrl_PushML2_P( SETUP_WIFLY , MENU_SUB , &Setup_WiFly , SETUP_WIFLY_de , SETUP_WIFLY_en ); |
||
2600 | #endif |
||
2601 | |||
2602 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
2603 | |||
2604 | #ifdef USE_BLUETOOTH |
||
2605 | MenuCtrl_PushML2_P( SETUP_GPSMAUS , MENU_SUB , &Setup_GPSMouse , SETUP_GPSMAUS_de , SETUP_GPSMAUS_en ); |
||
2606 | #endif |
||
2607 | |||
2608 | #ifdef USE_FOLLOWME |
||
2609 | MenuCtrl_PushML2_P( SETUP_FOLLOWME , MENU_SUB , &Setup_FollowMe , SETUP_FOLLOWME_de , SETUP_FOLLOWME_en ); |
||
2610 | #endif |
||
2611 | |||
2612 | #ifdef USE_TRACKING |
||
2613 | MenuCtrl_PushML2_P( SETUP_SERVOCONFIG , MENU_SUB , &Setup_ServoTracking, SETUP_SERVOCONFIG_de , SETUP_SERVOCONFIG_en ); // tracking/servo_setup.c |
||
2614 | #endif |
||
2615 | |||
2616 | #ifdef USE_JOYSTICK |
||
2617 | MenuCtrl_PushML2_P( SETUP_JOYSTICK , MENU_SUB , &Setup_Joysticks , SETUP_JOYSTICK_de , SETUP_JOYSTICK_en ); |
||
2618 | #endif |
||
2619 | |||
2620 | MenuCtrl_PushSeparator(); // MENUE TRENNLINIE |
||
2621 | |||
2622 | MenuCtrl_PushML2_P( SETUP_PKTUPDATE , MENU_ITEM, &PKT_Update , SETUP_PKTUPDATE_de , SETUP_PKTUPDATE_en ); |
||
2623 | //MenuCtrl_PushML2_P( SETUP_PKTDEBUG , MENU_ITEM, NOFUNC , SETUP_PKTDEBUG_de , SETUP_PKTDEBUG_en ); |
||
2624 | MenuCtrl_PushML2_P( SETUP_EEPROMRESET , MENU_ITEM, &PKT_Reset_EEprom , SETUP_EEPROMRESET_de , SETUP_EEPROMRESET_en ); |
||
2625 | |||
2626 | //--------------- |
||
2627 | // Control |
||
2628 | //--------------- |
||
2629 | while( true ) |
||
2630 | { |
||
2631 | MenuCtrl_Control( MENUCTRL_EVENT ); |
||
2632 | if( MenuCtrl_GetKey() == KEY_ESC ) break; |
||
2633 | |||
2634 | itemid = MenuCtrl_GetItemId(); // welcher Menu-Punkt (ID) |
||
2635 | |||
2636 | //-------------------- |
||
2637 | // SETUP_PKTDEBUG |
||
2638 | //-------------------- |
||
2639 | if( itemid == SETUP_PKTDEBUG ) |
||
2640 | { |
||
2641 | Config.Debug = Edit_generic( Config.Debug, 0,1,Show_uint3,1 ,NULL,NULL); |
||
2642 | } |
||
2643 | |||
2644 | } |
||
2645 | |||
2646 | //--------------- |
||
2647 | // Destroy |
||
2648 | //--------------- |
||
2649 | MenuCtrl_Destroy(); |
||
2650 | } |