From: Jérémie D. <Ba...@us...> - 2010-02-21 17:45:44
|
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 2022bc49119a03672546af0c2403b821f5b0ab5b (commit) via a1569a3a2a4a8c207bd4ea194783f2aae66be14a (commit) from 9383eb0cc3a954ab07681748fb6c59f65703bd2c (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 2022bc49119a03672546af0c2403b821f5b0ab5b Author: Jérémie Dimino <je...@di...> Date: Sun Feb 21 16:58:59 2010 +0100 [controller] typo commit a1569a3a2a4a8c207bd4ea194783f2aae66be14a Author: Jérémie Dimino <je...@di...> Date: Sun Feb 21 16:54:01 2010 +0100 [controller] use the same limit for all screen refresh ----------------------------------------------------------------------- Changes: diff --git a/PC_Mainboard/clients/controller.ml b/PC_Mainboard/clients/controller.ml index d0a730c..173b0f6 100644 --- a/PC_Mainboard/clients/controller.ml +++ b/PC_Mainboard/clients/controller.ml @@ -170,11 +170,11 @@ let rec draw krobot = Draw.textc screen 1 0 [fg line_color; text "─[ "; fg name_color; text "Range finders"; - fg line_color; text "]─┬─[ "; + fg line_color; text " ]─┬─[ "; fg name_color; text "Logic Sensors"; - fg line_color; text "]─┬─[ "; + fg line_color; text " ]─┬─[ "; fg name_color; text "Status"; - fg line_color; text "]─"]; + fg line_color; text " ]─"]; points.(9).(0) <- { line with char = "├" }; points.(9).(size.columns - 1) <- { line with char = "┤" }; for i = 1 to size.columns - 2 do @@ -362,19 +362,16 @@ lwt () = Lwt_main.exit_hooks in - (* Events that causes the display to be redrawn *) + (* Minimum delay to wait between two screen redrawing *) let delay = 1.0 /. (float_of_int refresh_rate) in - let notify signal = - Lwt_signal.always_notify_p - (fun _ -> refresh krobot) - (Lwt_signal.limit (fun () -> Lwt_unix.sleep delay) signal) - and urgent signal = - Lwt_signal.always_notify_p - (fun _ -> refresh krobot) - signal - in - urgent Lwt_term.size; - urgent engine_state; + (* Event which refresh the screen when it occurs: *) + let event, push = React.E.create () in + Lwt_event.always_notify_p + (fun () -> refresh krobot) + (* Limit the number of redraw per seconds: *) + (Lwt_event.limit (fun () -> Lwt_unix.sleep delay) event); + (* Ask for a refresh when [signal] changes: *) + let notify signal = Lwt_signal.always_notify (fun _ -> push ()) signal in notify box; notify logs; notify (Krobot.compass krobot); @@ -388,6 +385,11 @@ lwt () = notify (Krobot.Card.state krobot `Sensor); notify (Krobot.Card.state krobot `Motor); + (* Redraw immedlatly the screen when [signal] changes: *) + let urgent signal = Lwt_signal.always_notify_p (fun _ -> refresh krobot) signal in + urgent Lwt_term.size; + urgent engine_state; + lwt history = Lwt_read_line.load_history history_file_name in set_engine_state (Engine.init history); hooks/post-receive -- krobot |