/*****************************************************************************
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de *
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net *
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net *
* Copyright (C) 2011 Harald Bongartz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
* *
* Credits to: *
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN *
* http://www.mikrokopter.de *
* Gregor "killagreg" Stobrawa for his version of the MK code *
* Thomas Kaiser "thkais" for the original project. See *
* http://www.ft-fanpage.de/mikrokopter/ *
* http://forum.mikrokopter.de/topic-4061-1.html *
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code *
* http://www.mylifesucks.de/oss/c-osd/ *
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility*
*****************************************************************************/
//############################################################################
//# HISTORY setup.c
//#
//# 04.03.2013 Cebra
//# - del: OSD-Sreenmode ,is no longer necessary, last OSD-Screen is saved at shutdown
//############################################################################
//bt_connect
#include "../cpu.h"
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <string.h>
#include <util/delay.h>
#include "../main.h"
#include "../setup/setup.h"
#include "../lcd/lcd.h"
#include "../eeprom/eeprom.h"
#include "../timer/timer.h"
#include "../menu.h"
#include "../wi232/Wi232.h"
#include "../bluetooth/bluetooth.h"
#include "../connect.h"
#include "../lipo/lipo.h"
#include "../messages.h"
#include "../eeprom/eeprom.h"
#include "../tracking/tracking.h"
#include "../uart/uart1.h"
#include "../osd/osd.h"
#include "../sound/pwmsine8bit.h"
#include "../tracking/servo_setup.h"
#include "../bluetooth/error.h"
#include "../stick/stick_setup.h"
uint8_t spalte
;
uint8_t mmode
;
uint8_t edit
;
uint8_t LCD_Orientation
;
uint8_t edit
= 0;
uint8_t LCD_Change
= 0;
uint8_t PKT_Change
= 0;
uint16_t Pre
;
uint16_t Pre16
;
char EditString
[21];
uint8_t bt_name_len
;
uint8_t length_tmp
;
uint8_t CheckGPS
=false;
uint8_t Old_Baudrate
= 0; //Merkzelle für alte Baudrate
//--------------------------------------------------------------
#define ITEMS_PKT 13
const prog_char param_menuitems_pkt
[ITEMS_PKT
][NUM_LANG
][18]= // zeilen,zeichen+1
// German, English, French, Dutch
{
{"Verbindung zum MK","connection to MK ","Aansluiting op MK"},
{"PKT allgemein \x1d","PKT global \x1d","PKT global \x1d"},
{"Wi.232 \x1d","Wi.232 \x1d","Wi.232 \x1d"},
{"BTM-222 \x1d","BTM-222 \x1d","BTM-222 \x1d"},
{"Servo Menü \x1d","servo menu \x1d","servo menu \x1d"},
{"OSD Anzeige \x1d","OSD screen \x1d","OSD screen \x1d"},
{"GPS \x1d","GPS \x1d","GPS \x1d"},
{"Follow Me \x1d","Follow Me \x1d","Follow Me \x1d"},
{"Joystick \x1d","joystick \x1d","joystick \x1d"},
{"PKT-Akku \x1d","PKT-Accu \x1d","PKT-Accu \x1d"},
{"PKT Update ","PKT Update ","PKT Update "},
{"Debug PKT ","Debug PKT ","Debug PKT "},
{"EEProm Reset ","EEProm Reset ","EEProm Reset "},
};
#define ITEMS_LCD 11
const prog_char param_menuitems_lcd
[ITEMS_LCD
][NUM_LANG
][18]= // zeilen,zeichen+1
// German, English, French, Dutch
{
{"Infos beim Start ","info at startup ","info bij opstart "},
{"OSD Empfangsausf.","OSD receive Error","OSD receive Error"},
{"Sprache ","language ","taal "},
{"Licht aus nach...","light off after ","licht uit na "},
{"Helligkeit ","brightness ","helderheid "},
{"Kontrast ","contrast ","contrast "},
{"Normal/Invers ","normal/inverted ","Normal/inverted "},
{"Orientierung ","orientation ","orientatie "},
{"Vario Ton Erw. ","Vario Sound Ext. ","Vario Sound Ext. "},
{"Hardware Beeper ","Hardware Beeper ","Hardware Beeper "},
{"Lautstärke Ton ","Volume ","Volume "},
};
#define ITEMS_WI 9
const prog_char param_menuitems_wi
[ITEMS_WI
][NUM_LANG
][18]= // zeilen,zeichen+1
// German, English, French, Dutch
{
{"Modul eingebaut? ","module built in? ","Module geinstal.?"},
{"TX/RX Kanal ","TX/RX Channel ","TX/RX Channel "},
{"NetW. Gruppe ","NetW. Group ","NetW. Group "},
{"NetW. Mode ","NetW. Mode ","NetW. Mode "},
{"TX Timeout ","TX Timeout ","TX Timeout "},
{"TX MTU ","TX MTU ","TX MTU "},
{"Baudrate Wi232/BT","Baudrate Wi232/BT","Baudrate Wi232/BT"},
{"Initialisieren ","initialize ","Initialize "},
{"Konfig. mit PC ","config. with PC ","Config. met PC "},
};
#define ITEMS_BT 7
const prog_char param_menuitems_bt
[ITEMS_BT
][NUM_LANG
][18]= // zeilen,zeichen+1
// German, English, Dutch
{
{"Modul eingebaut? ","module built in? ","module geinstall?"},
{"Name ","name ","Naam "},
{"Pin ","pin ","Pin "},
{"Initialisieren ","initialize ","Initialize "},
{"Bluetooth MAC-Adr","Bluetooth MAC-Adr","Bluetooth MAC-Adr"},
{"RE-ID ","RE-ID ","RE-ID "},
{"Konfig. mit PC ","config. with PC ","Config. met PC "},
};
#define ITEMS_Accu 2
const prog_char param_menuitems_Accu
[ITEMS_Accu
][NUM_LANG
][18]= // zeilen,zeichen+1
// German, English, French, Dutch
{
{"PKT-Akkutyp ","PKT-Accutyp ","PKT-batterij type"},
{"PKT Akku Messung ","PKT AccuMeasure ","PKT batt. meting "},
};
#define ITEMS_GPS 6
const prog_char param_menuitems_GPS
[ITEMS_GPS
][NUM_LANG
][18]= // zeilen,zeichen+1
// German, English, French, Dutch
{
{"wähle GPS Maus ","select GPS mouse ","select GPS mouse "},
{"Suche GPS Maus ","search GPS mouse ","search GPS mouse "},
{"GPS Maus Typ ","GPS mouse typ ","GPS mouse typ "},
{"GPS Maus aktiv? ","GPS mouse activ? ","GPS mouse activ? "},
{"Zeige GPS Device ","show GPS device ","show GPS device "},
{"GPS Daten ","GPS data ","GPS data "},
};
#define ITEMS_FOLLOWME 3
const prog_char param_menuitems_FOLLOWME
[ITEMS_GPS
][NUM_LANG
][18]= // zeilen,zeichen+1
// German, English, French, Dutch
{
{"FollowMe Refresh","FollowMe Refresh","FollowMe Refresh"},
{"FollowMe Speed ","FollowMe Speed ","FollowMe Speed "},
{"Toleranz Radius ","Tolerance Radius","Tolerance Radius"},
};
#define ITEMS_OSD 9
const prog_char param_menuitems_OSD
[ITEMS_OSD
][NUM_LANG
][18]= // zeilen,zeichen+1
// German, English, French, Dutch
{
{"OUT1/2 Format ","OUT1/2 format ","OUT1/2 format "},
{"OUT1/2 Polarität ","OUT1/2 polarity ","OUT1/2 polarity "},
{"Navi Daten an SV2","Navi data to SV2 ","Navi data to SV2 "},
{"Max. Sinkrate m/s","max fallspeed m/s","max fallspeed m/s"},
{"Variometer Beep ","Variometer beep ","Variometer beep "},
{"Home aus MK Sicht","home from MK view","home from MK view"},
{"MK LowBat Warnung","MK LowBat warning","MK LoBat alarm "},
{"MK mAh Warnung","MK mAh warning ","MK mAh alarm "},
{"MK Volt Balken","MK volt bargraph ","MK volt bargraph "},
};
//--------------------------------------------------------------
void Show_Error_HW12
(void)
{
lcd_cls
();
lcd_printp_at
(0,3,PSTR
(" Mit Hardware 1.x "), 2);
lcd_printp_at
(0,4,PSTR
(" nicht möglich "), 2);
_delay_ms
(1000);
}
void Edit_printout
(uint16_t Value
,uint16_t min
,uint16_t max
, uint8_t what
)
{
switch (what
)
{
case Show_uint3
: write_ndigit_number_u
(16, 2,Value
, 3, 0,0);break;
case Show_uint5
: write_ndigit_number_u
(16, 2,Value
, 5, 0,0);break;
case Show_uint10th
: write_ndigit_number_u_10th
(16, 2,Value
, 3, 0,0); break;
case GPSMOUSE
:
switch(Value
)
{
case GPS_Bluetoothmouse1
: lcd_printp_at
(12, 2, PSTR
("BT-Mouse1"), 0);break;
case GPS_Mikrokopter
: lcd_printp_at
(12, 2, PSTR
("Mikrokopt"), 0);break;
lcd_printp_at
(12, 2, PSTR
("unknown"), 0);
break;
}
break;
case Wi_Netmode
:
switch (Value
)
{
case false :lcd_puts_at
(15, 2, strGet
(SLAVE
), 0);
break;
case true :lcd_puts_at
(15, 2, strGet
(NORMAL
), 0);
break;
break;
}
break;
case OnOff
:
switch (Value
)
{
case false :lcd_puts_at
(17, 2, strGet
(OFF
), 0);
break;
case true :lcd_puts_at
(17, 2, strGet
(ON
), 0);
break;
break;
}
break;
case YesNo
:
switch (Value
)
{
case false :lcd_puts_at
(17, 2, strGet
(NOO
), 0);
break;
case true :lcd_puts_at
(17, 2, strGet
(YES
), 0);
break;
break;
}
break;
case NormRev
:
switch (Value
)
{
case false :lcd_puts_at
(14, 2, strGet
(NORMAL
), 0);
break;
case true :lcd_puts_at
(14, 2, strGet
(REVERSE
), 0);
break;
break;
}
break;
case Kontrast
: {
write_ndigit_number_u
(16, 2,Value
, 3, 0,0);
if (Value
>= max
)
{
Value
= max
;
set_beep
( 200, 0x0080, BeepNormal
);
write_ndigit_number_u
(16, 2,Value
, 3, 0,0);
}
else
{
write_ndigit_number_u
(16, 2,Value
, 3, 0,0);
cli
();
clr_A0
();
send_byte
(0x81);
send_byte
(Value
); // Daten zum LCD senden
set_A0
();
sei
();
}
// break;
if (Value
== min
)
{
write_ndigit_number_u
(16, 2,Value
, 3, 0,0);
Value
= min
;
set_beep
( 200, 0x0080, BeepNormal
);
}
else
{
write_ndigit_number_u
(16, 2,Value
, 3, 0,0);
cli
();
clr_A0
();
send_byte
(0x81);
send_byte
(Value
); // Daten zum LCD senden
set_A0
();
sei
();
}
}
break;
case Baudrate
:
switch (Value
)
{
case 0x0 : lcd_printp_at
(15, 2, PSTR
("2400 "), 0);
break;
case 0x1 : lcd_printp_at
(15, 2, PSTR
("9600 "), 0);
break;
case 0x2 : lcd_printp_at
(15, 2, PSTR
("19200 "), 0);
break;
case 0x3 : lcd_printp_at
(15, 2, PSTR
("38400 "), 0);
break;
case 0x4 : lcd_printp_at
(15, 2, PSTR
("57600 "), 0);
break;
case 0x5 : lcd_printp_at
(15, 2, PSTR
("115200"), 0);
break;
case 0x6 : lcd_printp_at
(15, 2, PSTR
("4800 "), 0);
break;
break;
}
break;
case Language
:
switch (Value
)
{
case
0x0 : lcd_puts_at
(10, 2, strGet
(DEUTSCH
), 0);//lcd_printp_at (14, 2, PSTR("Deutsch"), 0);
break;
case 0x1 : lcd_puts_at
(10, 2, strGet
(ENGLISCH
), 0);//lcd_printp_at (14, 2, PSTR("English"), 0);
break;
case 0x2 : lcd_puts_at
(10, 2, strGet
(NETHERL
), 0);//lcd_printp_at (14, 2, PSTR("Netherl"), 0);
break;
break;
}
break;
case Sticktype
:
switch (Value
)
{
case false :lcd_puts_at
(14, 2, strGet
(POTI
), 0);
break;
case true :lcd_puts_at
(14, 2, strGet
(TASTER
), 0);
break;
break;
}
break;
break;
}
}
uint16_t Edit_generic
(uint16_t Value
, uint16_t min
, uint16_t max
,uint8_t Text
, uint8_t what
)
{
Pre
= Value
;
lcd_cls
();
lcd_puts_at
(0, 2, strGet
(Text
), 0);
Edit_printout
(Value
,min
,max
, what
);
lcd_puts_at
(0, 7, strGet
(KEYLINE2
), 0);
do
{
if ((get_key_press
(1 << KEY_PLUS
) || get_key_long_rpt_sp
((1 << KEY_PLUS
), 2)) && (Value
< max
))
{
edit
= 1;
Value
++;
Edit_printout
(Value
,min
,max
, what
);
playTone
(500,20,Config.
Volume);
}
if ((get_key_press
(1 << KEY_MINUS
) || get_key_long_rpt_sp
((1 << KEY_MINUS
), 2)) && (Value
> min
))
{
edit
= 1;
Value
--;
Edit_printout
(Value
,min
,max
, what
);
playTone
(500,20,Config.
Volume);
}
if (get_key_press
(1 << KEY_ENTER
))
{
return Value
;
}
}
while (!get_key_press
(1 << KEY_ESC
));
get_key_press
(KEY_ALL
);
edit
= 0;
return Pre
;
}
//--------------------------------------------------------------
uint8_t ChangeWi_SV2
(uint8_t Value
)
{
Pre
= Value
;
lcd_cls
();
lcd_puts_at
(0, 1, strGet
(CONNECT1
), 0);
lcd_puts_at
(0, 2, strGet
(CONNECT2
), 0);
if(Config.
UseWi == false)
{
lcd_puts_at
(0, 1, strGet
(CONNECT1
), 0);
lcd_puts_at
(0, 2, strGet
(CONNECT4
), 0);
lcd_puts_at
(0, 1, strGet
(CONNECT5
), 0);
lcd_puts_at
(0, 2, strGet
(CONNECT6
), 0);
lcd_puts_at
(0, 1, strGet
(CONNECT7
), 0);
lcd_puts_at
(0, 2, strGet
(CONNECT8
), 0);
lcd_puts_at
(0, 1, strGet
(CONNECT9
), 0);
// lcd_printp_at (12, 7, PSTR("Ende"), 0);
lcd_puts_at
(12, 7, strGet
(ENDE
), 0);
while (!get_key_press
(1 << KEY_ESC
));
get_key_press
(KEY_ALL
);
edit
= 0;
return Pre
;
}
else
{
switch (Value
)
{
case 0x0 :lcd_printp_at
(14, 2, PSTR
("Wi232"), 0);
break;
case 0x1 : lcd_puts_at
(14, 2, strGet
(KABEL
), 0);
//lcd_printp_at (14, 2, PSTR("Kabel"), 0);
break;
break;
}
// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0);
lcd_puts_at
(0, 7, strGet
(KEYLINE2
), 0);
do
{
if(Config.
UseWi == true)
{
if ((get_key_press
(1 << KEY_PLUS
)) && (Value
== 0))
{
edit
= 1;
Value
= 1;
// lcd_printp_at (14, 2, PSTR("Kabel"), 0);
lcd_puts_at
(14, 2, strGet
(KABEL
), 0);
Change_Output
(Uart02FC
);
}
if ((get_key_press
(1 << KEY_MINUS
)) && (Value
== 1))
{
edit
= 1;
Value
= 0;
lcd_printp_at
(14, 2, PSTR
("Wi232"), 0);
Change_Output
(Uart02Wi
);
}
if (get_key_press
(1 << KEY_ENTER
))
{
// lcd_printp_at (0, 4, PSTR("Sie müssen das PKT"), 0);
// lcd_printp_at (0, 5, PSTR("jetzt neu starten!"), 0);
lcd_puts_at
(0, 4, strGet
(CONNECT10
), 0);
lcd_puts_at
(0, 5, strGet
(CONNECT11
), 0);
lcd_cls_line
(0, 7, 18);
while (!get_key_press
(1 << KEY_ENTER
));
return Value
;
}
}
}
while (!get_key_press
(1 << KEY_ESC
));
}
get_key_press
(KEY_ALL
);
edit
= 0;
return Pre
;
}
//--------------------------------------------------------------
uint8_t Edit_DisplayHelligkeit
(uint8_t Value
, uint8_t min
, uint8_t max
, uint8_t Text
)
{
float ValCorr
= 2.55; // (Value * ValCorr) maximal 255
Pre
= Value
;
OCR2A
= Value
* ValCorr
;
lcd_cls
();
// lcd_printp_at (0, 2, Text, 0);
lcd_puts_at
(0, 2, strGet
(Text
), 0);
write_ndigit_number_u
(16, 2, Value
, 3, 0,0);
lcd_printp_at
(17, 2, PSTR
("%"), 0);
// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0);
lcd_puts_at
(0, 7, strGet
(KEYLINE2
), 0);
do
{
write_ndigit_number_u
(16, 2,Value
, 3, 0,0);
lcd_frect
((8*0), (8*4), (Value
* (16*8) / 100), 6, 1);
if ((get_key_press
(1 << KEY_PLUS
) || get_key_long_rpt_sp
((1 << KEY_PLUS
), 3)) && (Value
< max
))
{
Value
++;
if (Value
>= max
)
{
Value
= max
;
set_beep
( 200, 0x0080, BeepNormal
);
}
else
OCR2A
= Value
* ValCorr
;
}
if ((get_key_press
(1 << KEY_MINUS
) || get_key_long_rpt_sp
((1 << KEY_MINUS
), 3)) && (Value
> min
))
{
lcd_frect
(((Value
- 1) * (16*8) / 100), (8*4), (16*8), 6, 0);
Value
--;
if (Value
== min
)
{
Value
= min
;
set_beep
( 200, 0x0080, BeepNormal
);
}
else
OCR2A
= Value
* ValCorr
;
}
if (get_key_press
(1 << KEY_ENTER
))
{
edit
= 1;
OCR2A
= Value
* ValCorr
;
Config.
LCD_Helligkeit = Value
;
// WriteParameter();
edit
= 0;
return Value
;
}
}
while (!get_key_press
(1 << KEY_ESC
));
{
get_key_press
(KEY_ALL
);
edit
= 0;
OCR2A
= Pre
* ValCorr
;
Config.
LCD_Helligkeit = Pre
;
// WriteParameter();
return Pre
;
}
}
//--------------------------------------------------------------
void Reset_EEprom
(void)
{
lcd_cls
();
get_key_press
(KEY_ALL
);
// lcd_printp_at (0, 2, PSTR(" EEProm wirklich"), 0);
// lcd_printp_at (0, 3, PSTR(" löschen?"), 0);
// lcd_printp_at (12, 7, PSTR("Ende OK"), 0);
lcd_puts_at
(0, 2, strGet
(EEPROM1
), 0);
lcd_puts_at
(0, 3, strGet
(EEPROM2
), 0);
lcd_puts_at
(12, 7, strGet
(ENDOK
), 0);
do
{
if (get_key_press
(1 << KEY_ENTER
))
{
Delete_EEPROM
();
clr_V_On
();
return;
}
}
while (!get_key_press
(1 << KEY_ESC
));
get_key_press
(KEY_ALL
);
}
//--------------------------------------------------------------
void PKT_Setup
(void)
{
// uint8_t ii = 0;
// uint8_t Offset = 0;
// uint8_t size = 0;
// uint8_t dmode = 0;
uint8_t target_pos
=1;
// uint8_t val;
lcd_cls
();
mmode
= 0;
edit
= 0;
val
= 0;
while(1)
{
size
= ITEMS_PKT
;
lcd_cls
();
lcd_printp_at
(0, 0, PSTR
(" PKT-Setup "), 2);
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0);
lcd_puts_at
(0, 7, strGet
(KEYLINE1
), 0);
// while(1)
// {
// ii = 0;
//
// if(Offset > 0)
// lcd_printp_at(1,1, PSTR("\x12"), 0);
//
// for(ii = 0;ii < 6 ; ii++)
// {
// if((ii+Offset) < size)
// lcd_printp_at(3,ii+1,param_menuitems_pkt[ii+Offset][Config.DisplayLanguage], 0);
//
// if((ii == 5)&&(ii+Offset < (size-1)))
// lcd_printp_at(1,6, PSTR("\x13"), 0);
//
// }
//
// if(dmode == 0)
// {
// if(Offset == 0)
// {
// if(size > 6)
// val = menu_choose2 (1, 5, target_pos,0,1);
// else
// val = menu_choose2 (1, size, target_pos,0,0);
//
// }
// else
// val = menu_choose2 (2, 5, target_pos,1,1);
//
// }
//
// if(dmode == 1)
// {
// if(Offset+7 > size)
// val = menu_choose2 (2, 6, target_pos,1,0);
// else
// val = menu_choose2 (2, 5, target_pos,1,1);
//
// }
//
// if(val == 254)
// {
// Offset++;
// dmode = 1;
// target_pos = 5;
// }
// else if(val == 253)
// {
// Offset--;
// dmode = 0;
// target_pos = 2;
// }
// else if(val == 255)
// { // Ende mit ESC, speichern
// if (edit == 1)
// {
// WriteParameter();
// edit = 0;
// return;
// }
// return;
// }
// else
// break;
// }
val
= menu_select
(param_menuitems_pkt
,size
,target_pos
);
if (val
==255) break;
target_pos
= val
;
//
// {"Verbindung zum MK","connection to MK "," connexion a MK " ,"Aansluiting op MK"},
// {"MK LowBat Warnung","MK LowBat warning","MK LowBat Attent", "MK LoBat alarm "},
// {"Anzeige \x1d","Display \x1d","d'affichage \x1d","Display \x1d"},
// {"Wi.232 \x1d","Wi.232 \x1d","Wi.232 \x1d","Wi.232 \x1d"},
// {"BTM-222 \x1d","BTM-222 \x1d","BTM-222 \x1d","BTM-222 \x1d"},
// {"Antennen Track. \x1d","antenna tracking\x1d","antenna tracking\x1d","antenna tracking\x1d"},
// {"OSD \x1d","OSD \x1d","OSD \x1d","OSD \x1d"},
// {"GPS \x1d","GPS \x1d","GPS \x1d","GPS \x1d"},
// "Follow Me \x1d"
// {"PKT-Akku \x1d","PKT-Accu \x1d","PKT-Accu \x1d","PKT-Accu \x1d"},
// {"PKT Update ","PKT Update ","PKT Mise a jour ","PKT Update "},
// {"Debug PKT ","Debug PKT ","Debug PKT ","Debug PKT "},
// {"EEProm Reset ","EEProm Reset ","EEProm Reinitiali","EEProm Reset "},
if((val
+ offset
) == 1)
{
#ifdef HWVERSION3_9
Config.
U02SV2 = ChangeWi_SV2
(Config.
U02SV2);
if (edit
== 1)
PKT_Change
= 1;
#else
Show_Error_HW12
();
#endif
}
if((val
+ offset
) == 2) Display_Setup
();
if((val
+ offset
) == 3)
{
#if defined HWVERSION3_9 || defined HWVERSION1_2W || defined HWVERSION1_3W
if(Config.
UseWi == false)
// Wi_Use();
{
Config.
UseWi = Edit_generic
(Config.
UseWi,0,1,WI2321
,YesNo
);
if (edit
==1)
if (Config.
UseWi== true) InitWi232
(Config.
PKT_Baudrate);
}
else
Wi_Setup
();
#else
Show_Error_HW12
();
#endif
}
if((val
+ offset
) == 4)
{
#ifdef HWVERSION3_9
if(Config.
UseBT == 0)
{
Config.
UseBT = Edit_generic
(Config.
UseBT,0,1,BT1
,YesNo
);
if (edit
==1)
if (Config.
UseBT == 1)
{
if (bt_init
()) Config.
BTIsSet = true; else Config.
BTIsSet = false;
// WriteParameter();
edit
= 0;
}
}
else
BT_Setup
();
#else
Show_Error_HW12
();
#endif
}
if((val
+ offset
) == 5) servo_menu
();
if((val
+ offset
) == 6) OSD_Setup
();
#ifdef HWVERSION3_9
if((val
+ offset
) == 7) GPS_Setup
();
if((val
+ offset
) == 8) FollowMe_Setup
();
if((val
+ offset
) == 9) Joysticks_Setup
();
if((val
+ offset
) == 10) Accu_Setup
();
#else
Show_Error_HW12
();
#endif
if((val
+ offset
) == 11) Update_PKT
();
if((val
+ offset
) == 12) Config.
Debug = Edit_generic
(Config.
Debug,0,1,DEBUGPKT
,Show_uint3
);
if((val
+ offset
) == 13) Reset_EEprom
();
}
}
//--------------------------------------------------------------
void Display_Setup
(void)
{
// uint8_t ii = 0;
// uint8_t Offset = 0;
// uint8_t size = 0;
// uint8_t dmode = 0;
uint8_t target_pos
= 1;
// uint8_t val;
lcd_cls
();
mmode
= 0;
edit
= 0;
LCD_Change
= 0;
// val = 0;
while(1)
{
size
= ITEMS_LCD
;
lcd_cls
();
lcd_puts_at
(0, 0, strGet
(DISPLAY1
), 2);
lcd_puts_at
(0, 7, strGet
(KEYLINE1
), 0);
// while(1)
// {
// ii = 0;
//
// if(Offset > 0)
// lcd_printp_at(1, 1, PSTR("\x12"), 0);
//
// for(ii = 0; ii < 6 ; ii++)
// {
// if((ii + Offset) < size)
// lcd_printp_at(3, ii + 1, param_menuitems_lcd[ii + Offset][Config.DisplayLanguage], 0);
//
// if((ii == 5)&&(ii+Offset < (size - 1)))
// lcd_printp_at(1,6, PSTR("\x13"), 0);
//
// }
//
// if(dmode == 0)
// {
// if(Offset == 0)
// {
// if(size > 6)
// val = menu_choose2 (1, 5, target_pos,0,1);
// else
// val = menu_choose2 (1, size, target_pos,0,0);
//
// }
// else
// val = menu_choose2 (2, 5, target_pos,1,1);
//
// }
//
// if(dmode == 1)
// {
// if(Offset + 7 > size)
// val = menu_choose2 (2, 6, target_pos,1,0);
// else
// val = menu_choose2 (2, 5, target_pos,1,1);
//
// }
//
// if(val == 254)
// {
// Offset++;
// dmode = 1;
// target_pos = 5;
// }
// else if(val == 253)
// {
// Offset--;
// dmode = 0;
// target_pos = 2;
// }
// else if(val == 255)
// { // Ende mit ESC, speichern
// if (edit == 1)
// {
// WriteParameter();
// edit = 0;
// return;
// }
// return;
// }
// else
// break;
// }
val
= menu_select
(param_menuitems_lcd
,size
,target_pos
);
if (val
==255) break;
target_pos
= val
;
if((val
+ offset
) == 1)
Config.
PKT_StartInfo = Edit_generic
(Config.
PKT_StartInfo,0,2,DISPLAY2
,OnOff
);
if((val
+ offset
) == 2)
Config.
OSD_RCErrorbeep = Edit_generic
(Config.
OSD_RCErrorbeep,0,2,DISPLAY9
,OnOff
);
if((val
+ offset
) == 3)
Config.
DisplayLanguage = Edit_generic
(Config.
DisplayLanguage,0,2,DISPLAY3
,Language
);
if((val
+ offset
) == 4)
Config.
DisplayTimeout = Edit_generic
(Config.
DisplayTimeout,0,254,DISPLAY4
,Show_uint3
);
if((val
+ offset
) == 5)
{
if (Config.
HWSound==0)
{
Config.
LCD_Helligkeit = Edit_DisplayHelligkeit
(Config.
LCD_Helligkeit,0,100,DISPLAY5
);
if (edit
== 1)
if(!LCD_Change
)
LCD_Change
=1;
}
}
if((val
+ offset
) == 6)
Config.
LCD_Kontrast = Edit_generic
(Config.
LCD_Kontrast,0,63,DISPLAY6
,Kontrast
);
if (edit
== 1)
if(!LCD_Change
)
LCD_Change
=1;
if((val
+ offset
) == 7)
{
Config.
LCD_DisplayMode = Edit_generic
(Config.
LCD_DisplayMode,0,4,DISPLAY7
,NormRev
);
if (edit
== 1)
if(!LCD_Change
)
LCD_Change
=1;
}
if((val
+ offset
) == 8)
{
Config.
LCD_ORIENTATION = Edit_generic
(Config.
LCD_ORIENTATION,0,4,DISPLAY8
,NormRev
);
if (edit
== 1)
if(!LCD_Change
)
LCD_Change
=1;
}
if((val
+ offset
) == 9)
{
Config.
HWSound = Edit_generic
(Config.
HWSound,0,1,HWSOUND
,YesNo
);
}
if((val
+ offset
) == 10)
{
Config.
HWBeeper = Edit_generic
(Config.
HWBeeper,0,1,HWBEEPER
,YesNo
);
}
if((val
+ offset
) == 11)
Config.
Volume = Edit_generic
(Config.
Volume,0,50,VOLUME
,Show_uint3
);
}
}
//--------------------------------------------------------------
void Wi_Setup
(void)
{
// uint8_t ii = 0;
// uint8_t Offset = 0;
// uint8_t size = 0;
// uint8_t dmode = 0;
uint8_t target_pos
= 1;
// uint8_t val = 0;
mmode
= 0;
edit
= 0;
// WiIsSet = true;
lcd_cls
();
while(1)
{
size
= ITEMS_WI
;
lcd_cls
();
lcd_printp_at
(0, 0, PSTR
(" Wi.232 Setup "), 2);
lcd_puts_at
(0, 7, strGet
(KEYLINE1
), 0);
// while(1)
// {
// ii = 0;
//
// if(Offset > 0)
// lcd_printp_at(1, 1, PSTR("\x12"), 0);
//
// for(ii = 0; ii < 6; ii++)
// {
// if((ii + Offset) < size)
// lcd_printp_at(3, ii+1, param_menuitems_wi[ii+Offset][Config.DisplayLanguage], 0);
//
// if((ii == 5)&&(ii + Offset < (size - 1)))
// lcd_printp_at(1, 6, PSTR("\x13"), 0);
//
// }
//
// if(dmode == 0)
// {
// if(Offset == 0)
// {
// if(size > 6)
// val = menu_choose2 (1, 5, target_pos,0,1);
// else
// val = menu_choose2 (1, size, target_pos,0,0);
//
// }
// else
// val = menu_choose2 (2, 5, target_pos,1,1);
//
// }
//
// if(dmode == 1)
// {
// if(Offset + 7 > size)
// val = menu_choose2 (2, 6, target_pos, 1, 0);
// else
// val = menu_choose2 (2, 5, target_pos, 1, 1);
//
// }
//
// if(val == 254)
// {
// Offset++;
// dmode = 1;
// target_pos = 5;
// }
// else if(val == 253)
// {
// Offset--;
// dmode = 0;
// target_pos = 2;
// }
// else if(val == 255)
// { // Ende mit ESC, speichern
// if (edit == 1)
// {
// if (Config.UseWi==true) InitWi232(Config.PKT_Baudrate);
// //Old_Baudrate = PKT_Baudrate;
// WriteParameter();
// edit = 0;
// }
//
// return;
// }
// else
//
// break;
// }
val
= menu_select
(param_menuitems_wi
,size
,target_pos
);
if (val
==255)
{
if (edit
== 1)
{
if (Config.
UseWi==true) InitWi232
(Config.
PKT_Baudrate);
//Old_Baudrate = PKT_Baudrate;
// WriteParameter();
edit
= 0;
}
break;
}
target_pos
= val
;
if((val
+ offset
) == 1)
{
Config.
UseWi = Edit_generic
(Config.
UseWi,0,1,WI2321
,YesNo
);
}
if((val
+ offset
) == 2)
{
Config.
WiTXRXChannel = Edit_generic
(Config.
WiTXRXChannel, 0, 5,WITXRX
,Show_uint3
);
}
if((val
+ offset
) == 3)
{
Config.
WiNetworkGroup = Edit_generic
(Config.
WiNetworkGroup, 0, 127, WINETWG
,Show_uint3
);
}
if((val
+ offset
) == 4)
{
Config.
WiNetworkMode = Edit_generic
(Config.
WiNetworkMode,0,1,WINETWM
,Wi_Netmode
);
}
if((val
+ offset
) == 5)
{
Config.
WiTXTO = Edit_generic
(Config.
WiTXTO,0,127,WITIMEOUT
,Show_uint3
);
}
if((val
+ offset
) == 6)
{
Config.
WiUartMTU = Edit_generic
(Config.
WiUartMTU,0,127,WIUART
,Show_uint3
);
}
if((val
+ offset
) == 7)
{
Old_Baudrate
= Config.
PKT_Baudrate;
Config.
PKT_Baudrate = Edit_generic
(Config.
PKT_Baudrate,1,6,PKT_BAUDRATE
,Baudrate
);
Wi232_New_Baudrate
= Config.
PKT_Baudrate;
BT_New_Baudrate
= Config.
PKT_Baudrate;
if (edit
==1)
{ if (Config.
UseBT==true) { set_BTOn
(); bt_setbaud
(BT_New_Baudrate
); set_BTOff
();}
if (Config.
UseWi==true) InitWi232
(Wi232_New_Baudrate
);
// WriteParameter();
Old_Baudrate
= Config.
PKT_Baudrate;
edit
= 0;
}
}
if((val
+ offset
) == 8)
InitWi232
(Config.
PKT_Baudrate);
if((val
+ offset
) == 9)
Port_USB2CFG_Wi
();
}
}
uint8_t Edit_String
(const char *data
, const uint8_t length
, uint8_t type
, const char *Text
)
{
uint8_t y
= 1;
uint8_t x
= 1;
uint8_t I
= 0;
lcd_cls
();
lcd_printp_at
(0, 0, Text
, 2);
for (uint8_t i
= 0; i
< length
; i
++)
{
lcd_putc
(y
++, 3, data
[i
], 0);
lcd_printp_at
(y
++, 3, PSTR
(" "), 0);
EditString
[i
] = data
[i
];
}
lcd_rect
((x
*6)-3, (8*3)-2, 10, 10, 1);
lcd_printp_at
(0, 6, PSTR
(" C"), 0);
lcd_printp_at
(0, 7, PSTR
(" \x17 \x16 \x19 OK"), 0);
do
{
if (type
== 1) // Name
{
for (uint8_t i
= bt_name_length
; i
> 0; i
--)
{
if (EditString
[i
- 1] != ' ')
{
bt_name_len
= i
;
break;
}
}
if ((get_key_press
(1 << KEY_PLUS
) || get_key_long_rpt_sp
((1 << KEY_PLUS
), 2)) && EditString
[I
] < 'z')
{
EditString
[I
]++;
if (EditString
[I
] >= 0x00 && EditString
[I
] < ' ')
EditString
[I
] = ' ';
if (EditString
[I
] > ' ' && EditString
[I
] < '0')
EditString
[I
] = '0';
if (EditString
[I
] > '9' && EditString
[I
] < 'A')
EditString
[I
] = 'A';
if (EditString
[I
] > 'Z' && EditString
[I
] < 'a')
EditString
[I
] = 'a';
lcd_putc
(x
, 3, EditString
[I
], 0);
edit
= 1;
}
if ((get_key_press
(1 << KEY_MINUS
) || get_key_long_rpt_sp
((1 << KEY_MINUS
), 2)) && EditString
[I
] > ' ')
{
EditString
[I
]--;
if (EditString
[I
] < 'a' && EditString
[I
] > 'Z')
EditString
[I
] = 'Z';
if (EditString
[I
] < 'A' && EditString
[I
] > '9')
EditString
[I
] = '9';
if (EditString
[I
] < '0' && EditString
[I
] > ' ')
EditString
[I
] = ' ';
lcd_putc
(x
, 3, EditString
[I
], 0);
edit
= 1;
}
}
else if (type
== 2) // PIN
{
if ((get_key_press
(1 << KEY_PLUS
) || get_key_long_rpt_sp
((1 << KEY_PLUS
), 1)) && (EditString
[I
] < '9'))
{
EditString
[I
]++;
if (EditString
[I
] >= 0x00 && EditString
[I
] < ' ')
EditString
[I
] = ' ';
if (EditString
[I
] > ' ' && EditString
[I
] < '0')
EditString
[I
] = '0';
lcd_putc
(x
, 3, EditString
[I
], 0);
edit
= 1;
}
if ((get_key_press
(1 << KEY_MINUS
) || get_key_long_rpt_sp
((1 << KEY_MINUS
), 1)) && (EditString
[I
] > '0'))
{
EditString
[I
]--;
if (EditString
[I
] < 'A' && EditString
[I
] > '9')
EditString
[I
] = '9';
lcd_putc
(x
, 3, EditString
[I
], 0);
edit
= 1;
}
}
if (get_key_long
(1 << KEY_ESC
))
{
if (type
== 1) // Name
EditString
[I
] = ' '; // Zeichen l�schen
else if (type
== 2) // Pin
EditString
[I
] = '0'; // Zeichen setzen
lcd_putc
(x
, 3, EditString
[I
], 0);
edit
= 1;
}
if (get_key_short
(1 << KEY_ESC
))
{
if (type
== 1)
length_tmp
= bt_name_length
;
else if (type
== 2)
length_tmp
= bt_pin_length
;
if ((x
/ 2) + 2 > length_tmp
)
{
lcd_rect
((x
*6)-3, (8*3)-2, 10, 10, 0);
x
= 1;
lcd_rect
((x
*6)-3, (8*3)-2, 10, 10, 1);
I
= 0;
}
else
{
lcd_rect
((x
*6)-3, (8*3)-2, 10, 10, 0);
x
++;
x
++;
lcd_rect
((x
*6)-3, (8*3)-2, 10, 10, 1);
I
++; //Zeiger auf Zeichen
}
}
}
while (!get_key_press
(1 << KEY_ENTER
));
{
return 1;
}
}
void BT_SelectDevice
(void)
{
uint8_t ii
= 0;
uint8_t Offset
= 0;
uint8_t size
= 0;
uint8_t dmode
= 0;
uint8_t target_pos
= 1;
uint8_t val
= 0;
mmode
= 0;
edit
= 0;
lcd_cls
();
while(1)
{
size
= bt_devicecount
;
lcd_cls
();
lcd_printp_at
(0, 0, PSTR
(" BT select Device "), 2);
lcd_puts_at
(0, 7, strGet
(KEYLINE1
), 0);
while(1)
{
ii
= 0;
if(Offset
> 0)
lcd_printp_at
(1, 1, PSTR
("\x12"), 0);
for(ii
= 0; ii
< 6; ii
++)
{
if((ii
+ Offset
) < size
)
{
if (strncmp (device_list
[ii
+ Offset
].
mac, Config.
gps_UsedMac, 14) == 0)
{
lcd_puts_at
(3, ii
+1, device_list
[ii
+ Offset
].
DevName, 2);
// lcd_puts_at(3, 4, strGet(KEYLINE1), 0);
}
else
{
lcd_puts_at
(3, ii
+1, device_list
[ii
+ Offset
].
DevName, 0);
// lcd_puts_at(3, 5, strGet(KEYLINE1), 0);
}
}
if((ii
== 5)&&(ii
+ Offset
< (size
- 1)))
lcd_printp_at
(1, 6, PSTR
("\x13"), 0);
}
if(dmode
== 0)
{
if(Offset
== 0)
{
if(size
> 6)
val
= menu_choose2
(1, 5, target_pos
,0,1);
else
val
= menu_choose2
(1, size
, target_pos
,0,0);
}
else
val
= menu_choose2
(2, 5, target_pos
,1,1);
}
if(dmode
== 1)
{
if(Offset
+ 7 > size
)
val
= menu_choose2
(2, 6, target_pos
, 1, 0);
else
val
= menu_choose2
(2, 5, target_pos
, 1, 1);
}
if(val
== 254)
{
Offset
++;
dmode
= 1;
target_pos
= 5;
}
else if(val
== 253)
{
Offset
--;
dmode
= 0;
target_pos
= 2;
}
else if(val
== 255)
{ // Ende mit ESC, speichern
if (edit
== 1)
{
// WriteParameter();
edit
= 0;
}
return;
}
else
break;
}
target_pos
= val
;
if(val
> 0 )
{
for(uint8_t i
= 0; i
< 14; i
++)
{
Config.
gps_UsedMac[i
] = device_list
[val
-1].
mac[i
];
}
for(uint8_t i
= 0; i
< 20; i
++)
{
Config.
gps_UsedDevName[i
] = device_list
[val
-1].
DevName[i
];
}
edit
= 1;
}
}
}
//--------------------------------------------------------------
//
void BT_Setup
(void)
{
// uint8_t ii = 0;
uint8_t z
= 0;
// uint8_t Offset = 0;
// uint8_t size = 0;
// uint8_t dmode = 0;
uint8_t target_pos
= 1;
// uint8_t val;
char string
[20];
mmode
= 0;
edit
= 0;
// val = 0;
// BTIsSet = true;
lcd_cls
();
while(1)
{
size
= ITEMS_BT
;
lcd_cls
();
lcd_puts_at
(0, 0, strGet
(BT1
), 2);
lcd_puts_at
(0, 7, strGet
(KEYLINE1
), 0);
// while(1)
// {
// ii = 0;
//
// if(Offset > 0)
// lcd_printp_at(1,1, PSTR("\x12"), 0);
//
// for(ii = 0; ii < 6; ii++)
// {
// if((ii + Offset) < size)
// {
// lcd_printp_at(3, ii + 1, param_menuitems_bt[ii+Offset][Config.DisplayLanguage], 0);
// if ((ii+Offset)==5)
// {
// for (uint8_t i = 0; i < RE_ID_length; i++)
// {
// lcd_putc (10+i, ii+1, Config.RE_ID[i], 0);
//
// }
// }
// }
//
//
// if((ii == 5) && (ii + Offset < (size - 1)))
// lcd_printp_at(1,6, PSTR("\x13"), 0);
//
// }
//
// if(dmode == 0)
// {
// if(Offset == 0)
// {
// if(size > 6)
// val = menu_choose2 (1, 5, target_pos, 0, 1);
// else
// val = menu_choose2 (1, size, target_pos, 0, 0);
//
// }
// else
// val = menu_choose2 (2, 5, target_pos, 1, 1);
//
// }
//
// if(dmode == 1)
// {
// if(Offset + 7 > size)
// val = menu_choose2 (2, 6, target_pos, 1, 0);
// else
// val = menu_choose2 (2, 5, target_pos, 1, 1);
// }
//
// if(val == 254)
// {
// Offset++;
// dmode = 1;
// target_pos = 5;
// }
// else if(val == 253)
// {
// Offset--;
// dmode = 0;
// target_pos = 2;
// }
// else if(val == 255)
// { // Ende mit ESC, speichern
// if (edit == 1)
// {
// if (Config.UseBT == 1);
// if (bt_init()) Config.BTIsSet = true; else Config.BTIsSet = false;
// WriteParameter();
// return;
// }
// return;
// }
// else
// break;
// }
val
= menu_select
(param_menuitems_bt
,size
,target_pos
);
if (val
==255)
{
if (edit
== 1)
{
if (Config.
UseBT == 1);
if (bt_init
()) Config.
BTIsSet = true; else Config.
BTIsSet = false;
}
break;
}
target_pos
= val
;
if((val
+ offset
) == 1)
Config.
UseBT = Edit_generic
(Config.
UseBT,0,1,BT4
,YesNo
);
if((val
+ offset
) == 2)
{
for (uint8_t i
= 0; i
< bt_name_length
; i
++)
{
string
[i
] = Config.
bt_name[i
];
}
string
[bt_name_length
] = 0;
Edit_String
(string
, bt_name_length
, 1, PSTR
(" Bluetooth Name "));
if (edit
== 1)
{
for (uint8_t i
= 0; i
< bt_name_len
; i
++)
{
Config.
bt_name[i
] = EditString
[i
];
// WriteParameter();
}
if (bt_name_len
< 10)
{
for (uint8_t i
= bt_name_len
; i
< 10; i
++)
{
Config.
bt_name[i
] = ' ';
// WriteParameter();
}
}
}
}
if((val
+ offset
) == 3)
{
for (uint8_t i
= 0; i
< bt_pin_length
; i
++)
{
string
[i
] = Config.
bt_pin[i
];
}
string
[bt_pin_length
] = 0;
Edit_String
(string
, bt_pin_length
, 2, PSTR
(" Bluetooth Pin "));
if (edit
== 1)
{
for (uint8_t i
= 0; i
< bt_pin_length
; i
++)
{
Config.
bt_pin[i
] = EditString
[i
];
// WriteParameter();
}
}
}
if((val
+ offset
) == 4)
{
// if (edit == 1)
// if(BTIsSet)
// BTIsSet = false;
if (bt_init
() == true)
{
lcd_printp_at
(0, 3, PSTR
("BT Init ok"), 0);
WriteBTInitFlag
();
}
else
{
lcd_printp_at
(0, 3, PSTR
("BT Init Error"), 0);
Config.
BTIsSet = false;
set_beep
( 1000, 0x0040, BeepNormal
);
}
}
if((val
+ offset
) == 5)
{
lcd_cls
();
lcd_printp_at
(0, 0, PSTR
(" BTM-222 MAC-Adresse "), 2);
lcd_puts_at
(18, 7, strGet
(OK
), 0);
lcd_printp_at
(0, 4, PSTR
("MAC:"), 0);
z
= 0;
for(uint8_t i
= 0; i
< 13; i
++)
{
lcd_putc
(z
, 5, Config.
bt_Mac[i
],0);
if ((i
%2==1)&&(i
<11))
{
z
++;
lcd_printp_at
(z
, 5, PSTR
(":"),0);
}
z
++;
}
while (!get_key_press
(1 << KEY_ENTER
));
}
if((val
+ offset
) == 6)
{
for (uint8_t i
= 0; i
< RE_ID_length
; i
++)
{
string
[i
] = Config.
RE_ID[i
];
}
string
[RE_ID_length
] = 0;
Edit_String
(string
, RE_ID_length
, 2, PSTR
(" RE-ID Notiz "));
if (edit
== 1)
{
for (uint8_t i
= 0; i
< RE_ID_length
; i
++)
{
Config.
RE_ID[i
] = EditString
[i
];
// WriteParameter();
}
}
}
if((val
+ offset
) == 7)
Port_FC2CFG_BT
();
}
}
void GPS_Setup
(void)
{
// uint8_t ii = 0;
// uint8_t Offset = 0;
// uint8_t size = 0;
// uint8_t dmode = 0;
uint8_t target_pos
= 1;
// uint8_t val;
uint8_t BT_WhasOn
= 0;
uint8_t status
;
// uint16_t uart_bytes;
mmode
= 0;
edit
= 0;
val
= 0;
lcd_cls
();
while(1)
{
size
= ITEMS_GPS
;
lcd_cls
();
lcd_puts_at
(0, 0, strGet
(GPS1
), 2);
lcd_puts_at
(0, 7, strGet
(KEYLINE1
), 0);
// while(1)
// {
// ii = 0;
//
// if(Offset > 0)
// lcd_printp_at(1,1, PSTR("\x12"), 0);
//
// for(ii = 0; ii < 6; ii++)
// {
// if((ii + Offset) < size)
// lcd_printp_at(3, ii + 1, param_menuitems_GPS[ii+Offset][Config.DisplayLanguage], 0);
//
// if((ii == 5) && (ii + Offset < (size - 1)))
// lcd_printp_at(1,6, PSTR("\x13"), 0);
//
// }
//
// if(dmode == 0)
// {
// if(Offset == 0)
// {
// if(size > 6)
// val = menu_choose2 (1, 5, target_pos, 0, 1);
// else
// val = menu_choose2 (1, size, target_pos, 0, 0);
//
// }
// else
// val = menu_choose2 (2, 5, target_pos, 1, 1);
//
// }
//
// if(dmode == 1)
// {
// if(Offset + 7 > size)
// val = menu_choose2 (2, 6, target_pos, 1, 0);
// else
// val = menu_choose2 (2, 5, target_pos, 1, 1);
// }
//
// if(val == 254)
// {
// Offset++;
// dmode = 1;
// target_pos = 5;
// }
// else if(val == 253)
// {
// Offset--;
// dmode = 0;
// target_pos = 2;
// }
// else if(val == 255)
// { // Ende mit ESC, speichern
// if (edit == 1)
// {
// WriteParameter();
// if (BT_WhasOn)
// {
// set_BTOn();
//// bt_set_mode(SLAVE);
// bt_init();
// set_BTOff();
// }
//
// return;
// }
// return;
// }
// else
// break;
// }
val
= menu_select
(param_menuitems_GPS
,size
,target_pos
);
if (val
==255)
{
if (edit
== 1)
{
// WriteParameter();
if (BT_WhasOn
)
{
set_BTOn
();
// bt_set_mode(SLAVE);
bt_init
();
set_BTOff
();
}
}
break;
}
target_pos
= val
;
//
// {"Suche GPS Maus ","search GPS mouse ","search GPS mouse ","search GPS mouse "},
// {"GPS Maus Typ ","GPS mouse typ ","GPS mouse typ ","GPS mouse typ "},
// {"GPS Maus aktiv? ","GPS mouse activ? ","GPS mouse activ? ","GPS mouse activ? "},
// {"Zeige GPS Device ","show GPS device ","show GPS device ","show GPS device "},
//
if((val
+ offset
) == 1)
{
if (bt_devicecount
==0)
{
lcd_cls
();
lcd_printp_at
(0, 0, PSTR
("wähle BT Device"), 0);
set_BTOn
();
BT_WhasOn
= true;
// _delay_ms(2000);
bt_downlink_init
();
bt_searchDevice
();
set_BTOff
();
BT_SelectDevice
();
}
else
BT_SelectDevice
();
// if (edit == 1) WriteParameter();
}
if((val
+ offset
) == 2)
{
lcd_cls
();
lcd_printp_at
(0, 0, PSTR
("suche BT Device"), 0);
set_BTOn
();
BT_WhasOn
= true;
bt_downlink_init
();
bt_searchDevice
();
set_BTOff
();
BT_SelectDevice
();
}
if((val
+ offset
) == 3)
{
Config.
gps_UsedGPSMouse = Edit_generic
(Config.
gps_UsedGPSMouse,0,1,GPS_MOUSETYP
,GPSMOUSE
);
if (edit
== 1) {
// WriteParameter();
edit
= 0;
}
}
if((val
+ offset
) == 4)
{
Config.
gps_UseGPS = Edit_generic
(Config.
gps_UseGPS,0,1,GPS3
,YesNo
);
if (edit
== 1) {
// WriteParameter();
edit
= 0;
}
}
if((val
+ offset
) == 5)
{
lcd_cls
();
lcd_puts_at
(0, 0, strGet
(GPS2
), 2);
lcd_puts_at
(18, 7, strGet
(OK
), 0);
lcd_printp_at
(0, 1, PSTR
("Device:"), 0);
lcd_printp_at
(0, 4, PSTR
("MAC:"), 0);
lcd_puts_at
(0, 2,Config.
gps_UsedDevName, 0);
for(uint8_t i
= 0; i
< 12; i
++)
{
lcd_putc
(i
, 5, Config.
gps_UsedMac[i
],0);
}
while (!get_key_press
(1 << KEY_ENTER
));
}
if((val
+ offset
) == 6)
{
get_key_press
(KEY_ALL
);
lcd_cls
();
lcd_puts_at
(18, 7, strGet
(OK
), 0);
lcd_puts_at
(0, 0,Config.
gps_UsedDevName, 2);
set_BTOn
();
BT_WhasOn
= true;
if (Config.
BTIsSlave==true)
{
bt_downlink_init
();
}
lcd_printp_at
(0, 1, PSTR
("try to connect"), 0);
status
= bt_connect
(Config.
gps_UsedMac);
lcd_printp_at
(0, 2, PSTR
("connect status"), 0);
write_ndigit_number_u
(14, 2, status
, 2, 0,0);
if (status
==true)
{
lcd_printp_at
(0, 1, PSTR
("connected "), 0);
receiveNMEA
= true;
}
else
{
lcd_printp_at
(0, 2, PSTR
("connect Error"), 0);
write_ndigit_number_u
(14, 2, status
, 2, 0,0);
}
//---OG:BEGIN---
if (receiveNMEA
==true)
{
lcd_cls
();
// BT-Device Name
lcd_puts_at
(0, 0,Config.
gps_UsedDevName, 2);
// Labels
lcd_printp_at
( 0, 1, PSTR
("Sat: "), 0);
lcd_printp_at
(11, 1, PSTR
("XErr: "), 0);
lcd_printp_at
( 0, 2, PSTR
("Fix: "), 0);
lcd_printp_at
(11, 2, PSTR
("HDOP: "), 0);
lcd_printp_at
( 0, 3, PSTR
(" Latitude Longitude"), 2);
lcd_printp_at
( 0, 6, PSTR
("Alt: "), 0);
// Bottom-Line: OK
lcd_puts_at
(18, 7, strGet
(OK
), 0);
bt_rx_ready
= 0;
do
{
CheckGPS
= true;
if (!bt_receiveNMEA
()){ receiveNMEA
= false; break;}
Tracking_NMEA
();
//---------------------------------------------------------------------
// Line 1 L: Sat-Anzahl
write_ndigit_number_u
(5, 1, NMEAsatsInUse
, 2, 0,0);
// Line 1 R: BT RX Error's
write_ndigit_number_u
(17, 1, bt_rxerror
, 4, 0,0);
//---------------------------------------------------------------------
// Line 2 L: Fix
write_ndigit_number_u
(5, 2, posfix
, 2, 0,0);
// Line 2 R: HDOP
if( HDOP
== 0 )
lcd_printp_at
(16, 2, PSTR
(" ---"), 0);
else
write_ndigit_number_u_10th
(16, 2, HDOP
, 4, 0,0);
//---------------------------------------------------------------------
// Line 4 L: Latitude
write_ndigit_number_u
(1, 4, (uint16_t)(NMEAlatitude
/10000000), 2, 0,0);
lcd_printp_at
(3, 4, PSTR
("."), 0);
write_ndigit_number_u
(4, 4, (uint16_t)((NMEAlatitude
/1000) % 10000), 4, 1,0);
write_ndigit_number_u
(8, 4, (uint16_t)((NMEAlatitude
/10) % 100), 2, 1,0);
// Line 4 R: Longitude
write_ndigit_number_u
(12, 4, (uint16_t)(NMEAlongitude
/10000000), 2, 0,0);
lcd_printp_at
(14, 4, PSTR
("."), 0);
write_ndigit_number_u
(15, 4, (uint16_t)((NMEAlongitude
/1000) % 10000), 4, 1,0);
write_ndigit_number_u
(19, 4, (uint16_t)((NMEAlongitude
/10) % 100), 2, 1,0);
//---------------------------------------------------------------------
// Line 6 L: Altitude
write_ndigit_number_u_10th
(5, 6, NMEAaltitude
, 5, 0,0);
lcd_printp_at
(11, 6, PSTR
("m"), 0);
// Line 6 R: GPS Time
lcd_puts_at
(13, 6, NMEAtime
, 0);
//---------------------------------------------------------------------
} while (!get_key_press
(1 << KEY_ENTER
) || !receiveNMEA
==true);
CheckGPS
= false;
lcd_cls
();
if (!receiveNMEA
) {
lcd_printp_at
(0, 1, PSTR
("lost BT data"), 0);
set_beep
( 400, 0x0080, BeepNormal
);
}
lcd_printp_at
(0, 3, PSTR
("GPS trennen"), 0);
lcd_printp_at
(0, 4, PSTR
("bitte warten..."), 0);
}
else
{
lcd_printp_at
(0, 3, PSTR
("Error connecting!"), 0);
while (!get_key_press
(1 << KEY_ENTER
));
}
receiveNMEA
= false;
CheckGPS
= false;
if (!bt_disconnect
()) lcd_printp_at
(0, 3, PSTR
("Error disconnecting!"), 0);
//---OG:END---
// if (receiveNMEA==true)
// {
// lcd_printp_at (0, 3, PSTR(" Latitude Longitude"), 2);
// bt_rx_ready = 0;
// do
// {
// CheckGPS = true;
// if (!bt_receiveNMEA()){ receiveNMEA = false; break;}
//
//
// Tracking_NMEA();
//
//
// write_ndigit_number_u (1, 4, (uint16_t)(NMEAlatitude/10000000), 2, 0,0);
// lcd_printp_at (3, 4, PSTR("."), 0);
// write_ndigit_number_u (4, 4, (uint16_t)((NMEAlatitude/1000) % 10000), 4, 1,0);
// write_ndigit_number_u (8, 4, (uint16_t)((NMEAlatitude/10) % 100), 2, 1,0);
//
//
// write_ndigit_number_u (12, 4, (uint16_t)(NMEAlongitude/10000000), 2, 0,0);
// lcd_printp_at (14, 4, PSTR("."), 0);
// write_ndigit_number_u (15, 4, (uint16_t)((NMEAlongitude/1000) % 10000), 4, 1,0);
// write_ndigit_number_u (19, 4, (uint16_t)((NMEAlongitude/10) % 100), 2, 1,0);
// lcd_printp_at (0, 2, PSTR("GPS Time: "), 0);
// lcd_puts_at (10, 2, NMEAtime, 0);
// lcd_printp_at (0, 6, PSTR("Satellite: "), 0);
// write_ndigit_number_u (11, 6, NMEAsatsInUse, 2, 1,0);
// lcd_printp_at (0, 5, PSTR("Fix: "), 0);
// write_ndigit_number_u (5, 5, posfix, 1, 1,0);
// lcd_printp_at (8, 5, PSTR("HDOP: "), 0);
// write_ndigit_number_u_10th (14, 5, HDOP, 4, 0,0);
// lcd_printp_at (0, 7, PSTR("Alitude: "), 0);
// write_ndigit_number_u_10th (9, 7, NMEAaltitude, 5, 0,0);
// lcd_printp_at (15, 7, PSTR("m"), 0);
// lcd_printp_at (0, 1, PSTR(" BT RX Error: "), 0);
// write_ndigit_number_u (13, 1, bt_rxerror, 3, 1,0);
//// write_ndigit_number_u (13, 1, UART1_RxError, 5, 1,0);
//
//// uart_bytes = uart1_available();
//// lcd_printp_at (0, 1, PSTR(" UartAvail: "), 0);
//// write_ndigit_number_u (13, 1,uart_bytes , 4, 1,0);
// }
//
//
// while (!get_key_press (1 << KEY_ENTER) || !receiveNMEA==true);
//
// CheckGPS = false;
// lcd_cls_line(0,1,21);
// lcd_cls_line(0,2,21);
// lcd_cls_line(0,3,21);
// lcd_cls_line(0,4,21);
// lcd_cls_line(0,5,21);
// lcd_cls_line(0,6,21);
// lcd_cls_line(0,7,21);
// if (!receiveNMEA) lcd_printp_at (0, 2, PSTR("lost BT data"), 0);
// lcd_printp_at (0, 3, PSTR("GPS trennen"), 0);
// lcd_printp_at (0, 4, PSTR("bitte warten"), 0);
// }
// else
// {
// lcd_printp_at (0, 4, PSTR("Error at connecting"), 0);
// while (!get_key_press (1 << KEY_ENTER));
// }
// receiveNMEA = false;
// CheckGPS = false;
// if (!bt_disconnect()) lcd_printp_at (0, 3, PSTR("Fehler beim Trennen"), 0);
set_BTOff
();
}
}
}
//--------------------------------------------------------------
uint8_t Edit_PKT_Accu
(uint8_t Value
, uint8_t min
, uint8_t max
)
{
Pre
= Value
;
lcd_cls
();
// lcd_printp_at (0, 2, Text, 0);
lcd_puts_at
(0, 2, strGet
(LIPO2
), 0);
switch (Value
)
{
case false :lcd_printp_at
(15, 2, PSTR
("LiIo"), 0);
break;
case true :lcd_printp_at
(15, 2, PSTR
("LiPo"), 0);
break;
break;
}
lcd_puts_at
(0, 7, strGet
(KEYLINE2
), 0);
do
{
if ((get_key_press
(1 << KEY_PLUS
)) && (Value
== 0))
{
Value
= 1;
lcd_printp_at
(15, 2, PSTR
("LiPo"), 0);
}
if ((get_key_press
(1 << KEY_MINUS
)) && (Value
== 1))
{
Value
= 0;
lcd_printp_at
(15, 2, PSTR
("LiIo"), 0);
}
if (get_key_press
(1 << KEY_ENTER
))
{
edit
= 1;
Config.
PKT_Accutyp = Value
;
return Value
;
}
}
while (!get_key_press
(1 << KEY_ESC
));
{
get_key_press
(KEY_ALL
);
edit
= 0;
Config.
PKT_Accutyp = Pre
;
return Pre
;
}
}
//--------------------------------------------------------------
uint16_t Edit_LipoOffset
(uint16_t Value
, uint16_t min
, uint16_t max
)
{
lcd_cls
();
lcd_puts_at
(0, 2, strGet
(LIPO3
), 0);
lcd_puts_at
(0, 5, strGet
(LIPO5
), 0);
lcd_puts_at
(0, 6, strGet
(LIPO6
), 0);
Pre16
= Value
;
write_ndigit_number_u
(16, 2, Value
, 4, 0,0);
lcd_puts_at
(0, 7, strGet
(KEYLINE2
), 0);
do
{
if ((get_key_press
(1 << KEY_PLUS
) || get_key_long_rpt_sp
((1 << KEY_PLUS
), 2)) && (Value
< max
-10))
{
edit
= 1;
Value
= Value
+10;
Config.
Lipo_UOffset = Value
;
write_ndigit_number_u
(16, 2,Value
, 4, 0,0);
}
if ((get_key_press
(1 << KEY_MINUS
) || get_key_long_rpt_sp
((1 << KEY_MINUS
), 2)) && (Value
> min
))
{
edit
= 1;
Value
=Value
-10;
Config.
Lipo_UOffset = Value
;
write_ndigit_number_u
(16, 2,Value
, 4, 0,0);
}
if (get_key_press
(1 << KEY_ENTER
))
return Value
;
show_Lipo
();
write_ndigit_number_u_100th
(8, 3, volt_avg
, 0, 0);
lcd_printp_at
(3, 3, PSTR
("Volt"), 0);
}
while (!get_key_press
(1 << KEY_ESC
));
{
get_key_press
(KEY_ALL
);
edit
= 0;
Config.
Lipo_UOffset = Pre16
;
return Pre16
;
}
}
//--------------------------------------------------------------
void Accu_Setup
(void)
{
// uint8_t ii = 0;
// uint8_t Offset = 0;
// uint8_t size = 0;
// uint8_t dmode = 0;
uint8_t target_pos
= 1;
// uint8_t val;
mmode
= 0;
edit
= 0;
val
= 0;
lcd_cls
();
while(1)
{
size
= ITEMS_Accu
;
lcd_cls
();
lcd_puts_at
(0, 0, strGet
(LIPO1
), 2);
lcd_puts_at
(0, 7, strGet
(KEYLINE1
), 0);
// while(1)
// {
// ii = 0;
//
// if(Offset > 0)
// lcd_printp_at(1,1, PSTR("\x12"), 0);
//
// for(ii = 0; ii < 6; ii++)
// {
// if((ii + Offset) < size)
// lcd_printp_at(3, ii + 1, param_menuitems_Accu[ii+Offset][Config.DisplayLanguage], 0);
//
// if((ii == 5) && (ii + Offset < (size - 1)))
// lcd_printp_at(1,6, PSTR("\x13"), 0);
//
// }
//
// if(dmode == 0)
// {
// if(Offset == 0)
// {
// if(size > 6)
// val = menu_choose2 (1, 5, target_pos, 0, 1);
// else
// val = menu_choose2 (1, size, target_pos, 0, 0);
//
// }
// else
// val = menu_choose2 (2, 5, target_pos, 1, 1);
//
// }
//
// if(dmode == 1)
// {
// if(Offset + 7 > size)
// val = menu_choose2 (2, 6, target_pos, 1, 0);
// else
// val = menu_choose2 (2, 5, target_pos, 1, 1);
// }
//
// if(val == 254)
// {
// Offset++;
// dmode = 1;
// target_pos = 5;
// }
// else if(val == 253)
// {
// Offset--;
// dmode = 0;
// target_pos = 2;
// }
// else if(val == 255)
// { // Ende mit ESC, speichern
// if (edit == 1)
// {
// WriteParameter();
// edit = 0;
// return;
// }
// return;
// }
// else
// break;
// }
val
= menu_select
(param_menuitems_Accu
,size
,target_pos
);
if (val
==255) break;
target_pos
= val
;
if((val
+ offset
) == 1)
{
Config.
PKT_Accutyp= Edit_PKT_Accu
(Config.
PKT_Accutyp,0,1);
if (edit
== 1) {
// WriteParameter();
edit
= 0;
}
}
if((val
+ offset
) == 2)
{
Config.
Lipo_UOffset = Edit_LipoOffset
(Config.
Lipo_UOffset,0,9999);
if (edit
== 1) {
// WriteParameter();
edit
= 0;
}
}
}
}
//--------------------------------------------------------------
uint8_t Edit_LED_Form
(uint8_t Value
, uint8_t min
, uint8_t max
, uint8_t Text
)
{
Pre
= Value
;
lcd_cls
();
lcd_puts_at
(0, 2, strGet
(Text
), 0);
switch (Value
)
{
case 0x1:
lcd_circle
(14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis
lcd_fcircle
(16 * 6 + 5, 2 * 8 + 3, 3, 0); // löschen
lcd_circle
(16 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis
lcd_fcircle
(16 * 6 + 5, 2 * 8 + 3, 1, 1); // plus
break;
case 0x3 :
lcd_circle
(14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis
lcd_fcircle
(16 * 6 + 5, 2 * 8 + 3, 3, 1); // schwarz
break;
break;
}
lcd_puts_at
(0, 7, strGet
(KEYLINE2
), 0);
do
{
if ((get_key_press
(1 << KEY_PLUS
)) && (Value
== 1))
{
Value
= 3;
lcd_circle
(14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis
lcd_fcircle
(16 * 6 + 5, 2 * 8 + 3, 3, 1); // schwarz
}
if ((get_key_press
(1 << KEY_MINUS
)) && (Value
== 3))
{
Value
= 1;
lcd_circle
(14 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis
lcd_fcircle
(16 * 6 + 5, 2 * 8 + 3, 3, 0); // löschen
lcd_circle
(16 * 6 + 5, 2 * 8 + 3, 3, 1); // kreis
lcd_fcircle
(16 * 6 + 5, 2 * 8 + 3, 1, 1); // plus
}
if (get_key_press
(1 << KEY_ENTER
))
{
edit
= 1;
Config.
OSD_LEDform = Value
;
// WriteParameter();
edit
= 0;
return Value
;
}
}
while (!get_key_press
(1 << KEY_ESC
));
{
get_key_press
(KEY_ALL
);
edit
= 0;
Config.
OSD_LEDform = Pre
;
return Pre
;
}
}
//--------------------------------------------------------------
void OSD_Setup
(void)
{
// uint8_t ii = 0;
// uint8_t Offset = 0;
// uint8_t size = 0;
// uint8_t dmode = 0;
uint8_t target_pos
= 1;
// uint8_t val;
mmode
= 0;
edit
= 0;
val
= 0;
lcd_cls
();
while(1)
{
size
= ITEMS_OSD
;
lcd_cls
();
lcd_puts_at
(0, 0, strGet
(OSD_Screen
), 2);
lcd_puts_at
(0, 7, strGet
(KEYLINE1
), 0);
// while(1)
// {
// ii = 0;
//
// if(Offset > 0)
// lcd_printp_at(1,1, PSTR("\x12"), 0);
//
// for(ii = 0; ii < 6; ii++)
// {
// if((ii + Offset) < size)
// lcd_printp_at(3, ii + 1, param_menuitems_OSD[ii+Offset][Config.DisplayLanguage], 0);
//
// if((ii == 5) && (ii + Offset < (size - 1)))
// lcd_printp_at(1,6, PSTR("\x13"), 0);
//
// }
//
// if(dmode == 0)
// {
// if(Offset == 0)
// {
// if(size > 6)
// val = menu_choose2 (1, 5, target_pos, 0, 1);
// else
// val = menu_choose2 (1, size, target_pos, 0, 0);
//
// }
// else
// val = menu_choose2 (2, 5, target_pos, 1, 1);
//
// }
//
// if(dmode == 1)
// {
// if(Offset + 7 > size)
// val = menu_choose2 (2, 6, target_pos, 1, 0);
// else
// val = menu_choose2 (2, 5, target_pos, 1, 1);
// }
//
// if(val == 254)
// {
// Offset++;
// dmode = 1;
// target_pos = 5;
// }
// else if(val == 253)
// {
// Offset--;
// dmode = 0;
// target_pos = 2;
// }
// else if(val == 255)
// { // Ende mit ESC, speichern
// if (edit == 1)
// {
// WriteParameter();
// edit = 0;
// return;
// }
// return;
// }
// else
// break;
// }
val
= menu_select
(param_menuitems_OSD
,size
,target_pos
);
if (val
==255) break;
target_pos
= val
;
//4.3.13 CB if((val + Offset) == 1) Config.OSD_ScreenMode = Edit_generic(Config.OSD_ScreenMode, 0, OSD_MaxScreen, OSD_SCREENMODE,Show_uint);
if((val
+ offset
) == 1) Config.
OSD_LEDform = Edit_LED_Form
(Config.
OSD_LEDform, 1, 3, OSD_LED_Form
);
if((val
+ offset
) == 2) Config.
OSD_InvertOut = Edit_generic
(Config.
OSD_InvertOut, 0, 1, OSD_Invert_Out
,YesNo
);
if((val
+ offset
) == 3) Config.
OSD_SendOSD = Edit_generic
(Config.
OSD_SendOSD, 0, 1,OSD_Send_OSD
,YesNo
);
if((val
+ offset
) == 4) Config.
OSD_Fallspeed = Edit_generic
(Config.
OSD_Fallspeed,0,247,FALLSPEED
,Show_uint10th
);
if((val
+ offset
) == 5) Config.
OSD_VarioBeep = Edit_generic
(Config.
OSD_VarioBeep,0,1,OSD_VARIOBEEP
,YesNo
);
if((val
+ offset
) == 6) Config.
OSD_HomeMKView = Edit_generic
(Config.
OSD_HomeMKView,0,1,OSD_HOMEMKVIEW
,YesNo
);
if((val
+ offset
) == 7) Config.
MK_LowBat = Edit_generic
(Config.
MK_LowBat,32,247,LOWBAT
,Show_uint10th
);
if((val
+ offset
) == 8) Config.
OSD_mAh_Warning = Edit_generic
(Config.
OSD_mAh_Warning,0,30000,OSD_MAHWARNING
, Show_uint5
);
if((val
+ offset
) == 9)Config.
OSD_LipoBar = Edit_generic
(Config.
OSD_LipoBar, 0, 1, OSD_LIPOBAR
,YesNo
);
}
}
//--------------------------------------------------------------
void FollowMe_Setup
(void)
{
// uint8_t ii = 0;
// uint8_t Offset = 0;
// uint8_t size = 0;
// uint8_t dmode = 0;
uint8_t target_pos
= 1;
// uint8_t val;
mmode
= 0;
edit
= 0;
val
= 0;
lcd_cls
();
while(1)
{
size
= ITEMS_FOLLOWME
;
lcd_cls
();
lcd_puts_at
(0, 0, strGet
(FOLLOWME_0
), 2);
lcd_puts_at
(0, 7, strGet
(KEYLINE1
), 0);
// while(1)
// {
// ii = 0;
//
// if(Offset > 0)
// lcd_printp_at(1,1, PSTR("\x12"), 0);
//
// for(ii = 0; ii < 6; ii++)
// {
// if((ii + Offset) < size)
// lcd_printp_at(3, ii + 1, param_menuitems_FOLLOWME[ii+Offset][Config.DisplayLanguage], 0);
//
// if((ii == 5) && (ii + Offset < (size - 1)))
// lcd_printp_at(1,6, PSTR("\x13"), 0);
//
// }
//
// if(dmode == 0)
// {
// if(Offset == 0)
// {
// if(size > 6)
// val = menu_choose2 (1, 5, target_pos, 0, 1);
// else
// val = menu_choose2 (1, size, target_pos, 0, 0);
//
// }
// else
// val = menu_choose2 (2, 5, target_pos, 1, 1);
//
// }
//
// if(dmode == 1)
// {
// if(Offset + 7 > size)
// val = menu_choose2 (2, 6, target_pos, 1, 0);
// else
// val = menu_choose2 (2, 5, target_pos, 1, 1);
// }
//
// if(val == 254)
// {
// Offset++;
// dmode = 1;
// target_pos = 5;
// }
// else if(val == 253)
// {
// Offset--;
// dmode = 0;
// target_pos = 2;
// }
// else if(val == 255)
// { // Ende mit ESC, speichern
// if (edit == 1)
// {
// WriteParameter();
// edit = 0;
// return;
// }
// return;
// }
// else
// break;
// }
val
= menu_select
(param_menuitems_FOLLOWME
,size
,target_pos
);
if (val
==255) break;
target_pos
= val
;
if((val
+ offset
) == 1) Config.
FM_Refresh = Edit_generic
(Config.
FM_Refresh, 250, 60000, FOLLOWME_1
, Show_uint3
);
if((val
+ offset
) == 2) Config.
FM_Speed = Edit_generic
(Config.
FM_Speed, 0, 100, FOLLOWME_2
, Show_uint3
);
if((val
+ offset
) == 3) Config.
FM_Radius = Edit_generic
(Config.
FM_Radius, 1,20, FOLLOWME_3
, Show_uint3
);
}
}