@@ -150,7 +150,7 @@ def __init__(
150
150
is_dhcp : bool = True ,
151
151
mac : Union [List [int ], Tuple [int ]] = DEFAULT_MAC ,
152
152
hostname : Optional [str ] = None ,
153
- dhcp_timeout : float = 30 ,
153
+ dhcp_timeout : float = 30.0 ,
154
154
debug : bool = False ,
155
155
) -> None :
156
156
"""
@@ -162,7 +162,7 @@ def __init__(
162
162
(0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED).
163
163
:param str hostname: The desired hostname, with optional {} to fill in the MAC
164
164
address, defaults to None.
165
- :param float dhcp_timeout: Timeout in seconds for DHCP response, defaults to 30.
165
+ :param float dhcp_timeout: Timeout in seconds for DHCP response, defaults to 30.0.
166
166
:param bool debug: Enable debugging output, defaults to False.
167
167
"""
168
168
self ._debug = debug
@@ -406,7 +406,6 @@ def remote_port(self, socket_num: int) -> Union[int, bytearray]:
406
406
407
407
:return Union[int, bytearray]: The port number of the socket connection.
408
408
"""
409
- # TODO: why return the buffer?
410
409
if socket_num >= self .max_sockets :
411
410
return self ._pbuff
412
411
for octet in range (2 ):
@@ -439,7 +438,6 @@ def ifconfig(
439
438
:params Tuple[bytearray, bytearray, bytearray, Tuple[int, int, int, int]]: \
440
439
Configuration settings - (ip_address, subnet_mask, gateway_address, dns_server).
441
440
"""
442
- # TODO: Might be better if params can be str as well
443
441
ip_address , subnet_mask , gateway_address , dns_server = params
444
442
445
443
self .write (REG_SIPR , 0x04 , ip_address )
@@ -455,7 +453,6 @@ def _w5100_init(self) -> int:
455
453
:return int: 1 if the initialization succeeds, 0 if it fails.
456
454
"""
457
455
time .sleep (1 )
458
- # TODO: Isn't the CS pin initialized in busio?
459
456
self ._cs .switch_to_output ()
460
457
self ._cs .value = 1
461
458
@@ -525,7 +522,6 @@ def sw_reset(self) -> int:
525
522
526
523
:return int: 0 if the reset succeeds, -1 if not.
527
524
"""
528
- # TODO: mode_reg appears to be unused, maybe self._read_mr starts the reset?
529
525
mode_reg = self ._read_mr ()
530
526
self ._write_mr (0x80 )
531
527
mode_reg = self ._read_mr ()
@@ -589,7 +585,6 @@ def write(
589
585
:param int callback: Callback reference.
590
586
:param Union[int, Sequence[Union[int, bytes]]] data: Data to write to the register address.
591
587
"""
592
- # TODO: Call with int means an error in a previous function
593
588
with self ._device as bus_device :
594
589
if self ._chip_type == "w5500" :
595
590
bus_device .write (bytes ([addr >> 8 ])) # pylint: disable=no-member
@@ -688,7 +683,7 @@ def socket_connect(
688
683
# initialize a socket and set the mode
689
684
res = self .socket_open (socket_num , conn_mode = conn_mode )
690
685
if res == 1 :
691
- raise RuntimeError ("Failed to initalize a connection with the socket." )
686
+ raise RuntimeError ("Failed to initialize a connection with the socket." )
692
687
693
688
# set socket destination IP and port
694
689
self ._write_sndipr (socket_num , dest )
@@ -758,7 +753,7 @@ def socket_listen(
758
753
res = self .socket_open (socket_num , conn_mode = conn_mode )
759
754
self .src_port = 0
760
755
if res == 1 :
761
- raise RuntimeError ("Failed to initalize the socket." )
756
+ raise RuntimeError ("Failed to initialize the socket." )
762
757
# Send listen command
763
758
self ._send_socket_cmd (socket_num , CMD_SOCK_LISTEN )
764
759
# Wait until ready
@@ -979,7 +974,7 @@ def socket_write(
979
974
assert socket_num <= self .max_sockets , "Provided socket exceeds max_sockets."
980
975
status = 0
981
976
ret = 0
982
- free_size = 0 # TODO: Bug report
977
+ free_size = 0
983
978
if len (buffer ) > SOCK_SIZE :
984
979
ret = SOCK_SIZE
985
980
else :
@@ -1020,7 +1015,7 @@ def socket_write(
1020
1015
dst_addr = socket_num * SOCK_SIZE + 0x4000
1021
1016
self .write (dst_addr , 0x00 , txbuf )
1022
1017
else :
1023
- txbuf = buffer [:ret ] # TODO: Bug report
1018
+ txbuf = buffer [:ret ]
1024
1019
self .write (dst_addr , 0x00 , buffer [:ret ])
1025
1020
1026
1021
# update sn_tx_wr to the value + data size
@@ -1153,5 +1148,4 @@ def _read_socket(self, sock: int, address: int) -> Optional[bytearray]: # *1
1153
1148
if self ._chip_type == "w5100s" :
1154
1149
cntl_byte = 0
1155
1150
return self .read (self ._ch_base_msb + sock * CH_SIZE + address , cntl_byte )
1156
- # TODO: If the chip is not supported, this should raise an exception.
1157
1151
return None
0 commit comments