diff --git a/Buzzer.py b/Buzzer.py index 027b946..0e39afb 100644 --- a/Buzzer.py +++ b/Buzzer.py @@ -20,14 +20,14 @@ BEEPBEEP = ((700,1000),(100,None),(600,1000)) # 0: BEEEEP BEEEEP BEEEEEP # 1: Alle Meine Entchen -ALARMTONES = (((300,1200),(100,None),(200,1200),(300,None),(None,10)), - ((400,c),(100,None),(400,d),(100,None),(400,e),(100,None),(400,f),(100,None),\ - (900,g),(100,None),(900,g),(100,None),(400,a),(100,None),(400,a),(100,None),\ - (400,a),(100,None),(400,a),(100,None),(1900,g),(100,None),(400,a),(100,None),\ - (400,a),(100,None),(400,a),(100,None),(400,a),(100,None),(1600,g),(100,None),\ - (400,f),(100,None),(400,f),(100,None),(400,f),(100,None),(400,f),(100,None),\ - (900,e),(100,None),(900,e),(100,None),(400,d),(100,None),(400,d),(100,None),\ - (400,d),(100,None),(400,d),(100,None),(1600,c)),) +ALARMTONES = (((300,1200),(80,None),(200,1200),(300,None),(None,10)), + ((400,c),(80,None),(400,d),(80,None),(400,e),(80,None),(400,f),(80,None),\ + (900,g),(80,None),(900,g),(80,None),(400,a),(80,None),(400,a),(80,None),\ + (400,a),(80,None),(400,a),(80,None),(1900,g),(80,None),(400,a),(80,None),\ + (400,a),(80,None),(400,a),(80,None),(400,a),(80,None),(1600,g),(80,None),\ + (400,f),(80,None),(400,f),(80,None),(400,f),(80,None),(400,f),(80,None),\ + (900,e),(80,None),(900,e),(80,None),(400,d),(80,None),(400,d),(80,None),\ + (400,d),(80,None),(400,d),(80,None),(1600,c)),) class Buzzer(): def __init__(self,pin,duty = 1000): @@ -47,7 +47,8 @@ class Buzzer(): self.newSound = False timesPlayed = 0 #print("Play sound!") - for i in range(len(self.sound)): + i = 0 + while i < len(self.sound): s = self.sound[i] if s[0] == None: if s[1]-timesPlayed == 0: @@ -55,6 +56,7 @@ class Buzzer(): else: i = 0 timesPlayed += 1 + continue if (s[1] != None): self._pwm.freq(s[1]) self._pwm.duty(self.duty) @@ -64,6 +66,7 @@ class Buzzer(): await asyncio.sleep_ms(s[0]) if self.newSound or self.sound == None: break + i+=1 if (not self.newSound): self.sound = None self.newSound = False diff --git a/Screens.py b/Screens.py index 37f759a..0a5081a 100644 --- a/Screens.py +++ b/Screens.py @@ -98,6 +98,7 @@ class RingtoneSettingsScreen(): onNumberChange=self.playAndSetSound,\ onPicked=lambda _:Settings.save()) await numberScreen + HW.buzzer.stop() class ShowIpScreen(): def __init__(self):