sandeepmistry / arduino-LoRa

An Arduino library for sending and receiving data using LoRa radios.
MIT License
1.64k stars 627 forks source link

Implicit header control code #315

Closed jdliue closed 3 years ago

jdliue commented 4 years ago

From the register description of data sheet, it seems the code should be changed to void LoRaClass::explicitHeaderMode() { _implicitHeaderMode = 0; writeRegister(REG_MODEM_CONFIG_1, readRegister(REG_MODEM_CONFIG_1) & 0xfefb); } void LoRaClass::implicitHeaderMode() { _implicitHeaderMode = 1; writeRegister(REG_MODEM_CONFIG_1, readRegister(REG_MODEM_CONFIG_1) | 0x0104); }

matburnham commented 3 years ago

How so @jdliue? The SX1278 datasheet, shows bit 0 as controlling the header mode:

image

IoTThinks commented 3 years ago

@matburnham I think the current source code is correct? 0xfe is 1111 1110. the last bit of the "and" is 0 => explicit mode. 0x01 is 000 0001. The last bit of the "OR" is 1 => implicit mode.

matburnham commented 3 years ago

It certainly appears to be. I was having trouble getting implicit mode to work, but the fault was elsewhere. This was one of a number of red herrings.

IoTThinks commented 3 years ago

Likely somewhere else.

jdliue commented 3 years ago

How so @jdliue? The SX1278 datasheet, shows bit 0 as controlling the header mode:

image

Hi, What I saw was as follow lora_reg After I checked the documentation and found that it was incorrectly quoted from SX1272's datasheet. Thank you for all your replies.