@@ -165,31 +165,30 @@ def navigate_up(self):
165165 self .refresh_file_list ()
166166
167167 def settings_button_tap (self , event ):
168- prefs = SharedPreferences (self .appFullName )
169168 global_json_path = self .bootfile_prefix + self .retrogodir + "/config/global.json"
170-
169+ current_audio = "buzzer"
170+ current_volume = "50"
171171 try :
172172 import json
173173 fd = open (global_json_path , "r" )
174174 config = json .load (fd )
175175 fd .close ()
176- editor = prefs .edit ()
177- current_audio = "buzzer" if config .get ("AudioDriver" ) != "i2s" else "i2s"
178- editor .put_string ("audio_output" , current_audio )
176+ if config .get ("AudioDriver" ) == "i2s" :
177+ current_audio = "i2s"
179178 current_volume = str (config .get ("Volume" , 50 ))
180- editor .put_string ("audio_volume" , current_volume )
181- editor .commit ()
182179 except Exception :
183180 pass
184181
182+ prefs = SharedPreferences (self .appFullName )
185183 intent = Intent (activity_class = SettingsActivity )
186184 intent .putExtra ("prefs" , prefs )
187185 intent .putExtra ("settings" , [
188186 {
189187 "title" : "Audio out" ,
190188 "key" : "audio_output" ,
191189 "ui" : "radiobuttons" ,
192- "default_value" : "buzzer" ,
190+ "dont_persist" : True ,
191+ "default_value" : current_audio ,
193192 "ui_options" : [
194193 ("Buzzer" , "buzzer" ),
195194 ("Ext DAC" , "i2s" ),
@@ -199,7 +198,8 @@ def settings_button_tap(self, event):
199198 {
200199 "title" : "Volume" ,
201200 "key" : "audio_volume" ,
202- "default_value" : "50" ,
201+ "dont_persist" : True ,
202+ "default_value" : current_volume ,
203203 "placeholder" : "0-100" ,
204204 "changed_callback" : self ._apply_volume ,
205205 },
0 commit comments