/trunk/GPS.h |
---|
8,7 → 8,7 |
{ |
s16 Nick; |
s16 Roll; |
s16 Yaw; |
// s16 Yaw; |
} __attribute__((packed)) GPS_Stick_t; |
#define CAM_UPDATE_AZIMUTH 0x01 |
/trunk/LICENSE.TXT |
---|
52,4 → 52,4 |
// + *) The territory aspect only refers to the place where the Software is used, not its programmed range. |
// + #### END OF LICENSING TERMS #### |
// + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
/trunk/gpx.c |
---|
336,6 → 336,20 |
fputs_(string, doc->file); |
break; |
case 2: |
// Flight duration |
sprintf(string, "<FlightTime>%d</FlightTime>\r\n", NaviData.FlyingTime); |
fputs_(string, doc->file); |
// Status of the complete MikroKopter |
sprintf(string, "<ErrorCode>%03d</ErrorCode>\r\n",ErrorCode); |
fputs_(string, doc->file); |
// Flags |
sprintf(string, "<FCFlags2>0x%02x,0x%02x</FCFlags2>\r\n",Logging_FCStatusFlags1,Logging_FCStatusFlags2); |
fputs_(string, doc->file); |
Logging_FCStatusFlags1 = 0; |
Logging_FCStatusFlags2 = 0; |
// NC Mode (contains the status) |
sprintf(string, "<NCFlag>0x%02X</NCFlag>\r\n", NCFlags); |
fputs_(string, doc->file); |
// Altimeter according to air pressure |
sprintf(string, "<Altimeter>%d,'%c'</Altimeter>\r\n", NaviData.Altimeter,FromFC_VarioCharacter); |
fputs_(string, doc->file); |
342,19 → 356,6 |
// Variometer according to air pressure |
sprintf(string, "<Variometer>%d</Variometer>\r\n", NaviData.Variometer); |
fputs_(string, doc->file); |
// Course in deg |
i16_1 = GPSData.Heading/100000L; |
sprintf(string, "<Course>%03d</Course>\r\n", i16_1); |
fputs_(string, doc->file); |
// Ground Speed in cm/s |
sprintf(string, "<GroundSpeed>%d</GroundSpeed>\r\n", NaviData.GroundSpeed); |
fputs_(string, doc->file); |
// Vertical Speed in cm/s |
sprintf(string, "<VerticalSpeed>%d</VerticalSpeed>\r\n", NaviData.TopSpeed); |
fputs_(string, doc->file); |
// Flight duration |
sprintf(string, "<FlightTime>%d</FlightTime>\r\n", NaviData.FlyingTime); |
fputs_(string, doc->file); |
break; |
case 3: |
// Ubat |
370,21 → 371,23 |
// Capacity |
sprintf(string, "<Capacity>%d</Capacity>\r\n", NaviData.UsedCapacity); |
fputs_(string, doc->file); |
// RC Quality |
sprintf(string, "<RCQuality>%d</RCQuality>\r\n", FC.RC_Quality); |
fputs_(string, doc->file); |
// RC Received Signal Strength Indication |
break; |
case 4: |
if(FC.RC_RSSI) |
/* if(FC.RC_RSSI) |
{ |
sprintf(string, "<RCRSSI>%d</RCRSSI>\r\n", FC.RC_RSSI); |
fputs_(string, doc->file); |
} |
// Compassind deg |
*/ // Compassind deg |
i16_1 = FromFlightCtrl.GyroHeading / 10; |
sprintf(string, "<Compass>%03d,%03d</Compass>\r\n", i16_1,ToFlightCtrl.CompassHeading); |
fputs_(string, doc->file); |
// magnetic field |
sprintf(string, "<MagnetField>%03d</MagnetField>\r\n",(u16) (EarthMagneticFieldFiltered/5)); |
fputs_(string, doc->file); |
// magnetic inclination & error |
sprintf(string, "<MagnetInclination>%02d,%02d</MagnetInclination>\r\n",(s16)EarthMagneticInclinationFiltered/10,(s16)(EarthMagneticInclinationFiltered/10 - EarthMagneticInclinationTheoretic)); |
fputs_(string, doc->file); |
// Nick Angle ind deg |
sprintf(string, "<NickAngle>%03d</NickAngle>\r\n", NaviData.AngleNick); |
fputs_(string, doc->file); |
393,12 → 396,6 |
fputs_(string, doc->file); |
break; |
case 5: |
// magnetic field |
sprintf(string, "<MagnetField>%03d</MagnetField>\r\n",(u16) (EarthMagneticFieldFiltered/5)); |
fputs_(string, doc->file); |
// magnetic inclination & error |
sprintf(string, "<MagnetInclination>%02d,%02d</MagnetInclination>\r\n",(s16)EarthMagneticInclinationFiltered/10,(s16)(EarthMagneticInclinationFiltered/10 - EarthMagneticInclinationTheoretic)); |
fputs_(string, doc->file); |
// BL Information |
sprintf(string, "<MotorCurrent>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</MotorCurrent>\r\n",Motor[0].Current,Motor[1].Current,Motor[2].Current,Motor[3].Current,Motor[4].Current,Motor[5].Current,Motor[6].Current,Motor[7].Current,Motor[8].Current,Motor[9].Current,Motor[10].Current,Motor[11].Current); |
fputs_(string, doc->file); |
414,12 → 411,11 |
fputs_(string, doc->file); |
sprintf(string, "<FC_I2C_ErrorCounter>%03d</FC_I2C_ErrorCounter>\r\n",(s16)FC_I2C_ErrorConter); |
fputs_(string, doc->file); |
sprintf(string, "<FC_SPI_ErrorCounter>%03d</FC_SPI_ErrorCounter>\r\n",(s16)DebugOut.Analog[12]); |
fputs_(string, doc->file); |
// Analog inputs of the NC |
sprintf(string, "<AnalogInputs>%d,%d,%d,%d</AnalogInputs>\r\n",AnalogData.Ch4,AnalogData.Ch5,AnalogData.Ch6,AnalogData.Ch7); |
fputs_(string, doc->file); |
// NC Mode (contains the status) |
sprintf(string, "<NCFlag>0x%02X</NCFlag>\r\n", NCFlags); |
fputs_(string, doc->file); |
sprintf(string, "<Servo>%d,%d,%d</Servo>\r\n", ServoParams.NickControl,ServoParams.RollControl,POI_KameraNick/10); // Raw Poti-Values of the Servo control and the POI_Nick in 1° |
fputs_(string, doc->file); |
436,14 → 432,6 |
fputs_(string, doc->file); |
break; |
case 7: |
// Flags |
sprintf(string, "<FCFlags2>0x%02x,0x%02x</FCFlags2>\r\n",Logging_FCStatusFlags1,Logging_FCStatusFlags2); |
fputs_(string, doc->file); |
Logging_FCStatusFlags1 = 0; |
Logging_FCStatusFlags2 = 0; |
// Status of the complete MikroKopter |
sprintf(string, "<ErrorCode>%03d</ErrorCode>\r\n",ErrorCode); |
fputs_(string, doc->file); |
// Target Bearing in deg |
sprintf(string, "<TargetBearing>%03d</TargetBearing>\r\n", NaviData.TargetPositionDeviation.Bearing); |
fputs_(string, doc->file); |
450,6 → 438,16 |
// Target Distance in dm |
sprintf(string, "<TargetDistance>%d</TargetDistance>\r\n", NaviData.TargetPositionDeviation.Distance); |
fputs_(string, doc->file); |
// Course in deg |
i16_1 = GPSData.Heading/100000L; |
sprintf(string, "<Course>%03d</Course>\r\n", i16_1); |
fputs_(string, doc->file); |
// Ground Speed in cm/s |
sprintf(string, "<GroundSpeed>%d</GroundSpeed>\r\n", NaviData.GroundSpeed); |
fputs_(string, doc->file); |
// Vertical Speed in cm/s |
sprintf(string, "<VerticalSpeed>%d</VerticalSpeed>\r\n", NaviData.TopSpeed); |
fputs_(string, doc->file); |
break; |
case 8: |
// RC Sticks as Nick/Roll/Yaw |
456,8 → 454,12 |
sprintf(string, "<RCSticks>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</RCSticks>\r\n", FC.StickNick,FC.StickRoll, FC.StickYaw, FC.StickGas,FC.Poti[0],FC.Poti[1],FC.Poti[2],FC.Poti[3],FC.Poti[4],FC.Poti[5],FC.Poti[6],FC.Poti[7]); |
fputs_(string, doc->file); |
// GPS Sticks as Nick/Roll/Yaw |
sprintf(string, "<GPSSticks>%d,%d,%d,'%c'</GPSSticks>\r\n", ToFlightCtrl.GPSStick.Nick, ToFlightCtrl.GPSStick.Roll, ToFlightCtrl.GPSStick.Yaw,NC_GPS_ModeCharacter); |
sprintf(string, "<GPSSticks>%d,%d,%d,'%c'</GPSSticks>\r\n", ToFlightCtrl.GPSStick.Nick, ToFlightCtrl.GPSStick.Roll, 0 ,NC_GPS_ModeCharacter); |
fputs_(string, doc->file); |
// RC Quality |
sprintf(string, "<RCQuality>%d</RCQuality>\r\n", FC.RC_Quality); |
fputs_(string, doc->file); |
// RC Received Signal Strength Indication |
// eof extensions |
sprintf(string, "</extensions>\r\n"); |
fputs_(string, doc->file); |
/trunk/main.h |
---|
39,7 → 39,7 |
#define VERSION_SERIAL_MINOR 0 |
#ifndef FOLLOW_ME |
#define FC_SPI_COMPATIBLE 51 |
#define FC_SPI_COMPATIBLE 52 |
#else |
#define FC_SPI_COMPATIBLE 0xFF |
#endif |
173,6 → 173,7 |
u8 ExtraConfig; |
u8 ComingHomeAltitude; |
u8 GlobalConfig3; |
u8 NaviOut1Parameter; // Distance between Photo releases |
} __attribute__((packed)) Param_t; |
typedef struct |
/trunk/ncmag.c |
---|
733,7 → 733,7 |
void NCMAG_Update(void) |
{ |
static u32 TimerUpdate = 0; |
static u8 send_config = 0; |
static s8 send_config = 0; |
u32 delay = 20; |
if( (I2C_State == I2C_STATE_OFF) || !NCMAG_Present ) |
747,9 → 747,9 |
if(Compass_Heading != -1) send_config = 0; // no re-configuration if value is valid |
if(++send_config == 25) // 500ms |
{ |
send_config = 0; |
send_config = -25; // next try after 1 second |
InitNC_MagnetSensor(); |
TimerUpdate = SetDelay(15); // back into the old time-slot |
TimerUpdate = SetDelay(20); // back into the old time-slot |
} |
else |
{ |
775,7 → 775,7 |
*/ |
break; |
} |
if(send_config == 24) TimerUpdate = SetDelay(5); // next event is the re-configuration |
if(send_config == 24) TimerUpdate = SetDelay(15); // next event is the re-configuration |
else TimerUpdate = SetDelay(delay); // every 20 ms are 50 Hz |
} |
} |
/trunk/spi_slave.c |
---|
103,7 → 103,7 |
s32 ToFcGpsZ = 0; |
u8 CompassCalState = 0; |
u8 SPI_CommandSequence[] = { SPI_NCCMD_VERSION, SPI_NCCMD_KALMAN, SPI_NCCMD_GPSINFO ,SPI_NCCMD_KALMAN, SPI_NCCMD_HOTT_INFO, SPI_NCCMD_KALMAN, SPI_MISC, SPI_NCCMD_KALMAN }; |
u8 SPI_CommandSequence[] = { SPI_NCCMD_KALMAN, SPI_NCCMD_GPSINFO ,SPI_NCCMD_KALMAN, SPI_NCCMD_HOTT_INFO, SPI_NCCMD_KALMAN, SPI_MISC, SPI_NCCMD_KALMAN, SPI_NCCMD_VERSION }; |
u8 SPI_CommandCounter = 0; |
s32 ToFC_Rotate_C = 64, ToFC_Rotate_S = 0; |
s32 HeadFreeStartAngle = 0; |
270,7 → 270,7 |
ToFlightCtrl.GPSStick.Nick = 0; |
ToFlightCtrl.GPSStick.Roll = 0; |
ToFlightCtrl.GPSStick.Yaw = 0; |
// ToFlightCtrl.GPSStick.Yaw = 0; |
VIC_Config(SSP0_ITLine, VIC_IRQ, PRIORITY_SPI0); |
VIC_ITCmd(SSP0_ITLine, ENABLE); |
285,7 → 285,7 |
void SPI0_UpdateBuffer(void) |
{ |
static u32 timeout = 0; |
static u8 counter = 50,hott_index = 0; |
static u8 counter = 50,hott_index = 0, last_error_code = 0; |
s16 tmp; |
s32 i1,i2; |
297,15 → 297,18 |
ToFlightCtrl.CompassHeading = Compass_Heading; |
DebugOut.Analog[10] = ToFlightCtrl.CompassHeading; |
if(ToFlightCtrl.CompassHeading >= 0) ToFlightCtrl.CompassHeading = (360 + ToFlightCtrl.CompassHeading + FromFlightCtrl.GyroYaw / 12) % 360; |
// ToFlightCtrl.MagVecX = MagVector.X; |
// ToFlightCtrl.MagVecY = MagVector.Y; |
ToFlightCtrl.MagVecX = MagVector.X; |
ToFlightCtrl.MagVecY = MagVector.Y; |
ToFlightCtrl.MagVecZ = MagVector.Z; |
ToFlightCtrl.NCStatus = 0; |
// ToFlightCtrl.NCStatus = 0; |
// cycle spi commands |
ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++]; |
if(ErrorCode != last_error_code) ToFlightCtrl.Command = SPI_NCCMD_VERSION; |
else ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++]; |
// restart command cycle at the end |
if(SPI_CommandCounter >= sizeof(SPI_CommandSequence)) SPI_CommandCounter = 0; |
last_error_code = ErrorCode; |
#define FLAG_GPS_AID 0x01 |
switch (ToFlightCtrl.Command) |
{ |
364,11 → 367,10 |
ToFlightCtrl.Param.Byte[1] = EarthMagneticInclination; |
ToFlightCtrl.Param.Byte[2] = EarthMagneticInclinationTheoretic; |
ToFlightCtrl.Param.Byte[3] = SpeakHoTT; |
ToFlightCtrl.Param.Byte[4] = 0; |
ToFlightCtrl.Param.Byte[5] = 0; |
ToFlightCtrl.Param.Byte[6] = 0; |
ToFlightCtrl.Param.Byte[7] = 0; |
ToFlightCtrl.Param.Byte[8] = 0; |
ToFlightCtrl.Param.Byte[4] = NaviData.WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1 |
ToFlightCtrl.Param.Byte[5] = NaviData.WaypointNumber; // number of stored waypoints |
ToFlightCtrl.Param.Int[3] = NaviData.TargetPositionDeviation.Distance / 10; |
ToFlightCtrl.Param.Byte[8] = NaviData.TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached |
ToFlightCtrl.Param.Byte[9] = 0; |
ToFlightCtrl.Param.Byte[10] = 0; |
ToFlightCtrl.Param.Byte[11] = 0; |
385,6 → 387,7 |
ToFlightCtrl.Param.sInt[3] = NaviData.HomePositionDeviation.Bearing; // deg //6&7 |
if(FC_WP_EventChannel > 254) FC_WP_EventChannel = 254; |
ToFlightCtrl.Param.Byte[8] = (s8)(FC_WP_EventChannel - 127); |
FC_WP_EventChannel = 0; // the GPS-Routine will set it again |
if(NCRARAM_STATE_VALID == NCParams_GetValue(NCPARAMS_ALTITUDE_RATE, &tmp)) |
{ |
ToFlightCtrl.Param.Byte[9] = (u8)tmp; |
582,7 → 585,9 |
CHK_POTI_MM(Parameter.NaviAccCompensation,FromFlightCtrl.Param.Byte[10],0,255); |
CHK_POTI_MM(Parameter.NaviAngleLimitation,FromFlightCtrl.Param.Byte[11],0,255); |
break; |
case SPI_FCCMD_PARAMETER2: |
CHK_POTI_MM(Parameter.NaviOut1Parameter,FromFlightCtrl.Param.Byte[0],0,255); |
break; |
case SPI_FCCMD_STICK: |
FC.StickGas = FromFlightCtrl.Param.sByte[0]; |
FC.StickYaw = FromFlightCtrl.Param.sByte[1]; |
634,6 → 639,7 |
ServoParams.RollMin = FromFlightCtrl.Param.Byte[8]; |
ServoParams.RollMax = FromFlightCtrl.Param.Byte[9]; |
BL_MinOfMaxPWM = FromFlightCtrl.Param.Byte[10]; |
FC_I2C_ErrorConter = FromFlightCtrl.Param.Byte[11]; |
break; |
case SPI_FCCMD_VERSION: |
682,6 → 688,7 |
if(Parameter.User8 < 150) FC.StatusFlags = FC_STATUS_START; |
else FC.StatusFlags = FC_STATUS_FLY | FC_STATUS_MOTOR_RUN; |
BL_MinOfMaxPWM = 255; |
NaviData.FCStatusFlags = FC.StatusFlags; |
*/ |
//+++++++++++++++++++++++++++++++++++++++++++++++++++ |
/trunk/spi_slave.h |
---|
27,6 → 27,7 |
#define SPI_FCCMD_VERSION 14 |
#define SPI_FCCMD_SERVOS 15 |
#define SPI_FCCMD_ACCU 16 |
#define SPI_FCCMD_PARAMETER2 17 |
extern s32 Kalman_K; |
extern s32 Kalman_Kompass ; |
100,11 → 101,12 |
{ |
u8 Command; |
GPS_Stick_t GPSStick; |
s16 MagVecX; |
s16 CompassHeading; |
s16 AccErrorN; // s16 MagVecX; |
s16 AccErrorR; // s16 MagVecY; |
s16 AccErrorN; |
s16 AccErrorR; |
s16 MagVecY; |
s16 MagVecZ; |
s16 NCStatus; |
u16 BeepTime; |
union |
{ |
/trunk/uart1.c |
---|
149,14 → 149,14 |
"GPS Data ", |
"CompassHeading ", //10 |
"GyroHeading ", |
"SPI Error ", |
"SPI Error ", // achtung: muss auf 12 bleiben |
"SPI Okay ", |
"I2C Error ", |
"I2C Okay ", //15 |
"16 ", |
"17 ", |
"18 ", |
"19 ", // SD-Card-time |
"17 MaxShiftSpeed", |
"18 shiftspeed ", |
"19 Gps speed ", // SD-Card-time |
"EarthMagnet [%] ", //20 |
"Z_Speed ", |
"N_Speed ", |