@@ -1198,7 +1198,7 @@ void RF24::stopListening(void)
1198
1198
void RF24::stopListening (const uint8_t * tx_address)
1199
1199
{
1200
1200
memcpy (txAddress, tx_address, addr_width);
1201
- startListening ();
1201
+ stopListening ();
1202
1202
write_register (TX_ADDR, txAddress, addr_width);
1203
1203
}
1204
1204
@@ -1606,12 +1606,12 @@ void RF24::openReadingPipe(uint8_t child, uint64_t address)
1606
1606
1607
1607
if (child <= 5 ) {
1608
1608
// For pipes 2-5, only write the LSB
1609
- if (child < 2 ) {
1610
- write_register (pgm_read_byte (&child_pipe[child]), reinterpret_cast <const uint8_t *>(&address), addr_width);
1611
- }
1612
- else {
1609
+ if (child > 1 ) {
1613
1610
write_register (pgm_read_byte (&child_pipe[child]), reinterpret_cast <const uint8_t *>(&address), 1 );
1614
1611
}
1612
+ else if (static_cast <bool >(config_reg & _BV (PRIM_RX)) || child != 0 ) {
1613
+ write_register (pgm_read_byte (&child_pipe[child]), reinterpret_cast <const uint8_t *>(&address), addr_width);
1614
+ }
1615
1615
1616
1616
// Note it would be more efficient to set all of the bits for all open
1617
1617
// pipes at once. However, I thought it would make the calling code
@@ -1648,12 +1648,12 @@ void RF24::openReadingPipe(uint8_t child, const uint8_t* address)
1648
1648
}
1649
1649
if (child <= 5 ) {
1650
1650
// For pipes 2-5, only write the LSB
1651
- if (child < 2 ) {
1652
- write_register (pgm_read_byte (&child_pipe[child]), address, addr_width);
1653
- }
1654
- else {
1651
+ if (child > 1 ) {
1655
1652
write_register (pgm_read_byte (&child_pipe[child]), address, 1 );
1656
1653
}
1654
+ else if (static_cast <bool >(config_reg & _BV (PRIM_RX)) || child != 0 ) {
1655
+ write_register (pgm_read_byte (&child_pipe[child]), address, addr_width);
1656
+ }
1657
1657
1658
1658
// Note it would be more efficient to set all of the bits for all open
1659
1659
// pipes at once. However, I thought it would make the calling code
0 commit comments