Closed
Description
CircuitPython version
Adafruit Circuitpython 7.0 latest and master (yeah I compiled master branch)
Code/REPL
import time
import board
import busio
from digitalio import DigitalInOut
import adafruit_requests as requests
import adafruit_esp32spi.adafruit_esp32spi_socket as socket
from adafruit_esp32spi import adafruit_esp32spi
import neopixel
from rainbowio import colorwheel
import gc
from secrets import secrets
UDP_IN_ADDR="192.168.2.147"
UDP_IN_PORT = 5500
UDP_TIMEOUT = 20
esp32_cs = DigitalInOut(board.CS1)
esp32_ready = DigitalInOut(board.ESP_BUSY)
esp32_reset = DigitalInOut(board.ESP_RESET)
spi = busio.SPI(board.SCK1, board.MOSI1, board.MISO1)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
socket.set_interface(esp)
s_in = socket.socket(type=socket.SOCK_DGRAM)
s_in.settimeout(UDP_TIMEOUT)
if esp.status == adafruit_esp32spi.WL_IDLE_STATUS:
print("ESP32 found and in idle mode")
print("Firmware vers.", esp.firmware_version)
print("MAC addr:", [hex(i) for i in esp.MAC_address])
print("Connecting to AP...")
while not esp.is_connected:
try:
esp.connect_AP(secrets["ssid"], secrets["password"])
except RuntimeError as e:
print("could not connect to AP, retrying: ", e)
continue
print("Connected to", str(esp.ssid, "utf-8"), "\tRSSI:", esp.rssi)
time.sleep(1)
IP_ADDR = esp.pretty_ip(esp.ip_address)
print("ip:", esp.ip_address)
print("My IP address is", esp.pretty_ip(esp.ip_address))
print("udp in addr: ", UDP_IN_ADDR, UDP_IN_PORT)
Behavior
The interface is missing the ifconfig to set a static IP adress:
esp.ifconfig = (IP_ADDRESS, SUBNET_MASK, GATEWAY_ADDRESS, DNS_SERVER)
this is critical for people wanting to use this device with circtuitpython to atleast be able to set a static IP, otherwise the DHCP will renew the IP adress from time to time.
I tested OpenMV micropython and their ifconfig works like a charm so its not the wifi chip, its the circtuitpython interface thats missing this.
Description
No response
Additional information
No response
Metadata
Metadata
Assignees
Labels
No labels