Skip to content

Commit 733ef1b

Browse files
committed
use adafruit_simplemath instead of simpleio. Use multi-line string for warning message
1 parent c41e65b commit 733ef1b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

adafruit_fruitjam/peripherals.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
import displayio
3939
import framebufferio
4040
import picodvi
41-
import simpleio
4241
import storage
4342
import supervisor
43+
from adafruit_simplemath import map_range
4444
from digitalio import DigitalInOut, Direction, Pull
4545
from neopixel import NeoPixel
4646

@@ -278,11 +278,11 @@ def volume(self, volume_level: int) -> None:
278278

279279
if volume_level > self.safe_volume_limit:
280280
raise ValueError(
281-
f"Volume level must be less than or equal to "
282-
+ f"safe_volume_limit: {self.safe_volume_limit}. "
283-
+ f"Using higher values could damage speakers. "
284-
+ f"To override this limitation pass a value larger {self.safe_volume_limit} "
285-
+ f"for the safe_volume_limit argument of the constructor."
281+
f"""Volume level must be less than or equal to
282+
safe_volume_limit: {self.safe_volume_limit}.
283+
Using higher values could damage speakers.
284+
To override this limitation pass a value larger {self.safe_volume_limit}
285+
for the safe_volume_limit argument of the constructor."""
286286
)
287287

288288
self._volume = volume_level
@@ -316,5 +316,5 @@ def _apply_volume(self) -> None:
316316
"""
317317
Map the basic volume level to a db value and set it on the DAC.
318318
"""
319-
db_val = simpleio.map_range(self._volume, 1, 20, -63, 23)
319+
db_val = map_range(self._volume, 1, 20, -63, 23)
320320
self._dac.dac_volume = db_val

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ adafruit-circuitpython-display-text
1515
adafruit-circuitpython-sd
1616
adafruit-circuitpython-ntp
1717
adafruit-circuitpython-connectionmanager
18-
adafruit-circuitpython-simpleio
18+
adafruit-circuitpython-simplemath

0 commit comments

Comments
 (0)