Compare commits
No commits in common. "update-things" and "main" have entirely different histories.
update-thi
...
main
13 changed files with 8 additions and 22 deletions
|
|
@ -1 +0,0 @@
|
|||
adafruit_requests==2.0.5
|
||||
|
|
@ -24,12 +24,8 @@ fi
|
|||
echo "Found device at $device_path"
|
||||
|
||||
echo 'Copying application code...'
|
||||
rsync --verbose --recursive --delete --checksum --times --modify-window=1 \
|
||||
rsync --verbose --recursive --delete --checksum \
|
||||
--include '/._*' --exclude '/.*' \
|
||||
--exclude '/boot_out.txt' --exclude '/settings.toml' --exclude '/lib' \
|
||||
--exclude '/boot_out.txt' --exclude '/settings.toml' \
|
||||
"$project_directory/src/" "$device_path"
|
||||
echo 'Finished copying application code'
|
||||
|
||||
echo 'Installing libraries with circup'
|
||||
circup install --requirement circup_requirements.txt
|
||||
echo 'Finished installing libraries with circup'
|
||||
|
|
|
|||
18
src/code.py
18
src/code.py
|
|
@ -7,17 +7,7 @@ import socketpool
|
|||
import supervisor
|
||||
import wifi
|
||||
|
||||
from adafruit_httpserver.server import Server as HTTPServer
|
||||
from adafruit_httpserver.response import Response
|
||||
|
||||
|
||||
def index(request):
|
||||
u = os.uname()
|
||||
return Response(
|
||||
request,
|
||||
content_type="text/plain",
|
||||
body=f"Hello from {u.machine} running CircuitPython {u.version}!\n",
|
||||
)
|
||||
from adafruit_httpserver.server import HTTPServer
|
||||
|
||||
|
||||
def main() -> None:
|
||||
|
|
@ -34,8 +24,7 @@ def main() -> None:
|
|||
host = str(wifi.radio.ipv4_address)
|
||||
pool = socketpool.SocketPool(wifi.radio)
|
||||
http_server = HTTPServer(pool)
|
||||
http_server.route("/")(index)
|
||||
http_server.start(host, port=80)
|
||||
http_server.start(host, port=80, root_path="public_html")
|
||||
|
||||
ssl_context = ssl.create_default_context()
|
||||
# The Pico is the server and does not require a certificate from the client, so disable
|
||||
|
|
@ -46,8 +35,7 @@ def main() -> None:
|
|||
)
|
||||
tls_pool = TLSServerSocketPool(pool, ssl_context)
|
||||
https_server = HTTPServer(tls_pool)
|
||||
https_server.route("/")(index)
|
||||
https_server.start(host, port=443)
|
||||
https_server.start(host, port=443, root_path="public_html")
|
||||
|
||||
print()
|
||||
print("The web server is listening on:")
|
||||
|
|
|
|||
BIN
src/lib/adafruit_httpserver/__init__.mpy
Executable file
BIN
src/lib/adafruit_httpserver/__init__.mpy
Executable file
Binary file not shown.
BIN
src/lib/adafruit_httpserver/headers.mpy
Executable file
BIN
src/lib/adafruit_httpserver/headers.mpy
Executable file
Binary file not shown.
BIN
src/lib/adafruit_httpserver/methods.mpy
Executable file
BIN
src/lib/adafruit_httpserver/methods.mpy
Executable file
Binary file not shown.
BIN
src/lib/adafruit_httpserver/mime_type.mpy
Executable file
BIN
src/lib/adafruit_httpserver/mime_type.mpy
Executable file
Binary file not shown.
BIN
src/lib/adafruit_httpserver/request.mpy
Executable file
BIN
src/lib/adafruit_httpserver/request.mpy
Executable file
Binary file not shown.
BIN
src/lib/adafruit_httpserver/response.mpy
Executable file
BIN
src/lib/adafruit_httpserver/response.mpy
Executable file
Binary file not shown.
BIN
src/lib/adafruit_httpserver/route.mpy
Executable file
BIN
src/lib/adafruit_httpserver/route.mpy
Executable file
Binary file not shown.
BIN
src/lib/adafruit_httpserver/server.mpy
Executable file
BIN
src/lib/adafruit_httpserver/server.mpy
Executable file
Binary file not shown.
BIN
src/lib/adafruit_httpserver/status.mpy
Executable file
BIN
src/lib/adafruit_httpserver/status.mpy
Executable file
Binary file not shown.
3
src/public_html/index.html
Normal file
3
src/public_html/index.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Hello world · Raspberry Pi Pico W</title>
|
||||
<p>Hello world from Raspberry Pi Pico W!</p>
|
||||
Loading…
Reference in a new issue