Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1753 → Rev 1756

/branches/MartinW_Jeti+/capacity.c
80,7 → 80,7
{
unsigned short Current, SetSum; // max value will be 255 * 12 = 3060
static unsigned short SubCounter = 0;
static unsigned short CurrentOffset = 0;
// static unsigned short CurrentOffset = 0;
static unsigned long SumCurrentOffset = 0;
unsigned char i, NumOfMotors, MinOfMaxPWM;
 
/branches/MartinW_Jeti+/fc.c
53,6 → 53,14
// + POSSIBILITY OF SUCH DAMAGE.
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
//Interessanten Maximumwerte
//Capacity.ActualCurrent/10, Capacity.ActualCurrent%10
//GPSInfo.Speed,GPSInfo.NumOfSats
//VarioMeter
//HoverGas/4
 
 
 
#include "main.h"
#include "mymath.h"
#include "isqrt.h"
62,12 → 70,16
 
 
#endif
unsigned char loop1, loop2, loop3, loop4;
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;
unsigned char h,m,s;
unsigned int BaroExpandActive = 0;
1311,8 → 1323,10
int CosAttitude; // for projection of hoover gas
 
// get the current hooverpoint
DebugOut.Analog[21] = HoverGas;
 
if((FCFlags & FCFLAG_FLY)) ///
{
DebugOut.Analog[21] = HoverGas;
}
// Expand the measurement
// measurement of air pressure close to upper limit and no overflow in correction of the new OCR0A value occurs
if(!BaroExpandActive)
1600,11 → 1614,15
HoverGasFilter += 4L * tmp_long2;
}
else //later
if(abs(VarioMeter) < 100) // only on small vertical speed
{
HoverGasFilter -= HoverGasFilter/HOVER_GAS_AVERAGE;
HoverGasFilter += tmp_long2;
}
HoverGas = (int16_t)(HoverGasFilter/HOVER_GAS_AVERAGE);
if(EE_Parameter.Hoehe_HoverBand)
{
/branches/MartinW_Jeti+/fc.h
44,11 → 44,16
#define Poti8 Poti[7]
 
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, loop4;
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 volatile unsigned char FCFlags;
/branches/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><File path="fc.c"></File><File path="jetimenu.c"></File></Project>
<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><File path="fc.c"></File><File path="jetimenu.c"></File><File path="capacity.c"></File><File path="capacity.h"></File></Project>
/branches/MartinW_Jeti+/jetimenu.c
69,10 → 69,21
 
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);
//1
 
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);
//1
}
 
 
108,7 → 119,6
void Menu_Current(uint8_t key)
{ //0123456789ABCDEF
 
loop1 ++;
if(loop1 >= updatemotors)
123,12 → 133,29
Motors6 =Motor[6].Current;
Motors7 =Motor[7].Current;
}
JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motors0-12, Motors1-12, Motors2-12, Motors3-12);
JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motors4-12, Motors5-12, Motors6-12, Motors6-12);
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 ");
JetiBox_printfxy(0,1,"Currents T%3i.%1iA",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
}
else
if(RequiredMotors <= 6)
{
224,35 → 251,20
void Menu_Info(uint8_t key)
{ //0123456789ABCDEF
 
// JetiBox_printfxy(0,0,"%3i=Hovergas",HoverGas);
JetiBox_printfxy(0,0,"%3i=VSpeed",VarioMeter);
JetiBox_printfxy(0,1,"%3i=HG/4 %3i=Gas",HoverGas/4,StickGas);
}
/*
void Menu_spoti1(uint8_t key)
{ //0123456789ABCDEF
 
JetiBox_printfxy(0,0,">%3i=SPot1",PPM_in[13]);
JetiBox_printfxy(0,1," %3i=SPot2",PPM_in[14]);
if(key== JETIBOX_KEY_UP) PPM_in[13] = PPM_in[13]+1;
if(key== JETIBOX_KEY_DOWN) PPM_in[13] = PPM_in[13]-1;
}
 
void Menu_spoti2(uint8_t key)
{ //0123456789ABCDEF
 
JetiBox_printfxy(0,0," %3i=SPot1",PPM_in[13]);
JetiBox_printfxy(0,1,">%3i=SPot2",PPM_in[14],key);
if(key== JETIBOX_KEY_UP) PPM_in[14] = PPM_in[14]+5;
if(key== JETIBOX_KEY_DOWN) PPM_in[14] = PPM_in[14]-5;
}
 
*/
 
void Menu_Serialpoti(uint8_t key)
{
Menu_keynumber(key);
 
JetiBox_printfxy(0,0,"%c%3i=SP1%c%3i=SP3",pos1,PPM_in[13],pos3,PPM_in[15]);
JetiBox_printfxy(0,1,"%c%3i=SP2%c%3i=SP4",pos2,PPM_in[14],pos4,PPM_in[16]);
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] --;
266,24 → 278,43
 
 
void Menu_hoeheconf(uint8_t key)
{ //0123456789ABCDEF
if(EE_Parameter.ExtraConfig == 3 || EE_Parameter.ExtraConfig == 1) //EE_Parameter.ExtraConfig == 1 =switched Hightv+ variopiepser
{
/*/ //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");
JetiBox_printfxy(0,0,"switched Hight v");
}
if(EE_Parameter.ExtraConfig == 2 || EE_Parameter.ExtraConfig == 0)
if((EE_Parameter.ExtraConfig & CFG2_HEIGHT_LIMIT) == 0)
{
JetiBox_printfxy(0,1,"Vario withbeep ^");
}
/*/
vario =0
vario und ton 2
nur hohe = 1
höhe mit schalter=1
höhe mit variopiep =3
/*/
if(key== JETIBOX_KEY_UP) EE_Parameter.ExtraConfig = 3;
if(key== JETIBOX_KEY_DOWN) EE_Parameter.ExtraConfig = 2;
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
}
}
 
 
470,6 → 501,26
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);
476,8 → 527,8
PC_MotortestActive = 240;
JetiBox_printfxy(0,0,"Mtest <+v <+^");
JetiBox_printfxy(0,1,"Motor=%3i Sp=%2i",loop3+1, MotorTest[loop3]);
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;
489,24 → 540,24
}
 
void Menu_mem(uint8_t key)
{ //0123456789ABCDEF
unsigned char i =0;
 
{
JetiBox_printfxy(0,0,"SETTING=%1i",GetActiveParamSet());
JetiBox_printfxy(0,1,"< and > to STORE");
JetiBox_printfxy(0,1, "< + >toSTOREto %1i",settingdest);
// 00123456789ABCDEF
//if(key== JETIBOX_KEY_DOWN )
if(key== JETIBOX_KEY_LANDR && !MotorenEin)
 
{
ParamSet_WriteToEEProm(GetActiveParamSet());
{
ParamSet_WriteToEEProm(settingdest);
Piep(GetActiveParamSet(),120);
JetiBox_printfxy(13,0,"OK!");
}
if((key== JETIBOX_KEY_UP) & (settingdest <5 )) settingdest++;
//for(i=0; i<5; i++)
//{
JetiBox_printfxy(i,0,"OK!");
//}
}
if((key== JETIBOX_KEY_DOWN) & (settingdest >1 )) settingdest--;
}
 
 
533,7 → 584,7
 
const MENU_ENTRY JetiBox_Menu[] PROGMEM=
{ // l r u d pHandler links rechts up down
{23, 1, 0, 0, &Menu_Status }, // Seite 1
{22, 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
551,10 → 602,10
{14, 16, 15, 15, &Menu_gps }, // 16
{15, 17, 16, 16, &Menu_loopP }, // 17
{16, 18, 17, 17, &Menu_coup }, // 18
{17, 19, 18, 18, &Menu_LOOPconf }, // 19
{18, 20, 19, 19, &Menu_hoeheconf }, // 20
{19, 21, 20, 20, &Menu_mtest }, // 21
{20, 22, 21, 21, &Menu_mem }, // 22
{17, 19, 18, 18, &Menu_camera }, // 19
{18, 20, 19, 19, &Menu_LOOPconf }, // 20
{19, 21, 20, 20, &Menu_hoeheconf }, // 21
{20, 22, 21, 21, &Menu_mtest }, // 22
{21, 0, 22, 22, &Menu_mem }, // 23
};
573,14 → 624,14
switch(key)
{
case JETIBOX_KEY_LEFT:
if (item == 0) return (1); // switch back to jeti expander menu
else
{
///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:
/branches/MartinW_Jeti+/led.c
27,7 → 27,15
if(!delay--) // 10ms Intervall
{
delay = 4;
if(EE_Parameter.UserParam8 >0) // 2ms Intervall ///
{
delay = 0;
}
 
 
 
if(FCFlags & (FCFLAG_LOWBAT | FCFLAG_NOTLANDUNG | FCFLAG_I2CERR))
{
if(EE_Parameter.WARN_J16_Bitmask)
55,7 → 63,8
else
if((EE_Parameter.J16Timing > 247) && (Parameter_J16Timing > 220)) {if(J16Bitmask & 128) J16_ON; else J16_OFF;}
else
if((EE_Parameter.J16Timing > 247) && (Parameter_J16Timing < 10)) {if(J16Bitmask & 128) J16_OFF; else J16_ON;}
//if((EE_Parameter.J16Timing > 247) && (Parameter_J16Timing < 10)) {if(J16Bitmask & 128) J16_OFF; else J16_ON;} //original
if((EE_Parameter.J16Timing > 247) && (Parameter_J16Timing < 2)) {if(J16Bitmask & 128) J16_OFF; else J16_ON;} //bei <10 reagiert gar nicht mehr, bei mir ist "2" i.o.
else
if(!J16Blinkcount--)
{
/branches/MartinW_Jeti+/makefile
7,7 → 7,7
VERSION_MAJOR = 0
VERSION_MINOR = 80
VERSION_PATCH = 6
NAMEEXT = jeti002
NAMEEXT = jeti003
VERSION_SERIAL_MAJOR = 11 # Serial Protocol
VERSION_SERIAL_MINOR = 0 # Serial Protocol
NC_SPI_COMPATIBLE = 14 # Navi-Kompatibilität
/branches/MartinW_Jeti+/rc.c
30,6 → 30,10
PPM_in[i] = 0;
PPM_diff[i] = 0;
}
PPM_in[13] = PPM_in[13] -127; // MartinR: Initialisierungswerte für die seriellen Potis für Jeti+
PPM_in[14] = PPM_in[14] -127; // MartinR: Initialisierungswerte für die seriellen Potis für Jeti+
PPM_in[13] = PPM_in[15] -127; // MartinR: Initialisierungswerte für die seriellen Potis für Jeti+
PPM_in[14] = PPM_in[16] -127; // MartinR: Initialisierungswerte für die seriellen Potis für Jeti+
 
AdNeutralGier = 0;
AdNeutralRoll = 0;