Rev 432 | Rev 437 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 432 | Rev 433 | ||
---|---|---|---|
Line 76... | Line 76... | ||
76 | #include "fifo.h" |
76 | #include "fifo.h" |
77 | #include "debug.h" |
77 | #include "debug.h" |
78 | #include "spi_slave.h" |
78 | #include "spi_slave.h" |
79 | #include "ftphelper.h" |
79 | #include "ftphelper.h" |
80 | #include "led.h" |
80 | #include "led.h" |
- | 81 | #include "fat16.h" |
|
- | 82 | ||
Line 81... | Line 83... | ||
81 | 83 | ||
82 | #define FALSE 0 |
84 | #define FALSE 0 |
Line 83... | Line 85... | ||
83 | #define TRUE 1 |
85 | #define TRUE 1 |
Line 403... | Line 405... | ||
403 | case NC_ADDRESS: // own Slave Address |
405 | case NC_ADDRESS: // own Slave Address |
404 | switch(SerialMsg.CmdID) |
406 | switch(SerialMsg.CmdID) |
405 | { |
407 | { |
Line 406... | Line 408... | ||
406 | 408 | ||
407 | case 'f': // ftp command |
- | |
- | 409 | case 'f': // ftp command |
|
408 | if(FC.StatusFlags & FC_STATUS_MOTOR_RUN) break; // not if the motors are running |
410 | |
409 | UART1_Request_FTP = SerialMsg.pData[0]; |
411 | UART1_Request_FTP = SerialMsg.pData[0]; |
410 | //if (UART1_Request_FTP == FTP_CMD_SET_CWD || UART1_Request_FTP == FTP_CMD_GET_FILE) |
412 | //if (UART1_Request_FTP == FTP_CMD_SET_CWD || UART1_Request_FTP == FTP_CMD_GET_FILE) |
411 | memcpy(&FTP_data, &SerialMsg.pData[1], sizeof(FTP_data)); // copy ftp parameter |
413 | memcpy(&FTP_data, &SerialMsg.pData[1], sizeof(FTP_data)); // copy ftp parameter |
Line 700... | Line 702... | ||
700 | Echo = 0; // reset echo value |
702 | Echo = 0; // reset echo value |
701 | UART1_Request_Echo = FALSE; |
703 | UART1_Request_Echo = FALSE; |
702 | } |
704 | } |
703 | else if(UART1_Request_FTP && (UART1_tx_buffer.Locked == FALSE)) |
705 | else if(UART1_Request_FTP && (UART1_tx_buffer.Locked == FALSE)) |
704 | { |
706 | { |
- | 707 | u8 errorcode = FTP_ERROR_NONE; |
|
- | 708 | if(FC.StatusFlags & FC_STATUS_MOTOR_RUN) errorcode = FTP_ERROR_MOTOR_RUN; |
|
- | 709 | else if (!Partition.IsValid) errorcode = FTP_ERROR_NO_SDCARD; |
|
- | 710 | ||
705 | CheckFTPCommand(UART1_Request_FTP); |
711 | if (!errorcode) CheckFTPCommand(UART1_Request_FTP); |
- | 712 | else |
|
- | 713 | { |
|
- | 714 | u8 cmd = FTP_CMD_ERROR; |
|
- | 715 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'F', NC_ADDRESS, 2, &cmd, 1, &errorcode, 1); |
|
- | 716 | } |
|
- | 717 | ||
706 | UART1_Request_FTP = FALSE; |
718 | UART1_Request_FTP = FALSE; |
707 | } |
719 | } |
708 | else if((UART1_Request_WritePoint!= 0xFF) && (UART1_tx_buffer.Locked == FALSE)) |
720 | else if((UART1_Request_WritePoint!= 0xFF) && (UART1_tx_buffer.Locked == FALSE)) |
709 | { |
721 | { |
710 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'W', NC_ADDRESS, 1, &UART1_Request_WritePoint, sizeof(UART1_Request_WritePoint)); |
722 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'W', NC_ADDRESS, 1, &UART1_Request_WritePoint, sizeof(UART1_Request_WritePoint)); |