audio fixes attempt
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import secrets
|
||||
from fastapi import APIRouter, HTTPException, Depends
|
||||
from fastapi import APIRouter, HTTPException, Depends, Query
|
||||
from app.models import CommandPayload
|
||||
from app.internal import firestore as fstore
|
||||
from app.internal.mqtt_handler import mqtt_handler
|
||||
@@ -93,7 +93,12 @@ async def reissue_node_key(node_id: str, _: dict = Depends(require_admin_token))
|
||||
|
||||
|
||||
@router.post("/{node_id}/config/{system_id}")
|
||||
async def assign_system(node_id: str, system_id: str):
|
||||
async def assign_system(
|
||||
node_id: str,
|
||||
system_id: str,
|
||||
hardware_preset: str = Query("rtl-sdr-v3"),
|
||||
ppm_override: float = Query(None),
|
||||
):
|
||||
"""
|
||||
Assign a system to a node. Fetches the system config from Firestore
|
||||
and pushes it to the node via MQTT, then marks the node as configured.
|
||||
@@ -106,13 +111,22 @@ async def assign_system(node_id: str, system_id: str):
|
||||
if not system:
|
||||
raise HTTPException(404, f"System '{system_id}' not found.")
|
||||
|
||||
# Push config to the node via MQTT
|
||||
mqtt_handler.push_config(node_id, system)
|
||||
# Include hardware preset in the push so the edge node applies it when
|
||||
# generating the OP25 config. Strip it from the system doc first so it
|
||||
# doesn't collide with SystemConfig field validation on the node side.
|
||||
push_payload = {**system, "hardware_preset": hardware_preset}
|
||||
if ppm_override is not None:
|
||||
push_payload["ppm_override"] = ppm_override
|
||||
mqtt_handler.push_config(node_id, push_payload)
|
||||
|
||||
# Update Firestore
|
||||
await fstore.doc_update("nodes", node_id, {
|
||||
node_updates = {
|
||||
"assigned_system_id": system_id,
|
||||
"configured": True,
|
||||
})
|
||||
"hardware_preset": hardware_preset,
|
||||
}
|
||||
if ppm_override is not None:
|
||||
node_updates["ppm_override"] = ppm_override
|
||||
await fstore.doc_update("nodes", node_id, node_updates)
|
||||
|
||||
return {"ok": True}
|
||||
|
||||
Reference in New Issue
Block a user