Browse Source

Reorganisation

Add pyportal-controller "sub-project"
master
Pierrick C 2 years ago
parent
commit
9fc6f5f94f
  1. 1
      .gitignore
  2. BIN
      pyportal-controller/lib/adafruit_esp32spi/PWMOut.mpy
  3. BIN
      pyportal-controller/lib/adafruit_esp32spi/adafruit_esp32spi.mpy
  4. BIN
      pyportal-controller/lib/adafruit_esp32spi/adafruit_esp32spi_socket.mpy
  5. BIN
      pyportal-controller/lib/adafruit_esp32spi/adafruit_esp32spi_wifimanager.mpy
  6. BIN
      pyportal-controller/lib/adafruit_esp32spi/adafruit_esp32spi_wsgiserver.mpy
  7. BIN
      pyportal-controller/lib/adafruit_esp32spi/digitalio.mpy
  8. BIN
      pyportal-controller/lib/adafruit_requests.mpy
  9. 46
      pyportal-controller/main.py
  10. 0
      station-esp8266/config_template.py
  11. 0
      station-esp8266/lib-src/adafruit_max31865.py
  12. 0
      station-esp8266/lib-src/bme280_i2c.py
  13. 0
      station-esp8266/lib-src/umqtt/robust.py
  14. 0
      station-esp8266/lib-src/umqtt/simple.py
  15. 0
      station-esp8266/lib/adafruit_max31865.mpy
  16. 0
      station-esp8266/lib/bme280_i2c.mpy
  17. 0
      station-esp8266/lib/umqtt/robust.mpy
  18. 0
      station-esp8266/lib/umqtt/simple.mpy
  19. 0
      station-esp8266/main.py

1
.gitignore

@ -1,2 +1,3 @@
config.py
*~
.ropeproject*

BIN
pyportal-controller/lib/adafruit_esp32spi/PWMOut.mpy

BIN
pyportal-controller/lib/adafruit_esp32spi/adafruit_esp32spi.mpy

BIN
pyportal-controller/lib/adafruit_esp32spi/adafruit_esp32spi_socket.mpy

BIN
pyportal-controller/lib/adafruit_esp32spi/adafruit_esp32spi_wifimanager.mpy

BIN
pyportal-controller/lib/adafruit_esp32spi/adafruit_esp32spi_wsgiserver.mpy

BIN
pyportal-controller/lib/adafruit_esp32spi/digitalio.mpy

BIN
pyportal-controller/lib/adafruit_requests.mpy

46
pyportal-controller/main.py

@ -0,0 +1,46 @@
import board
import busio
from digitalio import DigitalInOut
import adafruit_esp32spi.adafruit_esp32spi_socket as socket
from adafruit_esp32spi import adafruit_esp32spi
import adafruit_requests as requests
import config
# If you are using a board with pre-defined ESP32 Pins:
esp32_cs = DigitalInOut(board.ESP_CS)
esp32_ready = DigitalInOut(board.ESP_BUSY)
esp32_reset = DigitalInOut(board.ESP_RESET)
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
requests.set_socket(socket, esp)
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...")
def WifiConnect(ssid, psk):
"""Connect to the wifi with given credentials."""
nets = esp.scan_networks()
for net in nets:
net_ssid = net['ssid']
if net_ssid == bytearray(ssid):
print('Network found!')
esp.connect_AP(net_ssid, psk)
while not esp.is_connected:
machine.idle() # save power while waiting
print('WLAN connection succeeded!')
break
if not esp.is_connected:
print("WLAN not found/not connected")
WifiConnect(config.WIFI_SSID, config.WIFI_PSK)
print("Connected to", str(esp.ssid, "utf-8"), "\tRSSI:", esp.rssi)
print("My IP address is", esp.pretty_ip(esp.ip_address))

0
code/config_template.py → station-esp8266/config_template.py

0
code/lib-src/adafruit_max31865.py → station-esp8266/lib-src/adafruit_max31865.py

0
code/lib-src/bme280_i2c.py → station-esp8266/lib-src/bme280_i2c.py

0
code/lib-src/umqtt/robust.py → station-esp8266/lib-src/umqtt/robust.py

0
code/lib-src/umqtt/simple.py → station-esp8266/lib-src/umqtt/simple.py

0
code/lib/adafruit_max31865.mpy → station-esp8266/lib/adafruit_max31865.mpy

0
code/lib/bme280_i2c.mpy → station-esp8266/lib/bme280_i2c.mpy

0
code/lib/umqtt/robust.mpy → station-esp8266/lib/umqtt/robust.mpy

0
code/lib/umqtt/simple.mpy → station-esp8266/lib/umqtt/simple.mpy

0
code/main.py → station-esp8266/main.py

Loading…
Cancel
Save