Merge 5c210c8ad8 into 508a0f5b87
This commit is contained in:
commit
8a295b4257
2 changed files with 20 additions and 31 deletions
|
|
@ -226,7 +226,7 @@ def PyDOS():
|
|||
if "_display" not in envVars.keys():
|
||||
if "display" in dir(Pydos_ui):
|
||||
envVars["_display"] = Pydos_ui.display
|
||||
elif "display" in dir(runtime):
|
||||
elif "display" in dir(runtime) and runtime.display is not None:
|
||||
envVars["_display"] = runtime.display
|
||||
elif "display" in dir(board):
|
||||
envVars["_display"] = board.display
|
||||
|
|
@ -238,6 +238,10 @@ def PyDOS():
|
|||
if envVars["_display"].root_group != displayio.CIRCUITPYTHON_TERMINAL:
|
||||
envVars["_display"].root_group = displayio.CIRCUITPYTHON_TERMINAL
|
||||
|
||||
envVars["_display"].auto_refresh = True
|
||||
envVars["_scrHeight"] = envVars["_display"].root_group[0].height
|
||||
envVars["_scrWidth"] = envVars["_display"].root_group[0].width - 1
|
||||
|
||||
return
|
||||
|
||||
def chkPath(tstPath):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2025 Tim Cocks for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
import gc
|
||||
import json
|
||||
|
||||
import board
|
||||
|
|
@ -10,10 +9,8 @@ from displayio import TileGrid, Group
|
|||
import adafruit_imageload
|
||||
import time
|
||||
import math
|
||||
import adafruit_tlv320
|
||||
from audiocore import WaveFile
|
||||
import audiobusio
|
||||
import adafruit_pathlib as pathlib
|
||||
import adafruit_fruitjam
|
||||
|
||||
launcher_config = {}
|
||||
if pathlib.Path("launcher.conf.json").exists():
|
||||
|
|
@ -31,34 +28,22 @@ i2c = board.I2C()
|
|||
while not i2c.try_lock():
|
||||
time.sleep(0.01)
|
||||
if 0x18 in i2c.scan():
|
||||
ltv320_present = True
|
||||
tlv320_present = True
|
||||
else:
|
||||
ltv320_present = False
|
||||
tlv320_present = False
|
||||
i2c.unlock()
|
||||
|
||||
if ltv320_present:
|
||||
dac = adafruit_tlv320.TLV320DAC3100(i2c)
|
||||
if tlv320_present:
|
||||
fjPeriphs = adafruit_fruitjam.peripherals.Peripherals()
|
||||
|
||||
# set sample rate & bit depth
|
||||
dac.configure_clocks(sample_rate=11030, bit_depth=16)
|
||||
|
||||
if "sound" in launcher_config:
|
||||
if launcher_config["sound"] == "speaker":
|
||||
if "tlv320" in launcher_config:
|
||||
if launcher_config["tlv320"].get("output") == "speaker":
|
||||
# use speaker
|
||||
dac.speaker_output = True
|
||||
dac.speaker_volume = -40
|
||||
else:
|
||||
# use headphones
|
||||
dac.headphone_output = True
|
||||
dac.headphone_volume = -15 # dB
|
||||
else:
|
||||
# default to headphones
|
||||
dac.headphone_output = True
|
||||
dac.headphone_volume = -15 # dB
|
||||
fjPeriphs.audio_output = "speaker"
|
||||
if "volume" in launcher_config["tlv320"]:
|
||||
fjPeriphs.volume = launcher_config["tlv320"]["volume"]
|
||||
|
||||
wave_file = open("/boot_animation/ada_fruitjam_boot_jingle.wav", "rb")
|
||||
wave = WaveFile(wave_file)
|
||||
audio = audiobusio.I2SOut(board.I2S_BCLK, board.I2S_WS, board.I2S_DIN)
|
||||
wave_file = "/boot_animation/ada_fruitjam_boot_jingle.wav"
|
||||
|
||||
|
||||
class OvershootAnimator:
|
||||
|
|
@ -648,8 +633,8 @@ display.root_group = main_group
|
|||
|
||||
start_time = time.monotonic()
|
||||
|
||||
if ltv320_present:
|
||||
audio.play(wave)
|
||||
if tlv320_present:
|
||||
fjPeriphs.play_file(wave_file,False)
|
||||
|
||||
while True:
|
||||
now = time.monotonic()
|
||||
|
|
@ -696,8 +681,8 @@ while True:
|
|||
if not still_going:
|
||||
break
|
||||
|
||||
if ltv320_present:
|
||||
while audio.playing:
|
||||
if tlv320_present:
|
||||
while fjPeriphs.audio.playing:
|
||||
pass
|
||||
|
||||
supervisor.set_next_code_file("code.py")
|
||||
|
|
|
|||
Loading…
Reference in a new issue