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