remove guard against missing DAC
This commit is contained in:
parent
5b726750db
commit
33eceaf3fa
1 changed files with 20 additions and 37 deletions
|
|
@ -108,19 +108,7 @@ class SoundManager:
|
|||
wsel_pin = board.I2S_WS
|
||||
din_pin = board.I2S_DIN
|
||||
|
||||
# Check if DAC is connected
|
||||
for i in range(500): # try for 5 seconds
|
||||
if i2c.try_lock():
|
||||
break
|
||||
time.sleep(0.01)
|
||||
if 0x18 in i2c.scan():
|
||||
ltv320_present = True
|
||||
else:
|
||||
ltv320_present = False
|
||||
i2c.unlock()
|
||||
|
||||
# Initialize TLV320
|
||||
if ltv320_present:
|
||||
self.tlv = adafruit_tlv320.TLV320DAC3100(i2c)
|
||||
|
||||
# set sample rate & bit depth
|
||||
|
|
@ -148,11 +136,6 @@ class SoundManager:
|
|||
)
|
||||
|
||||
print("TLV320 I2S DAC initialized successfully")
|
||||
|
||||
else:
|
||||
print("TLV320 DAC not found, falling back to PWM audio output")
|
||||
self.audio = audiopwmio.PWMAudioOut(board.D10)
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error initializing TLV320 DAC: {e}")
|
||||
print("Falling back to PWM audio output")
|
||||
|
|
|
|||
Loading…
Reference in a new issue