etrombly / RFM69

Python RFM69 library for raspberrypi
GNU General Public License v3.0
115 stars 77 forks source link

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

Closed kkunzelm closed 3 years ago

kkunzelm commented 7 years ago

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"

etrombly commented 7 years ago

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.

kkunzelm commented 7 years ago

Dear Eric,

thank you very much for explaining me this context. I am looking forward to the update of the library.

Sincerely

Karl-Heinz

ygoe commented 3 years ago

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

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

radio.shutdown()