Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2536 → Rev 2537

/trunk/fc.c
276,6 → 276,18
Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L;
}
 
void StoreNeutralToEeprom(void)
{
BoatNeutralNick = AdNeutralNick;
BoatNeutralRoll = AdNeutralRoll;
BoatNeutralGier = AdNeutralGier;
SetParamWord(PID_ACC_NICK, (uint16_t)NeutralAccX);
SetParamWord(PID_ACC_ROLL, (uint16_t)NeutralAccY);
SetParamWord(PID_GYRO_NICK,(uint16_t)BoatNeutralNick);
SetParamWord(PID_GYRO_ROLL,(uint16_t)BoatNeutralRoll);
SetParamWord(PID_GYRO_YAW,(uint16_t)BoatNeutralGier);
}
 
//############################################################################
// Nullwerte ermitteln
// Parameter: 0 -> after switch on (ignore ACC-Z fault)
342,12 → 354,7
NeutralAccX = abs(Mittelwert_AccNick) / (2*ACC_AMPLIFY);
NeutralAccY = abs(Mittelwert_AccRoll) / (2*ACC_AMPLIFY);
// Save ACC neutral settings to eeprom
SetParamWord(PID_ACC_NICK, (uint16_t)NeutralAccX);
SetParamWord(PID_ACC_ROLL, (uint16_t)NeutralAccY);
SetParamWord(PID_ACC_TOP, (uint16_t)NeutralAccZ);
SetParamWord(PID_GYRO_NICK,(uint16_t)AdNeutralNick);
SetParamWord(PID_GYRO_ROLL,(uint16_t)AdNeutralRoll);
SetParamWord(PID_GYRO_YAW,(uint16_t)AdNeutralGier);
StoreNeutralToEeprom();
}
else
{
/trunk/fc.h
49,6 → 49,7
extern void ParameterZuordnung(void);
extern unsigned char GetChannelValue(unsigned char ch); // gives the unsigned value of the channel
extern void ChannelAssingment(void);
extern void StoreNeutralToEeprom(void);
 
#define Poti1 Poti[0]
#define Poti2 Poti[1]
/trunk/hottmenu.c
1235,13 → 1235,21
static unsigned char mode=MD_OFF,cursor=MD_OFF;
 
case 0: HoTT_printfxy(0,0,"ACC calibration");break;
case 1: HoTT_printfxy(0,1," ACC Stick");break;
case 2: HoTT_printfxy(0,2,"Nick = %3i %4i",NeutralAccX,ChannelNick);break;
case 3: HoTT_printfxy(0,3,"Roll = %3i %4i",NeutralAccY,ChannelRoll);break;
case 1: HoTT_printfxy(0,2,"ACC: N:%3i R:%3i ",NeutralAccX,NeutralAccY);
case 2: HoTT_printfxy(0,3,"Stick: (%i/%i) ",ChannelNick,ChannelRoll);
case 3: if(ChannelNick || ChannelRoll) HoTT_printfxy(7,3,"!!");
break;
case 4: HoTT_printfxy(2,4,"Off");break;
case 5: HoTT_printfxy(2,5,"Calibrate");break;
case 6: HoTT_printfxy(2,6,"Save");
if(mode == MD_SAV && cursor == MD_SAV) HoTT_printfxy(7,6,"(SET)");
case 6: HoTT_printfxy(2,6,"Save ");
if(mode == MD_SAV && cursor == MD_SAV)
{
HoTT_printfxy(7,6,"(SET)");
}
else if((mode == MD_CAL) && !((NC_GPS_ModeCharacter == ' ') || (NC_GPS_ModeCharacter == '/') || (NC_GPS_ModeCharacter == '-')))
{
HoTT_printfxy(2,6,"Swich GPS off!");
}
break;
case 7:
case 8: HoTT_printfxy(0,cursor+3,">");break;
1330,14 → 1338,16
{
if(!MotorenEin)
{
/* BoatNeutralNick = AdNeutralNick;
BoatNeutralRoll = AdNeutralRoll;
BoatNeutralGier = AdNeutralGier;
SetParamWord(PID_ACC_NICK, (uint16_t)NeutralAccX);
SetParamWord(PID_ACC_ROLL, (uint16_t)NeutralAccY);
BoatNeutralNick = AdNeutralNick;
BoatNeutralRoll = AdNeutralRoll;
BoatNeutralGier = AdNeutralGier;
SetParamWord(PID_GYRO_NICK,(uint16_t)BoatNeutralNick);
SetParamWord(PID_GYRO_ROLL,(uint16_t)BoatNeutralRoll);
SetParamWord(PID_GYRO_YAW,(uint16_t)BoatNeutralGier);
*/
StoreNeutralToEeprom();
HoTT_printfxy(7,6," okay ");
HoTT_printfxy(1,mode+3," ");
mode = MD_OFF;
/trunk/jetimenu.c
68,6 → 68,8
#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);}
 
unsigned char JumpToMenu = 0xff;
 
// -----------------------------------------------------------
// the menu functions
// -----------------------------------------------------------
195,6 → 197,62
JetiBox_printfxy(0,0,"Save singl.Point");
// JetiBox_printfxy(0,1,"(Relative) ");
}
 
void Menu_AccCal_Ask(uint8_t key)
{ //0123456789ABCDEF
JetiBox_printfxy(0,0,"ACC calibration");
// JetiBox_printfxy(0,1,"(Relative) ");
}
 
void Menu_AccCal(uint8_t key)
{
static unsigned char changed = 0;
//0123456789ABCDEF
JetiBox_printfxy(0,0,"ACC calibration");
 
if((FC_StatusFlags & FC_STATUS_MOTOR_RUN) && ((NC_GPS_ModeCharacter == ' ') || (NC_GPS_ModeCharacter == '/') || (NC_GPS_ModeCharacter == '-')))
{
if(!EE_Parameter.Driftkomp) EE_Parameter.Driftkomp = 6; // enables the Gyro-Drift compensation to make sure that a litlte calibration error won't effect the attitude
JetiBox_printfxy(0,0,"ACC N=%3i R=%3i",NeutralAccX,NeutralAccY);
if(ChannelNick || ChannelRoll)
JetiBox_printfxy(0,1,"Stick! (%i/%i)",ChannelNick,ChannelRoll)
else //0123456789ABCDEF
if(changed) JetiBox_printfxy(0,1,"land to safe ")
else JetiBox_printfxy(0,1,"use keys now ")
if(key== JETIBOX_KEY_UP ) {NeutralAccX++;JetiBeep=130; changed = 1;}
if(key== JETIBOX_KEY_DOWN ) {NeutralAccX--;JetiBeep=130; changed = 1;}
if(key== JETIBOX_KEY_RIGHT ) {NeutralAccY++;JetiBeep=130; changed = 1;}
if(key== JETIBOX_KEY_LEFT) {NeutralAccY--;JetiBeep=130; changed = 1;}
}
else
{
if(!(FC_StatusFlags & FC_STATUS_MOTOR_RUN)) // motors are off
{
if(key == JETIBOX_KEY_LEFT) { JumpToMenu = 0; changed = 0; }// Exit
 
if(changed == 0) JetiBox_printfxy(0,1,"Fly with GPS off")
else
if(changed == 1)
{
JetiBox_printfxy(0,1," safe -->")
if(key== JETIBOX_KEY_RIGHT)
{
StoreNeutralToEeprom();
JetiBeep = 130;
changed = 2;
}
}
else
if(changed == 2)
{
JetiBox_printfxy(0,1," values stored ");
}
} //0123456789ABCDEF
else JetiBox_printfxy(0,1,"switch GPS off ")
}
// JetiBox_printfxy(0,1,"(Relative) ");
}
#endif
 
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
382,8 → 440,8
const MENU_ENTRY JetiBox_Menu[] PROGMEM=
{ // l r u d pHandler
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
 
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
#define ACC_CAL 13
{8, 1, 0, 0, &Menu_Status }, // 0
{0, 2, 1, 1, &Menu_Temperature }, // 1
{1, 3, 2, 2, &Menu_Battery }, // 2
392,12 → 450,15
{4, 6, 5,10, &Menu_WPL_R1 }, // 5
{5, 7, 6,11, &Menu_POINT_LD}, // 6
{6, 8, 7,12, &Menu_POINT_SV}, // 7
{7, 0, 8, 6, &Magnet_Values }, // 8
{7, 9, 8, 8, &Magnet_Values }, // 8
{8, 0, 9,14, &Menu_AccCal_Ask},// 9
 
{4, 9, 9, 9, &Menu_WPL_A2 }, // 9
{5,10,10,10, &Menu_WPL_R2 }, // 10
{6,11,11,11, &Menu_POINT_LD2}, // 11
{7,12,12,12, &Menu_POINT_SV2}, // 12
{4,10,10,10, &Menu_WPL_A2 }, // 10
{5,11,11,11, &Menu_WPL_R2 }, // 11
{6,12,12,12, &Menu_POINT_LD2}, // 12
{7,13,13,13, &Menu_POINT_SV2}, // 13
 
{14,14,14,14, &Menu_AccCal}, // 14
#else
{6, 1, 0, 0, &Menu_Status }, // 0
{0, 2, 1, 1, &Menu_Temperature }, // 1
422,7 → 483,6
#if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP)
static uint8_t item = 0, last_item = 0; // the menu item
static uint8_t updateDelay = 1 , last_key;
 
// navigate within the menu by key action
last_item = item;
switch(key)
444,6 → 504,7
default:
break;
}
if(JumpToMenu != 0xff) { item = JumpToMenu; JumpToMenu = 0xff;};
// 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;
/trunk/libfc1284.a
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/libfc644.a
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/menu.c
80,9 → 80,14
void Menu(void)
{
unsigned char i;
static char DisableMenu = 0, AccMenu = 0, changed = 0;
 
if(!DisableMenu)
{
if(RemoteKeys & KEY1) { if(MenuePunkt) MenuePunkt--; else MenuePunkt = MaxMenue;}
if(RemoteKeys & KEY2) { if(MenuePunkt == MaxMenue) MenuePunkt = 0; else MenuePunkt++;}
if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuePunkt = 0;
}
LcdClear();
if(MenuePunkt < 10) {LCD_printfxy(17,0,"[%i]",MenuePunkt);}
else {LCD_printfxy(16,0,"[%i]",MenuePunkt);};
156,41 → 161,50
LCD_printfxy(0,1,"Nick %4i (%4i)",AdWertNick - AdNeutralNick/8, AdNeutralNick);
LCD_printfxy(0,2,"Roll %4i (%4i)",AdWertRoll - AdNeutralRoll/8, AdNeutralRoll);
LCD_printfxy(0,3,"Yaw %4i (%4i)",AdNeutralGier - AdWertGier, AdNeutralGier);
// LCD_printfxy(0,1,"Nick %4i (%3i.%x)",AdWertNick - AdNeutralNick/8, AdNeutralNick/16, (AdNeutralNick%16)/2);
// LCD_printfxy(0,2,"Roll %4i (%3i.%x)",AdWertRoll - AdNeutralRoll/8, AdNeutralRoll/16, (AdNeutralRoll%16)/2);
// LCD_printfxy(0,1,"Nick %4i (%4i)",AdWertNickFilter, AdNeutralNick);
// LCD_printfxy(0,2,"Roll %4i (%4i)",AdWertRollFilter, AdNeutralRoll);
// LCD_printfxy(0,3,"Yaw %4i (%3i)",AdNeutralGier - AdWertGier, AdNeutralGier/2);
 
/*
// entfernt aus Platzmangel
if(PlatinenVersion == 10)
{
LCD_printfxy(0,1,"Nick%4i (%3i.%i)",AdWertNick - AdNeutralNick/8, AdNeutralNick/8, AdNeutralNick%8);
LCD_printfxy(0,2,"Roll%4i (%3i.%i)",AdWertRoll - AdNeutralRoll/8, AdNeutralRoll/8, AdNeutralRoll%8);
LCD_printfxy(0,3,"Gier%4i (%3i)",AdNeutralGier - AdWertGier, AdNeutralGier);
}
else
if((PlatinenVersion == 11) || (PlatinenVersion >= 20))
{
LCD_printfxy(0,1,"Nick %4i (%3i.%x)",AdWertNick - AdNeutralNick/8, AdNeutralNick/16, (AdNeutralNick%16)/2);
LCD_printfxy(0,2,"Roll %4i (%3i.%x)",AdWertRoll - AdNeutralRoll/8, AdNeutralRoll/16, (AdNeutralRoll%16)/2);
LCD_printfxy(0,3,"Yaw %4i (%3i)",AdNeutralGier - AdWertGier, AdNeutralGier/2);
}
else
if(PlatinenVersion == 13)
{
LCD_printfxy(0,1,"Nick %4i (%3i)(%3i)",AdWertNick - AdNeutralNick/8, AdNeutralNick/16,AnalogOffsetNick);
LCD_printfxy(0,2,"Roll %4i (%3i)(%3i)",AdWertRoll - AdNeutralRoll/8, AdNeutralRoll/16,AnalogOffsetRoll);
LCD_printfxy(0,3,"Yaw %4i (%3i)(%3i)",AdNeutralGier - AdWertGier, AdNeutralGier/2,AnalogOffsetGier);
}
*/
AccMenu = 0;
break;
case 6:
LCD_printfxy(0,0,"ACC - Sensor");
LCD_printfxy(0,1,"Nick %4i (%3i)",AdWertAccNick,NeutralAccX);
LCD_printfxy(0,2,"Roll %4i (%3i)",AdWertAccRoll,NeutralAccY);
LCD_printfxy(0,3,"Z %4i (%3i)",AdWertAccHoch,(int)NeutralAccZ);
switch(AccMenu)
{
case 0:
LCD_printfxy(0,0,"ACC - Sensor");
LCD_printfxy(0,1,"Nick %4i (%3i)",AdWertAccNick,NeutralAccX);
LCD_printfxy(0,2,"Roll %4i (%3i)",AdWertAccRoll,NeutralAccY);
LCD_printfxy(0,3,"Z %4i (%3i)(cal)",AdWertAccHoch,(int)NeutralAccZ);
if(RemoteKeys & KEY4) AccMenu++;
changed = 0;
break;
case 1:
LCD_printfxy(0,0,"Calibration:");
LCD_printfxy(0,1,"ACC: N:%3i R:%3i ",NeutralAccY,NeutralAccX);
if(ChannelNick || ChannelRoll) LCD_printfxy(0,2,"Stick: (%i/%i) !! ",ChannelNick,ChannelRoll);
if((FC_StatusFlags & FC_STATUS_MOTOR_RUN) && ((NC_GPS_ModeCharacter == ' ') || (NC_GPS_ModeCharacter == '/') || (NC_GPS_ModeCharacter == '-')))
{
DisableMenu = 1;
if(!EE_Parameter.Driftkomp) EE_Parameter.Driftkomp = 6; // enables the Gyro-Drift compensation to make sure that a litlte calibration error won't effect the attitude
if(RemoteKeys & KEY1) { NeutralAccY--; changed = 1;}
if(RemoteKeys & KEY2) { NeutralAccY++; changed = 1;}
if(RemoteKeys & KEY3) { NeutralAccX--; changed = 1;}
if(RemoteKeys & KEY4) { NeutralAccX++; changed = 1;}
LCD_printfxy(13,0,"on ");
if(changed) LCD_printfxy(0,3,"land to safe ")
else LCD_printfxy(0,3,"use keys to trim ACC")
}
else
{
LCD_printfxy(13,0,"off");
DisableMenu = 0;
if(!(FC_StatusFlags & FC_STATUS_MOTOR_RUN) && changed)
{
LCD_printfxy(0,3,"Safe? (yes)(no)");
if(RemoteKeys & KEY3) { StoreNeutralToEeprom(); AccMenu = 0;}
if(RemoteKeys & KEY4) { changed = 0;}
}
else LCD_printfxy(0,3,"Fly with GPS off");
}
break;
default: AccMenu = 0; break;
}
break;
case 7:
LCD_printfxy(0,0,"Voltage: %3i.%1iV",UBat/10, UBat%10);
197,6 → 211,7
LCD_printfxy(0,1,"Current: %3i.%1iA",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
LCD_printfxy(0,2,"Power: %4iW",Capacity.ActualPower);
LCD_printfxy(0,3,"Discharge: %5imAh", Capacity.UsedCapacity);
AccMenu = 0;
break;
case 8:
LCD_printfxy(0,0,"Receiver");
/trunk/version.txt
779,6 → 779,10
- Error Message: Redundancy Test
- Redundant Slave: copy the Current, State and Temperature from the UART Data
 
2.09f (19.03.2015)
- ACC-Calibration with Jeti and KopterTool
 
 
toDo:
- CalAthmospheare nachführen