Skip to content
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

openReadingPipe() is limited to two nodes #33

Open
MarkusHaberzettl opened this issue Jan 22, 2017 · 0 comments
Open

openReadingPipe() is limited to two nodes #33

MarkusHaberzettl opened this issue Jan 22, 2017 · 0 comments

Comments

@MarkusHaberzettl
Copy link

Hi,

I tried to register two listening-nodes with openReadingPipe().
This raised an "Invalid Address Lenght"-error, even though registering multiple listening-nodes should be possible.

The error is raised in line 625 of the nrf24.py:

def openReadingPipe(self, pipe, address):
        if pipe >= 6:
            raise RuntimeError("Invalid pipe number")
        if (pipe >= 2 and len(address) > 1) or len(address) > 5:
            raise RuntimeError("Invalid adress length") # -> Error occurs here

The if-condition here prevents any openReadingPipe(2, ..) till openReadinPipe(5, ...).
But why? In maniacbugs original NRF24-library there is no such restriction

void RF24::openReadingPipe(uint8_t child, uint64_t address)
{
  if (child == 0){
    memcpy(pipe0_reading_address,&address,addr_width);
  }
  if (child <= 6)
  {
    if ( child < 2 )
      write_register(pgm_read_byte(&child_pipe[child]), reinterpret_cast<const uint8_t*>(&address), addr_width);
//--------------- Here is the Relevant Line:
    else
      write_register(pgm_read_byte(&child_pipe[child]), reinterpret_cast<const uint8_t*>(&address), 1);

    write_register(pgm_read_byte(&child_payload_size[child]),payload_size);

    write_register(EN_RXADDR,read_register(EN_RXADDR) | _BV(pgm_read_byte(&child_pipe_enable[child])));
  }
}

Is there a reason for your restriction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant