etrombly/RFM69

example.py: while true loop -> test.shutdown()

Closed this issue · 3 comments

Dear author of this library (I did not find your name within a few clicks),

you library is awsome. It worked instantly as expected even without too much knowledge of the Python programming language.

I have a question which concerning the while true loop you use to initiate test.receiveBegin().

As far as I understand the construct this is a infinite loop. You implement no break condition. Therefore according to my understanding the two lines:

print "shutting down"
test.shutdown()

are never reached.

Was this by intention? Do I miss something?

I really would appreciate your comment on this observation.

Thank you very much for making the library public and taking the time to support it.

Sincerely

Karl-Heinz

PS: I did not know another way to contact you except to open this "issue"

you're correct, it would never reach that block. I just added that so it had an example of how to shut down the radio. It would have been better to have that in an interrupt handler, or something like that. I need to make a few updates to the library, so will probably modify the example so it makes more sense.

ygoe commented

I saw that, too, and fixed it like this:

try:
    while True:
        # do stuff
except KeyboardInterrupt:
    pass

radio.shutdown()