Browse Source

Fixed a bug where the CPU was running at 100% when using softTone

- added delay in SoftTone thread when frequence = 0
pull/11/head
Crom 12 years ago
parent
commit
4b90644dae
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      wiringPi/softTone.c

+ 5
- 1
wiringPi/softTone.c View File

@@ -69,6 +69,10 @@ static PI_THREAD (softToneThread)
digitalWrite (pin, LOW) ; digitalWrite (pin, LOW) ;
delayMicroseconds (halfPeriod) ; delayMicroseconds (halfPeriod) ;
} }
else
{
delayMicroseconds(1000);
}
} }


return NULL ; return NULL ;
@@ -114,6 +118,6 @@ int softToneCreate (int pin)


while (newPin != -1) while (newPin != -1)
delay (1) ; delay (1) ;
return res ; return res ;
} }

Loading…
Cancel
Save