Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2341 → Rev 2342

/trunk/eeprom.c
138,8 → 138,7
EE_Parameter.GyroAccAbgleich = 32; // 1/k
EE_Parameter.BitConfig = 0; // Looping usw.
EE_Parameter.GlobalConfig = CFG_ACHSENKOPPLUNG_AKTIV | CFG_KOMPASS_AKTIV | CFG_GPS_AKTIV | CFG_HOEHEN_SCHALTER;
EE_Parameter.ExtraConfig = CFG_GPS_AID | CFG2_VARIO_BEEP;
EE_Parameter.GlobalConfig3 = CFG3_SPEAK_ALL;//CFG3_VARIO_FAILSAFE;
EE_Parameter.ExtraConfig = CFG_GPS_AID | CFG2_VARIO_BEEP | CFG_LEARNABLE_CAREFREE;
EE_Parameter.Receiver = RECEIVER_HOTT;
EE_Parameter.MotorSafetySwitch = 0;
EE_Parameter.ExternalControl = 0;
149,7 → 148,7
EE_Parameter.KompassWirkung = 64; // Wert : 0-247
 
EE_Parameter.Hoehe_MinGas = 30;
EE_Parameter.MaxHoehe = 255; // Wert : 0-247 255 -> Poti1
EE_Parameter.HoeheChannel = 5; // Wert : 0-32
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
if(ACC_AltitudeControl)
{
159,6 → 158,8
EE_Parameter.Hoehe_HoverBand = 1; // Wert : 0-247
EE_Parameter.Hoehe_GPS_Z = 0; // Wert : 0-247
EE_Parameter.Hoehe_StickNeutralPoint = 127;// Wert : 0-247 (0 = Hover-Estimation)
EE_Parameter.GlobalConfig3 = CFG3_SPEAK_ALL;//
EE_Parameter.FailSafeTime = 30; // 0 = off
}
else
#endif
169,6 → 170,8
EE_Parameter.Hoehe_HoverBand = 8; // Wert : 0-247
EE_Parameter.Hoehe_GPS_Z = 20; // Wert : 0-247
EE_Parameter.Hoehe_StickNeutralPoint = 0;// Wert : 0-247 (0 = Hover-Estimation)
EE_Parameter.GlobalConfig3 = CFG3_SPEAK_ALL;
EE_Parameter.FailSafeTime = 0; // 0 = off
}
EE_Parameter.Hoehe_Verstaerkung = 15; // Wert : 0-50 (15 -> ca. +/- 5m/sek bei Stick-Voll-Ausschlag)
211,7 → 214,7
EE_Parameter.LoopThreshold = 90; // Wert: 0-247 Schwelle für Stickausschlag
EE_Parameter.LoopHysterese = 50;
 
EE_Parameter.NaviGpsModeControl = 254; // 254 -> Poti 2
EE_Parameter.NaviGpsModeChannel = 6; // Kanal 6
EE_Parameter.NaviGpsGain = 100;
EE_Parameter.NaviGpsP = 90;
EE_Parameter.NaviGpsI = 90;
228,13 → 231,12
EE_Parameter.NaviAngleLimitation = 140;
EE_Parameter.NaviPH_LoginTime = 5;
EE_Parameter.OrientationAngle = 0;
EE_Parameter.CareFreeModeControl = 0;
EE_Parameter.CareFreeChannel = 0;
EE_Parameter.UnterspannungsWarnung = 33; // Wert : 0-247 ( Automatische Zellenerkennung bei < 50)
EE_Parameter.NotGas = 65; // Wert : 0-247 // Gaswert bei Empangsverlust (ggf. in Prozent)
EE_Parameter.NotGasZeit = 90; // Wert : 0-247 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen
EE_Parameter.MotorSmooth = 0;
EE_Parameter.ComingHomeAltitude = 0; // 0 = don't change
EE_Parameter.FailSafeTime = 0; // 0 = off
EE_Parameter.MaxAltitude = 150; // 0 = off
EE_Parameter.AchsKopplung1 = 125;
EE_Parameter.AchsKopplung2 = 52;
/trunk/eeprom.h
4,7 → 4,7
#include <inttypes.h>
#include "twimaster.h"
 
#define EEPARAM_REVISION 94 // is count up, if paramater stucture has changed (compatibility)
#define EEPARAM_REVISION 95 // is count up, if paramater stucture has changed (compatibility)
#define EEMIXER_REVISION 1 // is count up, if mixer stucture has changed (compatibility)
 
#define EEPROM_ADR_PARAM_BEGIN 0
144,7 → 144,7
unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
unsigned char Hoehe_MinGas; // Wert : 0-100
unsigned char Luftdruck_D; // Wert : 0-250
unsigned char MaxHoehe; // Wert : 0-32
unsigned char HoeheChannel; // Wert : 0-32
unsigned char Hoehe_P; // Wert : 0-32
unsigned char Hoehe_Verstaerkung; // Wert : 0-50
unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250
214,7 → 214,7
unsigned char WARN_J17_Bitmask; // for the J17 Output
//---NaviCtrl---------------------------------------------
unsigned char NaviOut1Parameter; // for the J16 Output
unsigned char NaviGpsModeControl; // Parameters for the Naviboard
unsigned char NaviGpsModeChannel; // Parameters for the Naviboard
unsigned char NaviGpsGain;
unsigned char NaviGpsP;
unsigned char NaviGpsI;
234,7 → 234,7
unsigned char ExternalControl; // for serial Control
//---CareFree---------------------------------------------
unsigned char OrientationAngle; // Where is the front-direction?
unsigned char CareFreeModeControl; // switch for CareFree
unsigned char CareFreeChannel; // switch for CareFree
unsigned char MotorSafetySwitch;
unsigned char MotorSmooth;
unsigned char ComingHomeAltitude;
/trunk/fc.c
118,7 → 118,7
unsigned char Looping_Links = 0, Looping_Rechts = 0, Looping_Unten = 0, Looping_Oben = 0;
 
unsigned char Parameter_Luftdruck_D = 48; // Wert : 0-250
unsigned char Parameter_HoehenSchalter = 251; // Wert : 0-250
unsigned char Parameter_HoehenSchalter = 0; // Wert : 0-250
unsigned char Parameter_Hoehe_P = 16; // Wert : 0-32
unsigned char Parameter_Hoehe_ACC_Wirkung = 58; // Wert : 0-250
unsigned char Parameter_KompassWirkung = 64; // Wert : 0-250
152,7 → 152,6
unsigned char Parameter_J16Timing; // for the J16 Output
unsigned char Parameter_J17Bitmask; // for the J17 Output
unsigned char Parameter_J17Timing; // for the J17 Output
unsigned char Parameter_NaviGpsModeControl; // Parameters for the Naviboard
unsigned char Parameter_NaviGpsGain;
unsigned char Parameter_NaviGpsP;
unsigned char Parameter_NaviGpsI;
602,8 → 601,15
}
}
 
unsigned char GetChannelValue(unsigned char ch) // gives the unsigned value of the channel
{
int tmp2;
if(ch == 0) return(0);
tmp2 = PPM_in[ch] + 127;
if(tmp2 > 255) tmp2 = 255; else if(tmp2 < 0) tmp2 = 0;
return(tmp2);
}
 
 
//############################################################################
// Trägt ggf. das Poti als Parameter ein
void ParameterZuordnung(void)
639,9 → 645,8
if(EE_Parameter.Servo4 == 247) { if(PORTC & (1<<PORTC2)) Parameter_Servo4 = 140; else Parameter_Servo4 = 70;}
else if(EE_Parameter.Servo4 == 246) { if(PORTC & (1<<PORTC3)) Parameter_Servo4 = 140; else Parameter_Servo4 = 70;} // Out2 (J17)
else CHK_POTI(Parameter_Servo4,EE_Parameter.Servo4);
 
CHK_POTI(Parameter_Servo5,EE_Parameter.Servo5);
CHK_POTI(Parameter_HoehenSchalter,EE_Parameter.MaxHoehe);
Parameter_HoehenSchalter = GetChannelValue(EE_Parameter.HoeheChannel);
CHK_POTI(Parameter_Hoehe_ACC_Wirkung,EE_Parameter.Hoehe_ACC_Wirkung);
CHK_POTI(Parameter_Hoehe_GPS_Z,EE_Parameter.Hoehe_GPS_Z);
CHK_POTI(Parameter_KompassWirkung,EE_Parameter.KompassWirkung);
677,11 → 682,11
MAX_GAS = EE_Parameter.Gas_Max;
MIN_GAS = EE_Parameter.Gas_Min;
 
tmp = EE_Parameter.CareFreeModeControl;
if(tmp > 50)
if(EE_Parameter.CareFreeChannel)
{
CareFree = 1;
if(tmp >= 248 && Poti[255 - tmp] < 50) CareFree = 0;
if(PPM_in[EE_Parameter.CareFreeChannel] < -64) CareFree = 0;
// if(tmp >= 248 && Poti[255 - tmp] < 50) CareFree = 0;
if(carefree_old != CareFree)
{
if(carefree_old < 3)
795,6 → 800,7
if(PPM_in[EE_Parameter.StartLandChannel] > 50)
{
if(old_switch == 50) if(FC_StatusFlags2 & FC_STATUS2_WAIT_FOR_TAKEOFF) { FC_StatusFlags2 |= FC_STATUS2_AUTO_STARTING; SpeakHoTT = SPEAK_RISING;}
FC_StatusFlags2 &= ~FC_STATUS2_AUTO_LANDING;
old_switch = 150;
}
else
801,6 → 807,7
if(PPM_in[EE_Parameter.StartLandChannel] < -50)
{
if(old_switch == 150) { FC_StatusFlags2 |= FC_STATUS2_AUTO_LANDING; SpeakHoTT = SPEAK_SINKING;}
FC_StatusFlags2 &= ~FC_STATUS2_AUTO_STARTING;
old_switch = 50;
}
else
960,7 → 967,7
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gas ist unten
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] < 35-120)
if(PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] < -100)
{
if(PPM_diff[EE_Parameter.MotorSafetySwitch & 127] > 5) move_safety_switch = 100;
else
968,7 → 975,7
// Motoren Starten
if(!MotorenEin)
{
if((((PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -75) && ((!(EE_Parameter.GlobalConfig3 & CFG3_MOTOR_SWITCH_MODE) && PPM_in[EE_Parameter.MotorSafetySwitch] < -75) || EE_Parameter.MotorSafetySwitch == 0)))
if((((PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -100) && ((!(EE_Parameter.GlobalConfig3 & CFG3_MOTOR_SWITCH_MODE) && PPM_in[EE_Parameter.MotorSafetySwitch] < -75) || EE_Parameter.MotorSafetySwitch == 0)))
|| (((EE_Parameter.GlobalConfig3 & CFG3_MOTOR_SWITCH_MODE) && PPM_in[EE_Parameter.MotorSafetySwitch] > -10 && move_safety_switch == 100)))
{
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
979,6 → 986,7
HoehenWertF = 0;
HoehenWert = 0;
SummenHoehe = 0;
if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > -100 || abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) < 100) && EE_Parameter.MotorSafetySwitch == 0) delay_einschalten = 0;
if(++delay_einschalten > 253)
{
delay_einschalten = 0;
1018,17 → 1026,29
else // only if motors are running
{
// if((PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75) && (PPM_in[EE_Parameter.MotorSafetySwitch] < -75 || EE_Parameter.MotorSafetySwitch == 0))
if((((PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75) && ((!(EE_Parameter.GlobalConfig3 & CFG3_MOTOR_SWITCH_MODE) && PPM_in[EE_Parameter.MotorSafetySwitch] < -75) || EE_Parameter.MotorSafetySwitch == 0)))
if((((PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 100) && ((!(EE_Parameter.GlobalConfig3 & CFG3_MOTOR_SWITCH_MODE) && PPM_in[EE_Parameter.MotorSafetySwitch] < -75) || EE_Parameter.MotorSafetySwitch == 0)))
|| (((EE_Parameter.GlobalConfig3 & CFG3_MOTOR_SWITCH_MODE) && PPM_in[EE_Parameter.MotorSafetySwitch] < -50 && move_safety_switch == -100)))
{
if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > -100 || abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) < 100) && EE_Parameter.MotorSafetySwitch == 0)
{
delay_ausschalten = 0;
}
else
{
SummeNick = 0;
SummeRoll = 0;
StickNick = 0;
StickRoll = 0;
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
SpeakHoTT = SPEAK_MK_OFF;
#endif
}
if(++delay_ausschalten > 250) // nicht sofort
{
MotorenEin = 0;
delay_ausschalten = 0;
modell_fliegt = 0;
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
SpeakHoTT = SPEAK_MK_OFF;
#endif
FC_StatusFlags2 &= ~(FC_STATUS2_WAIT_FOR_TAKEOFF | FC_STATUS2_AUTO_STARTING | FC_STATUS2_AUTO_LANDING);
}
}
else delay_ausschalten = 0;
/trunk/fc.h
38,6 → 38,7
 
extern volatile unsigned char FC_StatusFlags, FC_StatusFlags2;
extern void ParameterZuordnung(void);
extern unsigned char GetChannelValue(unsigned char ch); // gives the unsigned value of the channel
 
#define Poti1 Poti[0]
#define Poti2 Poti[1]
123,7 → 124,7
extern signed char WaypointTrimming;
extern int HoverGas;
extern unsigned char Parameter_Luftdruck_D;
extern unsigned char Parameter_MaxHoehe;
//extern unsigned char Parameter_MaxHoehe;
extern unsigned char Parameter_Hoehe_P;
extern unsigned char Parameter_Hoehe_ACC_Wirkung;
extern unsigned char Parameter_KompassWirkung;
/trunk/hottmenu.c
705,7 → 705,7
HoTT_printf("DISABLED");
break;
case 3: HoTT_printfxy(0,3,"CF:");
if(!EE_Parameter.CareFreeModeControl) HoTT_printf("DISABLED")
if(!EE_Parameter.CareFreeChannel) HoTT_printf("DISABLED")
else
{
if(CareFree) HoTT_printf(" (ON) ") else HoTT_printf(" (OFF)");
716,7 → 716,7
if(!(Parameter_GlobalConfig & CFG_GPS_AKTIV)) HoTT_printf("DISABLED")
else
{
CHK_POTI(tmp,EE_Parameter.NaviGpsModeControl);
tmp = GetChannelValue(EE_Parameter.NaviGpsModeChannel);
if(tmp < 50) HoTT_printf("(FREE)")
else
if(tmp >= 180) HoTT_printf("(HOME)")
/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/main.c
381,6 → 381,7
{
NaviDataOkay--;
VersionInfo.HardwareError[1] &= ~FC_ERROR1_SPI_RX;
VersionInfo.Flags |= FC_VERSION_FLAG_NC_PRESENT;
}
else
{
401,6 → 402,9
FromNaviCtrl.AccErrorN = 0;
FromNaviCtrl.AccErrorR = 0;
FromNaviCtrl.CompassValue = -1;
FromNC_AltitudeSpeed = 0;
FromNC_AltitudeSetpoint = 0;
VersionInfo.Flags &= ~FC_VERSION_FLAG_NC_PRESENT;
NaviDataOkay = 0;
}
if(UBat < BattLowVoltageWarning)
/trunk/makefile
6,10 → 6,10
#-------------------------------------------------------------------
VERSION_MAJOR = 0
VERSION_MINOR = 91
VERSION_PATCH = 0
VERSION_PATCH = 2
VERSION_SERIAL_MAJOR = 11 # Serial Protocol
VERSION_SERIAL_MINOR = 0 # Serial Protocol
NC_SPI_COMPATIBLE = 54 # Navi-Kompatibilität
NC_SPI_COMPATIBLE = 55 # Navi-Kompatibilität
LIB_FC_COMPATIBLE = 2 # Library
#-------------------------------------------------------------------
# ATMEGA644: 63487 is maximum
/trunk/rc.c
75,9 → 75,9
if(i < 5) PPM_in[i] = 0; else PPM_in[i] = -127;
PPM_diff[i] = 0;
}
PPM_in[PPM_IN_MAX] = +127;
PPM_in[PPM_IN_OFF] = -127;
PPM_in[PPM_IN_MID] = 0;
PPM_in[PPM_IN_MAX] = +127;
AdNeutralGier = 0;
AdNeutralRoll = 0;
AdNeutralNick = 0;
/trunk/rc.h
34,8 → 34,8
#define SERIAL_POTI_START 17
#define WP_EVENT_PPM_IN 29
#define PPM_IN_OFF 30
#define PPM_IN_MID 31
#define PPM_IN_MAX 32
#define PPM_IN_MAX 31
#define PPM_IN_MID 32
 
#define FromNC_WP_EventChannel PPM_in[WP_EVENT_PPM_IN] // WP_EVENT-Channel-Value
 
/trunk/spi.c
180,7 → 180,7
ToNaviCtrl.Param.Int[0] = Capacity.ActualCurrent; // 0.1A
ToNaviCtrl.Param.Int[1] = Capacity.UsedCapacity; // mAh
ToNaviCtrl.Param.Byte[4] = (unsigned char) UBat; // 0.1V
ToNaviCtrl.Param.Byte[5] = EE_Parameter.NaviGpsModeControl; // GPS-Mode
ToNaviCtrl.Param.Byte[5] = GetChannelValue(EE_Parameter.NaviGpsModeChannel); // GPS-Mode control
ToNaviCtrl.Param.Byte[6] = VarioCharacter;
ToNaviCtrl.Param.Byte[7] = motorindex;
ToNaviCtrl.Param.Byte[8] = Motor[motorindex].MaxPWM;
/trunk/uart.c
680,8 → 680,9
VersionInfo.SWMinor = VERSION_MINOR;
VersionInfo.SWPatch = VERSION_PATCH;
VersionInfo.ProtoMajor = VERSION_SERIAL_MAJOR;
VersionInfo.ProtoMinor = VERSION_SERIAL_MINOR;
 
VersionInfo.reserved1 = 0;
VersionInfo.reserved2 = 0;
VersionInfo.HWMajor = PlatinenVersion;
pRxData = 0;
RxDataLen = 0;
}
/trunk/uart.h
85,14 → 85,24
#define FC_ERROR1_RES2 0x40
#define FC_ERROR1_RES3 0x80
 
 
// for FlightCtrl
//VersionInfo.Flags
#define FC_VERSION_FLAG_NC_PRESENT 0x01
// for NaviCtrl
#define NC_VERSION_FLAG_MK3MAG_PRESENT 0x01
 
struct str_VersionInfo
{
unsigned char SWMajor;
unsigned char SWMinor;
unsigned char ProtoMajor;
unsigned char ProtoMinor;
unsigned char reserved1;
unsigned char SWPatch;
unsigned char HardwareError[5];
unsigned char HardwareError[2];
unsigned char HWMajor;
unsigned char reserved2;
unsigned char Flags;
};
 
extern struct str_VersionInfo VersionInfo;
/trunk/version.txt
589,7 → 589,11
- Checking the ACC-Z value in flight and report ACC-Z if out of range
- disable Altitude hold in case of ACC-Z error
0.91b
0.91c
- Move NICK/Roll Sticks for switching on / off
- Move the Stick > 100 instead > 75 for switch on / off
- Failsafe active if ACC-Upgarde
- AltitudeMode, GPS_Mode & Carefree_Mode are now direct channels instead of Poti-Values (NaviGpsModeChannel,CareFreeChannel,HoeheChannel)
- NC-SPI communication from 25Hz to 41Hz
- MotorTemperature and GPS-Mode-Switch more often to NC
- Auto-Start/Landing