Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1880 → Rev 1897

/branches/V0.84a_MartinW_Jeti+/Spektrum.c
2,10 → 2,20
Decodieren eines RC Summen Signals oder Spektrum Empfänger-Satellit
#######################################################################################*/
 
 
 
 
 
 
 
#include "Spektrum.h"
#include "main.h"
// Achtung: RECEIVER_SPEKTRUM_EXP wird in der Main.h gesetzt
 
#ifndef WITHSPECTRUM /// MartinW
#warning : "### without SPECTRUM Code ###"
#endif
 
unsigned char SpektrumTimer = 0;
 
#ifdef RECEIVER_SPEKTRUM_EXP
75,6 → 85,9
void SpektrumUartInit(void)
//############################################################################
{
#ifdef WITHSPECTRUM /// MartinW main.h means no memsave
#warning : "### with left over Spectrum code ###"
// -- Start of USART1 initialisation for Spekturm seriell-mode
// USART1 Control and Status Register A, B, C and baud rate register
uint8_t sreg = SREG;
128,6 → 141,7
// restore global interrupt flags
SREG = sreg;
#endif
return;
}
 
210,6 → 224,9
//############################################################################
void SpektrumParser(unsigned char c)
{
#ifdef WITHSPECTRUM /// MartinW main.h means no memsave
#warning : "### with left over Spectrum code ###"
static unsigned char Sync=0, FrameCnt=0, ByteHigh=0, ReSync=1, Frame2=0;
unsigned int Channel, index = 0;
signed int signal = 0, tmp;
404,4 → 421,5
SpektrumTimer = MIN_FRAMEGAP;
}
}
#endif
}
/branches/V0.84a_MartinW_Jeti+/eeprom.c
591,5 → 591,6
}
 
printf("\n\rMixer-Config: '%s' (%u Motors)",Mixer.Name, RequiredMotors);
printf("\n\r==============================");
//printf("\n\r==============================");
printf("\n\r="); /// Martinw; removed memorysaving
}
/branches/V0.84a_MartinW_Jeti+/fc.c
57,6 → 57,31
#include "mymath.h"
#include "isqrt.h"
 
 
//MartinW; added vars
unsigned char loop1, loop2, loop3;
unsigned char settingdest = 5;
int keynumber=-7;
 
unsigned short CurrentOffset = 0;///
 
unsigned char pos1, pos2, pos3, pos4=0;
unsigned char Motors0,Motors1,Motors2,Motors3,Motors4,Motors5,Motors6,Motors7;
unsigned char Motors0max,Motors1max,Motors2max,Motors3max,Motors4max,Motors5max,Motors6max,Motors7max;
unsigned short MotorsTmax;
unsigned char updatemotors=5;
 
//Panorama Trigger;
int degreeold =0;
int degreedivold =0;
int degreediv =0;
unsigned int panograd=0;
unsigned char panotrigger=0;
unsigned char calibration_done = 0;
///MartinW; added vars END
 
 
 
unsigned char h,m,s;
unsigned int BaroExpandActive = 0;
int MesswertNick,MesswertRoll,MesswertGier,MesswertGierBias, RohMesswertNick,RohMesswertRoll;
73,7 → 98,9
long Integral_Gier = 0;
long Mess_IntegralNick = 0,Mess_IntegralNick2 = 0;
long Mess_IntegralRoll = 0,Mess_IntegralRoll2 = 0;
long Mess_Integral_Gier = 0,Mess_Integral_Gier2 = 0;
//long Mess_Integral_Gier = 0,Mess_Integral_Gier2 = 0; ///MartinW so war es
long Mess_Integral_Gier = 0; ///MartinW: Mess_Integral_Gier2 unbenutzt
 
long MittelIntegralNick,MittelIntegralRoll,MittelIntegralNick2,MittelIntegralRoll2;
long SummeNick=0,SummeRoll=0;
volatile long Mess_Integral_Hoch = 0;
192,6 → 219,20
DebugOut.Analog[13] = Motor[1].SetPoint;
DebugOut.Analog[14] = Motor[2].SetPoint;
DebugOut.Analog[15] = Motor[3].SetPoint;
///MartinW added Debug ouputs
DebugOut.Analog[16] = Motor[4].SetPoint;
DebugOut.Analog[17] = Motor[5].SetPoint;
DebugOut.Analog[18] = FromNC_AltitudeSpeed; ///
 
//DebugOut.Analog[18] = Motor[6].SetPoint; // v0.84a
//DebugOut.Analog[24] = Motor[6].SetPoint; // on v0.84a = SollHoehe/5
DebugOut.Analog[25] = Motor[6].SetPoint;
DebugOut.Analog[26] = Motor[7].SetPoint;
//DebugOut.Analog[27] = Motor[9].SetPoint; // on v0.84a = KompassSollWert
///MartinW added Debug ouputs END
 
DebugOut.Analog[20] = ServoNickValue;
DebugOut.Analog[22] = Capacity.ActualCurrent;
DebugOut.Analog[23] = Capacity.UsedCapacity;
202,6 → 243,8
DebugOut.Analog[29] = Capacity.MinOfMaxPWM;
DebugOut.Analog[30] = GPS_Nick;
DebugOut.Analog[31] = GPS_Roll;
if(VersionInfo.HardwareError[0] || VersionInfo.HardwareError[1]) DebugOut.Status[1] |= 1; else DebugOut.Status[1] &= 0xfe;
}
 
658,7 → 701,7
static unsigned int RcLostTimer;
static unsigned char delay_neutral = 0;
static unsigned char delay_einschalten = 0,delay_ausschalten = 0;
static unsigned char calibration_done = 0;
//static unsigned char calibration_done = 0;// moved up
static char NeueKompassRichtungMerken = 0;
static long ausgleichNick, ausgleichRoll;
int IntegralNickMalFaktor,IntegralRollMalFaktor;
758,6 → 801,13
ServoActive = 1;
DDRD |=0x80; // enable J7 -> Servo signal
Piep(GetActiveParamSet(),120);
#ifdef WITH_JETI_BEEP /// MartinW main.h
#warning : "### with JetiBeep Delay ###"
JetiBeep = 101;///
delayjetibeepset = (GetActiveParamSet()*10);
#else
#warning : "### without JetiBeep Delay ###"
#endif
}
}
}
800,7 → 850,7
MotorenEin = 1;
sollGier = 0;
Mess_Integral_Gier = 0;
Mess_Integral_Gier2 = 0;
//Mess_Integral_Gier2 = 0; //MartinR: Mess_Integral_Gier2 unbenutzt
Mess_IntegralNick = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccNick;
Mess_IntegralRoll = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccRoll;
Mess_IntegralNick2 = IntegralNick;
885,6 → 935,9
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ Analoge Steuerung per Seriell
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#ifdef WITH_ExternControl /// MartinW memorysaving
#warning : "### with ExternControl ###"
if(ExternControl.Config & 0x01 && Parameter_ExternalControl > 128)
{
StickNick += (int) ExternControl.Nick * (int) EE_Parameter.Stick_P;
910,6 → 963,10
}
else MaxStickRoll--;
if(FC_StatusFlags & FC_STATUS_EMERGENCY_LANDING) {MaxStickNick = 0; MaxStickRoll = 0;}
#else
#warning : "### without ExternControl ###"
#endif
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Looping?
1772,10 → 1829,47
if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil;
else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil;
else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L;
 
if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing
else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing
 
#ifdef WITH_ORIGINAL_MOTORSMOOTHING /// MartinW main.h means no memsave
#warning : "### with WITH_ORIGINAL_MOTORSMOOTHING ###"
if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing
else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing
#else
#warning : "### without WITH_ORIGINAL_MOTORSMOOTHING, ajustable ###"
// MartinW; variable MS START
if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing
// else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing
// Arthur P: the original code allowed the motor value to drop to 0 or negative values
// straight off, i.e. could amplify an intended decrease excessively while upregulation
// is dampened. The modification would still allow immediate drop below intended value
// but would dampen this. This would still allow for airbraking of the prop to have effect
// but it might lead to less sudden excessive drops in rpm with only gradual recovery.
// 090807 Arthur P: Due to problems with uart.c which still refers to user parameter 1 and 2 and
// possible timing issues with the shutter interval load, removed the shutter interval functions
// and switched to use of userparam6 for the motor smoothing.
// 091114 Inserted modification into 0.76g source code.
// 20100804 Modified v.0.80d code where motorsmoothing is no longer a separate function.
// Downsmoothing either uses default v.0.7x+ 150% downstep (user para 7 == 0),
// 50% downstep (user para 7 == 1 or 2), or downsteps of x% (userpara7 ==):
// 66.6% (3), 75% (4), 80% (5), 90% (10), 95% (20), 97.5% (40), 98% (50), 99% (100).
else
{
if(Parameter_UserParam7 < 2)
{ // Original function
tmp_int = 2 * tmp_int - tmp_motorwert[i];
}
else
{
// If userpara7 >= 2 then allow >= 50% of the intended step down to rapidly reach the intended value.
tmp_int = tmp_int + ((tmp_motorwert[i] - tmp_int)/Parameter_UserParam7);
}
}
// MartinW; variable MS END
#endif
LIMIT_MIN_MAX(tmp_int,(int) MIN_GAS * 4,(int) MAX_GAS * 4);
Motor[i].SetPoint = tmp_int / 4;
Motor[i].SetPointLowerBits = (tmp_int % 4)<<1; // (3 bits total)
/branches/V0.84a_MartinW_Jeti+/fc.h
36,6 → 36,28
#define Poti7 Poti[6]
#define Poti8 Poti[7]
 
/// MartinW; added vars
extern unsigned char Motors0,Motors1,Motors2,Motors3,Motors4,Motors5,Motors6,Motors7;
unsigned char Motors0max,Motors1max,Motors2max,Motors3max,Motors4max,Motors5max,Motors6max,Motors7max;
unsigned short MotorsTmax;
extern unsigned char updatemotors;
extern unsigned char loop1, loop2, loop3;
extern unsigned char settingdest;
extern unsigned char pos1, pos2, pos3, pos4;
extern int keynumber;
extern unsigned short CurrentOffset;///
extern signed char jetivalue1,jetivalue2,jetivalue3,jetivalue4;
 
extern int degreeold;
extern int degreedivold;
extern int degreediv;
extern unsigned int panograd;
extern unsigned char panotrigger;
extern int StickGas;
extern unsigned char calibration_done;
/// MartinW; added vars
 
 
extern unsigned char Sekunde,Minute;
extern unsigned int BaroExpandActive;
extern long IntegralNick,IntegralNick2;
49,7 → 71,8
extern long IntegralAccNick,IntegralAccRoll;
extern long SummeNick,SummeRoll;
extern volatile long Mess_Integral_Hoch;
extern long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2;
//extern long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2;
extern long Integral_Gier,Mess_Integral_Gier;///
extern int KompassValue;
extern int KompassSollWert;
extern int KompassRichtung;
/branches/V0.84a_MartinW_Jeti+/flight.pnproj
1,0 → 0,0
<Project name="Flight-Ctrl"><File path="uart.h"></File><File path="jeti.h"></File><File path="main.c"></File><File path="main.h"></File><File path="makefile"></File><File path="uart.c"></File><File path="printf_P.h"></File><File path="timer0.c"></File><File path="timer0.h"></File><File path="old_macros.h"></File><File path="twimaster.c"></File><File path="version.txt"></File><File path="twimaster.h"></File><File path="rc.c"></File><File path="rc.h"></File><File path="fc.h"></File><File path="menu.h"></File><File path="menu.c"></File><File path="_Settings.h"></File><File path="analog.c"></File><File path="analog.h"></File><File path="GPS.c"></File><File path="gps.h"></File><File path="License.txt"></File><File path="spi.h"></File><File path="spi.c"></File><File path="led.h"></File><File path="led.c"></File><File path="fc.c"></File><File path="mymath.c"></File><File path="mymath.h"></File><File path="isqrt.S"></File><File path="Spektrum.c"></File><File path="Spektrum.h"></File><File path="eeprom.h"></File><File path="eeprom.c"></File><File path="libfc.h"></File><File path="debug.c"></File><File path="debug.h"></File></Project>
<Project name="Flight-Ctrl"><File path="uart.h"></File><File path="main.c"></File><File path="main.h"></File><File path="makefile"></File><File path="uart.c"></File><File path="printf_P.h"></File><File path="timer0.c"></File><File path="timer0.h"></File><File path="old_macros.h"></File><File path="twimaster.c"></File><File path="version.txt"></File><File path="twimaster.h"></File><File path="rc.c"></File><File path="rc.h"></File><File path="fc.h"></File><File path="menu.h"></File><File path="menu.c"></File><File path="_Settings.h"></File><File path="analog.c"></File><File path="analog.h"></File><File path="GPS.c"></File><File path="gps.h"></File><File path="License.txt"></File><File path="spi.h"></File><File path="spi.c"></File><File path="led.h"></File><File path="led.c"></File><File path="fc.c"></File><File path="mymath.c"></File><File path="mymath.h"></File><File path="isqrt.S"></File><File path="Spektrum.c"></File><File path="Spektrum.h"></File><File path="eeprom.h"></File><File path="eeprom.c"></File><File path="libfc.h"></File><File path="debug.c"></File><File path="debug.h"></File><File path="jetimenu.c"></File><File path="jetimenu.h"></File></Project>
/branches/V0.84a_MartinW_Jeti+/jetimenu.c
12,6 → 12,15
#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);}
 
19,34 → 28,69
// the menu functions
// -----------------------------------------------------------
 
void Menu_Status(uint8_t key)
{ //0123456789ABCDEF
 
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
{
}
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)
if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)
{
JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter);
}
if(calibration_done == 0 && (Capacity.UsedCapacity <=1) ) //63074-62962
{
JetiBox_printfxy(0,0," JETI+ sponsored" );
JetiBox_printfxy(0,1,"by Flyinghigh.ch" );
}
#ifdef WITH_JETI_BEEP /// MartinW main.h
#warning : "### with JetiBeep Delay ###"
if(Parameter_UserParam3 >= 1 && !(FC_StatusFlags & FC_STATUS_LOWBAT)) /// MartinW; Variobeep only when no Battery warning
{
JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter);
}
if(VarioCharacter == 0x2B) ///
{
JetiBeep = 101;//"."
delayjetibeepset = 10;
//JetiBox_printfxy(0,0,"+" );
}
if(VarioCharacter == 0x2D) ///
{
JetiBeep = 116;// "_"
delayjetibeepset = 10;
//JetiBox_printfxy(0,0,"-" );
}
}
#else
#warning : "### without JetiBeep Delay ###"
#endif
}
 
 
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,0,"T%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);
/* ///MartinW unnecessary
if(RequiredMotors <= 4)
{
JetiBox_printfxy(0,1,"Temperatures ");
JetiBox_printfxy(0,1,"Temperatures");
}
else
if(RequiredMotors <= 6)
53,13 → 97,26
{
JetiBox_printfxy(8,1,"\%cC ",0xdf);
}
 
*/
}
 
void Menu_Battery(uint8_t key)
{ //0123456789ABCDEF
JetiBox_printfxy(0,0,"%2i.%1iV %3i.%1iA", UBat/10, UBat%10, Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
JetiBox_printfxy(0,1,"%4iW %6imAh",Capacity.ActualPower, Capacity.UsedCapacity);
 
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);
}
 
 
92,7 → 149,505
}
}
 
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,"I%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;
}
 
 
uint8_t Menu_keynumber(uint8_t key) /// thanks to "metro"
{
pos1=0;pos2=0;pos3=0;pos4=0;
if((key== JETIBOX_KEY_UP)||(key== JETIBOX_KEY_DOWN)||((keynumber >= 1)&&(keynumber <= 4 )))
{
if((keynumber <= 0)||(keynumber >= 5 ))
{
if(key== JETIBOX_KEY_DOWN) {keynumber=1;key= JETIBOX_KEY_UNDEF;} //Key auf UNDEF setzen da sonst der Wert gleich um 1 verkleinert wird.
if(key== JETIBOX_KEY_UP) {keynumber=4;key= JETIBOX_KEY_UNDEF;} //Key auf UNDEF setzen da sonst der Wert gleich um 1 vergrössert wird.
}
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++;
}
return key;
}
 
 
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,"M%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);
}
 
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
//key=Menu_keynumber(key);
 
 
JetiBox_printfxy(0,0,"%3i=HG/4 %3i=Gas",HoverGas/4,StickGas);
//JetiBox_printfxy(0,1,"%3i=VSpeed",VarioMeter);
//JetiBox_printfxy(0,1,"%3i=JetiBeep",JetiBeep);
}
 
 
 
void Menu_Serialpoti(uint8_t key)
{
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]= PPM_in[15] +5;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) PPM_in[15]= PPM_in[15] -5;
if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) PPM_in[16]= PPM_in[16] +10;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) PPM_in[16]= PPM_in[16] -10;
/*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));
JetiBeep = 0;
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)
{
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);
JetiBox_printfxy(0,1,"%c%3i=HG %c%3i=NG",pos2,EE_Parameter.Hoehe_Verstaerkung,pos4,EE_Parameter.NotGas);
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 --;
if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.NotGas ++;
if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.NotGas --;
}
 
 
void Menu_stick(uint8_t key)
{
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)
{
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)
{
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)
{
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%c%",pos2,EE_Parameter.NaviGpsI,pos4);
 
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)) GIER_GRAD_FAKTOR=GIER_GRAD_FAKTOR +100;
/// if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) GIER_GRAD_FAKTOR=GIER_GRAD_FAKTOR -100;
 
}
 
 
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)
{
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",pos2,EE_Parameter.LoopThreshold);
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)) KompassStartwert=KompassStartwert +5;
//if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) KompassStartwert=KompassStartwert -5;
}
 
 
void Menu_coup(uint8_t key)
{
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)
{
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)
{
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 ))
{
MotorTest[loop3]=0;
loop3 ++;//motornummer
}
if((key==JETIBOX_KEY_DownANDL) & (loop3 >0 ))
{
MotorTest[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)
{
#ifdef WITH_JETI_BEEP /// MartinW main.h
#warning : "### with JetiBeep Delay ###"
JetiBeep = 101;
delayjetibeepset = (GetActiveParamSet()*10);
#else
#warning : "### without JetiBeep Delay ###"
#endif
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
// -----------------------------------------------------------
115,18 → 670,44
*/
 
const MENU_ENTRY JetiBox_Menu[] PROGMEM=
{ // l r u d pHandler
{3, 1, 0, 0, &Menu_Status }, // 0
{0, 2, 1, 1, &Menu_Temperature }, // 1
{1, 3, 2, 2, &Menu_Battery }, // 2
{2, 0, 3, 3, &Menu_PosInfo }, // 3
{ // l r u d pHandler links rechts up down
{22, 1, 0, 8, &Menu_Status }, // Seite 0
{ 0, 2, 1, 1, &Menu_Temperature }, // 1
{ 1, 3, 2, 2, &Menu_Battery }, // 2
{ 2, 4, 3, 3, &Menu_PosInfo }, // 3
{ 3, 5, 4, 4, &Menu_Current }, // 4
// { 4, 6, 5, 5, &Menu_SetPoint }, // 5
{ 4, 6, 5, 5, &Menu_I2C }, // 5
{ 5, 7, 6, 6, &Menu_Integal }, // 6
{ 6, 22, 7, 7, &Menu_Info }, // 7
{ 0, 9, 8, 8, &Menu_Serialpoti }, // 8
{ 8, 10, 9, 9, &Menu_hoehe1 }, // 9
{ 9, 11, 10, 10, &Menu_hoehe2 }, // 10
{10, 12, 11, 11, &Menu_stick }, // 11
{11, 13, 12, 12, &Menu_gyro }, // 12
{12, 14, 13, 13, &Menu_gyroGandStab }, // 13
{13, 15, 14, 14, &Menu_gps }, // 14
{14, 16, 15, 15, &Menu_gpspid }, // 15
{15, 17, 16, 16, &Menu_loopP }, // 16
{16, 18, 17, 17, &Menu_coup }, // 17
{17, 19, 18, 18, &Menu_camera }, // 18
{18, 20, 19, 19, &Menu_LOOPconf }, // 19
{19, 21, 20, 20, &Menu_hoeheconf }, // 20
{20, 0, 21, 21, &Menu_mem }, // 21
{ 7, 0, 22, 22, &Menu_mtest }, // 22
};
//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
134,18 → 715,44
switch(key)
{
case JETIBOX_KEY_LEFT:
if (item == 0) return (1); // switch back to jeti expander menu
else item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item
///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:
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;
}
/branches/V0.84a_MartinW_Jeti+/led.c
11,8 → 11,8
{
// set PC2 & PC3 as output (control of J16 & J17)
DDRC |= (1<<DDC2)|(1<<DDC3);
J16_OFF;
J17_OFF;
/// J16_OFF; /// MartinW: removed because of switching during calibration, not useful for activate fireworks
/// J17_OFF;
J16Blinkcount = 0; J16Mask = 128;
J17Blinkcount = 0; J17Mask = 128;
}
/branches/V0.84a_MartinW_Jeti+/main.c
61,6 → 61,11
unsigned char FoundMotors = 0;
unsigned char JetiBeep = 0; // to allow any Morse-Beeping of the Jeti-Box
 
unsigned char delayjetibeep = 0;///
unsigned char delayjetibeepset =0;///
static char panodelay = 0; ///martinw
static char panoleddelay = 0; ///martinw
 
void CalMk3Mag(void)
{
static unsigned char stick = 1;
103,7 → 108,9
}
}
else BattLowVoltageWarning = EE_Parameter.UnterspannungsWarnung;
if(print) printf(" Low warning level: %d.%d",BattLowVoltageWarning/10,BattLowVoltageWarning%10);
//if(print) printf(" Low warning level: %d.%d",BattLowVoltageWarning/10,BattLowVoltageWarning%10);
if(print) printf("Low Batt level: %d.%d",BattLowVoltageWarning/10,BattLowVoltageWarning%10); /// Martinw; removed memorysaving
 
}
 
//############################################################################
196,18 → 203,22
{
if(!(Motor[i].State & MOTOR_STATE_PRESENT_MASK) && Mixer.Motor[i][0] > 0)
{
printf("\n\r\n\r!! MISSING BL-CTRL: %d !!",i+1);
//printf("\n\r\n\r!! MISSING BL-CTRL: %d !!",i+1);
printf("\n\r\n\r!!MISSING BL-CTRL: %d!!",i+1);/// Martinw; removed memorysaving
ServoActive = 2; // just in case the FC would be used as camera-stabilizer
}
Motor[i].State &= ~MOTOR_STATE_ERROR_MASK; // clear error counter
}
printf("\n\r===================================");
//printf("\n\r===================================");/// Martinw; removed memorysaving
printf("\n\r=");/// Martinw; removed memorysaving
 
 
if(RequiredMotors < FoundMotors) VersionInfo.HardwareError[1] |= FC_ERROR1_MIXER;
 
//if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)
{
printf("\n\rCalibrating pressure sensor..");
//printf("\n\rCalibrating pressure sensor..");
printf("\n\rCal. pressure sensor");/// Martinw; removed memorysaving
timer = SetDelay(1000);
SucheLuftruckOffset();
while (!CheckDelay(timer));
235,8 → 246,12
printf("\n\rControl: ");
if (EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold");
else printf("Normal (ACC-Mode)");
#ifdef WITH_MKTOOL_Display // MartinW; for no MKT Display main.h
#warning : "### with MKTool Display ###"
LcdClear();
#endif
 
LcdClear();
I2CTimeout = 5000;
WinkelOut.Orientation = 1;
LipoDetection(1);
243,7 → 258,8
 
LIBFC_ReceiverInit(EE_Parameter.Receiver);
 
printf("\n\r===================================\n\r");
//printf("\n\r===================================\n\r");
printf("\n\r=\n\r"); /// Martinw; removed memorysaving
//SpektrumBinding();
timer = SetDelay(2000);
timerPolling = SetDelay(250);
250,6 → 266,14
 
Debug(ANSI_CLEAR "FC-Start!\n\rFlugzeit: %d min", FlugMinutenGesamt); // Note: this won't waste flash memory, if #DEBUG is not active
DebugOut.Status[0] = 0x01 | 0x02;
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) ///MartinW; only for 1284er
//#warning : "### with Sponsored Message ###"
printf("\n\rJETI+ Version sponsored by Flyinghigh.ch, progammed by MartinW\n\r");
#else
#endif
 
 
JetiBeep = 0;
while (1)
{
260,6 → 284,26
{
timerPolling = SetDelay(100);
LIBFC_Polling();
#ifdef WITH_JETI_BEEP /// MartinW main.h
#warning : "### with JetiBeep Delay ###"
if(!(JetiBeep == 0))
{
delayjetibeep++;
}
if(delayjetibeep == delayjetibeepset )
{
delayjetibeep = 0;
JetiBeep = 0;
}
#else
#warning : "### without JetiBeep Delay ###"
JetiBeep = 0;
#endif
}
if(UpdateMotor && AdReady) // ReglerIntervall
{
392,6 → 436,52
timer = SetDelay(20); // falls "timer += 20;" mal nicht geht
}
}
#ifdef WITH_PANOTRIGGER /// MartinW main.h means no memsave
#warning : "### with Panorama Trigger Function ###"
//// Pano Trigger
if(Parameter_UserParam8 >= 200) //enable/disable Pano Trigger Function
{
if(Parameter_UserParam4 <=9) { Parameter_UserParam4 = 10; }
degreedivold = degreediv;
degreediv = (ErsatzKompass / GIER_GRAD_FAKTOR) / Parameter_UserParam4;//Division
if((degreediv-degreedivold)==2||(degreediv-degreedivold)==1||(degreediv-degreedivold)== -2||(degreediv-degreedivold)== -1)
{
if(panodelay == 0)
{
panotrigger= 1; // muss wieder geleert werden
ROT_ON;
J16_ON;
panodelay = Parameter_UserParam5;
}
}
else
{
if(panodelay <= Parameter_UserParam6) //ms Intervall
{
//panoleddelay = Parameter_UserParam6;
J16_OFF;
ROT_OFF;
}
if(panodelay > 0)
{
panodelay--;
}
}
}// END if(Parameter_UserParam4 >= 1)
//// Pano Trigger
 
#else
#warning : "### without Panorama Trigger Function ###"
 
#endif
LED_Update();
Capacity_Update();
} //else DebugOut.Analog[26]++;
/branches/V0.84a_MartinW_Jeti+/main.h
6,6 → 6,31
//#define SWITCH_LEARNS_CAREFREE
//#define RECEIVER_SPEKTRUM_EXP
 
 
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) ///MartinW
#define WITH_MKTOOL_Display
#define WITH_JETI_SIMULATION
#define WITH_ExternControl
#define WITH_FULL_ANALOG_TEXT
#define WITHSPECTRUM
#else
#endif
 
//#define WITH_MKTOOL_Display /// MartinW; with MKTool Display 70604-63130
//#define WITHSPECTRUM /// MartinW; memsave
//#define WITH_FULL_ANALOG_TEXT /// MartinW; memsave
//#define WITH_ExternControl /// MartinW; memsave
//#define WITH_ORIGINAL_MOTORSMOOTHING /// MartinW; memsave 63312-63164
//#define WITH_JETI_SIMULATION /// MartinW; memsave 63312-63016
#define WITH_JETI_BEEP /// MartinW; 63072-63038; 63216-63050
#define WITH_PANOTRIGGER /// MartinW; 63328-63118
 
 
 
 
 
 
 
// neue Hardware
#define ROT_OFF {if((PlatinenVersion == 10)||(PlatinenVersion >= 20)) PORTB &=~0x01; else PORTB |= 0x01;}
#define ROT_ON {if((PlatinenVersion == 10)||(PlatinenVersion >= 20)) PORTB |= 0x01; else PORTB &=~0x01;}
34,6 → 59,7
extern unsigned char JetiBeep;
void LipoDetection(unsigned char print);
extern unsigned int FlugMinuten,FlugMinutenGesamt,FlugSekunden;
extern unsigned char delayjetibeepset;///
 
#include <stdlib.h>
#include <string.h>
/branches/V0.84a_MartinW_Jeti+/makefile
42,7 → 42,7
# Target file name (without extension).
 
ifeq ($(VERSION_PATCH), 0)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_SVN$(REV)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_Jeti+_SVN$(REV)
endif
ifeq ($(VERSION_PATCH), 1)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)b_SVN$(REV)
/branches/V0.84a_MartinW_Jeti+/menu.c
8,6 → 8,10
#include "main.h"
#include "eeprom.h"
 
#ifdef WITH_MKTOOL_Display // only include functions if DEBUG is defined in main.h
 
#warning : "### with MKTool Display ###"
 
char DisplayBuff[80] = "Hello World";
unsigned char DispPtr = 0;
 
202,3 → 206,4
}
RemoteKeys = 0;
}
#endif
/branches/V0.84a_MartinW_Jeti+/rc.c
30,6 → 30,11
PPM_in[i] = 0;
PPM_diff[i] = 0;
}
PPM_in[13] = PPM_in[13] -127; /// MartinW: Initialisierungswerte für die seriellen Potis für Jeti+
PPM_in[14] = PPM_in[14] -127;
PPM_in[15] = PPM_in[15] -127; /// MartinW: Initialisierungswerte für die seriellen Potis für Jeti+
PPM_in[16] = PPM_in[16] -127;
 
AdNeutralGier = 0;
AdNeutralRoll = 0;
/branches/V0.84a_MartinW_Jeti+/uart.c
77,6 → 77,13
unsigned int AboTimeOut = 0;
unsigned volatile char JetiUpdateModeActive = 0;
 
 
 
 
#ifdef WITH_FULL_ANALOG_TEXT /// MartinW main.h means no memsave
#warning : "### with normal ANALOG_TEXT[32][16] ###"
const unsigned char ANALOG_TEXT[32][16] PROGMEM =
{
//1234567890123456
96,9 → 103,9
"Motor 2 ",
"Motor 3 ",
"Motor 4 ", //15
"16 ",
"17 ",
"18 ",
"Motor 5 ",///
"Motor 6 ",///
"nc alt speed ",
"19 ",
"Servo ", //20
"Hovergas ",
105,16 → 112,57
"Current [0.1A] ",
"Capacity [mAh] ",
"Hight Setpoint ",
"25 ", //25
"26 ",
"Motor 7 ", //25 ///
"Motor 8 ",///
"Compass Setpoint",
"I2C-Error ",
"BL Limit ",
"GPS_Nick ", //30
"GPS_Roll "
};
};
#else
#warning : "### with reduced ANALOG_TEXT[32][13] ###"
const unsigned char ANALOG_TEXT[32][13] PROGMEM =
{
//1234567890123456
"AngleNick ", //0
"AngleRoll ",
"AccNick ",
"AccRoll ",
"YawGyro ",
"Height Value ", //5
"AccZ ",
"Gas ",
"Compass Value",
"Voltage[0.1V]",
"ReceiverLevel", //10
"Gyro Compass ",
"Motor 1 ",
"Motor 2 ",
"Motor 3 ",
"Motor 4 ", //15
"Motor 5 ",///
"Motor 6 ",///
"nc alt speed ",
"19 ",
"Servo ", //20
"Hovergas ",
"Current[0.1A]",
"Capacity[mAh]",
"Hight Setp ",
"Motor 8 ", //25 ///
"Motor 9 ",///
"Compass Setp ",
"I2C-Error ",
"BL Limit ",
"GPS_Nick ", //30
"GPS_Roll "
};
#endif
 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ Sende-Part der Datenübertragung
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
170,7 → 218,12
RxdBuffer[buf_ptr] = '\r';
if(RxdBuffer[2] == 'R')
{
#ifdef WITH_MKTOOL_Display /// MartinW main.h
#warning : "### with MKTool Display ###"
LcdClear();
#endif
 
wdt_enable(WDTO_250MS); // Reset-Commando
ServoActive = 0;
}
467,6 → 520,13
}
break;
case 'j':
#ifdef WITH_JETI_SIMULATION /// MartinW main.h means no memsave
#warning : "### with jeti update command ###"
 
 
tempchar1 = LIBFC_GetCPUType();
if((tempchar1 == CPU_ATMEGA644P) || (tempchar1 == CPU_ATMEGA1284P))
{
524,6 → 584,11
 
sei();
}
#else
#warning : "### without jeti update command ###"
 
#endif
break;
 
} // case FC_ADDRESS:
570,6 → 635,10
break;
 
case 'h':// x-1 Displayzeilen
#ifdef WITH_MKTOOL_Dispay /// MartinW memorysave
#warning : "### with MKTool Display ###"
 
PcZugriff = 255;
if((pRxData[0] & 0x80) == 0x00) // old format
{
590,7 → 659,11
PcZugriff = 255;
MenuePunkt = pRxData[0];
DebugDisplayAnforderung1 = 1;
#endif
break;
case 'v': // Version-Anforderung und Ausbaustufe
GetVersionAnforderung = 1;
break;
667,6 → 740,9
Intervall3D = 0;
}
 
#ifdef WITH_MKTOOL_Display //main.h
#warning : "### with MKTool Display ###"
 
if(((Display_Interval>0 && CheckDelay(Display_Timer)) || DebugDisplayAnforderung) && UebertragungAbgeschlossen)
{
if(DisplayLine > 3)// new format
689,6 → 765,9
SendOutData('L', FC_ADDRESS, 3, &MenuePunkt, sizeof(MenuePunkt), &MaxMenue, sizeof(MaxMenue), DisplayBuff, sizeof(DisplayBuff));
DebugDisplayAnforderung1 = 0;
}
#endif
 
if(GetVersionAnforderung && UebertragungAbgeschlossen)
{
SendOutData('V', FC_ADDRESS, 1, (unsigned char *) &VersionInfo, sizeof(VersionInfo));
731,9 → 810,25
}
if(DebugTextAnforderung != 255) // Texte für die Analogdaten
{
#ifdef WITH_FULL_ANALOG_TEXT /// MartinW main.h means no memsave
#warning : "### with normal ANALOG_TEXT[32][16] ###"
unsigned char label[16]; // local sram buffer
memcpy_P(label, ANALOG_TEXT[DebugTextAnforderung], 16); // read lable from flash to sra
SendOutData('A', FC_ADDRESS, 2, (unsigned char *)&DebugTextAnforderung, sizeof(DebugTextAnforderung),label, 16);
 
#else
#warning : "### with reduced ANALOG_TEXT[32][13] ###"
unsigned char label[16]=" "; // local sram buffer ///MartinW; for MKTool, needs 32 bytes
memcpy_P(label, ANALOG_TEXT[DebugTextAnforderung], 13); // read lable from flash to sra
SendOutData('A', FC_ADDRESS, 2, (unsigned char *)&DebugTextAnforderung, sizeof(DebugTextAnforderung),label, 16);
#endif
DebugTextAnforderung = 255;
}
if(ConfirmFrame && UebertragungAbgeschlossen) // Datensatz bestätigen
/branches/V0.84a_MartinW_Jeti+/version.txt
457,7 → 457,62
- immer einmal Carefree Beepen nach dem Kalibrieren
- Kanaloffset für Potis von 110 auf 127 erhöht, damit es gleich ist mit allen anderen Kanälen
- POI-Richtung (Soll-Himmelsrichtung) bezieht sich auf den Kamera-Winkel
================================================================================================================
MaxSize Flashsize is 63488 bytes on Atmega644
 
=============== Jeti+ Version v0.84a ==============
 
JETI+ Version sponsored by Flyinghigh.ch, progammed by MartinW
 
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
Please test it before using on your high-end Equipment.
Emergency-Gas instead of configurable Highswitch
Jeti-Menu_SetPoint Menu removed
 
Panorama Trigger; J16 will be overwritten, Output 1 Bitmask must be cleared
 
recommended Userparameter;
UP3 Variobeep on >=1 / off = 0, only if you are on the first Jetipage (spoti3 poti7)
UP4 Angle of Pano Trigger, normaly 10...180 (spoti4 poti8)
UP5 200 Trigger delay
UP6 170 Trigger interval, depends on your Camera, 170 is for Canon 5D
UP7 2 Motorsmoothing, 0 is with the original Code, 1...100 is adjustable
UP8 enable Pano if >=200
Serialpoti 1 Steps of 1
Serialpoti 2 Steps of 1
Serialpoti 3 Steps of 5
Serialpoti 4 Steps of 10
all initialized on 0 (rc.c)
sponsored Message until calibration in first Jetipage or 10 Seconds
 
Motortest bug removed; only one Motor at the same Time
LED init modified;
/// J16_OFF; /// MartinW: removed because of switching during calibration, not useful for activate fireworks
/// J17_OFF;
 
Compiler Switch for:
//#define WITH_MKTOOL_Display /// MartinW; memsave, with MKTool Display 70604-63130
//#define WITHSPECTRUM /// MartinW; memsave
//#define WITH_FULL_ANALOG_TEXT /// MartinW; memsave
//#define WITH_ExternControl /// MartinW; memsave //thanks to MartinR
//#define WITH_ORIGINAL_MOTORSMOOTHING /// MartinW; memsave 63312-63164
//#define WITH_JETI_SIMULATION /// MartinW; memsave 63312-63016
#define WITH_JETI_BEEP /// MartinW; 63072-63038; 63216-63050
#define WITH_PANOTRIGGER /// MartinW; 63328-63118
 
Todo;
Jeti+ Menu with Compiler-Switch
Emergency sinking;
FromNC_AltitudeSpeed = FromNaviCtrl.Param.Byte[9];
FromNC_AltitudeSetpoint = (long) FromNaviCtrl.Param.sInt[5] * 10; // in cm
long FromNC_AltitudeSetpoint = 0;
unsigned char FromNC_AltitudeSpeed = 0;
 
else // Gas Stick in Hover Range
LN 1528 if(FromNC_AltitudeSpeed && FromNC_AltitudeSetpoint < SollHoehe) // von NC gesteuert -> sinken