Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 863 → Rev 864

/trunk/CamCtrl.c
20,9 → 20,10
ToGimbalCtrl_t ToGimbalCtrl;
 
s32 FromMenuGimbalYaw = 0,FromMenuServoNickControl = 0, MenuNickGimbalOffset = 0;
u16 CamCtrlTimeout = 25000;
u16 CamCtrlTimeout = 31000;
u16 LaserCtrlTimeout = 5000;
u16 GimbalCtrlTimeout = 8000;
u16 I2C0_Timeout = 0;
u8 ResetNickServoValue = 1;
 
void InitCamCtrl(void)
74,7 → 75,8
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++
 
if(FromCamCtrl.CamStatus & CAM_STATE_I2C_OK) CamCtrlTimeout = 9000;
if(FromCamCtrl.CamStatus & CAM_STATE_I2C_OK) CamCtrlTimeout = 19000;
I2C0_Timeout = 31000;
}
 
void CamCtrl_GetData(u8 timeout)
144,6 → 146,7
DebugOut.Analog[13] = FromLaserCtrl.Distance;
if((FromLaserCtrl.LaserStatus & LASER_DATA_OK) && (FromLaserCtrl.Distance == 0)) FromLaserCtrl.Distance = 1; // just to mark that the value is active (0 -> not connected)
LaserCtrlTimeout = 30000;
I2C0_Timeout = 31000;
}
 
 
176,13 → 179,13
{ // if crc is ok and number of byte are matching
memcpy((u8 *)&FromGimbalCtrl, pRxBuffer, sizeof(FromGimbalCtrl));
GimbalCtrlTimeout = 30000;
//DebugOut.Analog[]++;
I2C0_Timeout = 31000;
}
 
 
void GimbalCtrl_GetData(u8 timeout)
{
static u32 timing = 3000;
static u32 timing = 500;
static s16 old_nick;
s16 tmp, NickGimbal;
#define GIMBAL_DATARATE 66 // 66ms = 15Hz bzw. 30Hz
/trunk/CamCtrl.h
130,6 → 130,7
extern u16 CamCtrlTimeout;
extern u16 LaserCtrlTimeout;
extern u16 GimbalCtrlTimeout;
extern u16 I2C0_Timeout;
extern u8 ResetNickServoValue;
extern void CamCtrl_UpdateData(u8* pRxBuffer, u8 RxBufferSize);
extern void LaserCtrl_UpdateData(u8* pRxBuffer, u8 RxBufferSize);
/trunk/ftphelper.c
79,7 → 79,7
 
char FTP_data[DATA_TRANSFER_SIZE+10]; // rx & tx buffer to avoid 2 buffers
 
#define KEYWORD_COUNT 52
#define KEYWORD_COUNT 54
// most used gpx tags can be compressed
const char keyword[KEYWORD_COUNT][16]=
{"Altimeter>\0 \0",
127,6 → 127,8
"ShutterCnt>\0 \0",
"ele_raw>\0 \0",
"GPSInfo>\0 \0",
"Gimbal>\0 \0",
"Laser>\0 \0",
"<WP>----,0,0,0<\0",
"MagnetInclinati\0",
"BL_Temperature>\0",
133,7 → 135,7
"AvaiableMotorPo\0",
"FC_I2C_ErrorCou\0",
"FC_SPI_ErrorCou\0",
"TargetDistance>\0"
"TargetDistance>\0",
};
//ACHTUNG: ggf. DATA_TRANSFER_SIZE vergrössern
 
/trunk/gpx.c
217,6 → 217,8
if(Parameter.Driftkomp) {sprintf(string, "<DriftComp>%i</DriftComp>\r\n",Parameter.Driftkomp);CheckSumAndWrite(&Check16File,string, doc->file);};
sprintf(string, "<BaroKompens.>%i</BaroKompens.>\r\n",LuftdruckTemperaturKompensation);CheckSumAndWrite(&Check16File,string, doc->file);
sprintf(string, "<FcTemperat.>%i.%1i</FcTemperat.>\r\n",FC_Temperatur/10,abs(FC_Temperatur)%10);CheckSumAndWrite(&Check16File,string, doc->file);
if(FromGimbalCtrl.GimbalStatus) {sprintf(string, "<GimbalCtrV>%i.%02i</GimbalCtrV>\r\n",1 + FromGimbalCtrl.Version / 100, FromGimbalCtrl.Version % 100);CheckSumAndWrite(&Check16File,string, doc->file);}
 
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Magnetometer
if(Compass_I2CPort == NCMAG_PORT_EXTERN) sprintf(string, "<MagSensor>external2,(%i),",NCMAG_Orientation);
723,6 → 725,12
CheckSumAndWrite(&Check16Block,string, doc->file);
}
 
if(FromGimbalCtrl.GimbalStatus)
{
sprintf(string, "<Gimbal>%d.%01d,%d.%01d</Gimbal>\r\n",FromGimbalCtrl.Nick/10,abs(FromGimbalCtrl.Nick%10),FromGimbalCtrl.Roll/10,abs(FromGimbalCtrl.Roll%10));
CheckSumAndWrite(&Check16Block,string, doc->file);
}
 
// sprintf(string, "<FCTemperat>%d</FCTemperat>\r\n",FC_Temperatur);
// CheckSumAndWrite(&Check16Block,string, doc->file);
 
/trunk/main.c
534,7 → 534,6
if(CountMilliseconds != old_ms) // 1 ms
{
if(!t20ms--) { CalcNickServoValue(); t20ms = 20; };
 
if(UART1_BaudrateFallbackTimeout)
{
if(--UART1_BaudrateFallbackTimeout == 0) UART1_Configure(Uart1Baudrate);
541,10 → 540,14
}
 
if(CanbusTimeOut >= 2) CanbusTimeOut--;
if(I2C0_Timeout)
{
I2C0_Timeout--;
if((I2C0_Timeout % 5000) == 0) I2CBus_StateReset(I2C0); // reset the I2C-Bus every 5 seconds
}
if(LaserCtrlTimeout)
{
LaserCtrlTimeout--;
if((LaserCtrlTimeout == 27000) || (LaserCtrlTimeout == 11000) || (LaserCtrlTimeout == 21000)) I2CBus_StateReset(I2C0);
}
else
{
555,7 → 558,6
if(GimbalCtrlTimeout)
{
GimbalCtrlTimeout--;
if((GimbalCtrlTimeout == 28000) || (GimbalCtrlTimeout == 10000) || (GimbalCtrlTimeout == 20000)) I2CBus_StateReset(I2C0);
}
else
{
568,8 → 570,7
if(CamCtrlTimeout)
{
if(--CamCtrlTimeout == 1) CamCtrlCharacter = '?';
else if(CamCtrlTimeout == 10000) CamCtrlTimeout = 0; // this is used during NC startup-Time phase
if((CamCtrlTimeout == 7000) || (CamCtrlTimeout == 1000)) I2CBus_StateReset(I2C0);
else if(CamCtrlTimeout == 20000) CamCtrlTimeout = 0; // this is used during NC startup-Time phase
}
else
{
874,31 → 875,22
}
 
// +++++++++++++++++++++++++++++++++++++++
// ++ check CamCtrl version (if connected)
// ++ check xxCtrl version (if connected)
// +++++++++++++++++++++++++++++++++++++++
if(Compass_I2CPort == NCMAG_PORT_INTERN)
{
if(I2CBus_LockBuffer(I2C0,3)) I2CBus_Transmission(I2C0, CAM_SLAVE_ADDRESS, &ToCamCtrl, 4, &CamCtrl_UpdateData, sizeof(FromCamCtrl));
if(I2CBus_LockBuffer(I2C0,6)) I2CBus_Transmission(I2C0, GIMBAL_SLAVE_ADDRESS, &ToGimbalCtrl, 4, &GimbalCtrl_UpdateData, sizeof(FromGimbalCtrl));
if(I2CBus_LockBuffer(I2C0,6)) I2CBus_Transmission(I2C0, LASER_SLAVE_ADDRESS, &ToLaserCtrl, 3, &LaserCtrl_UpdateData, sizeof(FromLaserCtrl));
}
else CamCtrlTimeout = 0; // disable CamCtrl communication if external compass is connected
// +++++++++++++++++++++++++++++++++++++++
 
// +++++++++++++++++++++++++++++++++++++++
// ++ check LaserCtrl version (if connected)
if(Compass_I2CPort == NCMAG_PORT_INTERN)
else
{
if(I2CBus_LockBuffer(I2C0,3)) I2CBus_Transmission(I2C0, LASER_SLAVE_ADDRESS, &ToLaserCtrl, 4, &LaserCtrl_UpdateData, sizeof(FromLaserCtrl));
CamCtrlTimeout = 0; // disable CamCtrl communication if external compass is connected
GimbalCtrlTimeout = 0; // disable CamCtrl communication if external compass is connected
LaserCtrlTimeout = 0; // disable CamCtrl communication if external compass is connected
}
else LaserCtrlTimeout = 0; // disable CamCtrl communication if external compass is connected
// +++++++++++++++++++++++++++++++++++++++
 
// +++++++++++++++++++++++++++++++++++++++
// ++ check GimbalCtrl version (if connected)
if(Compass_I2CPort == NCMAG_PORT_INTERN)
{
if(I2CBus_LockBuffer(I2C0,3)) I2CBus_Transmission(I2C0, GIMBAL_SLAVE_ADDRESS, &ToGimbalCtrl, 4, &GimbalCtrl_UpdateData, sizeof(FromGimbalCtrl));
}
else GimbalCtrlTimeout = 0; // disable CamCtrl communication if external compass is connected
// +++++++++++++++++++++++++++++++++++++++
GPS_Init();
 
// ---------- Prepare the isr driven
/trunk/main.h
14,7 → 14,7
 
#define VERSION_MAJOR 2
#define VERSION_MINOR 20
#define VERSION_PATCH 1
#define VERSION_PATCH 2
// 0 = A
// 1 = B
// 2 = C
37,7 → 37,7
 
#define CAN_SLAVE_COMPATIBLE 2
#ifndef FOLLOW_ME
#define FC_SPI_COMPATIBLE 90 // <------------------
#define FC_SPI_COMPATIBLE 91 // <------------------
#else
#define FC_SPI_COMPATIBLE 0xFF
#endif
/trunk/menu.c
81,7 → 81,7
 
 
u8 MenuItem = 0;
u8 MaxMenuItem = 33;
u8 MaxMenuItem = 34;
 
void Menu_Putchar(char c)
{
375,17 → 375,42
LCD_printfxy(0,2,"Gs:%4i Ya:%4i ",FC.StickGas, FC.StickYaw);
LCD_printfxy(0,3,"RC-Level: %3i", FC.RC_Quality); // Remote Control Level from FC
break;
case 12: // RC poti controls from FC
case 12: // RC stick controls from FC
LCD_printfxy(0,0,"Ext.-Ctrl" );
 
if(!EE_Parameter.ExternalControl)
{
LCD_printfxy(0,2,"not used" );
}
else
if(FC.Poti[255 - EE_Parameter.ExternalControl] < 128)
{
LCD_printfxy(0,2,"Switch is off");
}
else
{
if(FromFC_ExternalCtrlCfg)
{
LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",ExternControl.Nick, ExternControl.Roll);
LCD_printfxy(0,2,"Gs:%4i Ya:%4i ",ExternControl.Gas, ExternControl.Gier);
LCD_printfxy(0,3,"C:%02x SW:%02x,",ExternControl.Config,ExternControl.Switches);
}
else
LCD_printfxy(0,2,"No Data");
}
break;
 
case 13: // RC poti controls from FC
LCD_printfxy(0,0,"RC-Potis 1" );
LCD_printfxy(0,1,"Po1:%3i Po2:%3i ",FC.Poti[0], FC.Poti[1]);
LCD_printfxy(0,2,"Po3:%3i Po4:%3i ",FC.Poti[2], FC.Poti[3]);
break;
case 13: // RC poti controls from FC
case 14: // RC poti controls from FC
LCD_printfxy(0,0,"RC-Potis 2" );
LCD_printfxy(0,1,"Po5:%3i Po6:%3i ",FC.Poti[4], FC.Poti[5]);
LCD_printfxy(0,2,"Po7:%3i Po8:%3i ",FC.Poti[6], FC.Poti[7]);
break;
case 14: // attitude from FC
case 15: // attitude from FC
if(FromFlightCtrl.AngleNick < 0) sign = '-';
else sign = '+';
i1 = abs(FromFlightCtrl.AngleNick)/10;
407,13 → 432,13
i2 = abs(FromFlightCtrl_AccRoll)%10;
LCD_printfxy(0,3," AccRoll:%c%03ld.%01ld", sign, i1, i2);
break;
case 15:
case 16:
LCD_printfxy(0,0,"Analog inputs");
LCD_printfxy(0,1,"A5:%3i ",AnalogData.Ch5);
LCD_printfxy(0,2,"A6:%3i ",AnalogData.Ch6);
LCD_printfxy(0,3,"A7:%3i ",AnalogData.Ch7);
break;
case 16:
case 17:
LCD_printfxy(0,0,"Compass: %3i", FromFlightCtrl.GyroHeading / 10);
LCD_printfxy(0,1,"Man.-Offset:%3i", FC.FromFC_CompassOffset / 10);
if(FC.FromFC_DisableDeclination)
428,13 → 453,13
}
LCD_printfxy(0,3,"True Compass: %3i", GyroCompassCorrected/10);
break;
case 17: // User Parameter
case 18: // User Parameter
LCD_printfxy(0,0,"UP1:%3i UP2:%3i",Parameter.User1,Parameter.User2);
LCD_printfxy(0,1,"UP3:%3i UP4:%3i",Parameter.User3,Parameter.User4);
LCD_printfxy(0,2,"UP5:%3i UP6:%3i",Parameter.User5,Parameter.User6);
LCD_printfxy(0,3,"UP7:%3i UP8:%3i",Parameter.User7,Parameter.User8);
break;
case 18: // User Parameter
case 19: // User Parameter
LCD_printfxy(0,0,"SD-Card Logs");
if(SDCardInfo.Valid == 1)
{
445,7 → 470,7
else
LCD_printfxy(0,1,"no card in slot ");
break;
case 19: // magnetic field
case 20: // magnetic field
if(Compass_CalState)
{
LCD_printfxy(0,0,"Calibration:");
498,7 → 523,7
}
if(Keys & KEY3)Compass_SetCalState(0); // cancel
break;
case 20:
case 21:
if(GeoMagDec < 0) sign = '-';
else sign = '+';
LCD_printfxy(0,0,"Magnetic Field");
506,11 → 531,11
LCD_printfxy(0,2,"Declination:%c%i.%1i ", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10);
LCD_printfxy(0,3,"Inclination:%2i (%2i)", EarthMagneticInclination, EarthMagneticInclinationTheoretic);
break;
case 21:
case 22:
LCD_printfxy(0,0,"SD-Setting ");
LCD_printfxy(0,2,"WP-Dynamic:%4i ",WaypointAcceleration);
break;
case 22:
case 23:
LCD_printfxy(0,0,"CPU Processing ");
LCD_printfxy(0,2,"GPS-Data: %2i.%iHz ",FreqNewGpsData/10, FreqNewGpsData%10);
LCD_printfxy(0,3,"GPS-Update:%2i.%iHz ",FreqGpsNavProcessed/10, FreqGpsNavProcessed%10);
517,7 → 542,7
if(FreqNewGpsData >= 48 && FreqNewGpsData <= 52) LCD_printfxy(18,2,"OK") else LCD_printfxy(18,2,"!!");
if(FreqGpsNavProcessed >= 350) LCD_printfxy(18,3,"OK") else LCD_printfxy(18,3,"!!");
break;
case 23:
case 24:
LCD_printfxy(0,0,"BL Current" );
LCD_printfxy(11,3,"(in 0.1A)" );
for(i1 = 0; i1 < 3; i1++)
527,7 → 552,7
}
break;
 
case 24:
case 25:
LCD_printfxy(0,0,"Ext. Compass" );
if(NCMAG_Compass_use_Orientation)
{
544,7 → 569,7
LCD_printfxy(0,1,"Not connected");
}
break;
case 25:
case 26:
{
static u8 index = 1;
if(Keys & KEY3) // next step
560,7 → 585,7
LCD_printfxy(0,3," %3d %3d LOAD", PointList_GetCount(), index);
}
break;
case 26:
case 27:
{
static u8 index = 1;
if(Keys & KEY3)
581,7 → 606,7
 
}
break;
case 27:
case 28:
{
static u8 index = 1;
if(Keys & KEY3)
597,7 → 622,7
LCD_printfxy(0,3,"Number: %3d (LOAD)", index);
}
break;
case 28:
case 29:
{
static u8 index = 1;
if(Keys & KEY3)
626,7 → 651,7
break;
*/
 
case 29:
case 30:
LCD_printfxy(0,0,"Trigger Input");
if(UART_VersionInfo.HWMajor >= 30)
{
642,13 → 667,13
LCD_printfxy(0,3,"(V3 required)");
}
break;
case 30:
case 31:
LCD_printfxy(0,0,"CamCtrl");
if(!(FromCamCtrl.CamStatus & CAM_STATE_I2C_OK))
{
LCD_printfxy(0,2,"Not connected");
if(CamCtrlTimeout < 10) LCD_printfxy(14,3,"(conn)"); // connect manually
if(Keys & KEY4) CamCtrlTimeout = 25000;
if(Keys & KEY4) CamCtrlTimeout = 31000;
}
else
{
705,7 → 730,7
}
}
break;
case 31:
case 32:
LCD_printfxy(0,0,"LaserCtrl");
if(!(FromLaserCtrl.LaserStatus & LASER_I2C_OK))
{
721,7 → 746,7
LCD_printfxy(0,2,"Dist:%5dcm",FromLaserCtrl.Distance);
}
break;
case 32:
case 33:
LCD_printfxy(0,0,"GimbalCtrl");
if(!(FromGimbalCtrl.GimbalStatus & GIMBAL_I2C_OK))
{
739,7 → 764,7
if(Keys & KEY4) { ToGimbalCtrl.BitCmd |= (GIMBAL_CMD_YW_ZERO); MenuNickGimbalOffset = 0;}
}
break;
case 33: // Temperaturecompensation of the Barosensor
case 34: // Temperaturecompensation of the Barosensor
{
static s32 dT = 0, tAlt = 0, faktor = 0;
static s32 dP = 0, pAlt = 0;
/trunk/spi_slave.c
1030,6 → 1030,7
else NaviData_Volatile.ShutterCounter = FromFlightCtrl.Param.Int[3]; // 6 & 7
LowVoltageLandingActive = FromFlightCtrl.Param.Byte[8];
Parameter.FailSafeTime = FromFlightCtrl.Param.Byte[9];
FromFC_ExternalCtrlCfg = FromFlightCtrl.Param.Byte[10];
// DebugOut.Analog[] = NaviData_Volatile.ShutterCounter;
// 8
// 9
/trunk/spi_slave.h
384,7 → 384,7
} __attribute__((packed)) paramset_t; // must be 179 bytes
 
extern paramset_t EE_Parameter;
 
#endif //_SPI_SLAVE_H
 
 
/trunk/uart1.c
149,6 → 149,7
u8 NewExternalControlFrame = 0; // flag that sends the Frame to FC
u16 UART1_BaudrateFallbackTimeout = 0;
u32 Uart1Baudrate = UART1_BAUD_RATE;
u8 FromFC_ExternalCtrlCfg = 0; // answer from FC
 
SerialChannel_t SerialChannel;
u8 NewSerialChannelFrame = 0; // flag that sends the Frame to FC
/trunk/uart1.h
118,6 → 118,7
} __attribute__((packed)) ExternControl_t;
extern ExternControl_t ExternControl;
extern u8 NewExternalControlFrame; // flag that sends the Frame to FC
extern u8 FromFC_ExternalCtrlCfg; // answer from FC
 
#define SERIAL_POTI_START 17
#define WP_EVENT_PPM_IN 29