Use only as much stack as needed for the M23 command

master
Scott Lahteine 9 years ago
parent e0ab06cfae
commit 6b01cf07c2

@ -266,7 +266,7 @@ void CardReader::release() {
} }
void CardReader::openAndPrintFile(const char *name) { void CardReader::openAndPrintFile(const char *name) {
char cmd[4 + (FILENAME_LENGTH + 1) * MAX_DIR_DEPTH + 2]; // Room for "M23 ", names with slashes, a null, and one extra char cmd[4 + strlen(name) + 1]; // Room for "M23 ", filename, and null
sprintf_P(cmd, PSTR("M23 %s"), name); sprintf_P(cmd, PSTR("M23 %s"), name);
for (char *c = &cmd[4]; *c; c++) *c = tolower(*c); for (char *c = &cmd[4]; *c; c++) *c = tolower(*c);
enqueue_and_echo_command_now(cmd); enqueue_and_echo_command_now(cmd);

Loading…
Cancel
Save