From d0b6b19373d38fc82684dc09224fc6baf41472f0 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 7 Dec 2017 17:16:23 +0100 Subject: [PATCH] save filename to eeprom first, then check if file is complete --- Firmware/Configuration.h | 2 +- Firmware/ultralcd.cpp | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 5ce1dd4f..7a31986d 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -9,7 +9,7 @@ // Firmware version #define FW_version "3.1.1-RC1" -#define FW_build 125 +#define FW_build 126 //#define FW_build --BUILD-NUMBER-- #define FW_version_build FW_version " b" STR(FW_build) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f7abc4fb..c1dac0ff 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6188,27 +6188,25 @@ static void menu_action_sdfile(const char* filename, char* longFilename) sprintf_P(cmd, PSTR("M23 %s"), filename); for (c = &cmd[4]; *c; 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)) { result = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILE_INCOMPLETE, false, false); lcd_update_enable(true); } 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_P(PSTR("M24")); }