Skip to content

Commit

Permalink
improved example
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Sep 9, 2024
1 parent 5d6bb4a commit 5cb9291
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions examples/joystick.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 5cb9291

Please sign in to comment.