Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2339 → Rev 2340

/trunk/eeprom.c
172,6 → 172,8
}
EE_Parameter.Hoehe_Verstaerkung = 15; // Wert : 0-50 (15 -> ca. +/- 5m/sek bei Stick-Voll-Ausschlag)
EE_Parameter.StartLandChannel = 0;
EE_Parameter.LandingSpeed = 12;
 
EE_Parameter.UserParam1 = 0; // zur freien Verwendung
EE_Parameter.UserParam2 = 0; // zur freien Verwendung
/trunk/eeprom.h
4,7 → 4,7
#include <inttypes.h>
#include "twimaster.h"
 
#define EEPARAM_REVISION 93 // is count up, if paramater stucture has changed (compatibility)
#define EEPARAM_REVISION 94 // 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
24,7 → 24,7
#define PID_HARDWARE_VERSION 17 // Byte
 
#define EEPROM_ADR_CHANNELS 80 // 80 - 93, 12 bytes + 1 byte crc
#define EEPROM_ADR_PARAMSET 100 // 100 - 650, 5 * 110 bytes
#define EEPROM_ADR_PARAMSET 100 // 100 - 725, 5 * 125 bytes
#define EEPROM_ADR_MIXERTABLE 1000 // 1000 - 1078, 78 bytes
#define EEPROM_ADR_BLCONFIG 1200 // 1200 - 1296, 12 * 8 bytes
 
243,6 → 243,8
unsigned char FailsafeChannel; // if the value of this channel is > 100, the MK reports "RC-Lost"
unsigned char ServoFilterNick;
unsigned char ServoFilterRoll;
unsigned char StartLandChannel;
unsigned char LandingSpeed;
//------------------------------------------------
unsigned char BitConfig; // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
unsigned char ServoCompInvert; // // 0x01 = Nick, 0x02 = Roll, 0x04 = relative moving // WICHTIG!!! am Ende lassen
250,7 → 252,7
unsigned char GlobalConfig3; // bitcodiert
char Name[12];
unsigned char crc; // must be the last byte!
} paramset_t;
} paramset_t; // 127 bytes
 
#define PARAMSET_STRUCT_LEN sizeof(paramset_t)
 
/trunk/fc.c
787,7 → 787,28
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(SenderOkay > 140)
{
static unsigned int trigger = 0;
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
static unsigned int trigger = 0;
static unsigned char old_switch = 100;
if(EE_Parameter.StartLandChannel && EE_Parameter.LandingSpeed)
{
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;}
old_switch = 150;
}
else
if(PPM_in[EE_Parameter.StartLandChannel] < -50)
{
if(old_switch == 150) { FC_StatusFlags2 |= FC_STATUS2_AUTO_LANDING; SpeakHoTT = SPEAK_SINKING;}
old_switch = 50;
}
else
{
FC_StatusFlags2 &= ~(FC_STATUS2_AUTO_STARTING | FC_STATUS2_AUTO_LANDING);
}
}
#endif
FC_StatusFlags &= ~FC_STATUS_EMERGENCY_LANDING;
RcLostTimer = EE_Parameter.NotGasZeit * 50;
if(GasMischanteil > 40 && MotorenEin)
801,6 → 822,9
sollGier = 0;
Mess_Integral_Gier = 0;
FC_StatusFlags2 |= FC_STATUS2_WAIT_FOR_TAKEOFF;
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
old_switch = 100;
#endif
}
else
{
808,13 → 832,13
if(FC_StatusFlags2 & FC_STATUS2_WAIT_FOR_TAKEOFF)
{
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
if((NC_To_FC_Flags & NC_TO_FC_AUTOSTART) && (VarioCharacter == '=') && ACC_AltitudeControl)
if((NC_To_FC_Flags & NC_TO_FC_AUTOSTART || FC_StatusFlags2 & FC_STATUS2_AUTO_STARTING) && (VarioCharacter == '=') && ACC_AltitudeControl)
{
FromNC_AltitudeSpeed = 100;
FromNC_AltitudeSetpoint = 800;
SollHoehe = 800;
FromNC_AltitudeSpeed = 80;
FromNC_AltitudeSetpoint = 500;
SollHoehe = 500;
trigger = 1000;
SpeakHoTT = SPEAK_NEXT_WP;
if(NC_To_FC_Flags & NC_TO_FC_AUTOSTART) SpeakHoTT = SPEAK_NEXT_WP;
/* if(StartTrigger != 2)
{
StartTrigger = 1;
822,14 → 846,16
}
*/
}
// else FC_StatusFlags2 &= ~(FC_STATUS2_AUTO_STARTING);
#endif
if(HoehenWert > 150 || HoehenWert < -350 || !(Parameter_GlobalConfig & CFG_HOEHENREGELUNG))
if(HoehenWertF > 150 || HoehenWert < -350 || !(Parameter_GlobalConfig & CFG_HOEHENREGELUNG))
{
FC_StatusFlags2 &= ~FC_STATUS2_WAIT_FOR_TAKEOFF;
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
SpeakHoTT = SPEAK_RISING;
trigger = 1000;
if(FC_StatusFlags2 & FC_STATUS2_AUTO_STARTING) { FromNC_AltitudeSpeed = 0; SollHoehe = 300;/*HoehenWertF + 100;*/}
else SpeakHoTT = SPEAK_RISING;
#endif
FC_StatusFlags2 &= ~(FC_STATUS2_WAIT_FOR_TAKEOFF | FC_STATUS2_AUTO_STARTING | FC_STATUS2_AUTO_LANDING);
}
SummeNick = 0;
SummeRoll = 0;
840,6 → 866,11
else // Flying mode
{
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
if((FC_StatusFlags2 & FC_STATUS2_AUTO_LANDING) && (VarioCharacter == 'v' || VarioCharacter == '=') && ACC_AltitudeControl)
{
FromNC_AltitudeSpeed = EE_Parameter.LandingSpeed;
FromNC_AltitudeSetpoint = -20000;
}
if(trigger < 1000)
{
trigger++;
885,7 → 916,7
}
else
{
ParamSet_ReadFromEEProm(GetActiveParamSet());
ParamSet_ReadFromEEProm(ActiveParamSet);
LipoDetection(0);
LIBFC_ReceiverInit(EE_Parameter.Receiver);
if((Parameter_GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert?
/trunk/fc.h
27,6 → 27,8
#define FC_STATUS2_OUT1_ACTIVE 0x08
#define FC_STATUS2_OUT2_ACTIVE 0x10
#define FC_STATUS2_WAIT_FOR_TAKEOFF 0x20 // Motor Running, but still on the ground
#define FC_STATUS2_AUTO_STARTING 0x40
#define FC_STATUS2_AUTO_LANDING 0x80
 
//NC_To_FC_Flags
#define NC_TO_FC_FLYING_RANGE 0x01
/trunk/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="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="hottmenu.c"></File><File path="hottmenu.h"></File></Project>
/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
252,7 → 252,6
FlugMinutenGesamt = 0;
}
printf("\n\rFlight-time %u min Total:%u min", FlugMinuten, FlugMinutenGesamt);
 
LcdClear();
I2CTimeout = 5000;
WinkelOut.Orientation = 1;
264,6 → 263,8
timerPolling = SetDelay(250);
 
Debug(ANSI_CLEAR "FC-Start!\n\rFlugzeit: %d min", FlugMinutenGesamt); // Note: this won't waste flash memory, if #DEBUG is not active
//printf("\n\rEE_Parameter size:%i\n\r", PARAMSET_STRUCT_LEN);
 
DebugOut.Status[0] = 0x01 | 0x02;
JetiBeep = 0;
if(EE_Parameter.ExtraConfig & CFG_NO_RCOFF_BEEPING) DisableRcOffBeeping = 1;
/trunk/makefile
5,11 → 5,11
F_CPU = 20000000
#-------------------------------------------------------------------
VERSION_MAJOR = 0
VERSION_MINOR = 90
VERSION_PATCH = 9
VERSION_MINOR = 91
VERSION_PATCH = 0
VERSION_SERIAL_MAJOR = 11 # Serial Protocol
VERSION_SERIAL_MINOR = 0 # Serial Protocol
NC_SPI_COMPATIBLE = 53 # Navi-Kompatibilität
NC_SPI_COMPATIBLE = 54 # Navi-Kompatibilität
LIB_FC_COMPATIBLE = 2 # Library
#-------------------------------------------------------------------
# ATMEGA644: 63487 is maximum
/trunk/rc.c
58,8 → 58,8
#include "main.h"
// Achtung: ACT_S3D_SUMMENSIGNAL wird in der Main.h gesetzt
 
volatile int PPM_in[26];
volatile int PPM_diff[26]; // das diffenzierte Stick-Signal
volatile int PPM_in[26+4];
volatile int PPM_diff[26+4]; // das diffenzierte Stick-Signal
volatile char Channels,tmpChannels = 0;
volatile unsigned char NewPpmData = 1;
unsigned int PPM_Neutral = 466;
70,7 → 70,7
//############################################################################
{
unsigned char i;
for(i=0;i<26;i++)
for(i=0;i<sizeof(PPM_in);i++)
{
if(i < 5) PPM_in[i] = 0; else PPM_in[i] = -127;
PPM_diff[i] = 0;
106,7 → 106,7
}
else
{
if(index < 13)
if(index < 13+4)
{
if((signal > 250) && (signal < 687))
{
140,10 → 140,10
else
{
static unsigned int AltICR=0;
static int ppm_in[13];
static int ppm_diff[13];
static int old_ppm_in[13];
static int old_ppm_diff[13];
static int ppm_in[13+4];
static int ppm_diff[13+4];
static int old_ppm_in[13+4];
static int old_ppm_diff[13+4];
signed int signal = 0,tmp;
static unsigned char index, okay_cnt = 0;
signal = (unsigned int) ICR1 - AltICR;
157,7 → 157,7
if(okay_cnt > 10)
{
NewPpmData = 0; // Null bedeutet: Neue Daten
for(index = 0; index < 13; index++)
for(index = 0; index < 13+4; index++)
{
if(okay_cnt > 30)
{
180,7 → 180,7
}
else
{
if(index < 13)
if(index < 13+4)
{
if((signal > 250) && (signal < 687))
{
221,7 → 221,7
unsigned char i;
ROT_ON;
index = 30;
for(i=0;i<13;i++) // restore from older data
for(i=0;i<13+4;i++) // restore from older data
{
PPM_in[i] = old_ppm_in[i];
PPM_diff[i] = 0;
/trunk/rc.h
13,15 → 13,22
#define TIMER_RELOAD_VALUE 250
#endif
 
#define GAS PPM_in[2]
#define FromNC_WP_EventChannel PPM_in[25] // WP_EVENT-Channel-Value
 
extern void rc_sum_init (void);
 
extern volatile int PPM_in[26];
extern volatile int PPM_diff[26]; // das diffenzierte Stick-Signal
extern volatile int PPM_in[26+4];
extern volatile int PPM_diff[26+4]; // das diffenzierte Stick-Signal
extern volatile unsigned char NewPpmData;
extern volatile char Channels,tmpChannels;
extern unsigned int PPM_Neutral;
 
// 0 -> frei bzw. ACT rssi
// 1 - 16 -> 1-16
// 17 - 28 -> 12 Serial channels
// 29 -> WP-Event kanal
 
#define SERIAL_POTI_START 17
#define WP_EVENT_PPM_IN 29
 
#define FromNC_WP_EventChannel PPM_in[WP_EVENT_PPM_IN] // WP_EVENT-Channel-Value
 
#endif //_RC_H
/trunk/spi.c
237,6 → 237,7
#else
ToNaviCtrl.Param.Byte[1] = 0;
#endif
ToNaviCtrl.Param.Byte[2] = EE_Parameter.LandingSpeed;
break;
case SPI_FCCMD_STICK:
cli();
370,7 → 371,7
GPSInfo.Speed = FromNaviCtrl.Param.Byte[3];
GPSInfo.HomeDistance = FromNaviCtrl.Param.Int[2];
GPSInfo.HomeBearing = FromNaviCtrl.Param.sInt[3];
PPM_in[25] = (signed char) FromNaviCtrl.Param.Byte[8]; // WP_EVENT-Channel-Value (FromNC_WP_EventChannel)
PPM_in[WP_EVENT_PPM_IN] = (signed char) FromNaviCtrl.Param.Byte[8]; // WP_EVENT-Channel-Value (FromNC_WP_EventChannel)
FromNC_AltitudeSpeed = FromNaviCtrl.Param.Byte[9];
FromNC_AltitudeSetpoint = (long) FromNaviCtrl.Param.sInt[5] * 10; // in cm
break;
/trunk/uart.c
64,8 → 64,8
#define BL_CTRL_ADDRESS 5
 
#define ABO_TIMEOUT 4000 // disable abo after 4 seconds
#define MAX_SENDE_BUFF 175
#define MAX_EMPFANGS_BUFF 175
#define MAX_SENDE_BUFF 220
#define MAX_EMPFANGS_BUFF 220
 
#define BLPARAM_REVISION 1
#define MASK_SET_PWM_SCALING 0x01
206,7 → 206,6
wdt_enable(WDTO_250MS); // Reset-Commando
ServoActive = 0;
}
 
}
}
else
244,6 → 243,7
{
tmpCRC += TxdBuffer[i];
}
// if(i > MAX_SENDE_BUFF - 3) tmpCRC += 11;
tmpCRC %= 4096;
TxdBuffer[i++] = '=' + tmpCRC / 64;
TxdBuffer[i++] = '=' + tmpCRC % 64;
250,10 → 250,10
TxdBuffer[i++] = '\r';
UebertragungAbgeschlossen = 0;
UDR0 = TxdBuffer[0];
//if(DebugOut.Analog[] < i) DebugOut.Analog[] = i;
}
 
 
 
// --------------------------------------------------------------------------
void SendOutData(unsigned char cmd,unsigned char address, unsigned char BufferAnzahl, ...) //unsigned char *snd, unsigned char len)
{
410,6 → 410,7
 
case 'q':// "Get"-Anforderung für Settings
// Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen
if(MotorenEin) break;
if((10 <= pRxData[0]) && (pRxData[0] < 20))
{
tempchar1 = pRxData[0] - 10;
439,7 → 440,6
while(!UebertragungAbgeschlossen);
SendOutData('Q', FC_ADDRESS, 2, &tempchar1, sizeof(tempchar1), (unsigned char *) &EE_Parameter, sizeof(EE_Parameter) - 1);
Debug("Lese Setting %d", tempchar1);
 
break;
 
case 's': // Parametersatz speichern
462,20 → 462,18
LIBFC_ReceiverInit(EE_Parameter.Receiver);
break;
case 'f': // auf anderen Parametersatz umschalten
if(MotorenEin) break;
if((1 <= pRxData[0]) && (pRxData[0] <= 5)) ParamSet_ReadFromEEProm(pRxData[0]);
tempchar1 = GetActiveParamSet();
while(!UebertragungAbgeschlossen);
SendOutData('F', FC_ADDRESS, 1, &tempchar1, sizeof(tempchar1));
if(!MotorenEin) Piep(tempchar1,110);
Piep(tempchar1,110);
LipoDetection(0);
LIBFC_ReceiverInit(EE_Parameter.Receiver);
break;
case 'y':// serial Potis
PPM_in[13] = (signed char) pRxData[0]; PPM_in[14] = (signed char) pRxData[1]; PPM_in[15] = (signed char) pRxData[2]; PPM_in[16] = (signed char) pRxData[3];
PPM_in[17] = (signed char) pRxData[4]; PPM_in[18] = (signed char) pRxData[5]; PPM_in[19] = (signed char) pRxData[6]; PPM_in[20] = (signed char) pRxData[7];
PPM_in[21] = (signed char) pRxData[8]; PPM_in[22] = (signed char) pRxData[9]; PPM_in[23] = (signed char) pRxData[10]; PPM_in[24] = (signed char) pRxData[11];
for(tempchar1 = 0; tempchar1 < 12; tempchar1++) PPM_in[SERIAL_POTI_START + tempchar1] = (signed char) pRxData[tempchar1];
break;
 
case 'u': // request BL parameter
Debug("Reading BL %d", pRxData[0]);
// try to read BL configuration
485,7 → 483,6
while(!UebertragungAbgeschlossen); // wait for previous frame to be sent
SendOutData('U', FC_ADDRESS, 4, &tempchar1, sizeof(tempchar1), &tempchar2, sizeof(tempchar2), &pRxData[0], 1, &BLConfig, sizeof(BLConfig_t));
break;
 
case 'w': // write BL parameter
Debug("Writing BL %d", pRxData[0]);
if(RxDataLen >= 1+sizeof(BLConfig_t))
/trunk/version.txt
589,8 → 589,13
- 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.90k
- Auto-Start/Landung
- StickNeutral setting per default auf 127
0.91a
- Auto-Start/Landing
- StickNeutral setting per default 127
- UART-Buffer increased from 175 to 220 Bytes
- no. of channels increased from 12 to 16
// 0 -> frei bzw. ACT rssi
// 1 - 16 -> 1-16
// 17 - 28 -> 12 Serial channels
// 29 -> WP-Event kanal