From 5cb92914d6cf93551222870c63cf20ed5404b6ba Mon Sep 17 00:00:00 2001 From: Uwe Fechner Date: Mon, 9 Sep 2024 08:55:35 +0200 Subject: [PATCH] improved example --- examples/joystick.jl | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/examples/joystick.jl b/examples/joystick.jl index 1bf46c4..52295db 100644 --- a/examples/joystick.jl +++ b/examples/joystick.jl @@ -107,15 +107,6 @@ function play() GC.enable(true) end -function async_play() - if viewer.stop - @async begin - play() - stop(viewer) - end - end -end - function parking() on_parking(ssc) end @@ -124,12 +115,17 @@ function autopilot() on_winchcontrol(ssc) end -on(viewer.btn_PLAY.clicks) do c; async_play(); end +on(viewer.btn_PLAY.clicks) do c; + stop(viewer) + stop(viewer); on_stop(ssc) +end on(viewer.btn_STOP.clicks) do c; stop(viewer); on_stop(ssc) end on(viewer.btn_PARKING.clicks) do c; parking(); end on(viewer.btn_AUTO.clicks) do c; autopilot(); end -on(jsbuttons.btn1) do val; if val async_play() end; end +on(jsbuttons.btn1) do val; if val + stop(viewer); on_stop(ssc) +end; end on(jsbuttons.btn2) do val; if val stop(viewer) end; end on(jsbuttons.btn3) do val; if val autopilot() end; end on(jsbuttons.btn4) do val; if val on_reelin(ssc) end; end