Rev 1793 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
#include "jetimenu.h"
#include "libfc.h"
#include "printf_P.h"
#include "main.h"
#include "spi.h"
#include "capacity.h"
#define JETIBOX_KEY_RIGHT 0x1F
#define JETIBOX_KEY_UP 0x2F
#define JETIBOX_KEY_DOWN 0x4F
#define JETIBOX_KEY_LEFT 0x8F
#define JETIBOX_KEY_NONE 0x0F
#define JETIBOX_KEY_UNDEF 0x00
//MartinW added Key's
#define JETIBOX_KEY_LANDR 0x9F // 159
#define JETIBOX_KEY_DownANDR 0x5F // 95
#define JETIBOX_KEY_DownANDL 0xCF // 207
#define JETIBOX_KEY_DownANDUP 0x6F // 111
#define JETIBOX_KEY_UPANDL 0xAF // 175
#define JETIBOX_KEY_UPANDR 0x3F // 63
//MartinW added Key's
#define JetiBox_printfxy(x,y,format, args...) { LIBFC_JetiBox_SetPos(y * 16 + x); _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);}
#define JetiBox_printf(format, args...) { _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);}
// -----------------------------------------------------------
// the menu functions
// -----------------------------------------------------------
void Menu_Status(uint8_t key)
{ //0123456789ABCDEF
JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10);
if(NaviDataOkay)
{
// JetiBox_printfxy(6,0,"%03dm %03d%c", GPSInfo.HomeDistance/10,GPSInfo.HomeBearing, 0xDF);
JetiBox_printfxy(6,0,"%3d%c %03dm",(int)(ErsatzKompass / GIER_GRAD_FAKTOR), 0xDF, GPSInfo.HomeDistance/10);
}
else
{
JetiBox_printfxy(6,0,"Status");
}
if(NC_ErrorCode) JetiBox_printfxy(6,0,"ERROR: %2d",NC_ErrorCode);
JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60);
if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)
{
JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter);
}
}
void Menu_Temperature(uint8_t key)
{ //0123456789ABCDEF
JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature);
JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature);
if(RequiredMotors <= 4)
{
JetiBox_printfxy(0,1,"Temperatures");
}
else
if(RequiredMotors <= 6)
{
JetiBox_printfxy(8,1,"\%cC ",0xdf);
}
}
void Menu_Battery(uint8_t key)
{ //0123456789ABCDEF
if(Capacity.ActualCurrent > MotorsTmax) MotorsTmax = Capacity.ActualCurrent; ///
JetiBox_printfxy(0,0,"%2i.%1iV", UBat/10, UBat%10);
//0123456789ABCDEF
if(!MotorenEin)
{
JetiBox_printfxy(10,0,"%3i.%1iA",MotorsTmax/10, MotorsTmax%10);
}
else
{
JetiBox_printfxy(10,0,"%3i.%1iA",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
}
JetiBox_printfxy(0,1,"%4iW %6imAH",Capacity.ActualPower, Capacity.UsedCapacity);
}
void Menu_PosInfo(uint8_t key)
{
if(NaviDataOkay)
{
JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats);
switch (GPSInfo.SatFix)
{
case SATFIX_3D:
JetiBox_printfxy(12,0," 3D");
break;
case SATFIX_2D:
case SATFIX_NONE:
default:
JetiBox_printfxy(12,0,"NoFx");
break;
}
if(GPSInfo.Flags & FLAG_DIFFSOLN)
{
JetiBox_printfxy(12,0,"DGPS");
}
JetiBox_printfxy(0,1,"Home:%3dm %3d%c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF);
}
else
{ //0123456789ABCDEF
JetiBox_printfxy(2,0,"No NaviCtrl!");
}
}
void Menu_Current(uint8_t key)
{ //0123456789ABCDEF
loop1 ++;
if(loop1 >= updatemotors)
{
loop1=0;
Motors0 =Motor[0].Current;
Motors1 =Motor[1].Current;
Motors2 =Motor[2].Current;
Motors3 =Motor[3].Current;
Motors4 =Motor[4].Current;
Motors5 =Motor[5].Current;
Motors6 =Motor[6].Current;
Motors7 =Motor[7].Current;
}
if(Motor[0].Current > Motors0max) Motors0max = Motor[0].Current;
if(Motor[1].Current > Motors1max) Motors1max = Motor[1].Current;
if(Motor[2].Current > Motors2max) Motors2max = Motor[2].Current;
if(Motor[3].Current > Motors3max) Motors3max = Motor[3].Current;
if(Motor[4].Current > Motors4max) Motors4max = Motor[4].Current;
if(Motor[5].Current > Motors5max) Motors5max = Motor[5].Current;
if(Motor[6].Current > Motors6max) Motors6max = Motor[6].Current;
if(Motor[7].Current > Motors7max) Motors7max = Motor[7].Current;
if(!MotorenEin)
{
Motors0=Motors0max;Motors1=Motors1max;Motors2=Motors2max;Motors3=Motors3max;Motors4=Motors4max;Motors5=Motors5max;Motors6=Motors6max;Motors7=Motors7max;
}
JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motors0-(CurrentOffset/RequiredMotors), Motors1-(CurrentOffset/RequiredMotors), Motors2-(CurrentOffset/RequiredMotors), Motors3-(CurrentOffset/RequiredMotors));
JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motors4-(CurrentOffset/RequiredMotors), Motors5-(CurrentOffset/RequiredMotors), Motors6-(CurrentOffset/RequiredMotors), Motors6-(CurrentOffset/RequiredMotors));
if(RequiredMotors <= 4)
{
JetiBox_printfxy(0,1,"Currents T%3i.%1iA",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
}
else
if(RequiredMotors <= 6)
{
JetiBox_printfxy(8,1,"%3i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
}
if(key== JETIBOX_KEY_UP) updatemotors = updatemotors+1;
if(key== JETIBOX_KEY_DOWN) updatemotors = updatemotors-1;
}
void Menu_keynumber(uint8_t key)
{
pos1=0;pos2=0;pos3=0;pos4=0;
if(keynumber <= 0 ) keynumber=1;
if(keynumber >= 5 ) keynumber=1;
if(keynumber== 1) pos1=0X3E;if(keynumber== 2) pos2=0X3E;if(keynumber== 3) pos3=0X3E;if(keynumber== 4) pos4=0X3E;
if(key== JETIBOX_KEY_LEFT) keynumber--;
if(key== JETIBOX_KEY_RIGHT) keynumber++;
}
void Menu_I2C(uint8_t key)
{ //0123456789ABCDEF
JetiBox_printfxy(0,0,"I2C%3i%3i%3i%3i",Motor[0].State & MOTOR_STATE_ERROR_MASK,Motor[1].State & MOTOR_STATE_ERROR_MASK, Motor[2].State & MOTOR_STATE_ERROR_MASK, Motor[3].State & MOTOR_STATE_ERROR_MASK);
JetiBox_printfxy(0,1,"%3i %3i %3i %3i",Motor[4].State & MOTOR_STATE_ERROR_MASK,Motor[5].State & MOTOR_STATE_ERROR_MASK, Motor[6].State & MOTOR_STATE_ERROR_MASK, Motor[7].State & MOTOR_STATE_ERROR_MASK);
}
void Menu_SetPoint(uint8_t key)
{ //0123456789ABCDEF
loop1 ++;
if(loop1 >= updatemotors)
{
loop1=0;
Motors0 =Motor[0].SetPoint;
Motors1 =Motor[1].SetPoint;
Motors2 =Motor[2].SetPoint;
Motors3 =Motor[3].SetPoint;
Motors4 =Motor[4].SetPoint;
Motors5 =Motor[5].SetPoint;
Motors6 =Motor[6].SetPoint;
Motors7 =Motor[7].SetPoint;
}
JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motors0, Motors1, Motors2, Motors3);
JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motors4, Motors5, Motors6, Motors7);
if(RequiredMotors <= 4)
{
JetiBox_printfxy(0,1,"M SetPoint ");
}
else
if(RequiredMotors <= 6)
{
JetiBox_printfxy(8,1,"MSetP%3i",updatemotors);
}
/*
JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].SetPoint, Motor[1].SetPoint, Motor[2].SetPoint, Motor[3].SetPoint);
JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].SetPoint, Motor[5].SetPoint, Motor[6].SetPoint, Motor[7].SetPoint);
if(RequiredMotors <= 4)
{
JetiBox_printfxy(0,1,"M SetPoint ");
}
else
if(RequiredMotors <= 6)
{
JetiBox_printfxy(8,1,"MSetP ");
}
*/
if(key== JETIBOX_KEY_UP) updatemotors = updatemotors+1;
if(key== JETIBOX_KEY_DOWN) updatemotors = updatemotors-1;
}
void Menu_Integal(uint8_t key)
{ //0123456789ABCDEF
int r=0;
int n=0;
int g=0;
n=SummeNick >> 9;
r=SummeRoll >> 9;
g=Mess_Integral_Gier >> 9;
JetiBox_printfxy(0,0,"%3iN %3iR +N",n, r);
JetiBox_printfxy(0,1,"%3iG +R -N -R",g);
}
void Menu_Info(uint8_t key)
{ //0123456789ABCDEF
JetiBox_printfxy(0,0,"%3i=VSpeed",VarioMeter);
JetiBox_printfxy(0,1,"%3i=HG/4 %3i=Gas",HoverGas/4,StickGas);
}
void Menu_Serialpoti(uint8_t key)
{
Menu_keynumber(key);
JetiBox_printfxy(0,0,"%c%3i=SP1%c%3i=SP3",pos1,PPM_in[13]+127,pos3,PPM_in[15]+127);
JetiBox_printfxy(0,1,"%c%3i=SP2%c%3i=SP4",pos2,PPM_in[14]+127,pos4,PPM_in[16]+127);
if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) PPM_in[13] ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) PPM_in[13] --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) PPM_in[14] ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) PPM_in[14] --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) PPM_in[15] ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) PPM_in[15] --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) PPM_in[16] ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) PPM_in[16] --;
}
void Menu_hoeheconf(uint8_t key)
{
/*/ //0123456789ABCDEF
//CFG2_HEIGHT_LIMIT | CFG2_VARIO_BEEP | CFG_SENSITIVE_RC
SENSITIVE_RC on/off |VARIO_BEEP on/off| sw Height= 1 Vario Height = 0;
bit 2 1 0
000 0 rcoff Beepoff h
001 1 rcoff Beepoff v
010 2 rcoff Beepon h
011 3 rcoff Beepon v
100 4 rcon Beepoff h
101 5 rcon Beepoff v
110 6 rcon Beepon h
111 7 rcon Beepon v
/*/
//JetiBox_printfxy(0,0,"%3i econf",EE_Parameter.ExtraConfig);
//JetiBox_printfxy(0,1,"%3i=beep %3ideckel",(EE_Parameter.ExtraConfig & CFG2_VARIO_BEEP),(EE_Parameter.ExtraConfig & CFG2_HEIGHT_LIMIT));
if((EE_Parameter.ExtraConfig & CFG2_HEIGHT_LIMIT) == 1) //EE_Parameter.ExtraConfig == 1 =switched Hightv+ variopiepser
{
JetiBox_printfxy(0,0,"switched Hight v");
}
if((EE_Parameter.ExtraConfig & CFG2_HEIGHT_LIMIT) == 0)
{
JetiBox_printfxy(0,1,"Vario withbeep ^");
}
if(key== JETIBOX_KEY_UP) EE_Parameter.ExtraConfig |= (1 << 0) ;// set bit 0
if(key== JETIBOX_KEY_DOWN)
{
EE_Parameter.ExtraConfig &= ~(1 << 0) ; //delete bit 0
EE_Parameter.ExtraConfig |= (1 << 1) ; //set bit 1 +piep
}
}
void Menu_hoehe1(uint8_t key)
{
Menu_keynumber(key);
JetiBox_printfxy(0,0,"%c%3i=HD %c%3i=HA",pos1,EE_Parameter.Luftdruck_D,pos3,EE_Parameter.Hoehe_ACC_Wirkung);
JetiBox_printfxy(0,1,"%c%3i=HP %c%3i=HM",pos2,EE_Parameter.Hoehe_P,pos4,EE_Parameter.Hoehe_MinGas);
if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Luftdruck_D ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Luftdruck_D --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Hoehe_P ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Hoehe_P --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Hoehe_ACC_Wirkung ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Hoehe_ACC_Wirkung --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.Hoehe_MinGas ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.Hoehe_MinGas --;
}
void Menu_hoehe2(uint8_t key)
{
Menu_keynumber(key);
JetiBox_printfxy(0,0,"%c%3i=HV %c%3i=HZ",pos1,EE_Parameter.Hoehe_HoverBand,pos3,EE_Parameter.Hoehe_GPS_Z);
JetiBox_printfxy(0,1,"%c%3i=HG %c%3i=HS",pos2,EE_Parameter.Hoehe_Verstaerkung,pos4,EE_Parameter.MaxHoehe);
if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Hoehe_HoverBand ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Hoehe_HoverBand --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Hoehe_Verstaerkung ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Hoehe_Verstaerkung --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Hoehe_GPS_Z ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Hoehe_GPS_Z --;
//if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.MaxHoehe ++;
//if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.MaxHoehe --;
}
void Menu_stick(uint8_t key)
{
Menu_keynumber(key);
JetiBox_printfxy(0,0,"%c%3i=StP%c%3i=SGP",pos1,EE_Parameter.Stick_P,pos3,EE_Parameter.Gier_P);
JetiBox_printfxy(0,1,"%c%3i=StD%c%3i=DrC",pos2,EE_Parameter.Stick_D,pos4,EE_Parameter.Driftkomp);
if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Stick_P ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Stick_P --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Stick_D ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Stick_D --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Gier_P ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Gier_P --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.Driftkomp ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.Driftkomp --;
}
void Menu_gyro(uint8_t key)
{
Menu_keynumber(key);
JetiBox_printfxy(0,0,"%c%3i=GYP%c%3i=GYI",pos1,EE_Parameter.Gyro_P,pos3,EE_Parameter.Gyro_I);
JetiBox_printfxy(0,1,"%c%3i=GYD%c%3i=MaI",pos2,EE_Parameter.Gyro_D,pos4,EE_Parameter.I_Faktor);
if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Gyro_P ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Gyro_P --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Gyro_D ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Gyro_D --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Gyro_I ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Gyro_I --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.I_Faktor ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.I_Faktor --;
}
void Menu_gps(uint8_t key)
{
Menu_keynumber(key);
JetiBox_printfxy(0,0,"%c%3i=NGG%c%3i=NSC",pos1,EE_Parameter.NaviGpsGain,pos3,EE_Parameter.NaviSpeedCompensation);
JetiBox_printfxy(0,1,"%c%3i=NWC%c%3i=NAL",pos2,EE_Parameter.NaviWindCorrection,pos4,EE_Parameter.NaviAngleLimitation);
if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.NaviGpsGain ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.NaviGpsGain --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.NaviWindCorrection ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.NaviWindCorrection --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.NaviSpeedCompensation ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.NaviSpeedCompensation --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation --;
}
void Menu_gpspid(uint8_t key)
{
Menu_keynumber(key);
JetiBox_printfxy(0,0,"%c%3i=NP%c%3i=ND",pos1,EE_Parameter.NaviGpsP,pos3,EE_Parameter.NaviGpsD);
JetiBox_printfxy(0,1,"%c%3i=NI",pos2,EE_Parameter.NaviGpsI);
if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.NaviGpsP ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.NaviGpsP --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.NaviGpsI ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.NaviGpsI --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.NaviGpsD ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.NaviGpsD --;
//if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation ++;
//if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation --;
}
void Menu_LOOPconf(uint8_t key) // Korrigiert mit &0xF0
{ //0123456789ABCDEF
char loopval;
loopval=EE_Parameter.BitConfig&0x0F;
JetiBox_printfxy(0,0," ");
if(EE_Parameter.BitConfig & CFG_LOOP_LINKS)
{
LIBFC_JetiBox_Putchar(0x3C);
LIBFC_JetiBox_Putchar(0x00);
}
if(EE_Parameter.BitConfig & CFG_LOOP_OBEN)
{
LIBFC_JetiBox_Putchar(0X5E);
LIBFC_JetiBox_Putchar(0x00);
}
if(EE_Parameter.BitConfig & CFG_LOOP_UNTEN)
{
LIBFC_JetiBox_Putchar(0x76);
LIBFC_JetiBox_Putchar(0x00);
}
if(EE_Parameter.BitConfig & CFG_LOOP_RECHTS)
{
LIBFC_JetiBox_Putchar(0X3E);
}
JetiBox_printfxy(0,1,"Loopingvalue %2id",loopval);
if((key== JETIBOX_KEY_UP ) & ((loopval) <15 )) loopval ++;
if((key== JETIBOX_KEY_DOWN) & ((loopval) >0 )) loopval --;
EE_Parameter.BitConfig=(EE_Parameter.BitConfig&0xF0)|loopval;
}
void Menu_loopP(uint8_t key)
{
Menu_keynumber(key);
JetiBox_printfxy(0,0,"%c%3i=LGL%c%3i=LHy",pos1,EE_Parameter.LoopGasLimit,pos3,EE_Parameter.LoopHysterese);
JetiBox_printfxy(0,1,"%c%3i=LTh%c",pos2,EE_Parameter.LoopThreshold,pos4);
if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.LoopGasLimit ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.LoopGasLimit --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.LoopThreshold ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.LoopThreshold --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.LoopHysterese ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.LoopHysterese --;
//if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation ++;
//if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation --;
}
void Menu_coup(uint8_t key)
{
Menu_keynumber(key);
JetiBox_printfxy(0,0,"%c%3i=FGP%c%3i=CYC",pos1,EE_Parameter.AchsKopplung1,pos3,EE_Parameter.CouplingYawCorrection);
JetiBox_printfxy(0,1,"%c%3i=FNR%c%3i=UP7",pos2,EE_Parameter.AchsKopplung2,pos4,EE_Parameter.UserParam7);
if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.AchsKopplung1 ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.AchsKopplung1 --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.AchsKopplung2 ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.AchsKopplung2 --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.CouplingYawCorrection ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.CouplingYawCorrection --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.UserParam7 ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.UserParam7 --;
}
void Menu_gyroGandStab(uint8_t key)
{
Menu_keynumber(key);
JetiBox_printfxy(0,0,"%c%3i=GGP%c%3i=GSt",pos1,EE_Parameter.Gyro_Gier_P,pos3,EE_Parameter.Gyro_Stability);
JetiBox_printfxy(0,1,"%c%3i=GGI%c%3i=DSt",pos2,EE_Parameter.Gyro_Gier_I,pos4,EE_Parameter.DynamicStability);
if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Gyro_Gier_P ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Gyro_Gier_P --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Gyro_Gier_I ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Gyro_Gier_I --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==3) & ( EE_Parameter.Gyro_Stability <15 )) EE_Parameter.Gyro_Stability ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==3) & ( EE_Parameter.Gyro_Stability >0 )) EE_Parameter.Gyro_Stability --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.DynamicStability ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.DynamicStability --;
}
void Menu_camera(uint8_t key)
{
Menu_keynumber(key);
JetiBox_printfxy(0,0,"%c%3i=NCT%c%3i=RCT",pos1,EE_Parameter.ServoNickControl,pos3,EE_Parameter.ServoRollControl);
JetiBox_printfxy(0,1,"%c%3i=NCP%c%3i=RCP",pos2,EE_Parameter.ServoNickComp,pos4,EE_Parameter.ServoRollComp);
if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.ServoNickControl ++; // Wert : 0-247 // Stellung des Servos
if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.ServoNickControl --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.ServoNickComp ++; // Wert : 0-247 // Einfluss Gyro/Servo
if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.ServoNickComp --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.ServoRollControl ++; // Wert : 0-247 // Stellung des Servos
if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.ServoRollControl --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.ServoRollComp ++; // Wert : 0-247 // Einfluss Gyro/Servo
if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.ServoRollComp --;
}
void Menu_mtest(uint8_t key)
{ //0123456789ABCDEF
//extern void LIBFC_JetiBox_Putchar(char c);
PC_MotortestActive = 240;
JetiBox_printfxy(0,0,"Mtest <+v <+^%3i",Motor[loop3].Current-(CurrentOffset/RequiredMotors)); //13 chars
JetiBox_printfxy(0,1,"Motor=%2i Sp=%2i",loop3+1, MotorTest[loop3]);
if((key== JETIBOX_KEY_UP) & (loop2 <100 )) loop2=loop2 +2;//GESCHW
if((key== JETIBOX_KEY_DOWN) & (loop2 >0 )) loop2=loop2 -2;
if((key== JETIBOX_KEY_UPANDL) & (loop3 <15 )) loop3 ++;//motornummer
if((key==JETIBOX_KEY_DownANDL) & (loop3 >0 )) loop3 --;
MotorTest[loop3]=loop2;
}
void Menu_mem(uint8_t key)
{
JetiBox_printfxy(0,0,"SETTING=%1i",GetActiveParamSet());
JetiBox_printfxy(0,1, "< + >toSTOREto %1i",settingdest);
// 00123456789ABCDEF
//if(key== JETIBOX_KEY_DOWN )
if(key== JETIBOX_KEY_LANDR && !MotorenEin)
{
ParamSet_WriteToEEProm(settingdest);
Piep(GetActiveParamSet(),120);
JetiBox_printfxy(13,0,"OK!");
}
if((key== JETIBOX_KEY_UP) & (settingdest <5 )) settingdest++;
if((key== JETIBOX_KEY_DOWN) & (settingdest >1 )) settingdest--;
}
// -----------------------------------------------------------
// the menu topology
// -----------------------------------------------------------
typedef void (*pFctMenu) (uint8_t); // the menu item handler function pointer
typedef struct{
int8_t left;
int8_t right;
int8_t up;
int8_t down;
pFctMenu pHandler;
} MENU_ENTRY;
// the menu navigation structure
/* |
3 - 0 - 1 - 2 - 3 - 0
*/
const MENU_ENTRY JetiBox_Menu[] PROGMEM=
{ // l r u d pHandler links rechts up down
{23, 1, 0, 0, &Menu_Status }, // Seite 1
{ 0, 2, 1, 1, &Menu_Temperature }, // 2
{ 1, 3, 2, 2, &Menu_Battery }, // 3
{ 2, 4, 3, 3, &Menu_PosInfo }, // 4
{ 3, 5, 4, 4, &Menu_Current }, // 5
{ 4, 6, 5, 5, &Menu_SetPoint }, // 6
{ 5, 7, 6, 6, &Menu_I2C }, // 7
{ 6, 8, 7, 7, &Menu_Integal }, // 8
{ 7, 9, 8, 8, &Menu_Info }, // 9
{ 8, 10, 9, 9, &Menu_Serialpoti }, // 10
{ 9, 11, 10, 10, &Menu_hoehe1 }, // 11
{10, 12, 11, 11, &Menu_hoehe2 }, // 12
{11, 13, 12, 12, &Menu_stick }, // 13
{12, 14, 13, 13, &Menu_gyro }, // 14
{13, 15, 14, 14, &Menu_gyroGandStab }, // 15
{14, 16, 15, 15, &Menu_gps }, // 16
{15, 17, 16, 16, &Menu_gpspid }, // 17
{16, 18, 17, 17, &Menu_loopP }, // 18
{17, 19, 18, 18, &Menu_coup }, // 19
{18, 20, 19, 19, &Menu_camera }, // 20
{19, 21, 20, 20, &Menu_LOOPconf }, // 21
{20, 22, 21, 21, &Menu_hoeheconf }, // 22
{21, 0, 22, 22, &Menu_mtest }, // 23
{22, 0, 23, 23, &Menu_mem }, // 23
};
//void Menu_gpspid(uint8_t key)
// -----------------------------------------------------------
// Update display buffer
// -----------------------------------------------------------
unsigned char JetiBox_Update(unsigned char key)
{
//printf(" %3i = keynumber, pos1 =%3i \n\r ", pos1); ///
static uint8_t item = 0, last_item = 0; // the menu item
// navigate within the menu by key action
last_item = item;
switch(key)
{
case JETIBOX_KEY_LEFT:
///if (item == 0) return (1); // switch back to jeti expander menu, so no back possible
///else
///{
if (keynumber <= 0 || keynumber >=5) //keynumber normaly 0, only in the parameter pages keyn=1...4
{
item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item
}
///}
break;
case JETIBOX_KEY_RIGHT:
if (keynumber <= 0 || keynumber >=5)
{
item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item
}
break;
case JETIBOX_KEY_UP:
item = pgm_read_byte(&JetiBox_Menu[item].up); //trigger to up menu item
break;
case JETIBOX_KEY_DOWN:
item = pgm_read_byte(&JetiBox_Menu[item].down); //trigger to down menu item
break;
case JETIBOX_KEY_NONE: ///
if (keynumber == 5 )
{
item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item
keynumber=6;
}
if (keynumber == 0) //keynumber normaly 0, only in the parameter pages keyn=1...4
{
item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item
keynumber=-1;
}
break;
default:
break;
}
// if the menu item has been changed, do not pass the key to the item handler
// to avoid jumping over to items
if(item != last_item) key = JETIBOX_KEY_UNDEF;
LIBFC_JetiBox_Clear();
//execute menu item handler
((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key);
return (0);
}