drenayaz commited on
Commit
ecda75b
·
1 Parent(s): 296123a

Fix mode switching (reload page on back) and increase audio retry to 10x2s

Browse files
Files changed (2) hide show
  1. arcade/main.py +4 -6
  2. arcade/static/index.html +1 -4
arcade/main.py CHANGED
@@ -147,18 +147,16 @@ class Arcade(ReachyMiniApp):
147
 
148
  print("Init sons...")
149
  audio_available = False
150
- if 'SDL_AUDIODRIVER' not in os.environ:
151
- os.environ['SDL_AUDIODRIVER'] = 'pulseaudio'
152
- for attempt in range(3):
153
  try:
154
  pygame.mixer.init(frequency=44100, size=-16, channels=2, buffer=1024)
155
  pygame.mixer.set_num_channels(16)
156
  audio_available = True
157
  break
158
  except pygame.error as e:
159
- if attempt < 2:
160
- print(f" Audio busy, retry {attempt + 1}/3...")
161
- time.sleep(1)
162
  else:
163
  print(f" Audio non disponible: {e}")
164
  print(" L'app fonctionnera sans son.")
 
147
 
148
  print("Init sons...")
149
  audio_available = False
150
+ for attempt in range(10):
 
 
151
  try:
152
  pygame.mixer.init(frequency=44100, size=-16, channels=2, buffer=1024)
153
  pygame.mixer.set_num_channels(16)
154
  audio_available = True
155
  break
156
  except pygame.error as e:
157
+ if attempt < 9:
158
+ print(f" Audio busy, retry {attempt + 1}/10...")
159
+ time.sleep(2)
160
  else:
161
  print(f" Audio non disponible: {e}")
162
  print(" L'app fonctionnera sans son.")
arcade/static/index.html CHANGED
@@ -250,10 +250,7 @@
250
  }
251
 
252
  function backToLanding() {
253
- document.getElementById('arcade-setup').style.display = 'none';
254
- document.getElementById('web-mode').style.display = 'none';
255
- document.getElementById('mirror-mode').style.display = 'none';
256
- document.getElementById('landing').style.display = 'flex';
257
  }
258
 
259
  function backToSetup() {
 
250
  }
251
 
252
  function backToLanding() {
253
+ window.location.reload();
 
 
 
254
  }
255
 
256
  function backToSetup() {