autocommit
This commit is contained in:
@@ -34,7 +34,7 @@ case "$COMMAND" in
|
|||||||
;;
|
;;
|
||||||
logs)
|
logs)
|
||||||
echo -e "\033[94m[INFO]\033[0m Reading $SERVICE_NAME logs..."
|
echo -e "\033[94m[INFO]\033[0m Reading $SERVICE_NAME logs..."
|
||||||
ssh ${REMOTE_USER}@${REMOTE_HOST} "tail -f -n 100 /home/uad/tello-commander/src/server/supervisor/tello-server.out.log"
|
ssh ${REMOTE_USER}@${REMOTE_HOST} "tail -f -n 100 /home/uad/tello-commander/src/server/supervisor/tello-server.out.log | sed -e 's/ERROR/\x1b[31m&\x1b[0m/g' -e 's/WARN/\x1b[33m&\x1b[0m/g' -e 's/INFO/\x1b[94m&\x1b[0m/g'"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "\033[31m[ERROR]\033[0m Invalid command!"
|
echo -e "\033[31m[ERROR]\033[0m Invalid command!"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import os
|
|||||||
|
|
||||||
from fastapi import Request, APIRouter
|
from fastapi import Request, APIRouter
|
||||||
from fastapi.responses import HTMLResponse
|
from fastapi.responses import HTMLResponse
|
||||||
|
from loguru import logger
|
||||||
from starlette.templating import Jinja2Templates
|
from starlette.templating import Jinja2Templates
|
||||||
|
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ async def webui(request: Request):
|
|||||||
|
|
||||||
@router.get("/reconnect")
|
@router.get("/reconnect")
|
||||||
async def reconnect(request: Request):
|
async def reconnect(request: Request):
|
||||||
|
logger.debug("Reconnecting to tello")
|
||||||
request.app.state.shared_state["connection"] = "NOK"
|
request.app.state.shared_state["connection"] = "NOK"
|
||||||
return {"message": "connection state set to NOK"}
|
return {"message": "connection state set to NOK"}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ async def collect_flight_stats(state):
|
|||||||
state["command"] = True
|
state["command"] = True
|
||||||
# Continuously collect stats and update shared state
|
# Continuously collect stats and update shared state
|
||||||
if state["connection"] not in ("genesis", "NOK"):
|
if state["connection"] not in ("genesis", "NOK"):
|
||||||
logger.debug(f"Connection state: {state['connection']}")
|
#logger.debug(f"Connection state: {state['connection']}")
|
||||||
await asyncio.sleep(0.2)
|
await asyncio.sleep(0.2)
|
||||||
try:
|
try:
|
||||||
bat = await asyncio.to_thread(tello.get_battery)
|
bat = await asyncio.to_thread(tello.get_battery)
|
||||||
@@ -67,7 +67,7 @@ async def collect_flight_stats(state):
|
|||||||
logger.error(te)
|
logger.error(te)
|
||||||
# search for any response if disconnected
|
# search for any response if disconnected
|
||||||
else:
|
else:
|
||||||
if counter % 10 == 0:
|
if counter % 30 == 0:
|
||||||
logger.warning("skipping stats collection")
|
logger.warning("skipping stats collection")
|
||||||
counter += 1
|
counter += 1
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user