Added return values for each endpoint

This commit is contained in:
Maximilian Giller 2024-05-02 18:03:44 +02:00
parent 10255b966b
commit dd3264365c

View file

@ -68,6 +68,7 @@ async def add_weight(tl: int, tr: int, bl: int, br: int):
sum = tl + tr + bl + br
add_line_to_history(f"{str(datetime.now())};{tl};{tr};{bl};{br};{sum};")
return "Added data"
@router.post("/latest")
@ -87,6 +88,7 @@ async def get_latest():
@router.post("/delete", tags=["file"])
async def delete_file():
os.remove(file_path)
return "Deleted file"
@router.post("/zero", tags=["calibration"])
@ -97,12 +99,14 @@ async def set_zero():
)
global zero_values
zero_values = latest_values
return "Set zeroes to: " + " | ".join(str(v) for v in zero_values)
@router.post("/scales", tags=["calibration"])
async def set_scales(tl: float, tr: float, bl: float, br: float):
global scale_values
scale_values = [tl, tr, bl, br]
return "Set zeroes to: " + " | ".join(str(v) for v in scale_values)
if not os.path.exists(file_path):