@@ -124,18 +124,19 @@ void menuUserProfiles()
124
124
for (int x = 0 ; x < MAX_PROFILE_COUNT ; x++)
125
125
{
126
126
if (strlen (profileNames[x]) > 0 )
127
- {
128
127
Serial.printf (" %d) Select %s" , x + 1 , profileNames[x]);
129
- if (x == profileNumber) Serial.print (" <- Current" );
130
- }
131
128
else
132
129
Serial.printf (" %d) Select (Empty)" , x + 1 );
133
130
131
+ if (x == profileNumber) Serial.print (" <- Current" );
132
+
134
133
Serial.println ();
135
134
}
136
135
137
136
Serial.printf (" %d) Edit profile name: %s\n\r " , MAX_PROFILE_COUNT + 1 , profileNames[profileNumber]);
138
137
138
+ Serial.printf (" %d) Delete profile '%s'\n\r " , MAX_PROFILE_COUNT + 2 , profileNames[profileNumber]);
139
+
139
140
Serial.println (F (" x) Exit" ));
140
141
141
142
int incoming = getNumber (menuTimeout); // Timeout after x seconds
@@ -164,6 +165,34 @@ void menuUserProfiles()
164
165
165
166
strcpy (profileNames[profileNumber], settings.profileName ); // Update array
166
167
}
168
+ else if (incoming == MAX_PROFILE_COUNT + 2 )
169
+ {
170
+ Serial.printf (" \r\n Delete profile '%s'. Press 'y' to confirm:" , profileNames[profileNumber]);
171
+ byte bContinue = getByteChoice (menuTimeout);
172
+ if (bContinue == ' y' )
173
+ {
174
+ // Remove profile from LittleFS
175
+ if (LittleFS.exists (settingsFileName))
176
+ LittleFS.remove (settingsFileName);
177
+
178
+ // Remove profile from SD if available
179
+ if (online.microSD == true )
180
+ {
181
+ if (sd.exists (settingsFileName))
182
+ sd.remove (settingsFileName);
183
+ }
184
+
185
+ // Clear this profile profile with default settings
186
+ Settings tempSettings;
187
+ settings = tempSettings;
188
+
189
+ recordSystemSettings ();
190
+
191
+ strcpy (profileNames[profileNumber], settings.profileName ); // Update array
192
+ }
193
+ else
194
+ Serial.println (F (" Delete aborted" ));
195
+ }
167
196
168
197
else if (incoming == STATUS_PRESSED_X)
169
198
break ;
0 commit comments