Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1734 | - | 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 | #include "cpu.h" |
||
36 | #include <avr/io.h> |
||
37 | #include <avr/interrupt.h> |
||
38 | #include <avr/pgmspace.h> |
||
39 | #include <string.h> |
||
40 | #include <util/delay.h> |
||
41 | #include "main.h" |
||
42 | #include "setup.h" |
||
43 | #include "lcd.h" |
||
44 | #include "eeprom.h" |
||
45 | #include "timer.h" |
||
46 | #include "menu.h" |
||
47 | #include "Wi232.h" |
||
48 | #include "bluetooth.h" |
||
49 | #include "connect.h" |
||
50 | #include "lipo.h" |
||
51 | #include "messages.h" |
||
52 | #include "eeprom.h" |
||
53 | #include "tracking.h" |
||
54 | #include "bluetooth.h" |
||
55 | #include "uart1.h" |
||
56 | |||
57 | |||
58 | |||
59 | uint8_t spalte; |
||
60 | uint8_t mmode; |
||
61 | uint8_t edit; |
||
62 | uint8_t LCD_Orientation; |
||
63 | uint8_t edit = 0; |
||
64 | uint8_t LCD_Change = 0; |
||
65 | uint8_t PKT_Change = 0; |
||
66 | uint16_t Pre; |
||
67 | uint16_t Pre16; |
||
68 | char EditString[21]; |
||
69 | uint8_t bt_name_len; |
||
70 | uint8_t length_tmp; |
||
71 | |||
72 | //-------------------------------------------------------------- |
||
73 | #define ITEMS_PKT 12 |
||
74 | |||
75 | prog_char param_menuitems_pkt[ITEMS_PKT][NUM_LANG][18]= // zeilen,zeichen+1 |
||
76 | // German, English, French, Dutch |
||
77 | { |
||
78 | {"Verbindung zum MK","connection to MK "," connexion a MK " ,"Aansluiting op MK"}, |
||
79 | {"Anzeige \x1d","Display \x1d","d'affichage \x1d","Display \x1d"}, |
||
80 | {"Wi.232 \x1d","Wi.232 \x1d","Wi.232 \x1d","Wi.232 \x1d"}, |
||
81 | {"BTM-222 \x1d","BTM-222 \x1d","BTM-222 \x1d","BTM-222 \x1d"}, |
||
82 | {"Antennen Track. \x1d","antenna tracking\x1d","antenna tracking\x1d","antenna tracking\x1d"}, |
||
83 | {"OSD Anzeige \x1d","OSD screen \x1d","OSD screen \x1d","OSD screen \x1d"}, |
||
84 | {"GPS \x1d","GPS \x1d","GPS \x1d","GPS \x1d"}, |
||
85 | {"Follow Me \x1d","Follow Me \x1d","Follow Me \x1d","Follow Me \x1d"}, |
||
86 | {"PKT-Akku \x1d","PKT-Accu \x1d","PKT-Accu \x1d","PKT-Accu \x1d"}, |
||
87 | {"PKT Update ","PKT Update ","PKT Mise a jour ","PKT Update "}, |
||
88 | {"Debug PKT ","Debug PKT ","Debug PKT ","Debug PKT "}, |
||
89 | {"EEProm Reset ","EEProm Reset ","EEProm Reinitiali","EEProm Reset "}, |
||
90 | }; |
||
91 | |||
92 | #define ITEMS_LCD 8 |
||
93 | |||
94 | prog_char param_menuitems_lcd[ITEMS_LCD][NUM_LANG][18]= // zeilen,zeichen+1 |
||
95 | // German, English, French, Dutch |
||
96 | { |
||
97 | {"Infos beim Start ","info at startup ","Infor. sur lancer","info bij opstart "}, |
||
98 | {"OSD Empfangsausf.","OSD receive Error","OSD receive Error","OSD receive Error"}, |
||
99 | {"Sprache ","language ","Langue ","taal "}, |
||
100 | {"Licht aus nach...","light off after ","Lumiere au bout ","licht uit na "}, |
||
101 | {"Helligkeit ","brightness ","luminosite ","helderheid "}, |
||
102 | {"Kontrast ","contrast ","contraste ","contrast "}, |
||
103 | {"Normal/Invers ","normal/inverted ","Normal / inverse ","Normal/inverted "}, |
||
104 | {"Orientierung ","orientation ","orientation ","orientatie "}, |
||
105 | |||
106 | }; |
||
107 | |||
108 | #define ITEMS_WI 9 |
||
109 | |||
110 | prog_char param_menuitems_wi[ITEMS_WI][NUM_LANG][18]= // zeilen,zeichen+1 |
||
111 | // German, English, French, Dutch |
||
112 | { |
||
113 | {"Modul eingebaut? ","module built in? ","Module installe ","Module geinstal.?"}, |
||
114 | {"TX/RX Kanal ","TX/RX Channel ","TX/RX Channel ","TX/RX Channel "}, |
||
115 | {"NetW. Gruppe ","NetW. Group ","NetW. Group ","NetW. Group "}, |
||
116 | {"NetW. Mode ","NetW. Mode ","NetW. Mode ","NetW. Mode "}, |
||
117 | {"TX Timeout ","TX Timeout ","TX Timeout ","TX Timeout "}, |
||
118 | {"TX MTU ","TX MTU ","TX MTU ","TX MTU "}, |
||
119 | {"Baudrate Wi232/BT","Baudrate Wi232/BT","Baudrate Wi232/BT","Baudrate Wi232/BT"}, |
||
120 | {"Initialisieren ","initialize ","initialiser ","Initialize "}, |
||
121 | {"Konfig. mit PC ","config. with PC ","Config. avec PC ","Config. met PC "}, |
||
122 | }; |
||
123 | |||
124 | |||
125 | #define ITEMS_BT 5 |
||
126 | |||
127 | prog_char param_menuitems_bt[ITEMS_BT][NUM_LANG][18]= // zeilen,zeichen+1 |
||
128 | // German, English, French, Dutch |
||
129 | { |
||
130 | {"Modul eingebaut? ","module built in? ","Module installe ","module geinstall?"}, |
||
131 | {"Name ","name ","Nom ","Naam "}, |
||
132 | {"Pin ","pin ","Pin ","Pin "}, |
||
133 | {"Initialisieren ","initialize ","initialiser ","Initialize "}, |
||
134 | {"Konfig. mit PC ","config. with PC ","Config. avec PC ","Config. met PC "}, |
||
135 | }; |
||
136 | |||
137 | #define ITEMS_Accu 2 |
||
138 | |||
139 | prog_char param_menuitems_Accu[ITEMS_Accu][NUM_LANG][18]= // zeilen,zeichen+1 |
||
140 | // German, English, French, Dutch |
||
141 | { |
||
142 | {"PKT-Akkutyp ","PKT-Accutyp ","PKT-Type de batt.","PKT-batterij type"}, |
||
143 | {"PKT Akku Messung ","PKT AccuMeasure ","batt. de mesure ","PKT batt. meting "}, |
||
144 | }; |
||
145 | |||
146 | #define ITEMS_GPS 6 |
||
147 | |||
148 | prog_char param_menuitems_GPS[ITEMS_GPS][NUM_LANG][18]= // zeilen,zeichen+1 |
||
149 | // German, English, French, Dutch |
||
150 | { |
||
151 | {"wähle GPS Maus ","select GPS mouse ","select GPS mouse ","select GPS mouse "}, |
||
152 | {"Suche GPS Maus ","search GPS mouse ","search GPS mouse ","search GPS mouse "}, |
||
153 | {"GPS Maus Typ ","GPS mouse typ ","GPS mouse typ ","GPS mouse typ "}, |
||
154 | {"GPS Maus aktiv? ","GPS mouse activ? ","GPS mouse activ? ","GPS mouse activ? "}, |
||
155 | {"Zeige GPS Device ","show GPS device ","show GPS device ","show GPS device "}, |
||
156 | {"GPS Daten ","GPS data ","GPS data ","GPS data "}, |
||
157 | |||
158 | }; |
||
159 | |||
160 | #define ITEMS_FOLLOWME 3 |
||
161 | |||
162 | prog_char param_menuitems_FOLLOWME[ITEMS_GPS][NUM_LANG][18]= // zeilen,zeichen+1 |
||
163 | // German, English, French, Dutch |
||
164 | { |
||
165 | {"FollowMe Refresh","FollowMe Refresh","FollowMe Refresh","FollowMe Refresh"}, |
||
166 | {"FollowMe Speed ","FollowMe Speed ","FollowMe Speed ","FollowMe Speed "}, |
||
167 | {"Toleranz Radius ","Tolerance Radius","Tolerance Radius","Tolerance Radius"}, |
||
168 | |||
169 | |||
170 | }; |
||
171 | |||
172 | |||
173 | |||
174 | #define ITEMS_OSD 10 |
||
175 | |||
176 | prog_char param_menuitems_OSD[ITEMS_OSD][NUM_LANG][18]= // zeilen,zeichen+1 |
||
177 | // German, English, French, Dutch |
||
178 | { |
||
179 | {"OSD Anzeige Var. ","OSD screenmode ","OSD screenmode ","OSD screenmode "}, |
||
180 | {"OUT1/2 Format ","OUT1/2 format ","OUT1/2 format ","OUT1/2 format "}, |
||
181 | {"OUT1/2 Polarität ","OUT1/2 polarity ","OUT1/2 polarity ","OUT1/2 polarity "}, |
||
182 | {"Navi Daten an SV2","Navi data to SV2 ","Navi data to SV2 ","Navi data to SV2 "}, |
||
183 | {"Max. Sinkrate m/s","max fallspeed m/s","max fallspeed m/s","max fallspeed m/s"}, |
||
184 | {"Variometer Beep ","Variometer beep ","Variometer beep ","Variometer beep "}, |
||
185 | {"Home aus MK Sicht","home from MK view","home from MK view","home from MK view"}, |
||
186 | {"MK LowBat Warnung","MK LowBat warning","MK LowBat Attent ","MK LoBat alarm "}, |
||
187 | {"MK mAh Warnung","MK mAh warning ","MK mAh Attent ","MK mAh alarm "}, |
||
188 | {"MK Volt Balken","MK volt bargraph ","MK volt bargraph ","MK volt bargraph "}, |
||
189 | }; |
||
190 | |||
191 | //-------------------------------------------------------------- |
||
192 | void Show_Error_HW12(void) |
||
193 | { |
||
194 | lcd_cls(); |
||
195 | lcd_printp_at (0,3,PSTR(" Mit Hardware 1.x "), 2); |
||
196 | lcd_printp_at (0,4,PSTR(" nicht möglich "), 2); |
||
197 | _delay_ms(1000); |
||
198 | |||
199 | } |
||
200 | |||
201 | |||
202 | //-------------------------------------------------------------- |
||
203 | uint8_t Edit_Int10th_Value(uint8_t Value, uint8_t min, uint8_t max,uint8_t Text) |
||
204 | { |
||
205 | Pre = Value; |
||
206 | lcd_cls(); |
||
207 | // lcd_printp_at (0, 2, Text, 0); |
||
208 | lcd_puts_at(0, 2, strGet(Text), 0); |
||
209 | write_ndigit_number_u_10th (16, 2,Value, 3, 0,0); |
||
210 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
211 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
212 | |||
213 | do |
||
214 | { |
||
215 | if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) && (Value < max)) |
||
216 | { |
||
217 | edit = 1; |
||
218 | Value++; |
||
219 | write_ndigit_number_u_10th (16, 2,Value, 3, 0,0); |
||
220 | } |
||
221 | |||
222 | if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) && (Value > min)) |
||
223 | { |
||
224 | edit = 1; |
||
225 | Value--; |
||
226 | write_ndigit_number_u_10th (16, 2,Value, 3, 0,0); |
||
227 | } |
||
228 | |||
229 | if (get_key_press (1 << KEY_ENTER)) |
||
230 | return Value; |
||
231 | |||
232 | } |
||
233 | while (!get_key_press (1 << KEY_ESC)); |
||
234 | { |
||
235 | get_key_press(KEY_ALL); |
||
236 | edit = 0; |
||
237 | return Pre; |
||
238 | } |
||
239 | } |
||
240 | |||
241 | |||
242 | //-------------------------------------------------------------- |
||
243 | uint8_t Edit_Int_Value(uint8_t Value, uint8_t min, uint8_t max,uint8_t Text) |
||
244 | { |
||
245 | lcd_cls(); |
||
246 | // lcd_printp_at (0, 2, Text, 0); |
||
247 | lcd_puts_at(0, 2, strGet(Text), 0); |
||
248 | Pre = Value; |
||
249 | write_ndigit_number_u (16, 2, Value, 3, 0,0); |
||
250 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
251 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
252 | |||
253 | do |
||
254 | { |
||
255 | if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) && (Value < max)) |
||
256 | { |
||
257 | edit = 1; |
||
258 | Value++; |
||
259 | write_ndigit_number_u (16, 2,Value, 3, 0,0); |
||
260 | } |
||
261 | |||
262 | if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) && (Value > min)) |
||
263 | { |
||
264 | edit = 1; |
||
265 | Value--; |
||
266 | write_ndigit_number_u (16, 2,Value, 3, 0,0); |
||
267 | } |
||
268 | |||
269 | if (get_key_press (1 << KEY_ENTER)) |
||
270 | return Value; |
||
271 | |||
272 | } |
||
273 | while (!get_key_press (1 << KEY_ESC)); |
||
274 | { |
||
275 | get_key_press(KEY_ALL); |
||
276 | edit = 0; |
||
277 | return Pre; |
||
278 | } |
||
279 | } |
||
280 | //-------------------------------------------------------------- |
||
281 | uint16_t Edit_Int16_Value(uint16_t Value, uint16_t min, uint16_t max,uint8_t Text) |
||
282 | { |
||
283 | lcd_cls(); |
||
284 | // lcd_printp_at (0, 2, Text, 0); |
||
285 | lcd_puts_at(0, 2, strGet(Text), 0); |
||
286 | Pre = Value; |
||
287 | write_ndigit_number_u (16, 2, Value, 5, 0,0); |
||
288 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
289 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
290 | |||
291 | do |
||
292 | { |
||
293 | if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) && (Value < max)) |
||
294 | { |
||
295 | edit = 1; |
||
296 | Value++; |
||
297 | write_ndigit_number_u (16, 2,Value, 5, 0,0); |
||
298 | } |
||
299 | |||
300 | if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) && (Value > min)) |
||
301 | { |
||
302 | edit = 1; |
||
303 | Value--; |
||
304 | write_ndigit_number_u (16, 2,Value, 5, 0,0); |
||
305 | } |
||
306 | |||
307 | if (get_key_press (1 << KEY_ENTER)) |
||
308 | return Value; |
||
309 | |||
310 | } |
||
311 | while (!get_key_press (1 << KEY_ESC)); |
||
312 | { |
||
313 | get_key_press(KEY_ALL); |
||
314 | edit = 0; |
||
315 | return Pre; |
||
316 | } |
||
317 | } |
||
318 | #if defined HWVERSION3_9 |
||
319 | //-------------------------------------------------------------- |
||
320 | uint8_t ChangeWi_SV2(uint8_t Value) |
||
321 | { |
||
322 | Pre = Value; |
||
323 | lcd_cls(); |
||
324 | // lcd_printp_at (0, 1, PSTR("Verbinde das PKT mit"), 0); |
||
325 | // lcd_printp_at (0, 2, PSTR("dem MK über:"), 0); |
||
326 | lcd_puts_at(0, 1, strGet(CONNECT1), 0); |
||
327 | lcd_puts_at(0, 2, strGet(CONNECT2), 0); |
||
328 | |||
329 | if(UseWi == false) |
||
330 | { |
||
331 | // lcd_printp_at (0, 0, PSTR("Verbinde das PKT mit "), 0); |
||
332 | // lcd_printp_at (0, 1, PSTR("dem MK über: Kabel, "), 0); |
||
333 | // lcd_printp_at (0, 2, PSTR("da kein Wi.232 Modul "), 0); |
||
334 | // lcd_printp_at (0, 3, PSTR("eingebaut ist. "), 0); |
||
335 | // lcd_printp_at (0, 4, PSTR("Wenn doch, dann bitte"), 0); |
||
336 | // lcd_printp_at (0, 5, PSTR("das Modul zuerst im "), 0); |
||
337 | // lcd_printp_at (0, 6, PSTR("Setupmenü aktivieren."), 0); |
||
338 | lcd_puts_at(0, 1, strGet(CONNECT1), 0); |
||
339 | lcd_puts_at(0, 2, strGet(CONNECT4), 0); |
||
340 | lcd_puts_at(0, 1, strGet(CONNECT5), 0); |
||
341 | lcd_puts_at(0, 2, strGet(CONNECT6), 0); |
||
342 | lcd_puts_at(0, 1, strGet(CONNECT7), 0); |
||
343 | lcd_puts_at(0, 2, strGet(CONNECT8), 0); |
||
344 | lcd_puts_at(0, 1, strGet(CONNECT9), 0); |
||
345 | |||
346 | |||
347 | // lcd_printp_at (12, 7, PSTR("Ende"), 0); |
||
348 | lcd_puts_at(12, 7, strGet(ENDE), 0); |
||
349 | while (!get_key_press (1 << KEY_ESC)); |
||
350 | get_key_press(KEY_ALL); |
||
351 | edit = 0; |
||
352 | return Pre; |
||
353 | } |
||
354 | else |
||
355 | { |
||
356 | switch (Value) |
||
357 | { |
||
358 | case 0x0 :lcd_printp_at (14, 2, PSTR("Wi232"), 0); |
||
359 | break; |
||
360 | case 0x1 : lcd_puts_at(14, 2, strGet(KABEL), 0); |
||
361 | |||
362 | //lcd_printp_at (14, 2, PSTR("Kabel"), 0); |
||
363 | |||
364 | break; |
||
365 | break; |
||
366 | } |
||
367 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
368 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
369 | |||
370 | do |
||
371 | { |
||
372 | if(UseWi == true) |
||
373 | { |
||
374 | if ((get_key_press (1 << KEY_PLUS)) && (Value == 0)) |
||
375 | { |
||
376 | edit = 1; |
||
377 | Value = 1; |
||
378 | // lcd_printp_at (14, 2, PSTR("Kabel"), 0); |
||
379 | lcd_puts_at(14, 2, strGet(KABEL), 0); |
||
380 | Change_Output(Uart02FC); |
||
381 | } |
||
382 | |||
383 | if ((get_key_press (1 << KEY_MINUS)) && (Value == 1)) |
||
384 | { |
||
385 | edit = 1; |
||
386 | Value = 0; |
||
387 | lcd_printp_at (14, 2, PSTR("Wi232"), 0); |
||
388 | Change_Output(Uart02Wi); |
||
389 | } |
||
390 | |||
391 | if (get_key_press (1 << KEY_ENTER)) |
||
392 | { |
||
393 | // lcd_printp_at (0, 4, PSTR("Sie müssen das PKT"), 0); |
||
394 | // lcd_printp_at (0, 5, PSTR("jetzt neu starten!"), 0); |
||
395 | lcd_puts_at(0, 4, strGet(CONNECT10), 0); |
||
396 | lcd_puts_at(0, 5, strGet(CONNECT11), 0); |
||
397 | lcd_cls_line (0, 7, 18); |
||
398 | while (!get_key_press (1 << KEY_ENTER)); |
||
399 | return Value; |
||
400 | } |
||
401 | } |
||
402 | } |
||
403 | while (!get_key_press (1 << KEY_ESC)); |
||
404 | } |
||
405 | get_key_press(KEY_ALL); |
||
406 | edit = 0; |
||
407 | return Pre; |
||
408 | } |
||
409 | #endif |
||
410 | |||
411 | #if defined HWVERSION3_9 || defined HWVERSION1_3W |
||
412 | |||
413 | //-------------------------------------------------------------- |
||
414 | uint8_t Edit_Wi_NetMode_Value(uint8_t Value) |
||
415 | { |
||
416 | Pre = Value; |
||
417 | lcd_cls(); |
||
418 | // lcd_printp_at (0, 2, PSTR("Wi NetW. Mode:"), 0); |
||
419 | lcd_puts_at(0, 2, strGet(WINETWM), 0); |
||
420 | |||
421 | switch (Value) |
||
422 | { |
||
423 | case 0x0 :lcd_puts_at(15, 2, strGet(SLAVE), 0);//lcd_printp_at (15, 2, PSTR("Slave "), 0); |
||
424 | break; |
||
425 | case 0x1 :lcd_puts_at(15, 2, strGet(NORMAL), 0);//lcd_printp_at (15, 2, PSTR("Normal"), 0); |
||
426 | break; |
||
427 | break; |
||
428 | } |
||
429 | |||
430 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
431 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
432 | |||
433 | do |
||
434 | { |
||
435 | if ((get_key_press (1 << KEY_PLUS)) && (Value == 0)) |
||
436 | { |
||
437 | edit = 1; |
||
438 | Value = NetMode_Normal; |
||
439 | // lcd_printp_at (15, 2, PSTR("Normal"), 0); |
||
440 | lcd_puts_at(15, 2, strGet(NORMAL), 0); |
||
441 | |||
442 | } |
||
443 | |||
444 | if ((get_key_press (1 << KEY_MINUS)) && (Value == 1)) |
||
445 | { |
||
446 | edit = 1; |
||
447 | Value = NetMode_Slave; |
||
448 | // lcd_printp_at (15, 2, PSTR("Slave "), 0); |
||
449 | lcd_puts_at(15, 2, strGet(SLAVE), 0); |
||
450 | } |
||
451 | |||
452 | if (get_key_press (1 << KEY_ENTER)) |
||
453 | return Value; |
||
454 | |||
455 | } |
||
456 | while (!get_key_press (1 << KEY_ESC)); |
||
457 | { |
||
458 | get_key_press(KEY_ALL); |
||
459 | edit = 0; |
||
460 | return Pre; |
||
461 | } |
||
462 | } |
||
463 | #endif |
||
464 | |||
465 | //-------------------------------------------------------------- |
||
466 | uint8_t Edit_OnOff(uint8_t Value, uint8_t min, uint8_t max,uint8_t Text) |
||
467 | |||
468 | { |
||
469 | Pre = Value; |
||
470 | lcd_cls(); |
||
471 | // lcd_printp_at (0, 2,Text, 0); |
||
472 | lcd_puts_at(0, 2, strGet(Text), 0); |
||
473 | |||
474 | switch (Value) |
||
475 | { |
||
476 | case false :lcd_puts_at(17, 2, strGet(OFF), 0);//lcd_printp_at (17, 2, PSTR("Aus"), 0); |
||
477 | break; |
||
478 | case true :lcd_puts_at(17, 2, strGet(ON), 0);//cd_printp_at (17, 2, PSTR("Ein"), 0); |
||
479 | break; |
||
480 | break; |
||
481 | } |
||
482 | |||
483 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
484 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
485 | |||
486 | do |
||
487 | { |
||
488 | if ((get_key_press (1 << KEY_PLUS)) && (Value == 0)) |
||
489 | { |
||
490 | Value = 1; |
||
491 | edit =1; |
||
492 | // lcd_printp_at (17, 2, PSTR("Ein"), 0); |
||
493 | lcd_puts_at(17, 2, strGet(ON), 0); |
||
494 | } |
||
495 | |||
496 | if ((get_key_press (1 << KEY_MINUS)) && (Value == 1)) |
||
497 | { |
||
498 | Value = 0; |
||
499 | edit =1; |
||
500 | // lcd_printp_at (17, 2, PSTR("Aus"), 0); |
||
501 | lcd_puts_at(17, 2, strGet(OFF), 0); |
||
502 | } |
||
503 | |||
504 | if (get_key_press (1 << KEY_ENTER)) |
||
505 | { |
||
506 | // edit = 1; |
||
507 | // |
||
508 | // PKT_StartInfo = Value; |
||
509 | // WriteParameter(); |
||
510 | |||
511 | return Value; |
||
512 | } |
||
513 | } |
||
514 | |||
515 | while (!get_key_press (1 << KEY_ESC)); |
||
516 | { |
||
517 | get_key_press(KEY_ALL); |
||
518 | edit = 0; |
||
519 | // PKT_StartInfo = Pre; |
||
520 | return Pre; |
||
521 | } |
||
522 | |||
523 | } |
||
524 | |||
525 | //-------------------------------------------------------------- |
||
526 | uint8_t Edit_YesNo(uint8_t Value, uint8_t min, uint8_t max,uint8_t Text) |
||
527 | |||
528 | { |
||
529 | Pre = Value; |
||
530 | lcd_cls(); |
||
531 | // lcd_printp_at (0, 2,Text, 0); |
||
532 | lcd_puts_at(0, 2, strGet(Text), 0); |
||
533 | |||
534 | switch (Value) |
||
535 | { |
||
536 | case false :lcd_puts_at(17, 2, strGet(NOO), 0);//lcd_printp_at (17, 2, PSTR("Aus"), 0); |
||
537 | break; |
||
538 | case true :lcd_puts_at(17, 2, strGet(YES), 0);//cd_printp_at (17, 2, PSTR("Ein"), 0); |
||
539 | break; |
||
540 | break; |
||
541 | } |
||
542 | |||
543 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
544 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
545 | |||
546 | do |
||
547 | { |
||
548 | if ((get_key_press (1 << KEY_PLUS)) && (Value == 0)) |
||
549 | { |
||
550 | Value = 1; |
||
551 | edit = 1; |
||
552 | // lcd_printp_at (17, 2, PSTR("Ein"), 0); |
||
553 | lcd_puts_at(17, 2, strGet(YES), 0); |
||
554 | } |
||
555 | |||
556 | if ((get_key_press (1 << KEY_MINUS)) && (Value == 1)) |
||
557 | { |
||
558 | Value = 0; |
||
559 | edit = 1; |
||
560 | // lcd_printp_at (17, 2, PSTR("Aus"), 0); |
||
561 | lcd_puts_at(17, 2, strGet(NOO), 0); |
||
562 | } |
||
563 | |||
564 | if (get_key_press (1 << KEY_ENTER)) |
||
565 | { |
||
566 | // edit = 1; |
||
567 | |||
568 | // PKT_StartInfo = Value; |
||
569 | // WriteParameter(); |
||
570 | |||
571 | return Value; |
||
572 | } |
||
573 | } |
||
574 | |||
575 | while (!get_key_press (1 << KEY_ESC)); |
||
576 | { |
||
577 | get_key_press(KEY_ALL); |
||
578 | edit = 0; |
||
579 | // PKT_StartInfo = Pre; |
||
580 | return Pre; |
||
581 | } |
||
582 | |||
583 | } |
||
584 | |||
585 | //-------------------------------------------------------------- |
||
586 | //uint8_t Edit_Baudrate(uint8_t Value, uint8_t min, uint8_t max,const char *Text) |
||
587 | uint8_t Edit_Baudrate(uint8_t Value, uint8_t min, uint8_t max,uint8_t Text) |
||
588 | { |
||
589 | Pre = Value; |
||
590 | lcd_cls(); |
||
591 | lcd_puts_at(0, 2,strGet(Text), 0); |
||
592 | switch (Value) |
||
593 | { |
||
594 | case 0x0 : lcd_printp_at(15, 2, PSTR("2400 "), 0); |
||
595 | break; |
||
596 | case 0x1 : lcd_printp_at(15, 2, PSTR("9600 "), 0); |
||
597 | break; |
||
598 | case 0x2 : lcd_printp_at(15, 2, PSTR("19200 "), 0); |
||
599 | break; |
||
600 | case 0x3 : lcd_printp_at(15, 2, PSTR("38400 "), 0); |
||
601 | break; |
||
602 | case 0x4 : lcd_printp_at(15, 2, PSTR("57600 "), 0); |
||
603 | break; |
||
604 | case 0x5 : lcd_printp_at(15, 2, PSTR("115200"), 0); |
||
605 | break; |
||
606 | break; |
||
607 | } |
||
608 | |||
609 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
610 | |||
611 | do |
||
612 | { |
||
613 | if ((get_key_press (1 << KEY_PLUS)) && (Value < max)) |
||
614 | { |
||
615 | edit = 1; |
||
616 | Value++; |
||
617 | //baudrate = Value; |
||
618 | switch (Value) |
||
619 | { |
||
620 | case 0x0 : lcd_printp_at(15, 2, PSTR("2400 "), 0); |
||
621 | break; |
||
622 | case 0x1 : lcd_printp_at(15, 2, PSTR("9600 "), 0); |
||
623 | break; |
||
624 | case 0x2 : lcd_printp_at(15, 2, PSTR("19200 "), 0); |
||
625 | break; |
||
626 | case 0x3 : lcd_printp_at(15, 2, PSTR("38400 "), 0); |
||
627 | break; |
||
628 | case 0x4 : lcd_printp_at(15, 2, PSTR("57600 "), 0); |
||
629 | break; |
||
630 | case 0x5 : lcd_printp_at(15, 2, PSTR("115200"), 0); |
||
631 | break; |
||
632 | break; |
||
633 | } |
||
634 | } |
||
635 | |||
636 | if ((get_key_press (1 << KEY_MINUS)) && (Value > min)) |
||
637 | { |
||
638 | edit = 1; |
||
639 | Value--; |
||
640 | //Baudrate = Value; |
||
641 | switch (Value) |
||
642 | { |
||
643 | case 0x0 : lcd_printp_at(15, 2, PSTR("2400 "), 0); |
||
644 | break; |
||
645 | case 0x1 : lcd_printp_at(15, 2, PSTR("9600 "), 0); |
||
646 | break; |
||
647 | case 0x2 : lcd_printp_at(15, 2, PSTR("19200 "), 0); |
||
648 | break; |
||
649 | case 0x3 : lcd_printp_at(15, 2, PSTR("38400 "), 0); |
||
650 | break; |
||
651 | case 0x4 : lcd_printp_at(15, 2, PSTR("57600 "), 0); |
||
652 | break; |
||
653 | case 0x5 : lcd_printp_at(15, 2, PSTR("115200"), 0); |
||
654 | break; |
||
655 | break; |
||
656 | } |
||
657 | } |
||
658 | |||
659 | if (get_key_press (1 << KEY_ENTER)) |
||
660 | return Value; |
||
661 | |||
662 | } |
||
663 | |||
664 | while (!get_key_press (1 << KEY_ESC)); |
||
665 | { |
||
666 | get_key_press(KEY_ALL); |
||
667 | edit = 0; |
||
668 | return Pre; |
||
669 | } |
||
670 | } |
||
671 | |||
672 | //-------------------------------------------------------------- |
||
673 | //uint8_t Edit_Language(uint8_t Value, uint8_t min, uint8_t max,const char *Text) |
||
674 | uint8_t Edit_Language(uint8_t Value, uint8_t min, uint8_t max,uint8_t Text) |
||
675 | { |
||
676 | Pre = Value; |
||
677 | lcd_cls(); |
||
678 | // lcd_printp_at (0, 2, Text, 0); |
||
679 | lcd_puts_at(0, 2,strGet(Text), 0); |
||
680 | switch (Value) |
||
681 | { |
||
682 | case |
||
683 | 0x0 : lcd_puts_at(10, 2, strGet(DEUTSCH), 0);//lcd_printp_at (14, 2, PSTR("Deutsch"), 0); |
||
684 | break; |
||
685 | case 0x1 : lcd_puts_at(10, 2, strGet(ENGLISCH), 0);//lcd_printp_at (14, 2, PSTR("English"), 0); |
||
686 | break; |
||
687 | case 0x2 : lcd_puts_at(10, 2, strGet(FRANCE), 0);//lcd_printp_at (14, 2, PSTR("France "), 0); |
||
688 | break; |
||
689 | case 0x3 : lcd_puts_at(10, 2, strGet(NETHERL), 0);//lcd_printp_at (14, 2, PSTR("Netherl"), 0); |
||
690 | break; |
||
691 | break; |
||
692 | } |
||
693 | |||
694 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
695 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
696 | |||
697 | do |
||
698 | { |
||
699 | if ((get_key_press (1 << KEY_PLUS)) && (Value < max)) |
||
700 | { |
||
701 | edit = 1; |
||
702 | Value++; |
||
703 | //DisplayLanguage = Value; |
||
704 | switch (Value) |
||
705 | { |
||
706 | case 0x0 : lcd_puts_at(10, 2, strGet(DEUTSCH), 0);//lcd_printp_at (14, 2, PSTR("Deutsch"), 0); |
||
707 | break; |
||
708 | case 0x1 : lcd_puts_at(10, 2, strGet(ENGLISCH), 0);//lcd_printp_at (14, 2, PSTR("English"), 0); |
||
709 | break; |
||
710 | case 0x2 : lcd_puts_at(10, 2, strGet(FRANCE), 0);//lcd_printp_at (14, 2, PSTR("France "), 0); |
||
711 | break; |
||
712 | case 0x3 : lcd_puts_at(10, 2, strGet(NETHERL), 0);//lcd_printp_at (14, 2, PSTR("Netherl"), 0); |
||
713 | break; |
||
714 | break; |
||
715 | } |
||
716 | } |
||
717 | |||
718 | if ((get_key_press (1 << KEY_MINUS)) && (Value > min)) |
||
719 | { |
||
720 | edit = 1; |
||
721 | Value--; |
||
722 | //DisplayLanguage = Value; |
||
723 | switch (Value) |
||
724 | { |
||
725 | case 0x0 : lcd_puts_at(10, 2, strGet(DEUTSCH), 0);//lcd_printp_at (14, 2, PSTR("Deutsch"), 0); |
||
726 | break; |
||
727 | case 0x1 : lcd_puts_at(10, 2, strGet(ENGLISCH), 0);//lcd_printp_at (14, 2, PSTR("English"), 0); |
||
728 | break; |
||
729 | case 0x2 : lcd_puts_at(10, 2, strGet(FRANCE), 0);//lcd_printp_at (14, 2, PSTR("France "), 0); |
||
730 | break; |
||
731 | case 0x3 : lcd_puts_at(10, 2, strGet(NETHERL), 0);//lcd_printp_at (14, 2, PSTR("Netherl"), 0); |
||
732 | break; |
||
733 | break; |
||
734 | } |
||
735 | } |
||
736 | |||
737 | if (get_key_press (1 << KEY_ENTER)) |
||
738 | return Value; |
||
739 | |||
740 | } |
||
741 | |||
742 | while (!get_key_press (1 << KEY_ESC)); |
||
743 | { |
||
744 | get_key_press(KEY_ALL); |
||
745 | edit = 0; |
||
746 | return Pre; |
||
747 | } |
||
748 | } |
||
749 | |||
750 | |||
751 | //-------------------------------------------------------------- |
||
752 | uint8_t Edit_Orientation(uint8_t Value, uint8_t min, uint8_t max,uint8_t Text) |
||
753 | { |
||
754 | Pre = Value; |
||
755 | lcd_cls(); |
||
756 | // lcd_printp_at (0, 2, Text, 0); |
||
757 | lcd_puts_at(0, 2, strGet(Text), 0); |
||
758 | |||
759 | switch (Value) |
||
760 | { |
||
761 | case 0x0 :lcd_puts_at(14, 2, strGet(NORMAL), 0);//lcd_printp_at (14, 2, PSTR("Normal "), 0); |
||
762 | break; |
||
763 | case 0x4 :lcd_puts_at(14, 2, strGet(REVERSE), 0);//lcd_printp_at (14, 2, PSTR("Reverse"), 0); |
||
764 | break; |
||
765 | break; |
||
766 | } |
||
767 | |||
768 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
769 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
770 | |||
771 | do |
||
772 | { |
||
773 | if ((get_key_press (1 << KEY_PLUS)) && (Value == 0)) |
||
774 | { |
||
775 | Value=4; |
||
776 | // lcd_printp_at (14, 2, PSTR("Reverse"), 0); |
||
777 | lcd_puts_at(14, 2, strGet(REVERSE), 0); |
||
778 | } |
||
779 | |||
780 | if ((get_key_press (1 << KEY_MINUS)) && (Value == 4)) |
||
781 | { |
||
782 | Value = 0; |
||
783 | // lcd_printp_at (14, 2, PSTR("Normal "), 0); |
||
784 | lcd_puts_at(14, 2, strGet(NORMAL), 0); |
||
785 | } |
||
786 | |||
787 | if (get_key_press (1 << KEY_ENTER)) |
||
788 | { |
||
789 | edit = 1; |
||
790 | cli(); |
||
791 | clr_A0 (); |
||
792 | |||
793 | if (Value == 0) |
||
794 | { |
||
795 | send_byte (0xA1); // normal |
||
796 | send_byte (0xC0); // normal |
||
797 | } |
||
798 | else |
||
799 | { |
||
800 | send_byte (0xA0); // reverse |
||
801 | send_byte (0xC8); // reverse |
||
802 | } |
||
803 | set_A0 (); |
||
804 | sei(); |
||
805 | LCD_Orientation = Value; |
||
806 | WriteParameter(); |
||
807 | return Value; |
||
808 | } |
||
809 | } |
||
810 | |||
811 | while (!get_key_press (1 << KEY_ESC)); |
||
812 | { |
||
813 | get_key_press(KEY_ALL); |
||
814 | edit = 0; |
||
815 | return Pre; |
||
816 | } |
||
817 | } |
||
818 | |||
819 | |||
820 | //-------------------------------------------------------------- |
||
821 | uint8_t Edit_DisplayMode(uint8_t Value, uint8_t min, uint8_t max,uint8_t Text) |
||
822 | { |
||
823 | Pre = Value; |
||
824 | lcd_cls(); |
||
825 | //lcd_printp_at (0, 2, Text, 0); |
||
826 | lcd_puts_at(0, 2, strGet(Text), 0); |
||
827 | |||
828 | switch (Value) |
||
829 | { |
||
830 | case 0x0 :lcd_puts_at(14, 2, strGet(NORMAL), 0);//lcd_printp_at (14, 2, PSTR("Normal "), 0); |
||
831 | break; |
||
832 | case 0x4 :lcd_puts_at(14, 2, strGet(REVERSE), 0);//lcd_printp_at (14, 2, PSTR("Reverse"), 0); |
||
833 | break; |
||
834 | break; |
||
835 | } |
||
836 | |||
837 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
838 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
839 | |||
840 | do |
||
841 | { |
||
842 | if ((get_key_press (1 << KEY_PLUS)) && (Value == 0)) |
||
843 | { |
||
844 | Value=4; |
||
845 | // lcd_printp_at (14, 2, PSTR("Inverse"), 0); |
||
846 | lcd_puts_at(14, 2, strGet(REVERSE), 0); |
||
847 | } |
||
848 | |||
849 | if ((get_key_press (1 << KEY_MINUS)) && (Value == 4)) |
||
850 | { |
||
851 | Value=0; |
||
852 | // lcd_printp_at (14, 2, PSTR("Normal "), 0); |
||
853 | lcd_puts_at(14, 2, strGet(NORMAL), 0); |
||
854 | } |
||
855 | |||
856 | if (get_key_press (1 << KEY_ENTER)) |
||
857 | { |
||
858 | edit = 1; |
||
859 | cli(); |
||
860 | clr_A0 (); |
||
861 | |||
862 | if (Value == 0) |
||
863 | send_byte (0xA6); // normal |
||
864 | else |
||
865 | send_byte (0xA7); // inverse |
||
866 | |||
867 | set_A0 (); |
||
868 | sei(); |
||
869 | LCD_DisplayMode = Value; |
||
870 | WriteParameter(); |
||
871 | |||
872 | return Value; |
||
873 | } |
||
874 | } |
||
875 | |||
876 | while (!get_key_press (1 << KEY_ESC)); |
||
877 | { |
||
878 | get_key_press(KEY_ALL); |
||
879 | edit = 0; |
||
880 | LCD_DisplayMode = Pre; |
||
881 | return Pre; |
||
882 | } |
||
883 | } |
||
884 | |||
885 | |||
886 | //-------------------------------------------------------------- |
||
887 | uint8_t Edit_DisplayKontrast(uint8_t Value, uint8_t min, uint8_t max,uint8_t Text) |
||
888 | { |
||
889 | Pre = Value; |
||
890 | lcd_cls(); |
||
891 | // lcd_printp_at (0, 2, Text, 0); |
||
892 | lcd_puts_at(0, 2, strGet(Text), 0); |
||
893 | write_ndigit_number_u (16, 2, Value, 3, 0,0); |
||
894 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
895 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
896 | |||
897 | do |
||
898 | { |
||
899 | write_ndigit_number_u (16, 2,Value, 3, 0,0); |
||
900 | lcd_frect ((8*0), (8*4), (Value * (16*8) / 64), 6, 1); |
||
901 | |||
902 | if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) && (Value < max)) |
||
903 | { |
||
904 | Value++; |
||
905 | |||
906 | if (Value >= max) |
||
907 | { |
||
908 | Value = max; |
||
909 | set_beep ( 200, 0x0080, BeepNormal); |
||
910 | } |
||
911 | else |
||
912 | { |
||
913 | cli(); |
||
914 | clr_A0 (); |
||
915 | send_byte (0x81); |
||
916 | send_byte (Value); // Daten zum LCD senden |
||
917 | set_A0 (); |
||
918 | sei(); |
||
919 | } |
||
920 | } |
||
921 | |||
922 | if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) && (Value > min)) |
||
923 | { |
||
924 | lcd_frect (((Value - 1) * (16*8) / 64), (8*4), (16*8), 6, 0); |
||
925 | Value--; |
||
926 | |||
927 | if (Value == min) |
||
928 | { |
||
929 | Value = min; |
||
930 | set_beep ( 200, 0x0080, BeepNormal); |
||
931 | } |
||
932 | else |
||
933 | { |
||
934 | // edit = 1; |
||
935 | cli(); |
||
936 | clr_A0 (); |
||
937 | send_byte (0x81); |
||
938 | send_byte (Value); // Daten zum LCD senden |
||
939 | set_A0 (); |
||
940 | sei(); |
||
941 | } |
||
942 | } |
||
943 | write_ndigit_number_u (16, 2,Value, 3, 0,0); |
||
944 | |||
945 | if (get_key_press (1 << KEY_ENTER)) |
||
946 | { |
||
947 | edit = 1; |
||
948 | LCD_Kontrast = Value; |
||
949 | WriteParameter(); |
||
950 | return Value; |
||
951 | } |
||
952 | } |
||
953 | |||
954 | while (!get_key_press (1 << KEY_ESC)); |
||
955 | { |
||
956 | get_key_press(KEY_ALL); |
||
957 | cli(); |
||
958 | clr_A0 (); |
||
959 | send_byte (0x81); |
||
960 | send_byte (Pre); // Daten zum LCD senden |
||
961 | set_A0 (); |
||
962 | sei(); |
||
963 | edit = 0; |
||
964 | LCD_Kontrast = Pre; |
||
965 | WriteParameter(); |
||
966 | return Pre; |
||
967 | } |
||
968 | } |
||
969 | |||
970 | |||
971 | //-------------------------------------------------------------- |
||
972 | uint8_t Edit_DisplayHelligkeit(uint8_t Value, uint8_t min, uint8_t max, uint8_t Text) |
||
973 | { |
||
974 | float ValCorr = 2.55; // (Value * ValCorr) maximal 255 |
||
975 | Pre = Value; |
||
976 | OCR2A = Value * ValCorr; |
||
977 | |||
978 | lcd_cls(); |
||
979 | // lcd_printp_at (0, 2, Text, 0); |
||
980 | lcd_puts_at(0, 2, strGet(Text), 0); |
||
981 | write_ndigit_number_u (16, 2, Value, 3, 0,0); |
||
982 | lcd_printp_at (17, 2, PSTR("%"), 0); |
||
983 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
984 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
985 | |||
986 | do |
||
987 | { |
||
988 | write_ndigit_number_u (16, 2,Value, 3, 0,0); |
||
989 | lcd_frect ((8*0), (8*4), (Value * (16*8) / 100), 6, 1); |
||
990 | |||
991 | if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) && (Value < max)) |
||
992 | { |
||
993 | Value++; |
||
994 | |||
995 | if (Value >= max) |
||
996 | { |
||
997 | Value = max; |
||
998 | set_beep ( 200, 0x0080, BeepNormal); |
||
999 | } |
||
1000 | else |
||
1001 | OCR2A = Value * ValCorr; |
||
1002 | |||
1003 | } |
||
1004 | |||
1005 | if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) && (Value > min)) |
||
1006 | { |
||
1007 | lcd_frect (((Value - 1) * (16*8) / 100), (8*4), (16*8), 6, 0); |
||
1008 | Value--; |
||
1009 | |||
1010 | if (Value == min) |
||
1011 | { |
||
1012 | Value = min; |
||
1013 | set_beep ( 200, 0x0080, BeepNormal); |
||
1014 | } |
||
1015 | else |
||
1016 | OCR2A = Value * ValCorr; |
||
1017 | |||
1018 | } |
||
1019 | |||
1020 | if (get_key_press (1 << KEY_ENTER)) |
||
1021 | { |
||
1022 | edit = 1; |
||
1023 | OCR2A = Value * ValCorr; |
||
1024 | LCD_Helligkeit = Value; |
||
1025 | WriteParameter(); |
||
1026 | return Value; |
||
1027 | } |
||
1028 | } |
||
1029 | |||
1030 | while (!get_key_press (1 << KEY_ESC)); |
||
1031 | { |
||
1032 | get_key_press(KEY_ALL); |
||
1033 | edit = 0; |
||
1034 | OCR2A = Pre * ValCorr; |
||
1035 | LCD_Helligkeit = Pre; |
||
1036 | WriteParameter(); |
||
1037 | return Pre; |
||
1038 | } |
||
1039 | } |
||
1040 | |||
1041 | |||
1042 | //-------------------------------------------------------------- |
||
1043 | void Reset_EEprom(void) |
||
1044 | { |
||
1045 | lcd_cls(); |
||
1046 | get_key_press(KEY_ALL); |
||
1047 | // lcd_printp_at (0, 2, PSTR(" EEProm wirklich"), 0); |
||
1048 | // lcd_printp_at (0, 3, PSTR(" löschen?"), 0); |
||
1049 | // lcd_printp_at (12, 7, PSTR("Ende OK"), 0); |
||
1050 | lcd_puts_at(0, 2, strGet(EEPROM1), 0); |
||
1051 | lcd_puts_at(0, 3, strGet(EEPROM2), 0); |
||
1052 | lcd_puts_at(12, 7, strGet(ENDOK), 0); |
||
1053 | |||
1054 | |||
1055 | do |
||
1056 | { |
||
1057 | |||
1058 | if (get_key_press (1 << KEY_ENTER)) |
||
1059 | { |
||
1060 | Delete_EEPROM(); |
||
1061 | return; |
||
1062 | } |
||
1063 | } |
||
1064 | while (!get_key_press (1 << KEY_ESC)); |
||
1065 | get_key_press(KEY_ALL); |
||
1066 | } |
||
1067 | |||
1068 | |||
1069 | //-------------------------------------------------------------- |
||
1070 | void PKT_Setup (void) |
||
1071 | { |
||
1072 | uint8_t ii = 0; |
||
1073 | uint8_t Offset = 0; |
||
1074 | uint8_t size = 0; |
||
1075 | size = ITEMS_PKT; |
||
1076 | uint8_t dmode = 0; |
||
1077 | uint8_t target_pos = 1; |
||
1078 | uint8_t val; |
||
1079 | |||
1080 | lcd_cls (); |
||
1081 | mmode = 0; |
||
1082 | edit= 0; |
||
1083 | val = 0; |
||
1084 | |||
1085 | while(1) |
||
1086 | { |
||
1087 | lcd_cls (); |
||
1088 | lcd_printp_at (0, 0, PSTR(" PKT-Setup "), 2); |
||
1089 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
||
1090 | lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
||
1091 | |||
1092 | while(1) |
||
1093 | { |
||
1094 | ii = 0; |
||
1095 | |||
1096 | if(Offset > 0) |
||
1097 | lcd_printp_at(1,1, PSTR("\x12"), 0); |
||
1098 | |||
1099 | for(ii = 0;ii < 6 ; ii++) |
||
1100 | { |
||
1101 | if((ii+Offset) < size) |
||
1102 | lcd_printp_at(3,ii+1,param_menuitems_pkt[ii+Offset][DisplayLanguage], 0); |
||
1103 | |||
1104 | if((ii == 5)&&(ii+Offset < (size-1))) |
||
1105 | lcd_printp_at(1,6, PSTR("\x13"), 0); |
||
1106 | |||
1107 | } |
||
1108 | |||
1109 | if(dmode == 0) |
||
1110 | { |
||
1111 | if(Offset == 0) |
||
1112 | { |
||
1113 | if(size > 6) |
||
1114 | val = menu_choose2 (1, 5, target_pos,0,1); |
||
1115 | else |
||
1116 | val = menu_choose2 (1, size, target_pos,0,0); |
||
1117 | |||
1118 | } |
||
1119 | else |
||
1120 | val = menu_choose2 (2, 5, target_pos,1,1); |
||
1121 | |||
1122 | } |
||
1123 | |||
1124 | if(dmode == 1) |
||
1125 | { |
||
1126 | if(Offset+7 > size) |
||
1127 | val = menu_choose2 (2, 6, target_pos,1,0); |
||
1128 | else |
||
1129 | val = menu_choose2 (2, 5, target_pos,1,1); |
||
1130 | |||
1131 | } |
||
1132 | |||
1133 | if(val == 254) |
||
1134 | { |
||
1135 | Offset++; |
||
1136 | dmode = 1; |
||
1137 | target_pos = 5; |
||
1138 | } |
||
1139 | else if(val == 253) |
||
1140 | { |
||
1141 | Offset--; |
||
1142 | dmode = 0; |
||
1143 | target_pos = 2; |
||
1144 | } |
||
1145 | else if(val == 255) |
||
1146 | { // Ende mit ESC, speichern |
||
1147 | if (edit == 1) |
||
1148 | { |
||
1149 | WriteParameter(); |
||
1150 | return; |
||
1151 | } |
||
1152 | return; |
||
1153 | } |
||
1154 | else |
||
1155 | break; |
||
1156 | } |
||
1157 | target_pos = val; |
||
1158 | |||
1159 | // |
||
1160 | // {"Verbindung zum MK","connection to MK "," connexion a MK " ,"Aansluiting op MK"}, |
||
1161 | // {"MK LowBat Warnung","MK LowBat warning","MK LowBat Attent", "MK LoBat alarm "}, |
||
1162 | // {"Anzeige \x1d","Display \x1d","d'affichage \x1d","Display \x1d"}, |
||
1163 | // {"Wi.232 \x1d","Wi.232 \x1d","Wi.232 \x1d","Wi.232 \x1d"}, |
||
1164 | // {"BTM-222 \x1d","BTM-222 \x1d","BTM-222 \x1d","BTM-222 \x1d"}, |
||
1165 | // {"Antennen Track. \x1d","antenna tracking\x1d","antenna tracking\x1d","antenna tracking\x1d"}, |
||
1166 | // {"OSD \x1d","OSD \x1d","OSD \x1d","OSD \x1d"}, |
||
1167 | // {"GPS \x1d","GPS \x1d","GPS \x1d","GPS \x1d"}, |
||
1168 | // "Follow Me \x1d" |
||
1169 | // {"PKT-Akku \x1d","PKT-Accu \x1d","PKT-Accu \x1d","PKT-Accu \x1d"}, |
||
1170 | // {"PKT Update ","PKT Update ","PKT Mise a jour ","PKT Update "}, |
||
1171 | // {"Debug PKT ","Debug PKT ","Debug PKT ","Debug PKT "}, |
||
1172 | // {"EEProm Reset ","EEProm Reset ","EEProm Reinitiali","EEProm Reset "}, |
||
1173 | |||
1174 | |||
1175 | |||
1176 | if((val + Offset) == 1) |
||
1177 | { |
||
1178 | #ifdef HWVERSION3_9 |
||
1179 | U02SV2 = ChangeWi_SV2(U02SV2); |
||
1180 | |||
1181 | if (edit == 1) |
||
1182 | PKT_Change = 1; |
||
1183 | |||
1184 | #else |
||
1185 | Show_Error_HW12(); |
||
1186 | #endif |
||
1187 | } |
||
1188 | |||
1189 | |||
1190 | if((val + Offset) == 2) |
||
1191 | Display_Setup(); |
||
1192 | |||
1193 | if((val + Offset) == 3) |
||
1194 | { |
||
1195 | #if defined HWVERSION3_9 || defined HWVERSION1_2W || defined HWVERSION1_3W |
||
1196 | if(UseWi == false) |
||
1197 | // Wi_Use(); |
||
1198 | { |
||
1199 | UseWi = Edit_YesNo(UseWi,0,1,WI2321); |
||
1200 | if (edit==1) |
||
1201 | if (UseWi== true) InitWi232(PKT_Baudrate); |
||
1202 | } |
||
1203 | |||
1204 | else |
||
1205 | Wi_Setup(); |
||
1206 | #else |
||
1207 | Show_Error_HW12(); |
||
1208 | #endif |
||
1209 | } |
||
1210 | |||
1211 | if((val + Offset) == 4) |
||
1212 | { |
||
1213 | #ifdef HWVERSION3_9 |
||
1214 | if(UseBT == 0) |
||
1215 | { |
||
1216 | UseBT = Edit_YesNo(UseBT,0,1,BT1); |
||
1217 | if (edit==1) |
||
1218 | if (UseBT == 1) |
||
1219 | { |
||
1220 | if (bt_init()) BTIsSet = true; else BTIsSet = false; |
||
1221 | WriteParameter(); |
||
1222 | } |
||
1223 | } |
||
1224 | else |
||
1225 | BT_Setup(); |
||
1226 | #else |
||
1227 | Show_Error_HW12(); |
||
1228 | #endif |
||
1229 | } |
||
1230 | |||
1231 | if((val + Offset) == 5) |
||
1232 | { |
||
1233 | |||
1234 | } |
||
1235 | if((val + Offset) == 6) |
||
1236 | { |
||
1237 | OSD_Setup(); |
||
1238 | } |
||
1239 | #ifdef HWVERSION3_9 |
||
1240 | if((val + Offset) == 7) |
||
1241 | GPS_Setup(); |
||
1242 | |||
1243 | if((val + Offset) == 8) |
||
1244 | FollowMe_Setup(); |
||
1245 | |||
1246 | |||
1247 | |||
1248 | if((val + Offset) == 9) |
||
1249 | |||
1250 | Accu_Setup(); |
||
1251 | #else |
||
1252 | Show_Error_HW12(); |
||
1253 | #endif |
||
1254 | if((val + Offset) == 10) |
||
1255 | Update_PKT(); |
||
1256 | |||
1257 | if((val + Offset) == 11) |
||
1258 | Debug = Edit_Int_Value(Debug,0,1,DEBUGPKT); |
||
1259 | |||
1260 | if((val + Offset) == 12) |
||
1261 | Reset_EEprom(); |
||
1262 | |||
1263 | } |
||
1264 | } |
||
1265 | |||
1266 | |||
1267 | //-------------------------------------------------------------- |
||
1268 | void Display_Setup (void) |
||
1269 | { |
||
1270 | uint8_t ii = 0; |
||
1271 | uint8_t Offset = 0; |
||
1272 | uint8_t size = 0; |
||
1273 | size = ITEMS_LCD; |
||
1274 | uint8_t dmode = 0; |
||
1275 | uint8_t target_pos = 1; |
||
1276 | uint8_t val; |
||
1277 | |||
1278 | lcd_cls (); |
||
1279 | mmode = 0; |
||
1280 | edit= 0; |
||
1281 | LCD_Change = 0; |
||
1282 | val = 0; |
||
1283 | |||
1284 | while(1) |
||
1285 | { |
||
1286 | lcd_cls (); |
||
1287 | // lcd_printp_at (0, 0, PSTR(" Display Setup "), 2); |
||
1288 | lcd_puts_at(0, 0, strGet(DISPLAY1), 2); |
||
1289 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
||
1290 | lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
||
1291 | |||
1292 | while(1) |
||
1293 | { |
||
1294 | ii = 0; |
||
1295 | |||
1296 | if(Offset > 0) |
||
1297 | lcd_printp_at(1, 1, PSTR("\x12"), 0); |
||
1298 | |||
1299 | for(ii = 0; ii < 6 ; ii++) |
||
1300 | { |
||
1301 | if((ii + Offset) < size) |
||
1302 | lcd_printp_at(3, ii + 1, param_menuitems_lcd[ii + Offset][DisplayLanguage], 0); |
||
1303 | |||
1304 | if((ii == 5)&&(ii+Offset < (size - 1))) |
||
1305 | lcd_printp_at(1,6, PSTR("\x13"), 0); |
||
1306 | |||
1307 | } |
||
1308 | |||
1309 | if(dmode == 0) |
||
1310 | { |
||
1311 | if(Offset == 0) |
||
1312 | { |
||
1313 | if(size > 6) |
||
1314 | val = menu_choose2 (1, 5, target_pos,0,1); |
||
1315 | else |
||
1316 | val = menu_choose2 (1, size, target_pos,0,0); |
||
1317 | |||
1318 | } |
||
1319 | else |
||
1320 | val = menu_choose2 (2, 5, target_pos,1,1); |
||
1321 | |||
1322 | } |
||
1323 | |||
1324 | if(dmode == 1) |
||
1325 | { |
||
1326 | if(Offset + 7 > size) |
||
1327 | val = menu_choose2 (2, 6, target_pos,1,0); |
||
1328 | else |
||
1329 | val = menu_choose2 (2, 5, target_pos,1,1); |
||
1330 | |||
1331 | } |
||
1332 | |||
1333 | if(val == 254) |
||
1334 | { |
||
1335 | Offset++; |
||
1336 | dmode = 1; |
||
1337 | target_pos = 5; |
||
1338 | } |
||
1339 | else if(val == 253) |
||
1340 | { |
||
1341 | Offset--; |
||
1342 | dmode = 0; |
||
1343 | target_pos = 2; |
||
1344 | } |
||
1345 | else if(val == 255) |
||
1346 | { // Ende mit ESC, speichern |
||
1347 | if (edit == 1) |
||
1348 | { |
||
1349 | WriteParameter(); |
||
1350 | return; |
||
1351 | } |
||
1352 | return; |
||
1353 | } |
||
1354 | else |
||
1355 | break; |
||
1356 | } |
||
1357 | target_pos = val; |
||
1358 | |||
1359 | if((val + Offset) == 1) |
||
1360 | PKT_StartInfo = Edit_OnOff(PKT_StartInfo,0,2,DISPLAY2); |
||
1361 | if((val + Offset) == 2) |
||
1362 | OSD_RCErrorbeep = Edit_OnOff(OSD_RCErrorbeep,0,2,DISPLAY9); |
||
1363 | |||
1364 | if((val + Offset) == 3) |
||
1365 | DisplayLanguage = Edit_Language(DisplayLanguage,0,3,DISPLAY3); |
||
1366 | // Edit_Language(DisplayLanguage,0,3,DISPLAY3); |
||
1367 | |||
1368 | if((val + Offset) == 4) |
||
1369 | DisplayTimeout = Edit_Int_Value(DisplayTimeout,0,254,DISPLAY4); |
||
1370 | |||
1371 | if((val + Offset) == 5) |
||
1372 | LCD_Helligkeit = Edit_DisplayHelligkeit(LCD_Helligkeit,0,100,DISPLAY5); |
||
1373 | if (edit == 1) |
||
1374 | if(!LCD_Change) |
||
1375 | LCD_Change =1; |
||
1376 | |||
1377 | if((val + Offset) == 6) |
||
1378 | LCD_Kontrast = Edit_DisplayKontrast(LCD_Kontrast,0,63,DISPLAY6); |
||
1379 | if (edit == 1) |
||
1380 | if(!LCD_Change) |
||
1381 | LCD_Change =1; |
||
1382 | |||
1383 | if((val + Offset) == 7) |
||
1384 | { |
||
1385 | LCD_DisplayMode = Edit_DisplayMode(LCD_DisplayMode,0,4,DISPLAY7); |
||
1386 | if (edit == 1) |
||
1387 | if(!LCD_Change) |
||
1388 | LCD_Change =1; |
||
1389 | } |
||
1390 | |||
1391 | if((val + Offset) == 8) |
||
1392 | { |
||
1393 | LCD_Orientation = Edit_Orientation(LCD_Orientation,0,4,DISPLAY8); |
||
1394 | if (edit == 1) |
||
1395 | if(!LCD_Change) |
||
1396 | LCD_Change =1; |
||
1397 | } |
||
1398 | |||
1399 | |||
1400 | |||
1401 | |||
1402 | } |
||
1403 | } |
||
1404 | |||
1405 | #if defined HWVERSION3_9 || defined HWVERSION1_3W |
||
1406 | ////-------------------------------------------------------------- |
||
1407 | //void Wi_Use (void) |
||
1408 | //{ |
||
1409 | // Pre = UseWi; |
||
1410 | // |
||
1411 | // lcd_cls (); |
||
1412 | // |
||
1413 | // lcd_cls (); |
||
1414 | //// lcd_printp_at (0, 0, PSTR(" Wi.232 Setup "), 2); |
||
1415 | //// lcd_printp_at (0, 2, PSTR("Ist ein Wi.232-Modul "), 0); |
||
1416 | //// lcd_printp_at (0, 4, PSTR("eingebaut?"), 0); |
||
1417 | // lcd_puts_at(0, 0, strGet(WI2321), 2); |
||
1418 | // lcd_puts_at(0, 2, strGet(WI2322), 0); |
||
1419 | // lcd_puts_at(0, 4, strGet(WI2323), 0); |
||
1420 | //// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
1421 | // lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
1422 | // |
||
1423 | // while(1) |
||
1424 | // { |
||
1425 | // if(UseWi == false) |
||
1426 | //// lcd_printp_at (12, 4, PSTR("Nein"), 0); |
||
1427 | // lcd_puts_at(12, 4, strGet(NOO), 0); |
||
1428 | // else |
||
1429 | // //lcd_printp_at (12, 4, PSTR("Ja "), 0); |
||
1430 | // lcd_puts_at(12, 4, strGet(YES), 0); |
||
1431 | // |
||
1432 | // if(get_key_press (1 << KEY_MINUS)) |
||
1433 | // { |
||
1434 | // UseWi = false; |
||
1435 | // edit = 1; |
||
1436 | // } |
||
1437 | // |
||
1438 | // if(get_key_press (1 << KEY_PLUS)) |
||
1439 | // { |
||
1440 | // UseWi = true; |
||
1441 | // edit = 1; |
||
1442 | // } |
||
1443 | // |
||
1444 | // if(get_key_short (1 << KEY_ENTER)) |
||
1445 | // { |
||
1446 | //// WiIsSet = false; |
||
1447 | //// WriteParameter(); |
||
1448 | //// if(UseWi == true) |
||
1449 | //// Wi_Setup(); |
||
1450 | // return; |
||
1451 | // } |
||
1452 | // |
||
1453 | // if (get_key_press (1 << KEY_ESC)) |
||
1454 | // { |
||
1455 | // get_key_press(KEY_ALL); |
||
1456 | // UseWi = Pre; |
||
1457 | // return; |
||
1458 | // } |
||
1459 | // } |
||
1460 | //} |
||
1461 | |||
1462 | |||
1463 | //-------------------------------------------------------------- |
||
1464 | void Wi_Setup (void) |
||
1465 | { |
||
1466 | uint8_t ii = 0; |
||
1467 | uint8_t Offset = 0; |
||
1468 | uint8_t size = 0; |
||
1469 | size = ITEMS_WI; |
||
1470 | uint8_t dmode = 0; |
||
1471 | uint8_t target_pos = 1; |
||
1472 | uint8_t val = 0; |
||
1473 | |||
1474 | mmode = 0; |
||
1475 | edit = 0; |
||
1476 | // WiIsSet = true; |
||
1477 | |||
1478 | lcd_cls (); |
||
1479 | |||
1480 | while(1) |
||
1481 | { |
||
1482 | lcd_cls (); |
||
1483 | lcd_printp_at (0, 0, PSTR(" Wi.232 Setup "), 2); |
||
1484 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
||
1485 | lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
||
1486 | |||
1487 | while(1) |
||
1488 | { |
||
1489 | ii = 0; |
||
1490 | |||
1491 | if(Offset > 0) |
||
1492 | lcd_printp_at(1, 1, PSTR("\x12"), 0); |
||
1493 | |||
1494 | for(ii = 0; ii < 6; ii++) |
||
1495 | { |
||
1496 | if((ii + Offset) < size) |
||
1497 | lcd_printp_at(3, ii+1, param_menuitems_wi[ii+Offset][DisplayLanguage], 0); |
||
1498 | |||
1499 | if((ii == 5)&&(ii + Offset < (size - 1))) |
||
1500 | lcd_printp_at(1, 6, PSTR("\x13"), 0); |
||
1501 | |||
1502 | } |
||
1503 | |||
1504 | if(dmode == 0) |
||
1505 | { |
||
1506 | if(Offset == 0) |
||
1507 | { |
||
1508 | if(size > 6) |
||
1509 | val = menu_choose2 (1, 5, target_pos,0,1); |
||
1510 | else |
||
1511 | val = menu_choose2 (1, size, target_pos,0,0); |
||
1512 | |||
1513 | } |
||
1514 | else |
||
1515 | val = menu_choose2 (2, 5, target_pos,1,1); |
||
1516 | |||
1517 | } |
||
1518 | |||
1519 | if(dmode == 1) |
||
1520 | { |
||
1521 | if(Offset + 7 > size) |
||
1522 | val = menu_choose2 (2, 6, target_pos, 1, 0); |
||
1523 | else |
||
1524 | val = menu_choose2 (2, 5, target_pos, 1, 1); |
||
1525 | |||
1526 | } |
||
1527 | |||
1528 | if(val == 254) |
||
1529 | { |
||
1530 | Offset++; |
||
1531 | dmode = 1; |
||
1532 | target_pos = 5; |
||
1533 | } |
||
1534 | else if(val == 253) |
||
1535 | { |
||
1536 | Offset--; |
||
1537 | dmode = 0; |
||
1538 | target_pos = 2; |
||
1539 | } |
||
1540 | else if(val == 255) |
||
1541 | { // Ende mit ESC, speichern |
||
1542 | if (edit == 1) |
||
1543 | { |
||
1544 | if (UseWi==true) InitWi232(PKT_Baudrate); |
||
1545 | WriteParameter(); |
||
1546 | } |
||
1547 | |||
1548 | return; |
||
1549 | } |
||
1550 | else |
||
1551 | |||
1552 | break; |
||
1553 | } |
||
1554 | target_pos = val; |
||
1555 | |||
1556 | if((val + Offset) == 1) |
||
1557 | { |
||
1558 | UseWi = Edit_YesNo(UseWi,0,1,WI2321); |
||
1559 | } |
||
1560 | |||
1561 | if((val + Offset) == 2) |
||
1562 | { |
||
1563 | WiTXRXChannel = Edit_Int_Value(WiTXRXChannel, 0, 5,WITXRX); |
||
1564 | |||
1565 | } |
||
1566 | |||
1567 | if((val + Offset) == 3) |
||
1568 | { |
||
1569 | WiNetworkGroup = Edit_Int_Value(WiNetworkGroup, 0, 127, WINETWG); |
||
1570 | |||
1571 | |||
1572 | } |
||
1573 | |||
1574 | if((val + Offset) == 4) |
||
1575 | { |
||
1576 | WiNetworkMode = Edit_Wi_NetMode_Value(WiNetworkMode); |
||
1577 | |||
1578 | |||
1579 | } |
||
1580 | |||
1581 | if((val + Offset) == 5) |
||
1582 | { |
||
1583 | WiTXTO = Edit_Int_Value(WiTXTO,0,127,WITIMEOUT); |
||
1584 | |||
1585 | |||
1586 | } |
||
1587 | |||
1588 | if((val + Offset) == 6) |
||
1589 | { |
||
1590 | WiUartMTU = Edit_Int_Value(WiUartMTU,0,127,WIUART); |
||
1591 | |||
1592 | |||
1593 | } |
||
1594 | |||
1595 | if((val + Offset) == 7) |
||
1596 | { |
||
1597 | PKT_Baudrate = Edit_Baudrate(PKT_Baudrate,0,5,PKT_BAUDRATE); |
||
1598 | New_Baudrate = PKT_Baudrate; |
||
1599 | //TODO: //if (edit==1) bt_init(); |
||
1600 | } |
||
1601 | |||
1602 | |||
1603 | |||
1604 | if((val + Offset) == 8) |
||
1605 | InitWi232(PKT_Baudrate); |
||
1606 | #if defined HWVERSION3_9 |
||
1607 | if((val + Offset) == 9) |
||
1608 | Port_USB2CFG_Wi(); |
||
1609 | #endif |
||
1610 | } |
||
1611 | } |
||
1612 | #endif |
||
1613 | |||
1614 | #ifdef HWVERSION3_9 |
||
1615 | //-------------------------------------------------------------- |
||
1616 | //17.6.12 gelöschtCB, geändert durch HaraldB |
||
1617 | //uint8_t Edit_String(const char *data, const uint8_t length, uint8_t type, const char *Text) |
||
1618 | //{ |
||
1619 | // uint8_t y = 1; |
||
1620 | // uint8_t x = 1; |
||
1621 | // uint8_t I = 0; |
||
1622 | // |
||
1623 | // lcd_cls(); |
||
1624 | // lcd_printp_at (0, 0, Text, 2); |
||
1625 | // |
||
1626 | // for (uint8_t i = 0; i < length; i++) |
||
1627 | // { |
||
1628 | // lcd_putc (y++, 3, data[i], 0); |
||
1629 | // lcd_printp_at (y++, 3, PSTR(" "), 0); |
||
1630 | // |
||
1631 | // EditString[i] = data[i]; |
||
1632 | // } |
||
1633 | // |
||
1634 | // lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 1); |
||
1635 | // lcd_printp_at (0, 6, PSTR(" C"), 0); |
||
1636 | // lcd_printp_at (0, 7, PSTR(" \x17 \x16 \x19 OK"), 0); |
||
1637 | // |
||
1638 | // do |
||
1639 | // { |
||
1640 | // if (type == 1) // Name |
||
1641 | // { |
||
1642 | // for (uint8_t i = bt_name_length; i > 0; i--) |
||
1643 | // { |
||
1644 | // if (EditString[i - 1] != ' ') |
||
1645 | // { |
||
1646 | // bt_name_len = i; |
||
1647 | // break; |
||
1648 | // } |
||
1649 | // } |
||
1650 | // |
||
1651 | // if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) && EditString[I] < 'z') |
||
1652 | // { |
||
1653 | // EditString[I]++; |
||
1654 | // |
||
1655 | // if (EditString[I] >= 0x00 && EditString[I] < ' ') |
||
1656 | // EditString[I] = ' '; |
||
1657 | // |
||
1658 | // if (EditString[I] > ' ' && EditString[I] < '0') |
||
1659 | // EditString[I] = '0'; |
||
1660 | // |
||
1661 | // if (EditString[I] > '9' && EditString[I] < 'A') |
||
1662 | // EditString[I] = 'A'; |
||
1663 | // |
||
1664 | // if (EditString[I] > 'Z' && EditString[I] < 'a') |
||
1665 | // EditString[I] = 'a'; |
||
1666 | // |
||
1667 | // lcd_putc (x, 3, EditString[I], 0); |
||
1668 | // edit = 1; |
||
1669 | // } |
||
1670 | // |
||
1671 | // if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) && EditString[I] > ' ') |
||
1672 | // { |
||
1673 | // EditString[I]--; |
||
1674 | // |
||
1675 | // if (EditString[I] < 'a' && EditString[I] > 'Z') |
||
1676 | // EditString[I] = 'Z'; |
||
1677 | // |
||
1678 | // if (EditString[I] < 'A' && EditString[I] > '9') |
||
1679 | // EditString[I] = '9'; |
||
1680 | // |
||
1681 | // if (EditString[I] < '0' && EditString[I] > ' ') |
||
1682 | // EditString[I] = ' '; |
||
1683 | // |
||
1684 | // lcd_putc (x, 3, EditString[I], 0); |
||
1685 | // edit = 1; |
||
1686 | // } |
||
1687 | // } |
||
1688 | // else if (type == 2) // PIN |
||
1689 | // { |
||
1690 | // if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) && (EditString[I] < '9')) |
||
1691 | // { |
||
1692 | // EditString[I]++; |
||
1693 | // lcd_putc (x, 3, EditString[I], 0); |
||
1694 | // edit = 1; |
||
1695 | // } |
||
1696 | // |
||
1697 | // if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) && (EditString[I] > '0')) |
||
1698 | // { |
||
1699 | // EditString[I]--; |
||
1700 | // lcd_putc (x, 3, EditString[I], 0); |
||
1701 | // edit = 1; |
||
1702 | // } |
||
1703 | // } |
||
1704 | // |
||
1705 | // if (get_key_long (1 << KEY_ESC)) |
||
1706 | // { |
||
1707 | // EditString[I] = ' '; // Zeichen l�schen |
||
1708 | // lcd_putc (x, 3, EditString[I], 0); |
||
1709 | // edit = 1; |
||
1710 | // } |
||
1711 | // |
||
1712 | // if (get_key_short (1 << KEY_ESC)) |
||
1713 | // { |
||
1714 | // if ((x / 2) + 2 > bt_name_length) |
||
1715 | // { |
||
1716 | // lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 0); |
||
1717 | // x = 1; |
||
1718 | // lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 1); |
||
1719 | // I = 0; |
||
1720 | // } |
||
1721 | // else |
||
1722 | // { |
||
1723 | // lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 0); |
||
1724 | // x++; |
||
1725 | // x++; |
||
1726 | // lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 1); |
||
1727 | // I++; //Zeiger auf Zeichen |
||
1728 | // } |
||
1729 | // } |
||
1730 | // } |
||
1731 | // while (!get_key_press (1 << KEY_ENTER)); |
||
1732 | // { |
||
1733 | // get_key_press(KEY_ALL); |
||
1734 | // return 1; |
||
1735 | // } |
||
1736 | //} |
||
1737 | |||
1738 | uint8_t Edit_String(const char *data, const uint8_t length, uint8_t type, const char *Text) |
||
1739 | { |
||
1740 | uint8_t y = 1; |
||
1741 | uint8_t x = 1; |
||
1742 | uint8_t I = 0; |
||
1743 | |||
1744 | lcd_cls(); |
||
1745 | lcd_printp_at (0, 0, Text, 2); |
||
1746 | |||
1747 | for (uint8_t i = 0; i < length; i++) |
||
1748 | { |
||
1749 | lcd_putc (y++, 3, data[i], 0); |
||
1750 | lcd_printp_at (y++, 3, PSTR(" "), 0); |
||
1751 | |||
1752 | EditString[i] = data[i]; |
||
1753 | } |
||
1754 | |||
1755 | lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 1); |
||
1756 | lcd_printp_at (0, 6, PSTR(" C"), 0); |
||
1757 | lcd_printp_at (0, 7, PSTR(" \x17 \x16 \x19 OK"), 0); |
||
1758 | |||
1759 | do |
||
1760 | { |
||
1761 | if (type == 1) // Name |
||
1762 | { |
||
1763 | for (uint8_t i = bt_name_length; i > 0; i--) |
||
1764 | { |
||
1765 | if (EditString[i - 1] != ' ') |
||
1766 | { |
||
1767 | bt_name_len = i; |
||
1768 | break; |
||
1769 | } |
||
1770 | } |
||
1771 | |||
1772 | if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) && EditString[I] < 'z') |
||
1773 | { |
||
1774 | EditString[I]++; |
||
1775 | |||
1776 | //if (EditString[I] >= 0x00 && EditString[I] < ' ') // MartinR: Compilerwarnung |
||
1777 | if (EditString[I] < ' ') // MartinR: geändert |
||
1778 | EditString[I] = ' '; |
||
1779 | |||
1780 | if (EditString[I] > ' ' && EditString[I] < '0') |
||
1781 | EditString[I] = '0'; |
||
1782 | |||
1783 | if (EditString[I] > '9' && EditString[I] < 'A') |
||
1784 | EditString[I] = 'A'; |
||
1785 | |||
1786 | if (EditString[I] > 'Z' && EditString[I] < 'a') |
||
1787 | EditString[I] = 'a'; |
||
1788 | |||
1789 | lcd_putc (x, 3, EditString[I], 0); |
||
1790 | edit = 1; |
||
1791 | } |
||
1792 | |||
1793 | if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) && EditString[I] > ' ') |
||
1794 | { |
||
1795 | EditString[I]--; |
||
1796 | |||
1797 | if (EditString[I] < 'a' && EditString[I] > 'Z') |
||
1798 | EditString[I] = 'Z'; |
||
1799 | |||
1800 | if (EditString[I] < 'A' && EditString[I] > '9') |
||
1801 | EditString[I] = '9'; |
||
1802 | |||
1803 | if (EditString[I] < '0' && EditString[I] > ' ') |
||
1804 | EditString[I] = ' '; |
||
1805 | |||
1806 | lcd_putc (x, 3, EditString[I], 0); |
||
1807 | edit = 1; |
||
1808 | } |
||
1809 | } |
||
1810 | else if (type == 2) // PIN |
||
1811 | { |
||
1812 | if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) && (EditString[I] < '9')) |
||
1813 | { |
||
1814 | EditString[I]++; |
||
1815 | |||
1816 | //if (EditString[I] >= 0x00 && EditString[I] < ' ') // MartinR: Compilerwarnung |
||
1817 | if (EditString[I] < ' ') // MartinR: geändert |
||
1818 | EditString[I] = ' '; |
||
1819 | if (EditString[I] > ' ' && EditString[I] < '0') |
||
1820 | EditString[I] = '0'; |
||
1821 | |||
1822 | lcd_putc (x, 3, EditString[I], 0); |
||
1823 | edit = 1; |
||
1824 | } |
||
1825 | |||
1826 | if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) && (EditString[I] > '0')) |
||
1827 | { |
||
1828 | EditString[I]--; |
||
1829 | |||
1830 | if (EditString[I] < 'A' && EditString[I] > '9') |
||
1831 | EditString[I] = '9'; |
||
1832 | |||
1833 | lcd_putc (x, 3, EditString[I], 0); |
||
1834 | edit = 1; |
||
1835 | } |
||
1836 | } |
||
1837 | |||
1838 | if (get_key_long (1 << KEY_ESC)) |
||
1839 | { |
||
1840 | if (type == 1) // Name |
||
1841 | EditString[I] = ' '; // Zeichen l�schen |
||
1842 | else if (type == 2) // Pin |
||
1843 | EditString[I] = '0'; // Zeichen setzen |
||
1844 | lcd_putc (x, 3, EditString[I], 0); |
||
1845 | edit = 1; |
||
1846 | } |
||
1847 | |||
1848 | if (get_key_short (1 << KEY_ESC)) |
||
1849 | { |
||
1850 | if (type == 1) |
||
1851 | length_tmp = bt_name_length; |
||
1852 | else if (type == 2) |
||
1853 | length_tmp = bt_pin_length; |
||
1854 | |||
1855 | if ((x / 2) + 2 > length_tmp) |
||
1856 | { |
||
1857 | lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 0); |
||
1858 | x = 1; |
||
1859 | lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 1); |
||
1860 | I = 0; |
||
1861 | } |
||
1862 | else |
||
1863 | { |
||
1864 | lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 0); |
||
1865 | x++; |
||
1866 | x++; |
||
1867 | lcd_rect ((x*6)-3, (8*3)-2, 10, 10, 1); |
||
1868 | I++; //Zeiger auf Zeichen |
||
1869 | } |
||
1870 | } |
||
1871 | } |
||
1872 | while (!get_key_press (1 << KEY_ENTER)); |
||
1873 | { |
||
1874 | return 1; |
||
1875 | } |
||
1876 | } |
||
1877 | ////-------------------------------------------------------------- |
||
1878 | //void BT_Use (void) |
||
1879 | //{ |
||
1880 | // Pre = UseBT; |
||
1881 | // |
||
1882 | // lcd_cls (); |
||
1883 | // |
||
1884 | // lcd_cls (); |
||
1885 | //// lcd_printp_at (0, 0, PSTR(" BTM-222 Setup "), 2); |
||
1886 | //// lcd_printp_at (0, 2, PSTR("Ist ein BTM-222-Modul"), 0); |
||
1887 | //// lcd_printp_at (0, 4, PSTR("eingebaut?"), 0); |
||
1888 | // lcd_puts_at(0, 0, strGet(BT1), 2); |
||
1889 | // lcd_puts_at(0, 2, strGet(BT2), 0); |
||
1890 | // lcd_puts_at(0, 4, strGet(BT3), 0); |
||
1891 | //// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
1892 | // lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
1893 | // |
||
1894 | // while(1) |
||
1895 | // { |
||
1896 | // if(UseBT == false) |
||
1897 | //// lcd_printp_at (12, 4, PSTR("Nein"), 0); |
||
1898 | // lcd_puts_at(12, 4, strGet(NOO), 0); |
||
1899 | // else |
||
1900 | //// lcd_printp_at (12, 4, PSTR("Ja "), 0); |
||
1901 | // lcd_puts_at(12, 4, strGet(YES), 0); |
||
1902 | // if(get_key_press (1 << KEY_MINUS)) |
||
1903 | // UseBT = false; |
||
1904 | // |
||
1905 | // if(get_key_press (1 << KEY_PLUS)) |
||
1906 | // UseBT = true; |
||
1907 | // |
||
1908 | // if(get_key_short (1 << KEY_ENTER)) |
||
1909 | // { |
||
1910 | //// BTIsSet = false; |
||
1911 | // WriteParameter(); |
||
1912 | // if(UseBT == true) |
||
1913 | // BT_Setup(); |
||
1914 | // return; |
||
1915 | // } |
||
1916 | // |
||
1917 | // if (get_key_press (1 << KEY_ESC)) |
||
1918 | // { |
||
1919 | // get_key_press(KEY_ALL); |
||
1920 | // UseBT = Pre; |
||
1921 | // return; |
||
1922 | // } |
||
1923 | // } |
||
1924 | //} |
||
1925 | #ifdef HWVERSION3_9 |
||
1926 | void BT_SelectDevice (void) |
||
1927 | { |
||
1928 | uint8_t ii = 0; |
||
1929 | uint8_t Offset = 0; |
||
1930 | uint8_t size = 0; |
||
1931 | size = bt_devicecount; |
||
1932 | uint8_t dmode = 0; |
||
1933 | uint8_t target_pos = 1; |
||
1934 | uint8_t val = 0; |
||
1935 | |||
1936 | mmode = 0; |
||
1937 | edit = 0; |
||
1938 | |||
1939 | |||
1940 | lcd_cls (); |
||
1941 | |||
1942 | while(1) |
||
1943 | { |
||
1944 | lcd_cls (); |
||
1945 | lcd_printp_at (0, 0, PSTR(" BT select Device "), 2); |
||
1946 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
||
1947 | lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
||
1948 | |||
1949 | while(1) |
||
1950 | { |
||
1951 | ii = 0; |
||
1952 | |||
1953 | if(Offset > 0) |
||
1954 | lcd_printp_at(1, 1, PSTR("\x12"), 0); |
||
1955 | |||
1956 | for(ii = 0; ii < 6; ii++) |
||
1957 | { |
||
1958 | if((ii + Offset) < size) |
||
1959 | { |
||
1960 | if (strncmp (device_list[ii + Offset].mac, gps_UsedMac, 14) == 0) |
||
1961 | { |
||
1962 | lcd_puts_at(3, ii+1, device_list[ii + Offset].DevName, 2); |
||
1963 | } |
||
1964 | else |
||
1965 | { |
||
1966 | lcd_puts_at(3, ii+1, device_list[ii + Offset].DevName, 0); |
||
1967 | } |
||
1968 | } |
||
1969 | |||
1970 | if((ii == 5)&&(ii + Offset < (size - 1))) |
||
1971 | lcd_printp_at(1, 6, PSTR("\x13"), 0); |
||
1972 | |||
1973 | } |
||
1974 | |||
1975 | if(dmode == 0) |
||
1976 | { |
||
1977 | if(Offset == 0) |
||
1978 | { |
||
1979 | if(size > 6) |
||
1980 | val = menu_choose2 (1, 5, target_pos,0,1); |
||
1981 | else |
||
1982 | val = menu_choose2 (1, size, target_pos,0,0); |
||
1983 | |||
1984 | } |
||
1985 | else |
||
1986 | val = menu_choose2 (2, 5, target_pos,1,1); |
||
1987 | |||
1988 | } |
||
1989 | |||
1990 | if(dmode == 1) |
||
1991 | { |
||
1992 | if(Offset + 7 > size) |
||
1993 | val = menu_choose2 (2, 6, target_pos, 1, 0); |
||
1994 | else |
||
1995 | val = menu_choose2 (2, 5, target_pos, 1, 1); |
||
1996 | |||
1997 | } |
||
1998 | |||
1999 | if(val == 254) |
||
2000 | { |
||
2001 | Offset++; |
||
2002 | dmode = 1; |
||
2003 | target_pos = 5; |
||
2004 | } |
||
2005 | else if(val == 253) |
||
2006 | { |
||
2007 | Offset--; |
||
2008 | dmode = 0; |
||
2009 | target_pos = 2; |
||
2010 | } |
||
2011 | else if(val == 255) |
||
2012 | { // Ende mit ESC, speichern |
||
2013 | if (edit == 1) |
||
2014 | { |
||
2015 | WriteParameter(); |
||
2016 | } |
||
2017 | |||
2018 | return; |
||
2019 | } |
||
2020 | else |
||
2021 | |||
2022 | break; |
||
2023 | } |
||
2024 | target_pos = val; |
||
2025 | |||
2026 | if(val > 0 ) |
||
2027 | { |
||
2028 | for(uint8_t i = 0; i < 14; i++) |
||
2029 | { |
||
2030 | gps_UsedMac[i] = device_list[val-1].mac[i]; |
||
2031 | } |
||
2032 | for(uint8_t i = 0; i < 20; i++) |
||
2033 | { |
||
2034 | gps_UsedDevName[i] = device_list[val-1].DevName[i]; |
||
2035 | } |
||
2036 | edit = 1; |
||
2037 | } |
||
2038 | } |
||
2039 | } |
||
2040 | #endif |
||
2041 | |||
2042 | //-------------------------------------------------------------- |
||
2043 | // |
||
2044 | void BT_Setup (void) |
||
2045 | { |
||
2046 | uint8_t ii = 0; |
||
2047 | uint8_t Offset = 0; |
||
2048 | uint8_t size = 0; |
||
2049 | size = ITEMS_BT; |
||
2050 | uint8_t dmode = 0; |
||
2051 | uint8_t target_pos = 1; |
||
2052 | uint8_t val; |
||
2053 | char string[20]; |
||
2054 | |||
2055 | mmode = 0; |
||
2056 | edit = 0; |
||
2057 | val = 0; |
||
2058 | // BTIsSet = true; |
||
2059 | |||
2060 | lcd_cls (); |
||
2061 | |||
2062 | while(1) |
||
2063 | { |
||
2064 | lcd_cls (); |
||
2065 | // lcd_printp_at (0, 0, PSTR(" BTM-222 Setup "), 2); |
||
2066 | lcd_puts_at(0, 0, strGet(BT1), 2); |
||
2067 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
||
2068 | lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
||
2069 | |||
2070 | while(1) |
||
2071 | { |
||
2072 | ii = 0; |
||
2073 | |||
2074 | if(Offset > 0) |
||
2075 | lcd_printp_at(1,1, PSTR("\x12"), 0); |
||
2076 | |||
2077 | for(ii = 0; ii < 6; ii++) |
||
2078 | { |
||
2079 | if((ii + Offset) < size) |
||
2080 | lcd_printp_at(3, ii + 1, param_menuitems_bt[ii+Offset][DisplayLanguage], 0); |
||
2081 | |||
2082 | if((ii == 5) && (ii + Offset < (size - 1))) |
||
2083 | lcd_printp_at(1,6, PSTR("\x13"), 0); |
||
2084 | |||
2085 | } |
||
2086 | |||
2087 | if(dmode == 0) |
||
2088 | { |
||
2089 | if(Offset == 0) |
||
2090 | { |
||
2091 | if(size > 6) |
||
2092 | val = menu_choose2 (1, 5, target_pos, 0, 1); |
||
2093 | else |
||
2094 | val = menu_choose2 (1, size, target_pos, 0, 0); |
||
2095 | |||
2096 | } |
||
2097 | else |
||
2098 | val = menu_choose2 (2, 5, target_pos, 1, 1); |
||
2099 | |||
2100 | } |
||
2101 | |||
2102 | if(dmode == 1) |
||
2103 | { |
||
2104 | if(Offset + 7 > size) |
||
2105 | val = menu_choose2 (2, 6, target_pos, 1, 0); |
||
2106 | else |
||
2107 | val = menu_choose2 (2, 5, target_pos, 1, 1); |
||
2108 | } |
||
2109 | |||
2110 | if(val == 254) |
||
2111 | { |
||
2112 | Offset++; |
||
2113 | dmode = 1; |
||
2114 | target_pos = 5; |
||
2115 | } |
||
2116 | else if(val == 253) |
||
2117 | { |
||
2118 | Offset--; |
||
2119 | dmode = 0; |
||
2120 | target_pos = 2; |
||
2121 | } |
||
2122 | else if(val == 255) |
||
2123 | { // Ende mit ESC, speichern |
||
2124 | // if (edit == 1) |
||
2125 | // { |
||
2126 | // if (UseBT == 1); |
||
2127 | // if (bt_init()) BTIsSet = true; else BTIsSet = false; |
||
2128 | // WriteParameter(); |
||
2129 | // return; |
||
2130 | // } |
||
2131 | return; |
||
2132 | } |
||
2133 | else |
||
2134 | |||
2135 | if (edit == 1) |
||
2136 | { |
||
2137 | if (UseBT == 1); |
||
2138 | if (bt_init()) BTIsSet = true; else BTIsSet = false; |
||
2139 | WriteParameter(); |
||
2140 | return; |
||
2141 | } |
||
2142 | |||
2143 | |||
2144 | |||
2145 | |||
2146 | break; |
||
2147 | } |
||
2148 | |||
2149 | target_pos = val; |
||
2150 | if((val + Offset) == 1) |
||
2151 | // BT_Use(); |
||
2152 | UseBT = Edit_YesNo(UseBT,0,1,BT4); |
||
2153 | |||
2154 | if((val + Offset) == 2) |
||
2155 | { |
||
2156 | for (uint8_t i = 0; i < bt_name_length; i++) |
||
2157 | { |
||
2158 | string[i] = bt_name[i]; |
||
2159 | } |
||
2160 | string[bt_name_length] = 0; |
||
2161 | Edit_String(string, bt_name_length, 1, PSTR(" Bluetooth Name ")); |
||
2162 | if (edit == 1) |
||
2163 | { |
||
2164 | for (uint8_t i = 0; i < bt_name_len; i++) |
||
2165 | { |
||
2166 | bt_name[i] = EditString[i]; |
||
2167 | WriteParameter(); |
||
2168 | } |
||
2169 | |||
2170 | if (bt_name_len < 10) |
||
2171 | { |
||
2172 | for (uint8_t i = bt_name_len; i < 10; i++) |
||
2173 | { |
||
2174 | bt_name[i] = ' '; |
||
2175 | WriteParameter(); |
||
2176 | } |
||
2177 | } |
||
2178 | } |
||
2179 | } |
||
2180 | |||
2181 | if((val + Offset) == 3) |
||
2182 | { |
||
2183 | for (uint8_t i = 0; i < bt_pin_length; i++) |
||
2184 | { |
||
2185 | string[i] = bt_pin[i]; |
||
2186 | } |
||
2187 | string[bt_pin_length] = 0; |
||
2188 | Edit_String(string, bt_pin_length, 2, PSTR(" Bluetooth Pin ")); |
||
2189 | if (edit == 1) |
||
2190 | { |
||
2191 | for (uint8_t i = 0; i < bt_pin_length; i++) |
||
2192 | { |
||
2193 | bt_pin[i] = EditString[i]; |
||
2194 | WriteParameter(); |
||
2195 | } |
||
2196 | } |
||
2197 | } |
||
2198 | |||
2199 | if((val + Offset) == 4) |
||
2200 | { |
||
2201 | // if (edit == 1) |
||
2202 | // if(BTIsSet) |
||
2203 | // BTIsSet = false; |
||
2204 | |||
2205 | if (bt_init() == true) |
||
2206 | { |
||
2207 | lcd_printp_at (0, 3, PSTR("BT Init ok"), 0); |
||
2208 | WriteBTInitFlag(); |
||
2209 | } |
||
2210 | else |
||
2211 | { |
||
2212 | lcd_printp_at (0, 3, PSTR("BT Init Error"), 0); |
||
2213 | BTIsSet = false; |
||
2214 | set_beep ( 1000, 0x0040, BeepNormal); |
||
2215 | |||
2216 | } |
||
2217 | } |
||
2218 | |||
2219 | if((val + Offset) == 5) |
||
2220 | Port_FC2CFG_BT(); |
||
2221 | |||
2222 | |||
2223 | } |
||
2224 | } |
||
2225 | |||
2226 | |||
2227 | void GPS_Setup (void) |
||
2228 | { |
||
2229 | uint8_t ii = 0; |
||
2230 | uint8_t Offset = 0; |
||
2231 | uint8_t size = 0; |
||
2232 | size = ITEMS_GPS; |
||
2233 | uint8_t dmode = 0; |
||
2234 | uint8_t target_pos = 1; |
||
2235 | uint8_t val; |
||
2236 | uint8_t BT_WhasOn = 0; |
||
2237 | |||
2238 | mmode = 0; |
||
2239 | edit = 0; |
||
2240 | val = 0; |
||
2241 | lcd_cls (); |
||
2242 | |||
2243 | while(1) |
||
2244 | { |
||
2245 | lcd_cls (); |
||
2246 | // lcd_printp_at (0, 0, PSTR(" PKT Accu Setup "), 2); |
||
2247 | lcd_puts_at(0, 0, strGet(GPS1), 2); |
||
2248 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
||
2249 | lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
||
2250 | |||
2251 | while(1) |
||
2252 | { |
||
2253 | ii = 0; |
||
2254 | |||
2255 | if(Offset > 0) |
||
2256 | lcd_printp_at(1,1, PSTR("\x12"), 0); |
||
2257 | |||
2258 | for(ii = 0; ii < 6; ii++) |
||
2259 | { |
||
2260 | if((ii + Offset) < size) |
||
2261 | lcd_printp_at(3, ii + 1, param_menuitems_GPS[ii+Offset][DisplayLanguage], 0); |
||
2262 | |||
2263 | if((ii == 5) && (ii + Offset < (size - 1))) |
||
2264 | lcd_printp_at(1,6, PSTR("\x13"), 0); |
||
2265 | |||
2266 | } |
||
2267 | |||
2268 | if(dmode == 0) |
||
2269 | { |
||
2270 | if(Offset == 0) |
||
2271 | { |
||
2272 | if(size > 6) |
||
2273 | val = menu_choose2 (1, 5, target_pos, 0, 1); |
||
2274 | else |
||
2275 | val = menu_choose2 (1, size, target_pos, 0, 0); |
||
2276 | |||
2277 | } |
||
2278 | else |
||
2279 | val = menu_choose2 (2, 5, target_pos, 1, 1); |
||
2280 | |||
2281 | } |
||
2282 | |||
2283 | if(dmode == 1) |
||
2284 | { |
||
2285 | if(Offset + 7 > size) |
||
2286 | val = menu_choose2 (2, 6, target_pos, 1, 0); |
||
2287 | else |
||
2288 | val = menu_choose2 (2, 5, target_pos, 1, 1); |
||
2289 | } |
||
2290 | |||
2291 | if(val == 254) |
||
2292 | { |
||
2293 | Offset++; |
||
2294 | dmode = 1; |
||
2295 | target_pos = 5; |
||
2296 | } |
||
2297 | else if(val == 253) |
||
2298 | { |
||
2299 | Offset--; |
||
2300 | dmode = 0; |
||
2301 | target_pos = 2; |
||
2302 | } |
||
2303 | else if(val == 255) |
||
2304 | { // Ende mit ESC, speichern |
||
2305 | if (edit == 1) |
||
2306 | { |
||
2307 | // WriteParameter(); |
||
2308 | if (BT_WhasOn) |
||
2309 | { |
||
2310 | set_BTOn(); |
||
2311 | // bt_set_mode(SLAVE); |
||
2312 | bt_init(); |
||
2313 | set_BTOff(); |
||
2314 | } |
||
2315 | |||
2316 | return; |
||
2317 | } |
||
2318 | return; |
||
2319 | } |
||
2320 | else |
||
2321 | break; |
||
2322 | } |
||
2323 | |||
2324 | target_pos = val; |
||
2325 | // |
||
2326 | // {"Suche GPS Maus ","search GPS mouse ","search GPS mouse ","search GPS mouse "}, |
||
2327 | // {"GPS Maus Typ ","GPS mouse typ ","GPS mouse typ ","GPS mouse typ "}, |
||
2328 | // {"GPS Maus aktiv? ","GPS mouse activ? ","GPS mouse activ? ","GPS mouse activ? "}, |
||
2329 | // {"Zeige GPS Device ","show GPS device ","show GPS device ","show GPS device "}, |
||
2330 | // |
||
2331 | |||
2332 | if((val + Offset) == 1) |
||
2333 | { |
||
2334 | if (bt_devicecount ==0) |
||
2335 | { |
||
2336 | lcd_cls (); |
||
2337 | lcd_printp_at (0, 0, PSTR("wähle BT Device"), 0); |
||
2338 | set_BTOn(); |
||
2339 | BT_WhasOn = true; |
||
2340 | // _delay_ms(2000); |
||
2341 | bt_downlink_init(); |
||
2342 | bt_searchDevice(); |
||
2343 | set_BTOff(); |
||
2344 | BT_SelectDevice(); |
||
2345 | } |
||
2346 | else |
||
2347 | BT_SelectDevice(); |
||
2348 | // if (edit == 1) WriteParameter(); |
||
2349 | } |
||
2350 | |||
2351 | if((val + Offset) == 2) |
||
2352 | { |
||
2353 | lcd_cls (); |
||
2354 | lcd_printp_at (0, 0, PSTR("suche BT Device"), 0); |
||
2355 | set_BTOn(); |
||
2356 | // _delay_ms(2000); |
||
2357 | BT_WhasOn = true; |
||
2358 | bt_downlink_init(); |
||
2359 | bt_searchDevice(); |
||
2360 | set_BTOff(); |
||
2361 | BT_SelectDevice(); |
||
2362 | } |
||
2363 | if((val + Offset) == 4) |
||
2364 | { |
||
2365 | gps_UseGPS = Edit_YesNo(gps_UseGPS,0,1,GPS3); |
||
2366 | if (edit == 1) WriteParameter(); |
||
2367 | } |
||
2368 | |||
2369 | if((val + Offset) == 5) |
||
2370 | { |
||
2371 | lcd_cls (); |
||
2372 | lcd_puts_at(0, 0, strGet(GPS2), 2); |
||
2373 | lcd_puts_at(18, 7, strGet(OK), 0); |
||
2374 | lcd_printp_at (0, 1, PSTR("Device:"), 0); |
||
2375 | lcd_printp_at (0, 4, PSTR("MAC:"), 0); |
||
2376 | |||
2377 | lcd_puts_at (0, 2,gps_UsedDevName, 0); |
||
2378 | |||
2379 | for(uint8_t i = 0; i < 12; i++) |
||
2380 | { |
||
2381 | lcd_putc (i, 5, gps_UsedMac[i],0); |
||
2382 | } |
||
2383 | |||
2384 | while (!get_key_press (1 << KEY_ENTER)); |
||
2385 | |||
2386 | } |
||
2387 | |||
2388 | |||
2389 | if((val + Offset) == 6) |
||
2390 | { |
||
2391 | lcd_cls (); |
||
2392 | lcd_puts_at(18, 7, strGet(OK), 0); |
||
2393 | lcd_puts_at (0, 0,gps_UsedDevName, 2); |
||
2394 | set_BTOn(); |
||
2395 | BT_WhasOn = true; |
||
2396 | if (BTIsSlave==true) |
||
2397 | { |
||
2398 | bt_downlink_init(); |
||
2399 | } |
||
2400 | if (bt_connect(gps_UsedMac)) |
||
2401 | { |
||
2402 | lcd_printp_at (0, 1, PSTR("connected"), 0); |
||
2403 | receiveNMEA = true; |
||
2404 | } |
||
2405 | if (receiveNMEA) |
||
2406 | { |
||
2407 | lcd_printp_at (0, 3, PSTR(" Latitude Longitude"), 2); |
||
2408 | do |
||
2409 | { |
||
2410 | // if (!bt_receiveNMEA()) break; |
||
2411 | //// Tracking_NMEA(); |
||
2412 | |||
2413 | write_ndigit_number_u (1, 4, (uint16_t)(NMEAlatitude/10000000), 2, 0,0); |
||
2414 | lcd_printp_at (3, 4, PSTR("."), 0); |
||
2415 | write_ndigit_number_u (4, 4, (uint16_t)((NMEAlatitude/1000) % 10000), 4, 1,0); |
||
2416 | write_ndigit_number_u (8, 4, (uint16_t)((NMEAlatitude/10) % 100), 2, 1,0); |
||
2417 | |||
2418 | |||
2419 | write_ndigit_number_u (12, 4, (uint16_t)(NMEAlongitude/10000000), 2, 0,0); |
||
2420 | lcd_printp_at (14, 4, PSTR("."), 0); |
||
2421 | write_ndigit_number_u (15, 4, (uint16_t)((NMEAlongitude/1000) % 10000), 4, 1,0); |
||
2422 | write_ndigit_number_u (19, 4, (uint16_t)((NMEAlongitude/10) % 100), 2, 1,0); |
||
2423 | lcd_printp_at (0, 2, PSTR("GPS Time: "), 0); |
||
2424 | lcd_puts_at (10, 2, NMEATime, 0); |
||
2425 | lcd_printp_at (0, 6, PSTR(" Satellite: "), 0); |
||
2426 | write_ndigit_number_u (13, 6, NMEAsatsInUse, 2, 1,0); |
||
2427 | // lcd_printp_at (0, 2, PSTR(" BT RX Error: "), 0); |
||
2428 | // write_ndigit_number_u (13, 2, bt_rxerror, 3, 1); |
||
2429 | |||
2430 | } |
||
2431 | |||
2432 | while (!get_key_press (1 << KEY_ENTER)); |
||
2433 | |||
2434 | lcd_cls_line(0,1,21); |
||
2435 | lcd_cls_line(0,2,21); |
||
2436 | lcd_cls_line(0,3,21); |
||
2437 | lcd_cls_line(0,4,21); |
||
2438 | lcd_cls_line(0,5,21); |
||
2439 | lcd_cls_line(0,6,21); |
||
2440 | lcd_printp_at (0, 3, PSTR("GPS trennen"), 0); |
||
2441 | } |
||
2442 | else |
||
2443 | { |
||
2444 | lcd_printp_at (0, 1, PSTR("Error at connecting"), 0); |
||
2445 | while (!get_key_press (1 << KEY_ENTER)); |
||
2446 | } |
||
2447 | receiveNMEA = false; |
||
2448 | if (!bt_disconnect()) lcd_printp_at (0, 3, PSTR("Fehler beim Trennen"), 0); |
||
2449 | |||
2450 | set_BTOff(); |
||
2451 | |||
2452 | } |
||
2453 | |||
2454 | |||
2455 | } |
||
2456 | } |
||
2457 | |||
2458 | |||
2459 | |||
2460 | |||
2461 | //-------------------------------------------------------------- |
||
2462 | uint8_t Edit_PKT_Accu(uint8_t Value, uint8_t min, uint8_t max) |
||
2463 | { |
||
2464 | Pre = Value; |
||
2465 | lcd_cls(); |
||
2466 | // lcd_printp_at (0, 2, Text, 0); |
||
2467 | lcd_puts_at(0, 2, strGet(LIPO2), 0); |
||
2468 | switch (Value) |
||
2469 | { |
||
2470 | case false :lcd_printp_at (15, 2, PSTR("LiIo"), 0); |
||
2471 | break; |
||
2472 | case true :lcd_printp_at (15, 2, PSTR("LiPo"), 0); |
||
2473 | break; |
||
2474 | break; |
||
2475 | } |
||
2476 | |||
2477 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
2478 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
2479 | |||
2480 | do |
||
2481 | { |
||
2482 | if ((get_key_press (1 << KEY_PLUS)) && (Value == 0)) |
||
2483 | { |
||
2484 | Value = 1; |
||
2485 | lcd_printp_at (15, 2, PSTR("LiPo"), 0); |
||
2486 | } |
||
2487 | |||
2488 | if ((get_key_press (1 << KEY_MINUS)) && (Value == 1)) |
||
2489 | { |
||
2490 | Value = 0; |
||
2491 | lcd_printp_at (15, 2, PSTR("LiIo"), 0); |
||
2492 | } |
||
2493 | |||
2494 | if (get_key_press (1 << KEY_ENTER)) |
||
2495 | { |
||
2496 | edit = 1; |
||
2497 | |||
2498 | PKT_Accutyp = Value; |
||
2499 | // WriteParameter(); |
||
2500 | |||
2501 | return Value; |
||
2502 | } |
||
2503 | } |
||
2504 | |||
2505 | while (!get_key_press (1 << KEY_ESC)); |
||
2506 | { |
||
2507 | get_key_press(KEY_ALL); |
||
2508 | edit = 0; |
||
2509 | PKT_Accutyp = Pre; |
||
2510 | return Pre; |
||
2511 | } |
||
2512 | |||
2513 | } |
||
2514 | |||
2515 | //-------------------------------------------------------------- |
||
2516 | uint16_t Edit_LipoOffset(uint16_t Value, uint16_t min, uint16_t max) |
||
2517 | { |
||
2518 | lcd_cls(); |
||
2519 | // lcd_printp_at (0, 2, Text, 0); |
||
2520 | lcd_puts_at(0, 2, strGet(LIPO3), 0); |
||
2521 | lcd_puts_at(0, 5, strGet(LIPO5), 0); |
||
2522 | lcd_puts_at(0, 6, strGet(LIPO6), 0); |
||
2523 | // lcd_printp_at (0, 3, PSTR("Offset verstellen bis"), 0); |
||
2524 | // lcd_printp_at (0, 4, PSTR("die Spannung passt"), 0); |
||
2525 | Pre16 = Value; |
||
2526 | write_ndigit_number_u (16, 2, Value, 4, 0,0); |
||
2527 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
||
2528 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
2529 | |||
2530 | do |
||
2531 | { |
||
2532 | if ((get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) && (Value < max-10)) |
||
2533 | { |
||
2534 | edit = 1; |
||
2535 | Value = Value +10; |
||
2536 | Lipo_UOffset = Value; |
||
2537 | write_ndigit_number_u (16, 2,Value, 4, 0,0); |
||
2538 | |||
2539 | } |
||
2540 | |||
2541 | if ((get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) && (Value > min)) |
||
2542 | { |
||
2543 | edit = 1; |
||
2544 | Value=Value -10; |
||
2545 | Lipo_UOffset = Value; |
||
2546 | write_ndigit_number_u (16, 2,Value, 4, 0,0); |
||
2547 | } |
||
2548 | |||
2549 | if (get_key_press (1 << KEY_ENTER)) |
||
2550 | return Value; |
||
2551 | #ifndef ohne_Lipo // MartinR |
||
2552 | show_Lipo(); |
||
2553 | #endif |
||
2554 | write_ndigit_number_u_100th(8, 3, volt_avg, 0, 0); |
||
2555 | lcd_printp_at(3, 3, PSTR("Volt"), 0); |
||
2556 | |||
2557 | } |
||
2558 | while (!get_key_press (1 << KEY_ESC)); |
||
2559 | { |
||
2560 | get_key_press(KEY_ALL); |
||
2561 | edit = 0; |
||
2562 | Lipo_UOffset = Pre16; |
||
2563 | return Pre16; |
||
2564 | } |
||
2565 | } |
||
2566 | |||
2567 | //-------------------------------------------------------------- |
||
2568 | void Accu_Setup (void) |
||
2569 | { |
||
2570 | uint8_t ii = 0; |
||
2571 | uint8_t Offset = 0; |
||
2572 | uint8_t size = 0; |
||
2573 | size = ITEMS_Accu; |
||
2574 | uint8_t dmode = 0; |
||
2575 | uint8_t target_pos = 1; |
||
2576 | uint8_t val; |
||
2577 | |||
2578 | mmode = 0; |
||
2579 | edit = 0; |
||
2580 | val = 0; |
||
2581 | lcd_cls (); |
||
2582 | |||
2583 | while(1) |
||
2584 | { |
||
2585 | lcd_cls (); |
||
2586 | // lcd_printp_at (0, 0, PSTR(" PKT Accu Setup "), 2); |
||
2587 | lcd_puts_at(0, 0, strGet(LIPO1), 2); |
||
2588 | // lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
||
2589 | lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
||
2590 | |||
2591 | while(1) |
||
2592 | { |
||
2593 | ii = 0; |
||
2594 | |||
2595 | if(Offset > 0) |
||
2596 | lcd_printp_at(1,1, PSTR("\x12"), 0); |
||
2597 | |||
2598 | for(ii = 0; ii < 6; ii++) |
||
2599 | { |
||
2600 | if((ii + Offset) < size) |
||
2601 | lcd_printp_at(3, ii + 1, param_menuitems_Accu[ii+Offset][DisplayLanguage], 0); |
||
2602 | |||
2603 | if((ii == 5) && (ii + Offset < (size - 1))) |
||
2604 | lcd_printp_at(1,6, PSTR("\x13"), 0); |
||
2605 | |||
2606 | } |
||
2607 | |||
2608 | if(dmode == 0) |
||
2609 | { |
||
2610 | if(Offset == 0) |
||
2611 | { |
||
2612 | if(size > 6) |
||
2613 | val = menu_choose2 (1, 5, target_pos, 0, 1); |
||
2614 | else |
||
2615 | val = menu_choose2 (1, size, target_pos, 0, 0); |
||
2616 | |||
2617 | } |
||
2618 | else |
||
2619 | val = menu_choose2 (2, 5, target_pos, 1, 1); |
||
2620 | |||
2621 | } |
||
2622 | |||
2623 | if(dmode == 1) |
||
2624 | { |
||
2625 | if(Offset + 7 > size) |
||
2626 | val = menu_choose2 (2, 6, target_pos, 1, 0); |
||
2627 | else |
||
2628 | val = menu_choose2 (2, 5, target_pos, 1, 1); |
||
2629 | } |
||
2630 | |||
2631 | if(val == 254) |
||
2632 | { |
||
2633 | Offset++; |
||
2634 | dmode = 1; |
||
2635 | target_pos = 5; |
||
2636 | } |
||
2637 | else if(val == 253) |
||
2638 | { |
||
2639 | Offset--; |
||
2640 | dmode = 0; |
||
2641 | target_pos = 2; |
||
2642 | } |
||
2643 | else if(val == 255) |
||
2644 | { // Ende mit ESC, speichern |
||
2645 | if (edit == 1) |
||
2646 | { |
||
2647 | WriteParameter(); |
||
2648 | |||
2649 | return; |
||
2650 | } |
||
2651 | return; |
||
2652 | } |
||
2653 | else |
||
2654 | break; |
||
2655 | } |
||
2656 | |||
2657 | target_pos = val; |
||
2658 | if((val + Offset) == 1) |
||
2659 | { |
||
2660 | PKT_Accutyp= Edit_PKT_Accu(PKT_Accutyp,0,1); |
||
2661 | if (edit == 1) WriteParameter(); |
||
2662 | } |
||
2663 | |||
2664 | if((val + Offset) == 2) |
||
2665 | { |
||
2666 | Lipo_UOffset = Edit_LipoOffset(Lipo_UOffset,0,9999); |
||
2667 | if (edit == 1) WriteParameter(); |
||
2668 | } |
||
2669 | |||
2670 | } |
||
2671 | } |
||
2672 | |||
2673 | |||
2674 | //-------------------------------------------------------------- |
||
2675 | uint8_t Edit_LED_Form (uint8_t Value, uint8_t min, uint8_t max, uint8_t Text) |
||
2676 | { |
||
2677 | Pre = Value; |
||
2678 | lcd_cls(); |
||
2679 | lcd_puts_at(0, 2, strGet(Text), 0); |
||
2680 | |||
2681 | switch (Value) |
||
2682 | { |
||
2683 | case 0x1: |
||
2684 | lcd_circle (14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
||
2685 | |||
2686 | lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 3, 0); // löschen |
||
2687 | lcd_circle (16 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
||
2688 | lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 1, 1); // plus |
||
2689 | break; |
||
2690 | case 0x3 : |
||
2691 | lcd_circle (14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
||
2692 | |||
2693 | lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 3, 1); // schwarz |
||
2694 | break; |
||
2695 | break; |
||
2696 | } |
||
2697 | |||
2698 | lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
||
2699 | |||
2700 | do |
||
2701 | { |
||
2702 | if ((get_key_press (1 << KEY_PLUS)) && (Value == 1)) |
||
2703 | { |
||
2704 | Value = 3; |
||
2705 | lcd_circle (14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
||
2706 | |||
2707 | lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 3, 1); // schwarz |
||
2708 | } |
||
2709 | |||
2710 | if ((get_key_press (1 << KEY_MINUS)) && (Value == 3)) |
||
2711 | { |
||
2712 | Value = 1; |
||
2713 | lcd_circle (14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
||
2714 | |||
2715 | lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 3, 0); // löschen |
||
2716 | lcd_circle (16 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis |
||
2717 | lcd_fcircle (16 * 6 + 5, 2 * 8 + 3, 1, 1); // plus |
||
2718 | } |
||
2719 | |||
2720 | if (get_key_press (1 << KEY_ENTER)) |
||
2721 | { |
||
2722 | edit = 1; |
||
2723 | OSD_LEDform = Value; |
||
2724 | WriteParameter(); |
||
2725 | |||
2726 | return Value; |
||
2727 | } |
||
2728 | } |
||
2729 | |||
2730 | while (!get_key_press (1 << KEY_ESC)); |
||
2731 | { |
||
2732 | get_key_press(KEY_ALL); |
||
2733 | edit = 0; |
||
2734 | OSD_LEDform = Pre; |
||
2735 | return Pre; |
||
2736 | } |
||
2737 | } |
||
2738 | |||
2739 | |||
2740 | //-------------------------------------------------------------- |
||
2741 | void OSD_Setup (void) |
||
2742 | { |
||
2743 | uint8_t ii = 0; |
||
2744 | uint8_t Offset = 0; |
||
2745 | uint8_t size = 0; |
||
2746 | size = ITEMS_OSD; |
||
2747 | uint8_t dmode = 0; |
||
2748 | uint8_t target_pos = 1; |
||
2749 | uint8_t val; |
||
2750 | |||
2751 | mmode = 0; |
||
2752 | edit = 0; |
||
2753 | val = 0; |
||
2754 | lcd_cls (); |
||
2755 | |||
2756 | while(1) |
||
2757 | { |
||
2758 | lcd_cls (); |
||
2759 | lcd_puts_at(0, 0, strGet(OSD_Screen), 2); |
||
2760 | lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
||
2761 | |||
2762 | while(1) |
||
2763 | { |
||
2764 | ii = 0; |
||
2765 | |||
2766 | if(Offset > 0) |
||
2767 | lcd_printp_at(1,1, PSTR("\x12"), 0); |
||
2768 | |||
2769 | for(ii = 0; ii < 6; ii++) |
||
2770 | { |
||
2771 | if((ii + Offset) < size) |
||
2772 | lcd_printp_at(3, ii + 1, param_menuitems_OSD[ii+Offset][DisplayLanguage], 0); |
||
2773 | |||
2774 | if((ii == 5) && (ii + Offset < (size - 1))) |
||
2775 | lcd_printp_at(1,6, PSTR("\x13"), 0); |
||
2776 | |||
2777 | } |
||
2778 | |||
2779 | if(dmode == 0) |
||
2780 | { |
||
2781 | if(Offset == 0) |
||
2782 | { |
||
2783 | if(size > 6) |
||
2784 | val = menu_choose2 (1, 5, target_pos, 0, 1); |
||
2785 | else |
||
2786 | val = menu_choose2 (1, size, target_pos, 0, 0); |
||
2787 | |||
2788 | } |
||
2789 | else |
||
2790 | val = menu_choose2 (2, 5, target_pos, 1, 1); |
||
2791 | |||
2792 | } |
||
2793 | |||
2794 | if(dmode == 1) |
||
2795 | { |
||
2796 | if(Offset + 7 > size) |
||
2797 | val = menu_choose2 (2, 6, target_pos, 1, 0); |
||
2798 | else |
||
2799 | val = menu_choose2 (2, 5, target_pos, 1, 1); |
||
2800 | } |
||
2801 | |||
2802 | if(val == 254) |
||
2803 | { |
||
2804 | Offset++; |
||
2805 | dmode = 1; |
||
2806 | target_pos = 5; |
||
2807 | } |
||
2808 | else if(val == 253) |
||
2809 | { |
||
2810 | Offset--; |
||
2811 | dmode = 0; |
||
2812 | target_pos = 2; |
||
2813 | } |
||
2814 | else if(val == 255) |
||
2815 | { // Ende mit ESC, speichern |
||
2816 | if (edit == 1) |
||
2817 | { |
||
2818 | WriteParameter(); |
||
2819 | |||
2820 | return; |
||
2821 | } |
||
2822 | return; |
||
2823 | } |
||
2824 | else |
||
2825 | break; |
||
2826 | } |
||
2827 | |||
2828 | target_pos = val; |
||
2829 | if((val + Offset) == 1) OSD_ScreenMode = Edit_Int_Value(OSD_ScreenMode, 0, 2, OSD_SCREENMODE); |
||
2830 | if((val + Offset) == 2) OSD_LEDform = Edit_LED_Form(OSD_LEDform, 1, 3, OSD_LED_Form); |
||
2831 | if((val + Offset) == 3) OSD_InvertOut = Edit_YesNo(OSD_InvertOut, 0, 1, OSD_Invert_Out); |
||
2832 | if((val + Offset) == 4) OSD_SendOSD = Edit_YesNo(OSD_SendOSD, 0, 1, OSD_Send_OSD); |
||
2833 | if((val + Offset) == 5) OSD_Fallspeed = Edit_Int10th_Value(OSD_Fallspeed,0,247,FALLSPEED); |
||
2834 | if((val + Offset) == 6) OSD_VarioBeep = Edit_YesNo(OSD_VarioBeep,0,1,OSD_VARIOBEEP); |
||
2835 | if((val + Offset) == 7) OSD_HomeMKView = Edit_YesNo(OSD_HomeMKView,0,1,OSD_HOMEMKVIEW); |
||
2836 | if((val + Offset) == 8) MK_LowBat = Edit_Int10th_Value(MK_LowBat,32,247,LOWBAT); |
||
2837 | if((val + Offset) == 9) OSD_mAh_Warning = Edit_Int16_Value(OSD_mAh_Warning,0,30000,OSD_MAHWARNING); |
||
2838 | if((val + Offset) == 10)OSD_LipoBar = Edit_YesNo(OSD_LipoBar, 0, 1, OSD_LIPOBAR); |
||
2839 | |||
2840 | |||
2841 | } |
||
2842 | } |
||
2843 | //-------------------------------------------------------------- |
||
2844 | void FollowMe_Setup (void) |
||
2845 | { |
||
2846 | uint8_t ii = 0; |
||
2847 | uint8_t Offset = 0; |
||
2848 | uint8_t size = 0; |
||
2849 | size = ITEMS_FOLLOWME; |
||
2850 | uint8_t dmode = 0; |
||
2851 | uint8_t target_pos = 1; |
||
2852 | uint8_t val; |
||
2853 | |||
2854 | mmode = 0; |
||
2855 | edit = 0; |
||
2856 | val = 0; |
||
2857 | lcd_cls (); |
||
2858 | |||
2859 | while(1) |
||
2860 | { |
||
2861 | lcd_cls (); |
||
2862 | lcd_puts_at(0, 0, strGet(FOLLOWME_0), 2); |
||
2863 | lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
||
2864 | |||
2865 | while(1) |
||
2866 | { |
||
2867 | ii = 0; |
||
2868 | |||
2869 | if(Offset > 0) |
||
2870 | lcd_printp_at(1,1, PSTR("\x12"), 0); |
||
2871 | |||
2872 | for(ii = 0; ii < 6; ii++) |
||
2873 | { |
||
2874 | if((ii + Offset) < size) |
||
2875 | lcd_printp_at(3, ii + 1, param_menuitems_FOLLOWME[ii+Offset][DisplayLanguage], 0); |
||
2876 | |||
2877 | if((ii == 5) && (ii + Offset < (size - 1))) |
||
2878 | lcd_printp_at(1,6, PSTR("\x13"), 0); |
||
2879 | |||
2880 | } |
||
2881 | |||
2882 | if(dmode == 0) |
||
2883 | { |
||
2884 | if(Offset == 0) |
||
2885 | { |
||
2886 | if(size > 6) |
||
2887 | val = menu_choose2 (1, 5, target_pos, 0, 1); |
||
2888 | else |
||
2889 | val = menu_choose2 (1, size, target_pos, 0, 0); |
||
2890 | |||
2891 | } |
||
2892 | else |
||
2893 | val = menu_choose2 (2, 5, target_pos, 1, 1); |
||
2894 | |||
2895 | } |
||
2896 | |||
2897 | if(dmode == 1) |
||
2898 | { |
||
2899 | if(Offset + 7 > size) |
||
2900 | val = menu_choose2 (2, 6, target_pos, 1, 0); |
||
2901 | else |
||
2902 | val = menu_choose2 (2, 5, target_pos, 1, 1); |
||
2903 | } |
||
2904 | |||
2905 | if(val == 254) |
||
2906 | { |
||
2907 | Offset++; |
||
2908 | dmode = 1; |
||
2909 | target_pos = 5; |
||
2910 | } |
||
2911 | else if(val == 253) |
||
2912 | { |
||
2913 | Offset--; |
||
2914 | dmode = 0; |
||
2915 | target_pos = 2; |
||
2916 | } |
||
2917 | else if(val == 255) |
||
2918 | { // Ende mit ESC, speichern |
||
2919 | if (edit == 1) |
||
2920 | { |
||
2921 | WriteParameter(); |
||
2922 | |||
2923 | return; |
||
2924 | } |
||
2925 | return; |
||
2926 | } |
||
2927 | else |
||
2928 | break; |
||
2929 | } |
||
2930 | |||
2931 | target_pos = val; |
||
2932 | if((val + Offset) == 1) FM_Refresh = Edit_Int16_Value(FM_Refresh, 250, 60000, FOLLOWME_1); |
||
2933 | if((val + Offset) == 2) FM_Speed = Edit_Int16_Value(FM_Speed, 0, 100, FOLLOWME_2); |
||
2934 | if((val + Offset) == 3) FM_Radius = Edit_Int16_Value(FM_Radius, 1,20, FOLLOWME_3); |
||
2935 | |||
2936 | } |
||
2937 | } |
||
2938 | |||
2939 | #endif |