From: Jérémie D. <Ba...@us...> - 2010-02-24 07:46:34
|
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 c2a2cd1daade5c0e5d52d2791998f874088988d9 (commit) from a56ae2921c0bad51ebc5c2cd11f1d9ba336c67d5 (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 c2a2cd1daade5c0e5d52d2791998f874088988d9 Author: Jérémie Dimino <je...@di...> Date: Wed Feb 24 08:42:56 2010 +0100 [hard_stop] never abort the program on uncaught exception ----------------------------------------------------------------------- Changes: diff --git a/PC_Mainboard/services/hard_stop.ml b/PC_Mainboard/services/hard_stop.ml index a07d177..fbb2558 100644 --- a/PC_Mainboard/services/hard_stop.ml +++ b/PC_Mainboard/services/hard_stop.ml @@ -25,32 +25,34 @@ let usage = Printf.sprintf "Usage: %s [-n]\n\noptions are:" (Filename.basename ( type state = OK | Stopped let handle_collide krobot sensors = - join [ - (if Util.front_collide sensors then begin - lwt () = Log.notice "front collision detected, inhibit motors" in - Krobot.inhibit_forward krobot duration - end else - return ()); - (if Util.back_collide sensors then begin - lwt () = Log.notice "back collision detected, inhibit motors" in - Krobot.inhibit_backward krobot duration - end else - return ()); - ] + try_lwt + join [ + (if Util.front_collide sensors then begin + lwt () = Log.notice "front collision detected, inhibit motors" in + Krobot.inhibit_forward krobot duration + end else + return ()); + (if Util.back_collide sensors then begin + lwt () = Log.notice "back collision detected, inhibit motors" in + Krobot.inhibit_backward krobot duration + end else + return ()); + ] + with exn -> + Log.info_f "collision handling failed with: %s" (Printexc.to_string exn) lwt () = Arg.parse args ignore usage; - if !foreground then - ignore (Log.info "starting hard_stop in foreground mode") - else begin - ignore (Log.info "starting hard_stop in daemon mode"); - Lwt_log.default := Lwt_log.syslog - ~level:(min Lwt_log.Info Lwt_log.default_level) - ~facility:`Daemon - (); - Lwt_daemon.daemonize () - end; + lwt () = + if !foreground then + Log.info "starting krobot hard stopper in foreground mode" + else begin + lwt () = Log.info "starting krobot hard stopper in daemon mode" in + Lwt_daemon.daemonize (); + return () + end + in lwt krobot = Krobot.create () in hooks/post-receive -- krobot |