From: Jérémie D. <Ba...@us...> - 2010-01-28 19:08:36
|
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 e33ec4b458d37bf85e80167bb00632f35f2a3ef6 (commit) from b390b8ba32db284ca0862c893a8b6240235da7a9 (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 e33ec4b458d37bf85e80167bb00632f35f2a3ef6 Author: Jérémie Dimino <je...@di...> Date: Thu Jan 28 20:08:09 2010 +0100 Ajout d'un monitor ----------------------------------------------------------------------- Changes: diff --git a/PC_Mainboard/clients/_tags b/PC_Mainboard/clients/_tags index fca1be6..ada7748 100644 --- a/PC_Mainboard/clients/_tags +++ b/PC_Mainboard/clients/_tags @@ -9,3 +9,4 @@ # lib-krobot uses obus <**/*>: pkg_obus +<tools/*>: pkg_lwt.text diff --git a/PC_Mainboard/clients/myocamlbuild.ml b/PC_Mainboard/clients/myocamlbuild.ml index 5d9fb2a..2d6a8a3 100644 --- a/PC_Mainboard/clients/myocamlbuild.ml +++ b/PC_Mainboard/clients/myocamlbuild.ml @@ -27,6 +27,7 @@ let packages = [ "lwt"; "lwt.unix"; "lwt.syntax"; + "lwt.text"; "str"; "xmlm"; "react"; @@ -92,6 +93,7 @@ let _ = "lib-krobot/krobot.cma"; "lib-krobot/krobot.cmxa"; "tools/status.native"; + "tools/monitor.native"; ]; (* +---------------------------------------------------------+ diff --git a/PC_Mainboard/clients/tools/monitor.ml b/PC_Mainboard/clients/tools/monitor.ml new file mode 100644 index 0000000..cd98a62 --- /dev/null +++ b/PC_Mainboard/clients/tools/monitor.ml @@ -0,0 +1,37 @@ +(* + * monitor.ml + * ---------- + * Copyright : (c) 2010, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +(* Prints status continuously *) + +open Lwt + +let print_status compass logic_sensors range_finders team = + lwt () = Lwt_term.goto_beginning_of_line 4 in + Lwt_io.printf "\ +compass = %d +logic_sensors = %s +range_finders = %s +team = %s +" + compass + (String.concat "" (List.map (function true -> "O" | false -> ".") (Array.to_list logic_sensors))) + (String.concat " " (List.map string_of_int (Array.to_list range_finders))) + (match team with Krobot.Team_red -> "red" | Krobot.Team_green -> "green") + +let signal = + React.S.l4 print_status Krobot.compass Krobot.logic_sensors Krobot.range_finders Krobot.team + +let rec loop_key () = + Lwt_term.read_key () >>= function + | Lwt_term.Key "q" | Lwt_term.Key_control ('c' | '[') -> + return () + | _ -> + loop_key () + +lwt () = Lwt_term.with_raw_mode loop_key diff --git a/PC_Mainboard/clients/tools/status.ml b/PC_Mainboard/clients/tools/status.ml index 47d92a2..76e4cf0 100644 --- a/PC_Mainboard/clients/tools/status.ml +++ b/PC_Mainboard/clients/tools/status.ml @@ -7,10 +7,12 @@ * This file is a part of [kro]bot. *) +(* Print status and exit *) + open Lwt open Krobot -let () = Lwt_main.run begin +lwt () = Lwt_io.printf "\ compass = %d logic_sensors = %s @@ -21,4 +23,3 @@ team = %s (String.concat "" (List.map (function true -> "O" | false -> ".") (Array.to_list (React.S.value logic_sensors)))) (String.concat " " (List.map string_of_int (Array.to_list (React.S.value range_finders)))) (match React.S.value team with Team_red -> "red" | Team_green -> "green") -end diff --git a/PC_Mainboard/clients/www/.depend b/PC_Mainboard/clients/www/.depend index e31d7f0..e69de29 100644 --- a/PC_Mainboard/clients/www/.depend +++ b/PC_Mainboard/clients/www/.depend @@ -1,8 +0,0 @@ -krobot.cmo: \ - /home/olivier/krobot/PC_Mainboard/Apps/usb/_build/src/protocol.cmo \ - /home/olivier/krobot/PC_Mainboard/Apps/usb/_build/src/kard.cmi \ - /home/olivier/krobot/PC_Mainboard/Apps/usb/_build/src/bootloader.cmi -krobot.cmx: \ - /home/olivier/krobot/PC_Mainboard/Apps/usb/_build/src/protocol.cmx \ - /home/olivier/krobot/PC_Mainboard/Apps/usb/_build/src/kard.cmx \ - /home/olivier/krobot/PC_Mainboard/Apps/usb/_build/src/bootloader.cmx hooks/post-receive -- krobot |