feat: cleanup and rework audio system
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import atexit
|
||||
import logging
|
||||
|
||||
try:
|
||||
from RPi import GPIO
|
||||
except ImportError:
|
||||
from .mockGpio import GPIO
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
PWM_FREQUENCY = 10_000 # 10 KHz
|
||||
MOTORS = []
|
||||
@@ -17,7 +19,7 @@ def setup_gpio():
|
||||
|
||||
|
||||
def cleanup_gpio():
|
||||
print("cleaning up")
|
||||
LOG.info("cleaning up")
|
||||
for motor in MOTORS:
|
||||
# noinspection PyProtectedMember
|
||||
motor._stop()
|
||||
@@ -49,7 +51,7 @@ class DcMotor:
|
||||
self._set_reverse(val)
|
||||
absval = abs(val)
|
||||
if absval > 1:
|
||||
print(f"clipping {val} to 1")
|
||||
logging.warning(f"clipping {val} to 1")
|
||||
absval = 1
|
||||
|
||||
self.pwm_enable.ChangeDutyCycle(absval * 100)
|
||||
|
||||
Reference in New Issue
Block a user