first working version
This commit is contained in:
parent
5a77113fb5
commit
42b533b5d8
@ -77,10 +77,8 @@
|
||||
#define EEPROM_FERROR_COUNT (EEPROM_UVLO_MESH_BED_LEVELING-16)
|
||||
// Power loss errors
|
||||
#define EEPROM_POWER_COUNT (EEPROM_UVLO_MESH_BED_LEVELING-17)
|
||||
#define UVLO_DIR_LEVEL (EEPROM_POWER_COUNT-1)
|
||||
#define UVLO_FIRST_LEVEL_FOLDER (EEPROM_FOLDER_LEVEL-8)
|
||||
#define UVLO_SECOND_LEVEL_FOLDER (EEPROM_FIRST_LEVEL-8)
|
||||
#define UVLO_THIRD_LEVEL_FOLDER (EEPROM_SECOND_LEVEL-8)
|
||||
#define EEPROM_DIR_DEPTH (EEPROM_POWER_COUNT-1)
|
||||
#define EEPROM_DIRS (EEPROM_DIR_DEPTH-80) //8 chars for each dir name, max 10 levels
|
||||
|
||||
//TMC2130 configuration
|
||||
#define EEPROM_TMC_AXIS_SIZE //axis configuration block size
|
||||
|
@ -350,6 +350,8 @@ extern bool mesh_bed_run_from_menu;
|
||||
|
||||
extern float distance_from_min[2];
|
||||
|
||||
extern char dir_names[3][9];
|
||||
|
||||
extern void calculate_volumetric_multipliers();
|
||||
|
||||
// Similar to the default Arduino delay function,
|
||||
|
@ -320,6 +320,7 @@ bool fan_state[2];
|
||||
int fan_edge_counter[2];
|
||||
int fan_speed[2];
|
||||
|
||||
char dir_names[3][9];
|
||||
|
||||
bool volumetric_enabled = false;
|
||||
float filament_size[EXTRUDERS] = { DEFAULT_NOMINAL_FILAMENT_DIA
|
||||
@ -7272,11 +7273,27 @@ void restore_print_from_eeprom() {
|
||||
char cmd[30];
|
||||
char* c;
|
||||
char filename[13];
|
||||
uint8_t depth = 0;
|
||||
char dir_name[9];
|
||||
|
||||
fan_speed_rec = eeprom_read_byte((uint8_t*)EEPROM_UVLO_FAN_SPEED);
|
||||
EEPROM_read_B(EEPROM_UVLO_FEEDRATE, &feedrate_rec);
|
||||
SERIAL_ECHOPGM("Feedrate:");
|
||||
MYSERIAL.println(feedrate_rec);
|
||||
|
||||
depth = eeprom_read_byte((uint8_t*)EEPROM_DIR_DEPTH);
|
||||
|
||||
MYSERIAL.println(int(depth));
|
||||
for (int i = 0; i < depth; i++) {
|
||||
for (int 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);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
filename[i] = eeprom_read_byte((uint8_t*)EEPROM_FILENAME + i);
|
||||
|
||||
|
@ -284,7 +284,6 @@ bool SdBaseFile::getFilename(char* name) {
|
||||
name[0] = '/';
|
||||
name[1] = '\0';
|
||||
return true;
|
||||
dir_level = 0;
|
||||
}
|
||||
// cache entry
|
||||
dir_t* p = cacheDirEntry(SdVolume::CACHE_FOR_READ);
|
||||
|
@ -233,6 +233,15 @@ void CardReader::openLogFile(char* name)
|
||||
openFile(name, false);
|
||||
}
|
||||
|
||||
void CardReader::getDirName(char* name, uint8_t level)
|
||||
{
|
||||
workDirParents[level].getFilename(name);
|
||||
}
|
||||
|
||||
uint16_t CardReader::getWorkDirDepth() {
|
||||
return workDirDepth;
|
||||
}
|
||||
|
||||
void CardReader::getAbsFilename(char *t)
|
||||
{
|
||||
uint8_t cnt=0;
|
||||
@ -635,7 +644,7 @@ void CardReader::updir()
|
||||
{
|
||||
--workDirDepth;
|
||||
workDir = workDirParents[0];
|
||||
int d;
|
||||
int d;
|
||||
for (int d = 0; d < workDirDepth; d++)
|
||||
workDirParents[d] = workDirParents[d+1];
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ public:
|
||||
uint16_t getnrfilenames();
|
||||
|
||||
void getAbsFilename(char *t);
|
||||
void getDirName(char* name, uint8_t level);
|
||||
uint16_t getWorkDirDepth();
|
||||
|
||||
|
||||
void ls();
|
||||
|
@ -6131,12 +6131,33 @@ static void menu_action_sdfile(const char* filename, char* longFilename)
|
||||
for (int i = 0; i < 8; i++) {
|
||||
eeprom_write_byte((uint8_t*)EEPROM_FILENAME + i, filename[i]);
|
||||
}
|
||||
|
||||
uint8_t depth = (uint8_t)card.getWorkDirDepth();
|
||||
|
||||
char dir_name[9];
|
||||
|
||||
for (uint8_t i = 0; i < depth; i++) {
|
||||
// card.getDirName(dir_name, i + 1);
|
||||
MYSERIAL.println(dir_name);
|
||||
for (int j = 0; j < 8; j++) {
|
||||
eeprom_write_byte((uint8_t*)EEPROM_DIRS + j + 8*i, dir_names[i][j]);
|
||||
}
|
||||
|
||||
}
|
||||
//MYSERIAL.println(int(depth));
|
||||
eeprom_write_byte((uint8_t*)EEPROM_DIR_DEPTH, depth);
|
||||
|
||||
enquecommand_P(PSTR("M24"));
|
||||
lcd_return_to_status();
|
||||
}
|
||||
static void menu_action_sddirectory(const char* filename, char* longFilename)
|
||||
{
|
||||
MYSERIAL.println(filename);
|
||||
|
||||
uint8_t depth = (uint8_t)card.getWorkDirDepth();
|
||||
|
||||
strcpy(dir_names[depth], filename);
|
||||
MYSERIAL.println(dir_names[depth]);
|
||||
card.chdir(filename);
|
||||
encoderPosition = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user