Skip to content

Commit aa96dd1

Browse files
committed
pylint
1 parent f437871 commit aa96dd1

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

adafruit_esp32spi/adafruit_esp32spi.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -697,11 +697,11 @@ def socket_write(self, socket_num, buffer, conn_mode=TCP_MODE):
697697
print("Writing:", buffer)
698698
self._socknum_ll[0][0] = socket_num
699699
sent = 0
700-
totalChunks = (len(buffer) // 64) + 1
700+
total_chunks = (len(buffer) // 64) + 1
701701
send_command = _SEND_DATA_TCP_CMD
702-
if conn_mode == UDP_MODE: # UDP requires a different command to write
702+
if conn_mode == self.UDP_MODE: # UDP requires a different command to write
703703
send_command = _INSERT_DATABUF_TCP_CMD
704-
for chunk in range(totalChunks):
704+
for chunk in range(total_chunks):
705705
resp = self._send_command_get_response(
706706
send_command,
707707
(
@@ -712,11 +712,11 @@ def socket_write(self, socket_num, buffer, conn_mode=TCP_MODE):
712712
)
713713
sent += resp[0][0]
714714

715-
if conn_mode == UDP_MODE:
715+
if conn_mode == self.UDP_MODE:
716716
# UDP verifies chunks on write, not bytes
717-
if sent != totalChunks:
717+
if sent != total_chunks:
718718
raise RuntimeError(
719-
"Failed to write %d chunks (sent %d)" % (totalChunks, sent)
719+
"Failed to write %d chunks (sent %d)" % (total_chunks, sent)
720720
)
721721
# UDP needs to finalize with this command, does the actual sending
722722
resp = self._send_command_get_response(_SEND_UDP_DATA_CMD, self._socknum_ll)
@@ -766,10 +766,11 @@ def socket_connect(self, socket_num, dest, port, conn_mode=TCP_MODE):
766766
print("*** Socket connect mode", conn_mode)
767767

768768
self.socket_open(socket_num, dest, port, conn_mode=conn_mode)
769-
if conn_mode == UDP_MODE:
769+
if conn_mode == self.UDP_MODE:
770770
# UDP doesn't actually establish a connection
771771
# but the socket for writing is created via start_server
772772
self.start_server(port, socket_num, conn_mode)
773+
return True
773774
else:
774775
times = time.monotonic()
775776
while (time.monotonic() - times) < 3: # wait 3 seconds

0 commit comments

Comments
 (0)