Skip to content

Commit

Permalink
power panic: read whole directory name block from EEPROM
Browse files Browse the repository at this point in the history
There is no need to read one byte at a time. We can simply
read the whole block in one go. This saves some flash memory.

Change in memory:
Flash: -18 bytes
SRAM: 0 bytes
  • Loading branch information
gudnimg committed Oct 22, 2023
1 parent 4fd76b6 commit d7d7ce1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions Firmware/power_panic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,7 @@ void restore_file_from_sd()
uint8_t depth = eeprom_read_byte((uint8_t*)EEPROM_DIR_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);
}
eeprom_read_block(dir_name, (const char *)EEPROM_DIRS + 8 * i, 8);
dir_name[8] = '\0';
card.chdir(dir_name, false);
}
Expand Down

0 comments on commit d7d7ce1

Please sign in to comment.