From b8b135042f33dfc22098475b28d728e06305881b Mon Sep 17 00:00:00 2001 From: mperino Date: Tue, 16 Nov 2021 08:03:13 -0800 Subject: [PATCH 01/10] Update esp_atcontrol_simpletest.py Changes for Challenger 2040 WIFI board --- examples/esp_atcontrol_simpletest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/esp_atcontrol_simpletest.py b/examples/esp_atcontrol_simpletest.py index d3bb914..258f7cf 100644 --- a/examples/esp_atcontrol_simpletest.py +++ b/examples/esp_atcontrol_simpletest.py @@ -20,7 +20,7 @@ # With a Particle Argon RX = board.ESP_TX TX = board.ESP_RX -resetpin = DigitalInOut(board.ESP_WIFI_EN) +resetpin = DigitalInOut(board.WIFI_RESET) rtspin = DigitalInOut(board.ESP_CTS) uart = busio.UART(TX, RX, timeout=0.1) esp_boot = DigitalInOut(board.ESP_BOOT_MODE) From bc538e84bdc18dfe73b80b5b7799ab6e7f17f326 Mon Sep 17 00:00:00 2001 From: mperino Date: Tue, 16 Nov 2021 08:21:37 -0800 Subject: [PATCH 02/10] Update esp_atcontrol_simpletest.py adding logic to set the initialzations for challenger board --- examples/esp_atcontrol_simpletest.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/examples/esp_atcontrol_simpletest.py b/examples/esp_atcontrol_simpletest.py index 258f7cf..4af0d5e 100644 --- a/examples/esp_atcontrol_simpletest.py +++ b/examples/esp_atcontrol_simpletest.py @@ -17,15 +17,24 @@ raise -# With a Particle Argon -RX = board.ESP_TX -TX = board.ESP_RX -resetpin = DigitalInOut(board.WIFI_RESET) -rtspin = DigitalInOut(board.ESP_CTS) -uart = busio.UART(TX, RX, timeout=0.1) -esp_boot = DigitalInOut(board.ESP_BOOT_MODE) -esp_boot.direction = Direction.OUTPUT -esp_boot.value = True +if board.board_id == challenger_rp2040_wifi: + RX = board.ESP_TX + TX = board.ESP_RX + resetpin = DigitalInOut(board.WIFI_RESET) + rtspin = DigitalInOut(board.ESP_CTS) + uart = busio.UART(TX, RX, timeout=0.1) + esp_boot = DigitalInOut(board.ESP_BOOT_MODE) + esp_boot.direction = Direction.OUTPUT + esp_boot.value = True +else: + RX = board.ESP_TX + TX = board.ESP_RX + resetpin = DigitalInOut(board.ESP_WIFI_EN) + rtspin = DigitalInOut(board.ESP_CTS) + uart = busio.UART(TX, RX, timeout=0.1) + esp_boot = DigitalInOut(board.ESP_BOOT_MODE) + esp_boot.direction = Direction.OUTPUT + esp_boot.value = True print("ESP AT commands") From 7bee8db5074c3cadc0f896331a7318180f5101dc Mon Sep 17 00:00:00 2001 From: mperino Date: Tue, 16 Nov 2021 08:22:31 -0800 Subject: [PATCH 03/10] Update esp_atcontrol_simpletest.py --- examples/esp_atcontrol_simpletest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/esp_atcontrol_simpletest.py b/examples/esp_atcontrol_simpletest.py index 4af0d5e..68cb366 100644 --- a/examples/esp_atcontrol_simpletest.py +++ b/examples/esp_atcontrol_simpletest.py @@ -17,7 +17,7 @@ raise -if board.board_id == challenger_rp2040_wifi: +if board.board_id == "challenger_rp2040_wifi": RX = board.ESP_TX TX = board.ESP_RX resetpin = DigitalInOut(board.WIFI_RESET) From 821248fba2123ea12f9eb336777287c074514667 Mon Sep 17 00:00:00 2001 From: mperino Date: Tue, 16 Nov 2021 08:25:44 -0800 Subject: [PATCH 04/10] Update esp_atcontrol_simpletest.py Oops in 20, adding comment 19 --- examples/esp_atcontrol_simpletest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/esp_atcontrol_simpletest.py b/examples/esp_atcontrol_simpletest.py index 68cb366..3bcd46b 100644 --- a/examples/esp_atcontrol_simpletest.py +++ b/examples/esp_atcontrol_simpletest.py @@ -16,7 +16,7 @@ print("WiFi secrets are kept in secrets.py, please add them there!") raise - +# the default else is the Aragon settings. Add different inits for different boards. if board.board_id == "challenger_rp2040_wifi": RX = board.ESP_TX TX = board.ESP_RX From 7cfeca619e97396dfc44f5c68de193976c01d81b Mon Sep 17 00:00:00 2001 From: mperino Date: Tue, 16 Nov 2021 10:22:45 -0800 Subject: [PATCH 05/10] Update esp_atcontrol_simpletest.py More changes with some comments on what's working and not. AP scan not working for me with challenger yet... --- examples/esp_atcontrol_simpletest.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/examples/esp_atcontrol_simpletest.py b/examples/esp_atcontrol_simpletest.py index 3bcd46b..2bbfa78 100644 --- a/examples/esp_atcontrol_simpletest.py +++ b/examples/esp_atcontrol_simpletest.py @@ -16,14 +16,14 @@ print("WiFi secrets are kept in secrets.py, please add them there!") raise -# the default else is the Aragon settings. Add different inits for different boards. + if board.board_id == "challenger_rp2040_wifi": RX = board.ESP_TX TX = board.ESP_RX resetpin = DigitalInOut(board.WIFI_RESET) - rtspin = DigitalInOut(board.ESP_CTS) - uart = busio.UART(TX, RX, timeout=0.1) - esp_boot = DigitalInOut(board.ESP_BOOT_MODE) +# rtspin = DigitalInOut(board.ESP_CTS) + uart = busio.UART(board.ESP_TX, board.ESP_RX, baudrate=11520) + esp_boot = DigitalInOut(board.WIFI_MODE) esp_boot.direction = Direction.OUTPUT esp_boot.value = True else: @@ -38,8 +38,9 @@ print("ESP AT commands") +# I had to remove the rtspin from the esp bellow to get the challenger_rp2040_wifi to work. esp = adafruit_espatcontrol.ESP_ATcontrol( - uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=False + uart, 115200, reset_pin=resetpin, debug=False ) print("Resetting ESP module") esp.hard_reset() @@ -48,9 +49,10 @@ while True: try: if first_pass: - print("Scanning for AP's") - for ap in esp.scan_APs(): - print(ap) +# I had to comment out scanning for APs as that did not work +# print("Scanning for AP's") +# for ap in esp.scan_APs(): +# print(ap) print("Checking connection...") # secrets dictionary must contain 'ssid' and 'password' at a minimum print("Connecting...") From 59f2c35bc03720d346d06789e404d269eaaecead Mon Sep 17 00:00:00 2001 From: mperino Date: Tue, 16 Nov 2021 11:14:46 -0800 Subject: [PATCH 06/10] Update esp_atcontrol_simpletest.py For some reason the Adafruit code has TX and RX swapped for the default board assignments... Flipped back for challenger.. --- examples/esp_atcontrol_simpletest.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/esp_atcontrol_simpletest.py b/examples/esp_atcontrol_simpletest.py index 2bbfa78..482ba59 100644 --- a/examples/esp_atcontrol_simpletest.py +++ b/examples/esp_atcontrol_simpletest.py @@ -1,3 +1,4 @@ + # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT @@ -18,11 +19,11 @@ if board.board_id == "challenger_rp2040_wifi": - RX = board.ESP_TX - TX = board.ESP_RX + RX = board.ESP_RX + TX = board.ESP_TX resetpin = DigitalInOut(board.WIFI_RESET) -# rtspin = DigitalInOut(board.ESP_CTS) - uart = busio.UART(board.ESP_TX, board.ESP_RX, baudrate=11520) + rtspin = False + uart = busio.UART(TX, RX, baudrate=11520) esp_boot = DigitalInOut(board.WIFI_MODE) esp_boot.direction = Direction.OUTPUT esp_boot.value = True @@ -40,7 +41,7 @@ print("ESP AT commands") # I had to remove the rtspin from the esp bellow to get the challenger_rp2040_wifi to work. esp = adafruit_espatcontrol.ESP_ATcontrol( - uart, 115200, reset_pin=resetpin, debug=False + uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=False ) print("Resetting ESP module") esp.hard_reset() From 2d7aab9203d62012675bde5c8cb9d8c2f6bde2d7 Mon Sep 17 00:00:00 2001 From: mperino Date: Wed, 17 Nov 2021 08:18:39 -0800 Subject: [PATCH 07/10] Update esp_atcontrol_simpletest.py --- examples/esp_atcontrol_simpletest.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/examples/esp_atcontrol_simpletest.py b/examples/esp_atcontrol_simpletest.py index 482ba59..2c509f2 100644 --- a/examples/esp_atcontrol_simpletest.py +++ b/examples/esp_atcontrol_simpletest.py @@ -16,7 +16,9 @@ except ImportError: print("WiFi secrets are kept in secrets.py, please add them there!") raise - +# Debug Level +# Change the Debug Flag if you have issues with AT commands +debugflag=False if board.board_id == "challenger_rp2040_wifi": RX = board.ESP_RX @@ -39,9 +41,9 @@ print("ESP AT commands") -# I had to remove the rtspin from the esp bellow to get the challenger_rp2040_wifi to work. +# For Boards that do not have an rtspin like challenger_rp2040_wifi set rtspin to False. esp = adafruit_espatcontrol.ESP_ATcontrol( - uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=False + uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=debugflag ) print("Resetting ESP module") esp.hard_reset() @@ -50,10 +52,11 @@ while True: try: if first_pass: -# I had to comment out scanning for APs as that did not work -# print("Scanning for AP's") -# for ap in esp.scan_APs(): -# print(ap) +# Some ESP do not return OK on AP Scan. See https://github.com/adafruit/Adafruit_CircuitPython_ESP_ATcontrol/issues/48 +# disable next 3 lines if you get a No OK response to AT+CWLAP + print("Scanning for AP's") + for ap in esp.scan_APs(): + print(ap) print("Checking connection...") # secrets dictionary must contain 'ssid' and 'password' at a minimum print("Connecting...") From 7db6bd956b391e8fccb0ad5c7db08e0262ccf50e Mon Sep 17 00:00:00 2001 From: mperino Date: Wed, 17 Nov 2021 08:47:39 -0800 Subject: [PATCH 08/10] Update esp_atcontrol_aio_post.py added support for challenger 2040 wifi --- examples/esp_atcontrol_aio_post.py | 38 +++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/examples/esp_atcontrol_aio_post.py b/examples/esp_atcontrol_aio_post.py index 68983f3..c81af08 100644 --- a/examples/esp_atcontrol_aio_post.py +++ b/examples/esp_atcontrol_aio_post.py @@ -1,6 +1,9 @@ # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT +# Note, you must create a feed called "test" in your AdafruitIO account. +# Your secrets file must contain your aio_username and aio_key + import time import board import busio @@ -21,21 +24,34 @@ print("WiFi secrets are kept in secrets.py, please add them there!") raise +# Debug Level +# Change the Debug Flag if you have issues with AT commands +debugflag=False -# With a Particle Argon -RX = board.ESP_TX -TX = board.ESP_RX -resetpin = DigitalInOut(board.ESP_WIFI_EN) -rtspin = DigitalInOut(board.ESP_CTS) -uart = busio.UART(TX, RX, timeout=0.1) -esp_boot = DigitalInOut(board.ESP_BOOT_MODE) -esp_boot.direction = Direction.OUTPUT -esp_boot.value = True -status_light = None +if board.board_id == "challenger_rp2040_wifi": + RX = board.ESP_RX + TX = board.ESP_TX + resetpin = DigitalInOut(board.WIFI_RESET) + rtspin = False + uart = busio.UART(TX, RX, baudrate=11520) + esp_boot = DigitalInOut(board.WIFI_MODE) + esp_boot.direction = Direction.OUTPUT + esp_boot.value = True + status_light = None +else: + RX = board.ESP_TX + TX = board.ESP_RX + resetpin = DigitalInOut(board.ESP_WIFI_EN) + rtspin = DigitalInOut(board.ESP_CTS) + uart = busio.UART(TX, RX, timeout=0.1) + esp_boot = DigitalInOut(board.ESP_BOOT_MODE) + esp_boot.direction = Direction.OUTPUT + esp_boot.value = True + status_light = None print("ESP AT commands") esp = adafruit_espatcontrol.ESP_ATcontrol( - uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=False + uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=debugflag ) wifi = adafruit_espatcontrol_wifimanager.ESPAT_WiFiManager(esp, secrets, status_light) From 992d7ad4cfbc15e875a18ccdd54e85ac33d09bac Mon Sep 17 00:00:00 2001 From: mperino Date: Wed, 17 Nov 2021 09:37:25 -0800 Subject: [PATCH 09/10] Update esp_atcontrol_simpletest.py Edit lines to be under 88 for black. --- examples/esp_atcontrol_simpletest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/esp_atcontrol_simpletest.py b/examples/esp_atcontrol_simpletest.py index 2c509f2..1c766e4 100644 --- a/examples/esp_atcontrol_simpletest.py +++ b/examples/esp_atcontrol_simpletest.py @@ -52,8 +52,9 @@ while True: try: if first_pass: -# Some ESP do not return OK on AP Scan. See https://github.com/adafruit/Adafruit_CircuitPython_ESP_ATcontrol/issues/48 -# disable next 3 lines if you get a No OK response to AT+CWLAP +# Some ESP do not return OK on AP Scan. +# See https://github.com/adafruit/Adafruit_CircuitPython_ESP_ATcontrol/issues/48 +# Comment out the next 3 lines if you get a No OK response to AT+CWLAP print("Scanning for AP's") for ap in esp.scan_APs(): print(ap) From 432e086ea96754e2401f904c00756783294b71f6 Mon Sep 17 00:00:00 2001 From: mperino Date: Wed, 17 Nov 2021 09:59:37 -0800 Subject: [PATCH 10/10] more black fixes --- examples/esp_atcontrol_aio_post.py | 4 ++-- examples/esp_atcontrol_simpletest.py | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/esp_atcontrol_aio_post.py b/examples/esp_atcontrol_aio_post.py index c81af08..0696147 100644 --- a/examples/esp_atcontrol_aio_post.py +++ b/examples/esp_atcontrol_aio_post.py @@ -25,8 +25,8 @@ raise # Debug Level -# Change the Debug Flag if you have issues with AT commands -debugflag=False +# Change the Debug Flag if you have issues with AT commands +debugflag = False if board.board_id == "challenger_rp2040_wifi": RX = board.ESP_RX diff --git a/examples/esp_atcontrol_simpletest.py b/examples/esp_atcontrol_simpletest.py index 1c766e4..9c70539 100644 --- a/examples/esp_atcontrol_simpletest.py +++ b/examples/esp_atcontrol_simpletest.py @@ -1,4 +1,3 @@ - # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT @@ -17,8 +16,8 @@ print("WiFi secrets are kept in secrets.py, please add them there!") raise # Debug Level -# Change the Debug Flag if you have issues with AT commands -debugflag=False +# Change the Debug Flag if you have issues with AT commands +debugflag = False if board.board_id == "challenger_rp2040_wifi": RX = board.ESP_RX @@ -52,9 +51,9 @@ while True: try: if first_pass: -# Some ESP do not return OK on AP Scan. -# See https://github.com/adafruit/Adafruit_CircuitPython_ESP_ATcontrol/issues/48 -# Comment out the next 3 lines if you get a No OK response to AT+CWLAP + # Some ESP do not return OK on AP Scan. + # See https://github.com/adafruit/Adafruit_CircuitPython_ESP_ATcontrol/issues/48 + # Comment out the next 3 lines if you get a No OK response to AT+CWLAP print("Scanning for AP's") for ap in esp.scan_APs(): print(ap)