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; |