80,8 → 80,13 |
#include "ftphelper.h" |
#include "led.h" |
#include "fat16.h" |
#include "eeprom.h" |
|
#define LIC_CMD_READ_LICENSE 1 |
#define LIC_CMD_WRITE_LICENSE 2 |
#define LIC_CMD_ERASE_LICENSE 3 |
|
|
#define FALSE 0 |
#define TRUE 1 |
|
109,6 → 114,7 |
u8 UART1_DisplayLine = 0; |
u8 UART1_ConfirmFrame = 0; |
u8 UART1_Request_FTP = FALSE; |
u8 UART1_Request_LicenseString = FALSE; |
u8 LastTransmittedFCStatusFlags2 = 0; |
u8 UART1_ExternalControlConfirmFrame = FALSE; |
u8 Send_NMEA_RMC = FALSE; |
139,6 → 145,7 |
volatile u8 SerialLinkOkay = 0; |
|
u8 text[200]; |
u8 *LicensePtr = UART1_tbuffer; |
|
const u8 ANALOG_LABEL[32][16] = |
{ |
159,10 → 166,10 |
"SPI Okay ", |
"I2C Error ", |
"I2C Okay ", //15 |
"16 dist (cm) ", |
"17 alt dist ", |
"18 time ", |
"19 climb ", // SD-Card-time |
"16 ", |
"17 ", |
"18 ", |
"19 ", // SD-Card-time |
"EarthMagnet [%] ", //20 |
"Ground Speed ", // "Z_Speed ", |
"N_Speed ", |
426,6 → 433,13 |
UART1_Request_SystemTime = TRUE; |
break; |
|
case 'm': // request for the license string |
UART1_Request_LicenseString = SerialMsg.pData[0]; |
if(UART1_Request_LicenseString == LIC_CMD_WRITE_LICENSE) |
{ |
memcpy(LicensePtr, &SerialMsg.pData[1],LICENSE_SIZE_TEXT); // copy ftp parameter |
} |
break; |
case 'f': // ftp command |
UART1_Request_FTP = SerialMsg.pData[0]; |
//if (UART1_Request_FTP == FTP_CMD_SET_CWD || UART1_Request_FTP == FTP_CMD_GET_FILE) |
1099,6 → 1113,40 |
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'E', NC_ADDRESS, 1, (u8 *)&ErrorMSG, sizeof(ErrorMSG)); |
UART1_Request_ErrorMessage = FALSE; |
} |
else if(UART1_Request_LicenseString && (UART1_tx_buffer.Locked == FALSE)) |
{ |
u8 result = 1; |
if(UART1_Request_LicenseString == LIC_CMD_READ_LICENSE) |
{ |
result = LIC_CMD_READ_LICENSE; |
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'M', NC_ADDRESS, 2, &result, 1, LicensePtr, LICENSE_SIZE); |
} |
else |
if((UART1_Request_LicenseString == LIC_CMD_ERASE_LICENSE) && !(FC.StatusFlags & FC_STATUS_MOTOR_RUN)) |
{ |
result = LIC_CMD_ERASE_LICENSE; |
DeleteLicenseInEEPROM(); |
CheckLicense(GET_LICENSE); |
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'M', NC_ADDRESS, 1, &result, 1); |
} |
else |
if((UART1_Request_LicenseString == LIC_CMD_WRITE_LICENSE) && !(FC.StatusFlags & FC_STATUS_MOTOR_RUN)) |
{ |
result = LIC_CMD_WRITE_LICENSE; |
if(CheckLicense(CHECK_ONLY)) //new license is okay |
{ |
WriteLicenseToEEPROM(EEPROM_LICENSE_DATA_KOMPATIBEL); |
result = 0; |
} |
else //new license is NOT okay |
{ |
ClearLicenseText(); |
CheckLicense(GET_LICENSE); // fetch a license if available |
} |
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'M', NC_ADDRESS, 1, &result, 1); |
} |
UART1_Request_LicenseString = 0; |
} |
#ifdef FOLLOW_ME |
else if(CheckDelay(UART1_FollowMe_Timer) && (UART1_tx_buffer.Locked == FALSE)) |
{ |