Skip to content

Commit

Permalink
improvment:
Browse files Browse the repository at this point in the history
when HPAI is 0 until now the stack could not answer (sendbyte unicast fail) due to addr = 0.
not the remoteIP and remotePort are used, when addr = 0.

This may also fix OpenKNX/OAM-IP-Router#6
  • Loading branch information
Ing-Dom committed Feb 11, 2024
1 parent ba3133a commit a2df638
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rp2040_arduino_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ int RP2040ArduinoPlatform::readBytesMultiCast(uint8_t* buffer, uint16_t maxLen)
}

_udp.read(buffer, len);
_remoteIP = _udp.remoteIP();
_remotePort = _udp.remotePort();

// print("Remote IP: ");
// print(_udp.remoteIP().toString().c_str());
Expand All @@ -349,7 +351,12 @@ int RP2040ArduinoPlatform::readBytesMultiCast(uint8_t* buffer, uint16_t maxLen)
bool RP2040ArduinoPlatform::sendBytesUniCast(uint32_t addr, uint16_t port, uint8_t* buffer, uint16_t len)
{
IPAddress ucastaddr(htonl(addr));

if(!addr)
ucastaddr = _remoteIP;

if(!port)
port = _remotePort;
// print("sendBytesUniCast to:");
// println(ucastaddr.toString().c_str());

Expand Down
3 changes: 3 additions & 0 deletions src/rp2040_arduino_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ class RP2040ArduinoPlatform : public ArduinoPlatform
#endif
protected: pin_size_t _rxPin = UART_PIN_NOT_DEFINED;
protected: pin_size_t _txPin = UART_PIN_NOT_DEFINED;

protected: IPAddress _remoteIP = 0;
protected: uint16_t _remotePort = 0;
};

#endif

0 comments on commit a2df638

Please sign in to comment.