File tree 1 file changed +11
-4
lines changed
core/services/ardupilot_manager/mavlink_proxy
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 3
3
from datetime import datetime
4
4
from typing import Optional
5
5
6
- from mavlink_proxy .AbstractRouter import AbstractRouter
6
+ from mavlink_proxy .AbstractRouter import AbstractRouter , TLogCondition
7
7
from mavlink_proxy .Endpoint import Endpoint , EndpointType
8
8
9
9
@@ -38,9 +38,16 @@ def convert_endpoint(endpoint: Endpoint) -> str:
38
38
return f"zenoh:{ endpoint .place } :{ endpoint .argument } "
39
39
raise ValueError (f"Endpoint of type { endpoint .connection_type } not supported on MAVLink-Server." )
40
40
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"
41
+ def convert_tlog_condition (tlog_condition : TLogCondition ) -> str :
42
+ match tlog_condition :
43
+ case TLogCondition .Always :
44
+ return "?when=always"
45
+ case TLogCondition .WhileArmed :
46
+ return "?when=while_armed"
47
+ return ""
48
+
49
+ tlog_condition_arg = convert_tlog_condition (self .tlog_condition ())
50
+ logging_endpoint = f"tlogwriter://{ self .logdir ()} { tlog_condition_arg } "
44
51
str_endpoints = [convert_endpoint (endpoint ) for endpoint in [master_endpoint , * self .endpoints ()]]
45
52
endpoints = " " .join ([* str_endpoints , logging_endpoint ])
46
53
You can’t perform that action at this time.
0 commit comments