Commit 31441e7 1 parent c69e622 commit 31441e7 Copy full SHA for 31441e7
File tree 1 file changed +10
-5
lines changed
core/services/ardupilot_manager/mavlink_proxy
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
import re
2
2
import subprocess
3
- from datetime import datetime
4
3
from typing import Optional
5
4
6
- from mavlink_proxy .AbstractRouter import AbstractRouter
5
+ from mavlink_proxy .AbstractRouter import AbstractRouter , TLogCondition
7
6
from mavlink_proxy .Endpoint import Endpoint , EndpointType
8
7
9
8
@@ -38,9 +37,15 @@ def convert_endpoint(endpoint: Endpoint) -> str:
38
37
return f"zenoh:{ endpoint .place } :{ endpoint .argument } "
39
38
raise ValueError (f"Endpoint of type { endpoint .connection_type } not supported on MAVLink-Server." )
40
39
41
- # MAVlink-Server takes direct file paths as endpoints, so we generate a timestamped file path
42
- now = datetime .now ().strftime ("%Y-%m-%d-%H-%M-%S" )
43
- logging_endpoint = f"tlogwriter:/root/.config/ardupilot-manager/firmware/logs/mavlink-server-{ now } .tlog"
40
+ def convert_tlog_condition (tlog_condition : TLogCondition ) -> str :
41
+ match tlog_condition :
42
+ case TLogCondition .Always :
43
+ return "?when=always"
44
+ case TLogCondition .WhileArmed :
45
+ return "?when=while_armed"
46
+
47
+ tlog_condition_arg = convert_tlog_condition (self .tlog_condition ())
48
+ logging_endpoint = f"tlogwriter://{ self .logdir ()} { tlog_condition_arg } "
44
49
str_endpoints = [convert_endpoint (endpoint ) for endpoint in [master_endpoint , * self .endpoints ()]]
45
50
endpoints = " " .join ([* str_endpoints , logging_endpoint ])
46
51
You can’t perform that action at this time.
0 commit comments