pass in write length (#1447)
This commit is contained in:
parent
a2ce3805a8
commit
d6186c1cf3
|
@ -374,7 +374,7 @@ void writeLogLine(void) {
|
||||||
|
|
||||||
if (isSdCardAlive()) {
|
if (isSdCardAlive()) {
|
||||||
appendPrintf(&fileLogger, "\r\n");
|
appendPrintf(&fileLogger, "\r\n");
|
||||||
appendToLog(fileLogger.buffer);
|
appendToLog(fileLogger.buffer, strlen(fileLogger.buffer));
|
||||||
logFileLineIndex++;
|
logFileLineIndex++;
|
||||||
}
|
}
|
||||||
#endif /* EFI_FILE_LOGGING */
|
#endif /* EFI_FILE_LOGGING */
|
||||||
|
|
|
@ -307,7 +307,7 @@ void readLogFileContent(char *buffer, short fileId, short offset, short length)
|
||||||
/**
|
/**
|
||||||
* @brief Appends specified line to the current log file
|
* @brief Appends specified line to the current log file
|
||||||
*/
|
*/
|
||||||
void appendToLog(const char *line) {
|
void appendToLog(const char *line, size_t lineLength) {
|
||||||
UINT bytesWritten;
|
UINT bytesWritten;
|
||||||
|
|
||||||
if (!isSdCardAlive()) {
|
if (!isSdCardAlive()) {
|
||||||
|
@ -316,7 +316,7 @@ void appendToLog(const char *line) {
|
||||||
errorReported = TRUE;
|
errorReported = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UINT lineLength = strlen(line);
|
|
||||||
totalLoggedBytes += lineLength;
|
totalLoggedBytes += lineLength;
|
||||||
lockSpi(SPI_NONE);
|
lockSpi(SPI_NONE);
|
||||||
FRESULT err = f_write(&FDLogFile, line, lineLength, &bytesWritten);
|
FRESULT err = f_write(&FDLogFile, line, lineLength, &bytesWritten);
|
||||||
|
@ -494,7 +494,9 @@ void initMmcCard(void) {
|
||||||
chThdCreateStatic(mmcThreadStack, sizeof(mmcThreadStack), LOWPRIO, (tfunc_t)(void*) MMCmonThread, NULL);
|
chThdCreateStatic(mmcThreadStack, sizeof(mmcThreadStack), LOWPRIO, (tfunc_t)(void*) MMCmonThread, NULL);
|
||||||
|
|
||||||
addConsoleAction("mountsd", MMCmount);
|
addConsoleAction("mountsd", MMCmount);
|
||||||
addConsoleActionS("appendtolog", appendToLog);
|
addConsoleActionS("appendtolog", [](const char* str) {
|
||||||
|
appendToLog(str, strlen(str));
|
||||||
|
});
|
||||||
addConsoleAction("umountsd", mmcUnMount);
|
addConsoleAction("umountsd", mmcUnMount);
|
||||||
addConsoleActionS("ls", listDirectory);
|
addConsoleActionS("ls", listDirectory);
|
||||||
addConsoleActionS("del", removeFile);
|
addConsoleActionS("del", removeFile);
|
||||||
|
|
|
@ -16,7 +16,7 @@ extern "C"
|
||||||
|
|
||||||
void initMmcCard(void);
|
void initMmcCard(void);
|
||||||
bool isSdCardAlive(void);
|
bool isSdCardAlive(void);
|
||||||
void appendToLog(const char *line);
|
void appendToLog(const char *line, size_t length);
|
||||||
|
|
||||||
void readLogFileContent(char *buffer, short fileId, short offset, short length);
|
void readLogFileContent(char *buffer, short fileId, short offset, short length);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue