Skip to content

Commit 9dcdf49

Browse files
committed
Stop mavlink based logging only in ULOG mode
1 parent c3f20aa commit 9dcdf49

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

MAVGCL/src/main/java/com/comino/flight/MainApp.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ public class MainApp extends Application {
177177

178178
private final WorkQueue wq = WorkQueue.getInstance();
179179

180+
private AnalysisModelService analysisModelService;
180181
private SimpleNTPServer ntp_server;
181182

182183
public MainApp() {
@@ -314,7 +315,7 @@ else if(args.get("ip")!=null)
314315
MAVGCLMap.getInstance(control);
315316
MAVGCLPX4Parameters.getInstance(control);
316317

317-
AnalysisModelService analysisModelService = AnalysisModelService.getInstance(control);
318+
analysisModelService = AnalysisModelService.getInstance(control);
318319
analysisModelService.startConverter();
319320

320321
state.getConnectedProperty().addListener((e,o,n) -> {
@@ -437,7 +438,7 @@ public void start(Stage primaryStage) {
437438
@Override
438439
public void stop() throws Exception {
439440
System.out.println("[mgc] Closing...");
440-
control.sendMAVLinkCmd(MAV_CMD.MAV_CMD_LOGGING_STOP);
441+
analysisModelService.close();
441442
control.shutdown();
442443
MAVPreferences.getInstance().putDouble("stage.x", primaryStage.getX());
443444
MAVPreferences.getInstance().putDouble("stage.y", primaryStage.getY());

MAVGCL/src/main/java/com/comino/flight/model/service/AnalysisModelService.java

+6
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ public void startConverter() {
188188
c.setPriority(Thread.NORM_PRIORITY+2);
189189
c.start();
190190
}
191+
192+
public void close() {
193+
stop();
194+
if(ulogger.isLogging())
195+
control.sendMAVLinkCmd(MAV_CMD.MAV_CMD_LOGGING_STOP);
196+
}
191197

192198
public void registerListener(ICollectorRecordingListener l) {
193199
listener.add(l);

0 commit comments

Comments
 (0)