@@ -23,7 +23,7 @@ void loadSettings()
2323 loadSystemSettingsFromFileSD (settingsFileName, &settings);
2424
2525 // Change empty profile name to 'Profile1' etc
26- if (strcmp (settings.profileName , " (Empty) " ) == 0 )
26+ if (strlen (settings.profileName ) == 0 )
2727 sprintf (settings.profileName , " Profile%d" , profileNumber + 1 );
2828
2929 // Record these settings to LittleFS and SD file to be sure they are the same
@@ -873,9 +873,7 @@ uint8_t loadProfileNames()
873873 for (int x = 0 ; x < MAX_PROFILE_COUNT ; x++)
874874 profileNames[x][0 ] = ' \0 ' ; // Ensure every profile name is terminated
875875
876- // Serial.printf("sizeof(Settings): %d\n\r", sizeof(Settings));
877-
878- // Check LittleFS for profile names
876+ // Check LittleFS and SD for profile names
879877 for (int x = 0 ; x < MAX_PROFILE_COUNT ; x++)
880878 {
881879 char fileName[40 ];
@@ -885,11 +883,11 @@ uint8_t loadProfileNames()
885883 profileCount++;
886884 }
887885
888- // Serial.printf("profileCount: %d\n\r", profileCount);
889- // Serial.println("Profiles:");
890- // for (int x = 0 ; x < MAX_PROFILE_COUNT ; x++)
891- // Serial.printf("%d) %s\n\r", x, profileNames[x]);
892- // Serial.println();
886+ // Serial.printf("profileCount: %d\n\r", profileCount);
887+ // Serial.println("Profiles:");
888+ // for (int x = 0 ; x < MAX_PROFILE_COUNT ; x++)
889+ // Serial.printf("%d) %s\n\r", x, profileNames[x]);
890+ // Serial.println();
893891
894892 return (profileCount);
895893}
@@ -953,16 +951,14 @@ uint8_t getProfileNumberFromUnit(uint8_t profileUnit)
953951 if (strlen (profileNames[x]) > 0 )
954952 {
955953 if (located == profileUnit)
956- {
957- return (located);
958- }
954+ return (x);
959955
960956 located++; // Valid settingFileName but not the unit we are looking for
961957 }
962958 }
963959 log_d (" Profile unit %d not found" , profileUnit);
964960
965- return (false );
961+ return (0 );
966962}
967963
968964// Record large character blob to file
0 commit comments