Skip to content

Commit

Permalink
Fix inconsistencies:
Browse files Browse the repository at this point in the history
- Add ipv4_address to match native wifi and esp32spi
- Fix recvfrom_into to return the correct address info
  • Loading branch information
justmobilize committed Jun 6, 2024
1 parent 931299b commit 2885a4d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions adafruit_wiznet5k/adafruit_wiznet5k.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,16 @@ def ip_address(self) -> bytes:
"""
return self._read(_REG_SIPR[self._chip_type], 0x00, 4)

@property
def ipv4_address(self) -> bytes:
"""
Configured IP address for the WIZnet Ethernet hardware.
:return str: The IP address (a string of the form '255.255.255.255')
"""
return self.pretty_ip(self.ip_address)


@staticmethod
def pretty_ip(ipv4: bytes) -> str:
"""
Expand Down
4 changes: 2 additions & 2 deletions adafruit_wiznet5k/adafruit_wiznet5k_socketpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,8 @@ def recvfrom_into( # pylint: disable=unused-argument
return (
self.recv_into(buffer, nbytes),
(
self._interface.remote_ip(self._socknum),
self._interface.remote_port(self._socknum),
self._interface.pretty_ip(self._interface.udp_from_ip[self._socknum]),
self._interface.udp_from_port[self._socknum],
),
)

Expand Down

0 comments on commit 2885a4d

Please sign in to comment.