Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2453 → Rev 2454

/I2C_Telemetry/trunk/gpx.c
273,7 → 273,7
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/*unsigned int BL3_Current(unsigned char who) // in 0,1A
{
/*if(Motor[who].Current <= 200) return((unsigned int) Motor[who].Current);
if(Motor[who].Current <= 200) return((unsigned int) Motor[who].Current);
else
{
if(Motor_Version[who] & MOTOR_STATE_BL30) return(200 + 10 * (unsigned int) (Motor[who].Current-200));
/I2C_Telemetry/trunk/main.c
191,7 → 191,7
timer = SetDelay(500);
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer
 
printf("\n\rFound BL-Ctrl: ");
printf("\n\rDetected BL-Ctrl: ");
timer = SetDelay(4000);
 
timer1000ms = SetDelay(1000);
218,7 → 218,7
{
if(!(Motor[i].State & MOTOR_STATE_PRESENT_MASK))
{
printf("\n\r\n\r!! MISSING BL-CTRL: %d !!",i+1);
printf("\n\rNot detected BL-Ctrl: %d",i+1);
}
Motor[i].State &= ~MOTOR_STATE_ERROR_MASK; // clear error counter
}
/I2C_Telemetry/trunk/mkprotocol.h
9,6 → 9,7
#define MK3MAG_ADDRESS 3
#define MKOSD_ADDRESS 4
#define BL_ADDRESS 5
#define I2C_TELEMETRY_ADDRESS 7
 
typedef struct
{
/I2C_Telemetry/trunk/uart.c
212,12 → 212,12
if(DisplayLine > 3)// new format
{
Menu();
MKProtocol_CreateSerialFrame(&UART0_tx_buffer, 'H', FC_ADDRESS, 1, (uint8_t *)DisplayBuff, 80);
MKProtocol_CreateSerialFrame(&UART0_tx_buffer, 'H', I2C_TELEMETRY_ADDRESS, 1, (uint8_t *)DisplayBuff, 80);
}
else // old format
{
LCD_printfxy(0,0,"!!! INCOMPATIBLE !!!");
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'H', FC_ADDRESS, 2, &DisplayLine, sizeof(DisplayLine), (uint8_t *)DisplayBuff, 20);
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'H', I2C_TELEMETRY_ADDRESS, 2, &DisplayLine, sizeof(DisplayLine), (uint8_t *)DisplayBuff, 20);
if(DisplayLine++ > 3) DisplayLine = 0;
}
Display_Timer = SetDelay(Display_Interval);
226,12 → 226,12
else if(Request_Display1)
{
Menu();
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'L', FC_ADDRESS, 3, &MenuePunkt, sizeof(MenuePunkt), &MaxMenue, sizeof(MaxMenue), DisplayBuff, sizeof(DisplayBuff));
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'L', I2C_TELEMETRY_ADDRESS, 3, &MenuePunkt, sizeof(MenuePunkt), &MaxMenue, sizeof(MaxMenue), DisplayBuff, sizeof(DisplayBuff));
Request_Display1 = 0;
}
else if(Request_VerInfo)
{
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'V', FC_ADDRESS, 1, (unsigned char *) &UART_VersionInfo, sizeof(UART_VersionInfo));
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'V', I2C_TELEMETRY_ADDRESS, 1, (unsigned char *) &UART_VersionInfo, sizeof(UART_VersionInfo));
Request_VerInfo = 0;
Debug_OK("Version gesendet");
}
238,7 → 238,7
else if(((DebugData_Interval>0 && CheckDelay(DebugData_Timer)) || Request_DebugData))
{
CopyDebugValues();
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'D', FC_ADDRESS, 1, (unsigned char *) &DebugOut,sizeof(DebugOut));
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'D', I2C_TELEMETRY_ADDRESS, 1, (unsigned char *) &DebugOut,sizeof(DebugOut));
Request_DebugData = 0;
if(DebugData_Interval>0) DebugData_Timer = SetDelay(DebugData_Interval);
}
246,12 → 246,12
{
uint8_t label[16]; // local sram buffer
memcpy_P(label, ANALOG_TEXT[Request_DebugLabel], 16); // read lable from flash to sra
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'A', FC_ADDRESS, 2, (unsigned char *)&Request_DebugLabel, sizeof(Request_DebugLabel),label, 16);
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'A', I2C_TELEMETRY_ADDRESS, 2, (unsigned char *)&Request_DebugLabel, sizeof(Request_DebugLabel),label, 16);
Request_DebugLabel = 255;
}
else if(Request_PPMChannels)
{
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'P', FC_ADDRESS, 1, (unsigned char *) &PPM_in, sizeof(PPM_in));
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'P', I2C_TELEMETRY_ADDRESS, 1, (unsigned char *) &PPM_in, sizeof(PPM_in));
Request_PPMChannels = 0;
}
else if(Request_FTP)
271,7 → 271,7
#ifdef DEBUG // only include functions if DEBUG is defined
else if(Request_DebugOutput)
{
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'0', FC_ADDRESS, 1, (unsigned char *) &tDebug, sizeof(tDebug));
MKProtocol_CreateSerialFrame(&UART0_tx_buffer,'0', I2C_TELEMETRY_ADDRESS, 1, (unsigned char *) &tDebug, sizeof(tDebug));
Request_DebugOutput = 0;
}
#endif
300,15 → 300,13
MKProtocol_DecodeSerialFrameHeader(&UART0_rx_buffer, &SerialMsg); // decode serial frame header in rxd buffer
MKProtocol_DecodeSerialFrameData(&UART0_rx_buffer, &SerialMsg); // decode serial frame data in rxd buffer
 
if( SerialMsg.Address == FC_ADDRESS )
if( SerialMsg.Address == FC_ADDRESS || SerialMsg.Address == I2C_TELEMETRY_ADDRESS)
{
switch(SerialMsg.CmdID)
{
case 'f': // ftp command
Request_FTP = SerialMsg.pData[0];
memcpy(&FTP_data, &SerialMsg.pData[1], sizeof(FTP_data)); // copy ftp parameter
break;
 
case 't':// Motortest
if(SerialMsg.DataLen > 20) memcpy(&MotorTest[0], SerialMsg.pData, sizeof(MotorTest));
else memcpy(&MotorTest[0], SerialMsg.pData, 4);
351,6 → 349,12
{
switch(SerialMsg.CmdID)
{
case 'f': // ftp command
Request_FTP = SerialMsg.pData[0];
memcpy(&FTP_data, &SerialMsg.pData[1], sizeof(FTP_data)); // copy ftp parameter
break;
case 't':// Motortest
if(SerialMsg.DataLen >= sizeof(MotorTest)) memcpy(&MotorTest[0], SerialMsg.pData, sizeof(MotorTest));
else memcpy(&MotorTest[0], SerialMsg.pData, 4);
593,6 → 597,8
UART_VersionInfo.SWPatch = VERSION_PATCH;
UART_VersionInfo.ProtoMajor = VERSION_SERIAL_MAJOR;
UART_VersionInfo.ProtoMinor = VERSION_SERIAL_MINOR;
UART_VersionInfo.Flags = 0x02; // GPS present -> MK Tool enables MKGPS Button
 
// restore global interrupt flags
SREG = sreg;
/I2C_Telemetry/trunk/ubx.c
114,8 → 114,8
volatile ubx_nav_velned_t UbxVelNed = {0,0,0,0,0,0,0,0,0, INVALID};
volatile ubxmsg_t UbxMsg;
 
void UBX_Setup(void);
 
 
// shared buffer
gps_data_t GPSData = {200,{0,0,0,INVALID},0,0,0,0,0,0,0, INVALID};
DateTime_t GPSDateTime = {0,0,0,0,0,0,0, INVALID};