-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Function Ed.ReadMusicEnd() report wrong status and it can end with deadlock condition.
There are two constants defined related to ReadMusicEnd():
"Ed.MUSIC_FINISHED": 0x01,
"Ed.MUSIC_NOT_FINISHED": 0x00,
Function ReadMusicEnd() should first test if any music is played at all and if not, return 1 (MUSIC_FINISHED); or other value. Current implementation in that case returns 0 (MUSIC_NOT_FINISHED).
Demo, it ends in deadlock condition after first pass of the loop:
#-------------Setup----------------
import Ed
Ed.EdisonVersion = Ed.V2
Ed.DistanceUnits = Ed.CM
Ed.Tempo = Ed.TEMPO_MEDIUM
#--------Your code below-----------
led = False
Ed.PlayBeep()
while True:
while Ed.ReadMusicEnd() == Ed.MUSIC_NOT_FINISHED: pass # bug is here
led = not led
if led:
Ed.LeftLed(Ed.ON)
Ed.RightLed(Ed.OFF)
else:
Ed.LeftLed(Ed.OFF)
Ed.RightLed(Ed.ON)
Ed.TimeWait(50, Ed.TIME_MILLISECONDS)
Metadata
Metadata
Assignees
Labels
No labels