Skip to content

Commit 98cfc0e

Browse files
committed
Add set_esp_debug command to enable debugging on the ESP32.
1 parent 607697c commit 98cfc0e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

adafruit_esp32spi/adafruit_esp32spi.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
# pylint: disable=bad-whitespace
5555
_SET_NET_CMD = const(0x10)
5656
_SET_PASSPHRASE_CMD = const(0x11)
57+
_SET_DEBUG_CMD = const(0x1A)
5758

5859
_GET_CONN_STATUS_CMD = const(0x20)
5960
_GET_IPADDR_CMD = const(0x21)
@@ -611,3 +612,10 @@ def socket_close(self, socket_num):
611612
resp = self._send_command_get_response(_STOP_CLIENT_TCP_CMD, self._socknum_ll)
612613
if resp[0][0] != 1:
613614
raise RuntimeError("Failed to close socket")
615+
616+
def set_esp_debug(self, enabled):
617+
"""Enable/disable debug mode on the ESP32. Debug messages will be
618+
written to the ESP32's UART."""
619+
resp = self._send_command_get_response(_SET_DEBUG_CMD, ((bool(enabled),),))
620+
if resp[0][0] != 1:
621+
raise RuntimeError("Failed to set debug mode")

0 commit comments

Comments
 (0)