@@ -37,7 +37,7 @@ void loadSettings()
3737
3838 activeProfiles = getActiveProfiles (); // Count is used during menu display
3939
40- log_d (" Settings profile #%d loaded" , profileNumber);
40+ log_d (" Settings profile #%d loaded of %d profiles " , profileNumber, activeProfiles );
4141}
4242
4343// Load a given settings file into a given settings array
@@ -96,11 +96,12 @@ uint8_t getProfileNumber()
9696 log_d (" profileNumber.txt not found" );
9797 profileNumber = 0 ;
9898 updateZEDSettings = true ; // Force module update
99- recordProfileNumber (profileNumber);
99+ recordProfileNumber (profileNumber, false ); // Record profile but we don't need a module config at next POR
100100 }
101101 else
102102 {
103103 profileNumber = fileProfileNumber.read ();
104+ updateZEDSettings = fileProfileNumber.read ();
104105 fileProfileNumber.close ();
105106 }
106107
@@ -109,7 +110,8 @@ uint8_t getProfileNumber()
109110 {
110111 log_d (" ProfileNumber invalid. Going to zero." );
111112 profileNumber = 0 ;
112- recordProfileNumber (profileNumber);
113+ updateZEDSettings = true ; // Force module update
114+ recordProfileNumber (profileNumber, false ); // Record profile but we don't need a module config at next POR
113115 }
114116
115117 log_d (" Using profile #%d" , profileNumber);
@@ -205,8 +207,8 @@ uint8_t getProfileNumberFromUnit(uint8_t profileUnit)
205207 return (false );
206208}
207209
208- // Record the given profile number
209- void recordProfileNumber (uint8_t profileNumber)
210+ // Record the given profile number as well as a config bool
211+ void recordProfileNumber (uint8_t profileNumber, bool markForUpdate )
210212{
211213 File fileProfileNumber = LittleFS.open (" /profileNumber.txt" , FILE_WRITE);
212214 if (!fileProfileNumber)
@@ -215,6 +217,7 @@ void recordProfileNumber(uint8_t profileNumber)
215217 return ;
216218 }
217219 fileProfileNumber.write (profileNumber);
220+ fileProfileNumber.write (markForUpdate); // If true, ZED will be config'd next POR
218221 fileProfileNumber.close ();
219222}
220223
@@ -375,7 +378,7 @@ void recordSystemSettingsToFile()
375378
376379 settingsFile.close ();
377380
378- log_d (" System settings recorded to file " );
381+ log_d (" Settings recorded to SD: %s " , settingsFileName );
379382
380383 xSemaphoreGive (xFATSemaphore);
381384 }
0 commit comments