Write a command to the log file
| 957 | // Write a command to the log file |
| 958 | // |
| 959 | void CardReader::write_command(char * const buf) { |
| 960 | char *begin = buf, |
| 961 | *npos = nullptr, |
| 962 | *end = buf + strlen(buf) - 1; |
| 963 | |
| 964 | myfile.writeError = false; |
| 965 | if ((npos = strchr(buf, 'N'))) { |
| 966 | begin = strchr(npos, ' ') + 1; |
| 967 | end = strchr(npos, '*') - 1; |
| 968 | } |
| 969 | end[1] = '\r'; |
| 970 | end[2] = '\n'; |
| 971 | end[3] = '\0'; |
| 972 | myfile.write(begin); |
| 973 | |
| 974 | if (myfile.writeError) SERIAL_ERROR_MSG(STR_SD_ERR_WRITE_TO_FILE); |
| 975 | } |
| 976 | |
| 977 | #if DISABLED(NO_SD_AUTOSTART) |
| 978 | /** |