Fix frequency issue on SX127x (#1368)#1369
Conversation
|
Thank you for the contribution! Although, I'm not sure this is the right way to fix this because we may encounter more bugs like this, where the radio is sensitive to register access. I think the better way would be to add a flag to |
|
Do you think it is worth optimizing out the initial register read when force is enabled? |
|
That needs to be kept, since we might only want to change some of the bits. The only point at which we could drop it is if force is enabled and all bits will be modified, but that seems like too much of an edge case now. Let's keep this PR to just fix this one thing ;) |
|
Thank you so much - all looks good, the failed CI run is unrelated and can be ignored. |
The SX127x requires that the LSB of the frequency register (Frf) be written in order to change the frequency, but the library was using a SPI writing function that checked for overwrites. If the LSB did not change, the new frequency would be written in successfully, but the frequency would stay at the module's default.
I changed it to use the lower level SPI writing function with no overwrite protection if there was no difference between the old and new contents for the LSB.
I have this commit working on my RFM96W board connected to an Arduino Nano Every, but I have not tested on any other platforms.