power panic: read EEPROM_FILENAME until \0 is seen

Also removed debug logs
This commit is contained in:
Guðni Már Gilbert 2023-10-09 18:23:25 +00:00 committed by gudnimg
parent 977792961c
commit 82cece95aa
1 changed files with 7 additions and 4 deletions

View File

@ -430,23 +430,26 @@ void restore_file_from_sd()
char dir_name[9];
uint8_t depth = eeprom_read_byte((uint8_t*)EEPROM_DIR_DEPTH);
MYSERIAL.println(int(depth));
for (uint8_t i = 0; i < depth; i++) {
for (uint8_t j = 0; j < 8; j++) {
dir_name[j] = eeprom_read_byte((uint8_t*)EEPROM_DIRS + j + 8 * i);
}
dir_name[8] = '\0';
MYSERIAL.println(dir_name);
card.chdir(dir_name, false);
}
for (uint8_t i = 0; i < 8; i++) {
filename[i] = eeprom_read_byte((uint8_t*)EEPROM_FILENAME + i);
const char c = eeprom_read_byte((uint8_t*)EEPROM_FILENAME + i);
filename[i] = c;
if (c == '\0') break; // Filename is shorter than 8 characters
}
// Add null delimiter in case all 8 characters were not NULL
filename[8] = '\0';
MYSERIAL.print(filename);
// Add extension to complete the DOS 8.3 filename
strcat_P(filename, PSTR(".gco"));
enquecommandf_P(MSG_M23, filename);
}