Some refactoring
This commit is contained in:
parent
c8d892ced3
commit
fcab8ac473
12
main.py
12
main.py
|
|
@ -1,4 +1,4 @@
|
|||
from fastapi import FastAPI, HTTPException, Query, Form, Depends
|
||||
from fastapi import FastAPI, HTTPException, Form
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.responses import HTMLResponse, RedirectResponse, JSONResponse
|
||||
import logging
|
||||
|
|
@ -11,7 +11,7 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
|
|||
from starlette.status import HTTP_302_FOUND
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Optional, Dict, Any
|
||||
from typing import Dict, Any
|
||||
from fastapi import Query
|
||||
import asyncio
|
||||
import datetime
|
||||
|
|
@ -19,9 +19,7 @@ import csv
|
|||
from collections import deque
|
||||
import numpy as np
|
||||
import aiohttp
|
||||
import httpx
|
||||
import time
|
||||
from patient_skid_functions import handle_patient_skid_for_idle, set_patient_skid_users
|
||||
from hardware.patient_skid import handle_patient_skid_for_idle, set_patient_skid_users
|
||||
|
||||
from serial_manager import SerialConfig, SerialStore, SerialReader
|
||||
from protocol_decoder import decode_frames
|
||||
|
|
@ -31,7 +29,7 @@ if platform.system() in ["Darwin"]: # macOS or Windows
|
|||
from MockCAN import CANBackend
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
else:
|
||||
from classCAN import CANBackend # Your real backend
|
||||
from hardware.classCAN import CANBackend # Your real backend
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
logging.getLogger("uvicorn.access").setLevel(logging.WARNING)
|
||||
|
|
@ -289,7 +287,6 @@ def expand_pu_number(pu_number: int) -> list[int]:
|
|||
return [pu_number] if pu_number != 3 else [1, 2]
|
||||
|
||||
|
||||
|
||||
def send_command_to_pu(
|
||||
pu: int, state: str, ploop_setpoint: float, qperm_setpoint: float
|
||||
) -> dict:
|
||||
|
|
@ -493,7 +490,6 @@ async def set_patients_with_delay(count: int, delay_s: int):
|
|||
logging.info(f"[AUTO TEST] Sending {count} patients to patient skid after {delay_s}s")
|
||||
set_patient_skid_users(count)
|
||||
|
||||
from fastapi import Query, Path
|
||||
|
||||
@router.post("/test/auto/{pu_number}")
|
||||
async def auto_test(pu_number: int ):
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user