--------------------------------------------------------------------------- -- -- Filename: -- -- telemetry.adb -- -- Description: -- -- XGC Ada demo telemetry package -- -- Credits: -- -- Copyright (C) 1997, ESTEC - ESA -- Copyright (c) 1999-2000, Chris Nettleton Software -- -- License: -- -- Permission to use copy, modify, and distribute this software for any -- purpose without fee is hereby granted. This software is provided -- "as is", without any express or implied warranty. -- -- Revision: -- -- $Id: $ -- --------------------------------------------------------------------------- with Text_IO; with Ada.Real_Time; with Controllers; package body Telemetry is use Ada.Real_Time; use Controllers; use Text_IO; package P is new Integer_IO (Integer); use P; Start_Time : constant Time := Clock; --------------- -- Telemetry -- --------------- task body Telemetry is Period : constant Time_Span := To_Time_Span (1.0); Next_Time : Time := Clock + Period; Temps : array (1 .. 5) of Temperature; Counter : Natural := 0; begin loop Next_Time := Next_Time + Period; delay until Next_Time; -- Outut Modes for i in 1 .. 5 loop if Modes (i) = Auto then if Heaters (i).Get_State = On then Put ('A'); else Put ('a'); end if; elsif Modes (i) = On then Put ('1'); else Put ('0'); end if; end loop; Put (" : "); -- Read sensors. for i in 1 .. 5 loop Sensors (i).Get (Temps (i)); end loop; -- Draw graph. for j in 0 .. 100 loop declare C : Character := ' '; begin if Counter rem 10 = 0 then if j rem 10 = 0 then C := '+'; else C := '-'; end if; end if; if Integer (Ambient_Temp) = j then C := '|'; end if; for i in 1 .. 5 loop if Integer (Temps (i)) = j then C := Character'Val (Character'Pos ('0') + i); end if; end loop; Put (C); end; end loop; New_Line; Counter := Counter + 1; end loop; end Telemetry; end Telemetry;