LowPowerLab Forum

Hardware support => Moteino => Topic started by: Tomega3 on December 11, 2014, 08:23:49 PM

Title: RFM69.initialize question
Post by: Tomega3 on December 11, 2014, 08:23:49 PM
I have been reading the RFM69.cpp file with great interest.
That is a powerful piece of code. My head is still swimming a little (maybe a lot)   :)

It looks like the initialize routine may wait for ever if its called and there is no radio connected or the radio is bad or some other failure to initialize.

Can it be modified to return a false if it waits to long in its 3 while loops?

Thanks
Title: Re: RFM69.initialize question
Post by: Felix on December 11, 2014, 10:05:13 PM
Yes that is something I have to fix. Generally you would not use the lib without a radio, but I can see how this is a "bad" practice to let code loop forever and assume nothing bad can happen.
You might want to check Charly86's fix for that particular issue in his own fork of the lib: https://github.com/hallard/RFM69/blob/master/firmware/RFM69.cpp
I will try to integrate some of his improvements.
Title: Re: RFM69.initialize question
Post by: Tomega3 on December 12, 2014, 04:26:51 PM
Thanks for the info, I see what Charly86's fix is.
I was thinking of something along those lines too.
I'll dig deeper and see if there are any other areas that may need a timeout in case the radio quits working or hangs after it has been initialized.

I think I saw that maybe the cansend tests may be a candidate. I have to keep looking.

Title: Re: RFM69.initialize question
Post by: diverdale on December 19, 2014, 04:41:47 PM
I downloaded Charley86's library and it works but I had to add a couple of items.

RFM69.h -- added #include <Arduino.h>

RFM69.cpp -- added #include "SPI.h"

those 2 mods and it works fine.

Hope it helps,
Dale