Allow SD card formatting through TS Native interface

This commit is contained in:
Josh Stewart 2023-09-18 10:12:02 +10:00
parent a92ca8d191
commit d2c7a19ac1
2 changed files with 16 additions and 3 deletions

View File

@ -946,7 +946,18 @@ void processSerialCommand(void)
SDcurrentDirChunk = word(serialPayload[7], serialPayload[8]);
sendReturnCodeMsg(SERIAL_RC_OK);
}
else if((SD_arg1 == SD_WRITE_SEC_ARG1) && (SD_arg2 == SD_WRITE_SEC_ARG2))
else if((SD_arg1 == SD_WRITE_READ_SEC_ARG1) && (SD_arg2 == SD_WRITE_READ_SEC_ARG2))
{
//Read sector Init? Unsure what this is meant to do however it is sent at the beginning of a Card Format request and requires an OK response
//Provided the sector being requested is x0 x0 x0 x0, we treat this as a SD Card format request
if( (serialPayload[7] == 0) && (serialPayload[8] == 0) && (serialPayload[9] == 0) && (serialPayload[10] == 0) )
{
//SD Card format request
formatExFat();
}
sendReturnCodeMsg(SERIAL_RC_OK);
}
else if((SD_arg1 == SD_WRITE_WRITE_SEC_ARG1) && (SD_arg2 == SD_WRITE_WRITE_SEC_ARG2))
{
//SD write sector command
}

View File

@ -23,8 +23,10 @@
#define SD_WRITE_DO_ARG2 0x0001
#define SD_WRITE_DIR_ARG1 0x0001
#define SD_WRITE_DIR_ARG2 0x0002
#define SD_WRITE_SEC_ARG1 0x0003
#define SD_WRITE_SEC_ARG2 0x0204
#define SD_WRITE_READ_SEC_ARG1 0x0002
#define SD_WRITE_READ_SEC_ARG2 0x0004
#define SD_WRITE_WRITE_SEC_ARG1 0x0003
#define SD_WRITE_WRITE_SEC_ARG2 0x0204
#define SD_WRITE_COMP_ARG1 0x0005
#define SD_WRITE_COMP_ARG2 0x0008
#define SD_ERASEFILE_ARG1 0x0006