-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skipping CRC OFF state at SX1278::setSpreadingFactorRaw() #217
Comments
You're right that the configuration for SF6 will indeeded ingore CRC configuration and always enable it. However, I don't see what's wrong with the second line, could you elaborate? EDIT: Ah, both of them are actually wrong in the code - @HamzaHajeir you can insert links to actual files in the repository, this is the corresponding code section in the current revision: RadioLib/src/modules/SX127x/SX1278.cpp Lines 494 to 504 in 81135e0
|
Fixed in 8438aa9, thanks for reporting. Let me know if you find anything else. |
Oh Great! I'm glad for the contribution Thanks for the great library :) |
Hi @jgromes , While trying the changes, the following fragments turned out to be problematic:
Surrounding the ternary conditionals with parentheses will fix the ...RX_CRC_MODE... from becoming the actual register value:
|
@zhgzhg thanks, reminds me why I dislike ternary so much. It's way too easy to forget about operator priority. |
It's a new thing to me : For other people to evaluate : run this under any compiler, as cpp.sh : // Example program
#include <iostream>
#include <string>
#define EIGHT 0x8
#define FOUR 0x4
#define TWO 0x2
#define ZERO 0x0
int main()
{
std::string name;
bool two = true;
std::cout << (EIGHT | FOUR | (two ? TWO : ZERO) ) << std::endl;
}
|
Hi
I'm reading the library to make a compatibility to STM32 HAL library I use.
I've came across this line, Which I expect it's a bug :
in SX1278.cpp L496 :
Shouldn't the two lines pointed to previously be :
state |= _mod->SPIsetRegValue(SX127X_REG_MODEM_CONFIG_2, SX127X_SF_6 | SX127X_TX_MODE_SINGLE | SX127x::_crcEnabled ? SX1278_RX_CRC_MODE_ON : SX1278_RX_CRC_MODE_OFF , 7, 2);
and
state |= _mod->SPIsetRegValue(SX127X_REG_MODEM_CONFIG_2, newSpreadingFactor | SX127X_TX_MODE_SINGLE | SX127x::_crcEnabled ? SX1278_RX_CRC_MODE_ON : SX1278_RX_CRC_MODE_OFF , 7, 2);
respectively ?
Because It will skip the CRC in case of being at
OFF
state.Thanks
The text was updated successfully, but these errors were encountered: