nRF24 / RF24Network

OSI Layer 3 Networking for nRF24L01(+) and nRF52x on Arduino and Raspberry Pi
https://nrf24.github.io/RF24Network/
GNU General Public License v2.0
353 stars 163 forks source link

radio.setDataRate( does not seem to be setting anything #213

Closed FlailAway closed 12 months ago

FlailAway commented 1 year ago

RF24Network 2.0.0, Arduino IDE 1.8.19, Linux Mint+MATE 20.1

This is my common setup for all Nodes. But, at the bottom where I print back the actual settings, "DataRate is zero!

What gives? Me or Library? :)

This is in "Setup"

    radioSetup(NODE_ME, PA_LEVEL_HIGH, SPEED_1MB);
//....................9............., 3......................., 1  (dots 'cos git stripped spaces AND indentation with Edit)
This is the function.
  ///////////////////////////////////////////
  void radioSetup(const uint16_t aNode, uint8_t paLevel, uint8_t dataRate) {
    radio.begin();
    radio.setChannel(RADIO_CHANNEL);  // currently 110
//      radio.setAutoAck(true);
//      radio.enableAckPayload();
//      radio.enableDynamicPayloads();
//      radio.setRetries(10,15);      // Max is 15. 0 means 250us, 15 means 4000us.
    switch(paLevel) {
      case 1:
        radio.setPALevel(RF24_PA_MIN);
      break;
      case 2:
        radio.setPALevel(RF24_PA_LOW);
      break;
      case 3:
        radio.setPALevel(RF24_PA_HIGH);
      break;
      case 4:
        radio.setPALevel(RF24_PA_MAX);
      break;
      default:
        radio.setPALevel(RF24_PA_LOW);
      break;
    }
    switch(dataRate) {
      case 1:
        radio.setDataRate(RF24_250KBPS);
      break;
      case 2:
        radio.setDataRate(RF24_1MBPS);
      break;
      case 3:
        radio.setDataRate(RF24_2MBPS);
      break;
      default:
        radio.setDataRate(RF24_1MBPS);
      break;
    }
    network.begin(aNode);
    Serial.print(F("Pin CE "));
    Serial.print(MY_RADIO_CE);
    Serial.print(F(", Pin CSN "));
    Serial.print(MY_RADIO_CSN);
    Serial.print(F(", Channel "));
    Serial.print(radio.getChannel());
    Serial.print(F(", Data Rate "));
    Serial.print(radio.getDataRate());
    Serial.print(F(", PA-Speed "));
    Serial.print(radio.getPALevel());
    Serial.println(F(">"));
  }
2bndy5 commented 1 year ago

Are you using an ebyte module? They reportedly don't allow changing the data rate, but that seems to vary on the ebyte module's model.

2bndy5 commented 1 year ago

dots 'cos git stripped spaces AND indentation with Edit

Github comments use MarkDown syntax. What you're looking for (but the site UI has no button for) is called fenced code blocks.

FlailAway commented 1 year ago

Thanks for the quick reply,

Hasty Edit: DUH!! the Zero is the Enum of the first item that is Zero. Had I changed my preference to "2" it would have displayed "1" and no Panic therein. Sorry.

Thanks for the "fenced code blocks" pointer, but strike-through curly+curly appears to not work in an Edit.

2bndy5 commented 1 year ago

the Zero is the Enum of the first item that is Zero

I had a feeling you had missed that but wasn't sure. Does this mean the issue is resolved?

Also, have you found a solution for your other issue (nRF24/RF24#909)? I ask because github isn't reddit; we like to close issues if somehow resolved or become very old/stale.


As for the MD syntax, I ~don't~ rarely use the UI buttons. I have become accustomed to writing directly in MarkDown 😜. BTW, I have found that the UI in the GitHub mobile app is better than the site's UI.

FlailAway commented 12 months ago

BTW, I have found that the UI in the GitHub mobile app

{grin} You City folk get it easy. We have no cell coverage out here in the boonies where we farm to feed the City folk.

I will close this issue due to operator error

The other issue I think is an Octal-Node-numbering thing. I will jump over to that thread to explain.