Merge pull request #111 from erichelgeson/eric/fewMinorFixes

Few minor fixes
This commit is contained in:
Eric Helgeson
2022-05-21 09:30:31 -05:00
committed by GitHub

View File

@@ -580,10 +580,9 @@ void findDriveImages(FsFile root) {
FsFile file_test = root.openNextFile(O_RDONLY); FsFile file_test = root.openNextFile(O_RDONLY);
char name[MAX_FILE_PATH+1]; char name[MAX_FILE_PATH+1];
file_test.getName(name, MAX_FILE_PATH+1); file_test.getName(name, MAX_FILE_PATH+1);
String file_name = String(name);
// Skip directories and already open files. // Skip directories and already open files.
if(file_test.isDir() || file_name.startsWith("LOG.txt")) { if(file_test.isDir() || strncmp(name, "LOG.txt", 7) == 0) {
file_test.close(); file_test.close();
continue; continue;
} }
@@ -595,8 +594,7 @@ void findDriveImages(FsFile root) {
// Valid file, open for reading/writing. // Valid file, open for reading/writing.
file = SD.open(name, O_RDWR); file = SD.open(name, O_RDWR);
if(file && file.isFile()) { if(file && file.isFile()) {
file_name.toLowerCase(); if(tolower(name[0]) == 'h' && tolower(name[1]) == 'd') {
if(file_name.startsWith("hd")) {
// Defaults for Hard Disks // Defaults for Hard Disks
int id = 1; // 0 and 3 are common in Macs for physical HD and CD, so avoid them. int id = 1; // 0 and 3 are common in Macs for physical HD and CD, so avoid them.
int lun = 0; int lun = 0;
@@ -604,7 +602,7 @@ void findDriveImages(FsFile root) {
// Positionally read in and coerase the chars to integers. // Positionally read in and coerase the chars to integers.
// We only require the minimum and read in the next if provided. // We only require the minimum and read in the next if provided.
int file_name_length = file_name.length(); int file_name_length = strlen(name);
if(file_name_length > 2) { // HD[N] if(file_name_length > 2) { // HD[N]
int tmp_id = name[HDIMG_ID_POS] - '0'; int tmp_id = name[HDIMG_ID_POS] - '0';
@@ -680,6 +678,18 @@ void initFileLog(int success_mhz) {
LOG_FILE.println(SDFAT_FILE_TYPE); LOG_FILE.println(SDFAT_FILE_TYPE);
LOG_FILE.print("SdFat version: "); LOG_FILE.print("SdFat version: ");
LOG_FILE.println(SD_FAT_VERSION_STR); LOG_FILE.println(SD_FAT_VERSION_STR);
LOG_FILE.print("SD Format: ");
switch(SD.vol()->fatType()) {
case FAT_TYPE_EXFAT:
LOG_FILE.println("exFAT");
break;
case FAT_TYPE_FAT32:
LOG_FILE.print("FAT32");
case FAT_TYPE_FAT16:
LOG_FILE.print("FAT16");
default:
LOG_FILE.println(" - Consider formatting the SD Card with exFAT for improved performance.");
}
LOG_FILE.print("SPI speed: "); LOG_FILE.print("SPI speed: ");
LOG_FILE.print(success_mhz); LOG_FILE.print(success_mhz);
LOG_FILE.println("Mhz"); LOG_FILE.println("Mhz");
@@ -724,7 +734,9 @@ void finalizeFileLog() {
} }
LOG_FILE.println("Finished initialization of SCSI Devices - Entering main loop."); LOG_FILE.println("Finished initialization of SCSI Devices - Entering main loop.");
LOG_FILE.sync(); LOG_FILE.sync();
#if DEBUG < 2
LOG_FILE.close(); LOG_FILE.close();
#endif
} }
/* /*