Merge pull request #296 from PavelSindler/MK3_for_merging

Save filename to eeprom first, then check if file is complete
This commit is contained in:
PavelSindler 2017-12-07 17:26:46 +01:00 committed by GitHub
commit 8a950d5972
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 16 deletions

View file

@ -9,7 +9,7 @@
// Firmware version // Firmware version
#define FW_version "3.1.1-RC1" #define FW_version "3.1.1-RC1"
#define FW_build 125 #define FW_build 126
//#define FW_build --BUILD-NUMBER-- //#define FW_build --BUILD-NUMBER--
#define FW_version_build FW_version " b" STR(FW_build) #define FW_version_build FW_version " b" STR(FW_build)

View file

@ -6188,27 +6188,25 @@ static void menu_action_sdfile(const char* filename, char* longFilename)
sprintf_P(cmd, PSTR("M23 %s"), filename); sprintf_P(cmd, PSTR("M23 %s"), filename);
for (c = &cmd[4]; *c; c++) for (c = &cmd[4]; *c; c++)
*c = tolower(*c); *c = tolower(*c);
for (int i = 0; i < 8; i++) {
eeprom_write_byte((uint8_t*)EEPROM_FILENAME + i, filename[i]);
}
uint8_t depth = (uint8_t)card.getWorkDirDepth();
eeprom_write_byte((uint8_t*)EEPROM_DIR_DEPTH, depth);
for (uint8_t i = 0; i < depth; i++) {
for (int j = 0; j < 8; j++) {
eeprom_write_byte((uint8_t*)EEPROM_DIRS + j + 8 * i, dir_names[i][j]);
}
}
if (!check_file(filename)) { if (!check_file(filename)) {
result = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILE_INCOMPLETE, false, false); result = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILE_INCOMPLETE, false, false);
lcd_update_enable(true); lcd_update_enable(true);
} }
if (result) { if (result) {
for (int i = 0; i < 8; i++) {
eeprom_write_byte((uint8_t*)EEPROM_FILENAME + i, filename[i]);
}
uint8_t depth = (uint8_t)card.getWorkDirDepth();
for (uint8_t i = 0; i < depth; i++) {
for (int j = 0; j < 8; j++) {
eeprom_write_byte((uint8_t*)EEPROM_DIRS + j + 8 * i, dir_names[i][j]);
}
}
eeprom_write_byte((uint8_t*)EEPROM_DIR_DEPTH, depth);
enquecommand(cmd); enquecommand(cmd);
enquecommand_P(PSTR("M24")); enquecommand_P(PSTR("M24"));
} }