From: Jérémie D. <Ba...@us...> - 2011-03-31 12:29:23
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 08f9457bae8f067a43784a49e4271a7b7c1a8963 (commit) via 20489cf95c9174859dea5fdb9e9e2a65f06ac9ba (commit) via 51a8d6e5e71f3224b5592e4db5f9f174c7b55108 (commit) from f7aa980b1984ec97e06982b24182553a41a30b33 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 08f9457bae8f067a43784a49e4271a7b7c1a8963 Author: Jérémie Dimino <je...@di...> Date: Thu Mar 31 14:26:27 2011 +0200 [krobot_viewer] cancel the goto thread on stop commit 20489cf95c9174859dea5fdb9e9e2a65f06ac9ba Author: Jérémie Dimino <je...@di...> Date: Thu Mar 31 14:18:49 2011 +0200 [krobot_viewer] clear the trajectory on stop This way the robot won't try to continue it. commit 51a8d6e5e71f3224b5592e4db5f9f174c7b55108 Author: Jérémie Dimino <je...@di...> Date: Thu Mar 31 14:17:59 2011 +0200 [krobot_viewer] do not fail if we clear the trajectory while moving ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/tools/krobot_viewer.ml b/info/control2011/src/tools/krobot_viewer.ml index 2834f20..d6ebd28 100644 --- a/info/control2011/src/tools/krobot_viewer.ml +++ b/info/control2011/src/tools/krobot_viewer.ml @@ -486,7 +486,9 @@ module Board = struct lwt () = wait_done board in (* Remove the point. *) - board.points <- List.tl board.points; + (match board.points with + | _ :: l -> board.points <- l + | [] -> ()); (* Redraw everything without the last point. *) queue_draw board; @@ -587,15 +589,22 @@ lwt () = Board.smooth board; false)); + let thread_go = ref (return ()) in ignore (ui#button_go#event#connect#button_release (fun ev -> if GdkEvent.Button.button ev = 1 then ignore_result ( ui#button_go#misc#set_sensitive false; - lwt () = Board.go board in - ui#button_go#misc#set_sensitive true; - return () + try_lwt + thread_go := Board.go board; + !thread_go + with + | Canceled -> + return () + finally + ui#button_go#misc#set_sensitive true; + return () ); false)); @@ -624,10 +633,13 @@ lwt () = ignore (ui#button_stop#event#connect#button_release (fun ev -> - if GdkEvent.Button.button ev = 1 then + if GdkEvent.Button.button ev = 1 then begin + Board.clear board; + cancel !thread_go; ignore_result ( Krobot_message.send bus (Unix.gettimeofday (), Motor_stop) - ); + ) + end; false)); pick [ hooks/post-receive -- krobot |