Repository navigation
Conversation
According to docs, if you pass None to animate_police_lights, it should animate forever.
WasabiFan
left a comment
There was a problem hiding this comment.
Good catches! One minor comment and then I'll merge. Thanks!
|
Two things, now that I look closer. Most importantly, shouldn't this change be made to all the animations, not just police lights? Second, can't we move the duration calculation to be within the if condition so we can eliminate the need for propagating |
Oh, of course, I didn't notice this issue is in other functions too, I just came across this. when I used it. Will do it
Yeah, it will simplify the code, however we would calculate the same thing in every cycle. Not a big deal, but my IT teacher would bite me :). Just tell me what you prefer and I will do it the same way in every animation function... |
|
Also shouldn't we issue warning/imply |
I figure this is probably a common use case for the Stopwatch anyway (checking if a time has elapsed) so I opened #667 to add such a method directly to the StopWatch. Once that is reviewed and merged you can use the new methods here. Sorry for making this take so long, we appreciate the contribution!
If it were clear-cut I might want to add such a warning, but consider this: in my main thread I spawn a new thread which runs my robot then my main thread just blocks running LEDs indefinetely. I'd say that's still valid (if a bit weird), so I'd prefer to just keep it simple here. If someone blocks their main thread unintentionally they'll either figure it out for themselves or ask for help and we can tell them. |
duration=Nonetoanimate_police_lightsto animate forever, as stated in docsall_off, as without it the leds light up on the next animation cycle