Add set_settings to Settings class

This commit is contained in:
jimmy 2025-05-19 21:59:43 +12:00
parent ec049b52c0
commit 3fa9377438
1 changed files with 2 additions and 3 deletions

View File

@ -2,7 +2,6 @@ from microdot import Microdot, send_file, Response
from microdot.utemplate import Template
from microdot.websocket import with_websocket
import machine
from settings import set_settings
import wifi
import json
@ -26,7 +25,7 @@ def web(settings, patterns):
def settings_handler(request):
# Keep the POST handler for compatibility or alternative usage if needed
# For WebSocket updates, the /ws handler is now primary
return set_settings(request.body.decode('utf-8'), settings, patterns)
return settings.set_settings(request.body.decode('utf-8'), patterns)
@app.route("/ws")
@with_websocket
@ -35,7 +34,7 @@ def web(settings, patterns):
data = await ws.receive()
if data:
# Process the received data
_, status_code = set_settings(data, settings, patterns)
_, status_code = settings.set_settings(data, patterns)
#await ws.send(status_code)
else:
break