To V0.0.4.0 48-hour history graph added
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5581 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
587ea10dc8
commit
0bcf146bf0
@ -145,7 +145,10 @@ var
|
||||
sFoobotName: string;
|
||||
begin
|
||||
if SaveLoadHighLows = False then
|
||||
Exit(False);
|
||||
begin
|
||||
ShowMessage('Unable to load All-Time stats');
|
||||
Exit(False);
|
||||
end;
|
||||
sFoobotName := FoobotIdentityObject.FoobotIdentityList[TheCurrentFoobot].Name;
|
||||
if not Assigned(HLINI) then
|
||||
HLINI := TIniFile.Create(ChangeFileExt(GetAppConfigFile(False), '.ini'));
|
||||
|
@ -19,8 +19,8 @@
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<UseVersionInfo Value="True"/>
|
||||
<RevisionNr Value="3"/>
|
||||
<StringTable ProductVersion="0.0.1.0"/>
|
||||
<RevisionNr Value="4"/>
|
||||
<StringTable Comments="Uses Foobot public API to query Foobot #1" FileDescription="Monitor for Foobot" InternalName="foobotmonitor" LegalCopyright="(c)2016 minesadorada@charcodelvalle.com" LegalTrademarks="Foobot" ProductName="Foobot" ProductVersion="0.0.0.0"/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="6">
|
||||
<Item1 Name="Debug" Default="True"/>
|
||||
@ -78,6 +78,11 @@
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<OtherDefines Count="1">
|
||||
<Define0 Value="DEBUGMODE"/>
|
||||
</OtherDefines>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</Item3>
|
||||
<Item4 Name="linux32">
|
||||
@ -179,16 +184,19 @@
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="3">
|
||||
<RequiredPackages Count="4">
|
||||
<Item1>
|
||||
<PackageName Value="industrial"/>
|
||||
<PackageName Value="TAChartLazarusPkg"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="cryptini"/>
|
||||
<PackageName Value="industrial"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="LCL"/>
|
||||
<PackageName Value="cryptini"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item4>
|
||||
</RequiredPackages>
|
||||
<Units Count="7">
|
||||
<Unit0>
|
||||
@ -262,6 +270,13 @@
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CustomOptions Value="-FcUTF8
|
||||
-dDEBUGMODE"/>
|
||||
<OtherDefines Count="1">
|
||||
<Define0 Value="DEBUGMODE"/>
|
||||
</OtherDefines>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
|
@ -15,7 +15,7 @@ uses
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, umainform, uconfigform
|
||||
Forms, tachartlazaruspkg, umainform, uconfigform
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
@ -4,13 +4,13 @@
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="10"/>
|
||||
<BuildModes Active="linux64"/>
|
||||
<Units Count="18">
|
||||
<Units Count="25">
|
||||
<Unit0>
|
||||
<Filename Value="foobotmonitor.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<CursorPos X="33" Y="25"/>
|
||||
<UsageCount Value="40"/>
|
||||
<UsageCount Value="72"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -20,9 +20,9 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="18"/>
|
||||
<CursorPos X="13" Y="26"/>
|
||||
<UsageCount Value="40"/>
|
||||
<TopLine Value="23"/>
|
||||
<CursorPos X="72" Y="39"/>
|
||||
<UsageCount Value="72"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
@ -32,9 +32,9 @@
|
||||
<ComponentName Value="configform"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<CursorPos X="2" Y="20"/>
|
||||
<UsageCount Value="30"/>
|
||||
<UsageCount Value="62"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
@ -44,7 +44,7 @@
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
<UsageCount Value="22"/>
|
||||
<UsageCount Value="54"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\foobot_objects.pas"/>
|
||||
@ -53,14 +53,15 @@
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
<UsageCount Value="22"/>
|
||||
<UsageCount Value="54"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="..\foobot_utility.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<CursorPos Y="27"/>
|
||||
<UsageCount Value="40"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<TopLine Value="65"/>
|
||||
<CursorPos X="18" Y="83"/>
|
||||
<UsageCount Value="72"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
@ -70,21 +71,21 @@
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
<UsageCount Value="22"/>
|
||||
<UsageCount Value="54"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="..\latest_stable\foobot_httpclient.pas"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<TopLine Value="43"/>
|
||||
<CursorPos X="47" Y="13"/>
|
||||
<UsageCount Value="39"/>
|
||||
<UsageCount Value="53"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="..\latest_stable\foobot_objects.pas"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<CursorPos X="32" Y="61"/>
|
||||
<UsageCount Value="39"/>
|
||||
<UsageCount Value="53"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
@ -93,12 +94,12 @@
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
<UsageCount Value="38"/>
|
||||
<UsageCount Value="36"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="..\latest_stable\umainform.lfm"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="8"/>
|
||||
<DefaultSyntaxHighlighter Value="LFM"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
@ -106,21 +107,21 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="10"/>
|
||||
<CursorPos X="57" Y="36"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="..\udataform.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="74"/>
|
||||
<CursorPos Y="96"/>
|
||||
<UsageCount Value="18"/>
|
||||
<UsageCount Value="16"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="..\umainform.pas"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<TopLine Value="134"/>
|
||||
<CursorPos X="25" Y="154"/>
|
||||
<UsageCount Value="19"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<TopLine Value="284"/>
|
||||
<CursorPos X="38" Y="313"/>
|
||||
<UsageCount Value="33"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
@ -129,148 +130,203 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="93"/>
|
||||
<CursorPos Y="114"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
<Filename Value="..\ulogin.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos Y="108"/>
|
||||
<UsageCount Value="13"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="..\..\..\components\cryptini\latest_stable\ucryptini.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="906"/>
|
||||
<CursorPos X="8" Y="939"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit16>
|
||||
<Unit17>
|
||||
<Filename Value="..\backup\foobot_utility.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="7"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit17>
|
||||
<Unit18>
|
||||
<Filename Value="C:\trunklatest\lazarus\components\IndustrialStuff\source\sensors.pas"/>
|
||||
<UnitName Value="Sensors"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="237"/>
|
||||
<CursorPos Y="265"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
<Filename Value="C:\trunklatest\lazarus\ide\lazarus.pp"/>
|
||||
<UnitName Value="Lazarus"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="111"/>
|
||||
<CursorPos X="18" Y="144"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit19>
|
||||
<Unit20>
|
||||
<Filename Value="C:\trunklatest\fpc\rtl\objpas\objpas.pp"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="11"/>
|
||||
<CursorPos X="8" Y="33"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit20>
|
||||
<Unit21>
|
||||
<Filename Value="D:\Lazarusprojects\healthmonitor\svn\healthanalysis\healthanalysis\umainform.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="540"/>
|
||||
<CursorPos X="55" Y="593"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="C:\trunklatest\fpc\rtl\objpas\sysutils\datih.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="109"/>
|
||||
<CursorPos X="10" Y="128"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
<Filename Value="C:\trunklatest\fpc\packages\rtl-objpas\src\inc\dateutil.inc"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<TopLine Value="93"/>
|
||||
<CursorPos X="19" Y="110"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit23>
|
||||
<Unit24>
|
||||
<Filename Value="..\latest_stable\udataform.pas"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="70"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit24>
|
||||
</Units>
|
||||
<OtherDefines Count="1">
|
||||
<Define0 Value="DEBUGMODE"/>
|
||||
</OtherDefines>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="165" Column="48" TopLine="145"/>
|
||||
<Caret Line="128" Column="7" TopLine="106"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="153" Column="47" TopLine="132"/>
|
||||
<Caret Line="129" Column="7" TopLine="107"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="105" Column="54" TopLine="80"/>
|
||||
<Caret Line="166" Column="83" TopLine="143"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="106" Column="54" TopLine="81"/>
|
||||
<Caret Line="279" Column="3" TopLine="277"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="107" Column="54" TopLine="82"/>
|
||||
<Caret Line="299" Column="57" TopLine="294"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="127" Column="37" TopLine="93"/>
|
||||
<Caret Line="300" Column="57" TopLine="295"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="202" Column="22" TopLine="197"/>
|
||||
<Caret Line="301" Column="57" TopLine="296"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="127" Column="17" TopLine="105"/>
|
||||
<Caret Line="302" Column="57" TopLine="297"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="207" Column="44" TopLine="184"/>
|
||||
<Caret Line="303" Column="57" TopLine="298"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="289" Column="22" TopLine="286"/>
|
||||
<Caret Line="304" Column="57" TopLine="299"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="216" Column="38" TopLine="194"/>
|
||||
<Caret Line="508" Column="30" TopLine="472"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="130" Column="22" TopLine="107"/>
|
||||
<Caret Line="515" Column="30" TopLine="479"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="131" Column="22" TopLine="108"/>
|
||||
<Caret Line="287" Column="66" TopLine="243"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="132" Column="22" TopLine="109"/>
|
||||
<Caret Line="529" Column="32" TopLine="487"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="134" Column="22" TopLine="111"/>
|
||||
<Caret Line="532" Column="27" TopLine="489"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="216" Column="17" TopLine="205"/>
|
||||
<Caret Line="535" Column="25" TopLine="494"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="134" TopLine="113"/>
|
||||
<Caret Line="531" Column="26" TopLine="494"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="208" Column="10" TopLine="201"/>
|
||||
<Caret Line="530" Column="5" TopLine="495"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="209" Column="10" TopLine="202"/>
|
||||
<Caret Line="529" Column="5" TopLine="494"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="226" TopLine="203"/>
|
||||
<Caret Line="509" Column="22" TopLine="488"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="271" Column="5" TopLine="251"/>
|
||||
<Caret Line="530" Column="25" TopLine="490"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="289" Column="57" TopLine="284"/>
|
||||
<Filename Value="..\foobot_utility.pas"/>
|
||||
<Caret Line="243" Column="47" TopLine="218"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="280" Column="3" TopLine="278"/>
|
||||
<Caret Line="527" Column="68" TopLine="486"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="286" Column="3" TopLine="284"/>
|
||||
<Caret Line="523" Column="17" TopLine="488"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="287" Column="3" TopLine="285"/>
|
||||
<Caret Line="245" TopLine="243"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="286" Column="3" TopLine="284"/>
|
||||
<Caret Line="244" TopLine="242"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="287" Column="3" TopLine="285"/>
|
||||
<Caret Line="264" Column="31" TopLine="242"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="294" Column="3" TopLine="292"/>
|
||||
<Caret Line="532" Column="43" TopLine="497"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="283" Column="15" TopLine="281"/>
|
||||
<Caret Line="188" Column="16" TopLine="176"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="11" Column="19" TopLine="7"/>
|
||||
<Caret Line="572" Column="44" TopLine="551"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectSession>
|
||||
|
Binary file not shown.
@ -9,7 +9,7 @@
|
||||
|
||||
[Setup]
|
||||
AppName=Foobot Monitor
|
||||
AppVersion=0.0.3.0
|
||||
AppVersion=0.0.4.0
|
||||
DefaultDirName={pf}\foobotmonitor
|
||||
DefaultGroupName=Foobot
|
||||
UninstallDisplayIcon={app}\foobotmonitor.exe
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,19 +1,18 @@
|
||||
object mainform: Tmainform
|
||||
Left = 614
|
||||
Height = 262
|
||||
Top = 109
|
||||
Width = 782
|
||||
Left = 583
|
||||
Height = 451
|
||||
Top = 174
|
||||
Width = 784
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'mainform'
|
||||
ClientHeight = 242
|
||||
ClientWidth = 782
|
||||
ClientHeight = 431
|
||||
ClientWidth = 784
|
||||
DefaultMonitor = dmDesktop
|
||||
Menu = MainMenu1
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
OnWindowStateChange = FormWindowStateChange
|
||||
Position = poWorkAreaCenter
|
||||
ShowInTaskBar = stNever
|
||||
@ -23,12 +22,12 @@ object mainform: Tmainform
|
||||
Left = 0
|
||||
Height = 120
|
||||
Top = 0
|
||||
Width = 782
|
||||
Width = 784
|
||||
Align = alTop
|
||||
Caption = 'Current Values'
|
||||
ChildSizing.ControlsPerLine = 6
|
||||
ClientHeight = 100
|
||||
ClientWidth = 778
|
||||
ClientWidth = 780
|
||||
TabOrder = 0
|
||||
object as_pm: TAnalogSensor
|
||||
Left = 0
|
||||
@ -43,7 +42,7 @@ object mainform: Tmainform
|
||||
ShowLevel = True
|
||||
Value = 0
|
||||
ValueMin = 0
|
||||
ValueMax = 300
|
||||
ValueMax = 1000
|
||||
ValueRed = 0
|
||||
ValueYellow = 0
|
||||
AnalogKind = akAnalog
|
||||
@ -59,11 +58,11 @@ object mainform: Tmainform
|
||||
TabOrder = 1
|
||||
ShowText = True
|
||||
ShowLevel = True
|
||||
Value = 0
|
||||
ValueMin = 0
|
||||
Value = 10
|
||||
ValueMin = 10
|
||||
ValueMax = 40
|
||||
ValueRed = 0
|
||||
ValueYellow = 0
|
||||
ValueRed = 10
|
||||
ValueYellow = 10
|
||||
AnalogKind = akAnalog
|
||||
end
|
||||
object as_hum: TAnalogSensor
|
||||
@ -77,11 +76,11 @@ object mainform: Tmainform
|
||||
TabOrder = 2
|
||||
ShowText = True
|
||||
ShowLevel = True
|
||||
Value = 0
|
||||
ValueMin = 0
|
||||
Value = 10
|
||||
ValueMin = 10
|
||||
ValueMax = 100
|
||||
ValueRed = 0
|
||||
ValueYellow = 0
|
||||
ValueRed = 10
|
||||
ValueYellow = 10
|
||||
AnalogKind = akAnalog
|
||||
end
|
||||
object as_co2: TAnalogSensor
|
||||
@ -95,11 +94,11 @@ object mainform: Tmainform
|
||||
TabOrder = 3
|
||||
ShowText = True
|
||||
ShowLevel = True
|
||||
Value = 0
|
||||
ValueMin = 0
|
||||
Value = 450
|
||||
ValueMin = 450
|
||||
ValueMax = 3000
|
||||
ValueRed = 0
|
||||
ValueYellow = 0
|
||||
ValueRed = 450
|
||||
ValueYellow = 450
|
||||
AnalogKind = akAnalog
|
||||
end
|
||||
object as_voc: TAnalogSensor
|
||||
@ -113,11 +112,11 @@ object mainform: Tmainform
|
||||
TabOrder = 4
|
||||
ShowText = True
|
||||
ShowLevel = True
|
||||
Value = 0
|
||||
ValueMin = 0
|
||||
Value = 125
|
||||
ValueMin = 125
|
||||
ValueMax = 1000
|
||||
ValueRed = 0
|
||||
ValueYellow = 0
|
||||
ValueRed = 125
|
||||
ValueYellow = 125
|
||||
AnalogKind = akAnalog
|
||||
end
|
||||
object as_allpollu: TAnalogSensor
|
||||
@ -133,7 +132,7 @@ object mainform: Tmainform
|
||||
ShowLevel = True
|
||||
Value = 0
|
||||
ValueMin = 0
|
||||
ValueMax = 300
|
||||
ValueMax = 1000
|
||||
ValueRed = 0
|
||||
ValueYellow = 0
|
||||
AnalogKind = akAnalog
|
||||
@ -143,14 +142,14 @@ object mainform: Tmainform
|
||||
Left = 0
|
||||
Height = 119
|
||||
Top = 120
|
||||
Width = 782
|
||||
Width = 784
|
||||
Align = alTop
|
||||
Caption = 'All-time Highs and Lows'
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsScaleChilds
|
||||
ChildSizing.ControlsPerLine = 6
|
||||
ClientHeight = 99
|
||||
ClientWidth = 778
|
||||
ClientWidth = 780
|
||||
TabOrder = 1
|
||||
object grp_pm: TGroupBox
|
||||
Left = 0
|
||||
@ -166,16 +165,16 @@ object mainform: Tmainform
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 60
|
||||
Caption = 'lbl_pmhigh'
|
||||
Width = 43
|
||||
Caption = 'No stats'
|
||||
ParentColor = False
|
||||
end
|
||||
object lbl_pmlow: TLabel
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 40
|
||||
Width = 55
|
||||
Caption = 'lbl_pmlow'
|
||||
Width = 44
|
||||
Caption = 'No Stats'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
@ -193,16 +192,16 @@ object mainform: Tmainform
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 64
|
||||
Caption = 'lbl_tmphigh'
|
||||
Width = 44
|
||||
Caption = 'No Stats'
|
||||
ParentColor = False
|
||||
end
|
||||
object lbl_tmplow: TLabel
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 40
|
||||
Width = 59
|
||||
Caption = 'lbl_tmplow'
|
||||
Width = 44
|
||||
Caption = 'No Stats'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
@ -220,16 +219,16 @@ object mainform: Tmainform
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 67
|
||||
Caption = 'lbl_humhigh'
|
||||
Width = 44
|
||||
Caption = 'No Stats'
|
||||
ParentColor = False
|
||||
end
|
||||
object lbl_humlow: TLabel
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 40
|
||||
Width = 62
|
||||
Caption = 'lbl_humlow'
|
||||
Width = 44
|
||||
Caption = 'No Stats'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
@ -247,16 +246,16 @@ object mainform: Tmainform
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 61
|
||||
Caption = 'lbl_co2high'
|
||||
Width = 44
|
||||
Caption = 'No Stats'
|
||||
ParentColor = False
|
||||
end
|
||||
object lbl_co2low: TLabel
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 40
|
||||
Width = 56
|
||||
Caption = 'lbl_co2low'
|
||||
Width = 44
|
||||
Caption = 'No Stats'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
@ -274,16 +273,16 @@ object mainform: Tmainform
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 61
|
||||
Caption = 'lbl_vochigh'
|
||||
Width = 44
|
||||
Caption = 'No Stats'
|
||||
ParentColor = False
|
||||
end
|
||||
object lbl_voclow: TLabel
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 40
|
||||
Width = 56
|
||||
Caption = 'lbl_voclow'
|
||||
Width = 44
|
||||
Caption = 'No Stats'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
@ -301,20 +300,91 @@ object mainform: Tmainform
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 81
|
||||
Caption = 'lbl_allpolluhigh'
|
||||
Width = 44
|
||||
Caption = 'No Stats'
|
||||
ParentColor = False
|
||||
end
|
||||
object lbl_allpollulow: TLabel
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 40
|
||||
Width = 76
|
||||
Caption = 'lbl_allpollulow'
|
||||
Width = 44
|
||||
Caption = 'No Stats'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
end
|
||||
object grp_chart: TGroupBox
|
||||
Left = 0
|
||||
Height = 179
|
||||
Top = 239
|
||||
Width = 784
|
||||
Align = alTop
|
||||
Caption = 'History'
|
||||
ClientHeight = 159
|
||||
ClientWidth = 780
|
||||
TabOrder = 2
|
||||
object Chart1: TChart
|
||||
Left = 0
|
||||
Height = 159
|
||||
Top = 0
|
||||
Width = 780
|
||||
AxisList = <
|
||||
item
|
||||
Marks.Format = '%2:s'
|
||||
Marks.Style = smsLabel
|
||||
Minors = <>
|
||||
Title.LabelFont.Orientation = 900
|
||||
end
|
||||
item
|
||||
Grid.Visible = False
|
||||
Intervals.Count = 24
|
||||
Intervals.Options = [aipGraphCoords, aipUseNiceSteps]
|
||||
Alignment = calBottom
|
||||
Arrow.Length = 24
|
||||
Marks.Distance = 0
|
||||
Marks.Format = '%2:s'
|
||||
Marks.OverlapPolicy = opHideNeighbour
|
||||
Marks.Range.Max = 24
|
||||
Marks.Source = DateTimeIntervalChartSource1
|
||||
Marks.Style = smsLabel
|
||||
Minors = <>
|
||||
Range.Max = 24
|
||||
Range.UseMax = True
|
||||
end>
|
||||
ExtentSizeLimit.UseXMax = True
|
||||
ExtentSizeLimit.XMax = 24
|
||||
Foot.Brush.Color = clBtnFace
|
||||
Foot.Font.Color = clBlue
|
||||
Foot.Text.Strings = (
|
||||
'Today'
|
||||
)
|
||||
Title.Brush.Color = clBtnFace
|
||||
Title.Font.Color = clBlue
|
||||
Title.Text.Strings = (
|
||||
'Foobot History'
|
||||
)
|
||||
Align = alClient
|
||||
object lineseries_pm: TLineSeries
|
||||
LinePen.Color = clMaroon
|
||||
end
|
||||
object lineseries_tmp: TLineSeries
|
||||
LinePen.Color = clRed
|
||||
end
|
||||
object lineseries_hum: TLineSeries
|
||||
LinePen.Color = clGreen
|
||||
end
|
||||
object lineseries_co2: TLineSeries
|
||||
LinePen.Color = clLime
|
||||
end
|
||||
object lineseries_voc: TLineSeries
|
||||
LinePen.Color = clNavy
|
||||
end
|
||||
object lineseries_allpollu: TLineSeries
|
||||
LinePen.Color = clBlue
|
||||
end
|
||||
end
|
||||
end
|
||||
object tmr_foobot: TTimer
|
||||
Enabled = False
|
||||
Interval = 3600
|
||||
@ -375,11 +445,10 @@ object mainform: Tmainform
|
||||
object mnu_optionsSeperator1: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object mnu_optionsShowHighsAndLows: TMenuItem
|
||||
object mnu_optionsShowMinimalDisplay: TMenuItem
|
||||
AutoCheck = True
|
||||
Caption = 'Show All-time Highs and Lows'
|
||||
Checked = True
|
||||
OnClick = mnu_optionsShowHighsAndLowsClick
|
||||
Caption = 'Only show guages'
|
||||
OnClick = mnu_optionsShowMinimalDisplayClick
|
||||
end
|
||||
object mnu_optionsSaveHighLows: TMenuItem
|
||||
AutoCheck = True
|
||||
@ -419,4 +488,8 @@ object mainform: Tmainform
|
||||
OnClick = mnu_fileExitClick
|
||||
end
|
||||
end
|
||||
object DateTimeIntervalChartSource1: TDateTimeIntervalChartSource
|
||||
Left = 174
|
||||
Top = 325
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,5 @@
|
||||
unit umainform;
|
||||
|
||||
{ Foobot Monitor
|
||||
|
||||
Copyright (C)2016 Gordon Bamber minsadorada@charcodelvalle.com
|
||||
@ -23,19 +24,24 @@ VERSION HISTORY
|
||||
V0.0.1.0: Initial commit
|
||||
V0.0.2.0: Trayicon added
|
||||
V0.0.3.0: Added Help menu. Updated Options menu
|
||||
V0.0.4.0: ??
|
||||
V0.0.4.0: Graph added
|
||||
V0.0.5.0: ??
|
||||
}
|
||||
{$ifopt D+}
|
||||
// Debug mode
|
||||
{$ENDIF}
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Sensors, Forms, Controls, Graphics, Dialogs,
|
||||
ExtCtrls, StdCtrls, Menus, lclIntf,foobot_utility, uCryptIni, Variants, dateutils,
|
||||
uconfigform;
|
||||
Classes, SysUtils, FileUtil, TAGraph, TAIntervalSources, TASeries, //TASources,
|
||||
Sensors, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, Menus,
|
||||
lclIntf, foobot_utility, uCryptIni, Variants, dateutils, uconfigform;
|
||||
|
||||
CONST
|
||||
const
|
||||
// Timer milliseconds
|
||||
ONEMINUTE = 60000;
|
||||
ONEHOUR = ONEMINUTE * 60;
|
||||
TWOHOURS = ONEHOUR * 2;
|
||||
@ -43,6 +49,13 @@ CONST
|
||||
EIGHTHOURS = ONEHOUR * 8;
|
||||
TWENTYFOURHOURS = ONEHOUR * 24;
|
||||
|
||||
// Colours for guages and graph lines
|
||||
COL_PM = clMaroon;
|
||||
COL_TMP = clRed;
|
||||
COL_HUM = clGreen;
|
||||
COL_CO2 = clLime;
|
||||
COL_VOC = clNavy;
|
||||
COL_ALLPOLLU = clBlue;
|
||||
|
||||
type
|
||||
|
||||
@ -55,6 +68,15 @@ type
|
||||
as_pm: TAnalogSensor;
|
||||
as_tmp: TAnalogSensor;
|
||||
as_voc: TAnalogSensor;
|
||||
Chart1: TChart;
|
||||
DateTimeIntervalChartSource1: TDateTimeIntervalChartSource;
|
||||
lineseries_allpollu: TLineSeries;
|
||||
lineseries_voc: TLineSeries;
|
||||
lineseries_co2: TLineSeries;
|
||||
lineseries_hum: TLineSeries;
|
||||
lineseries_tmp: TLineSeries;
|
||||
lineseries_pm: TLineSeries;
|
||||
grp_chart: TGroupBox;
|
||||
grp_pm: TGroupBox;
|
||||
grp_tmp: TGroupBox;
|
||||
grp_hum: TGroupBox;
|
||||
@ -91,7 +113,7 @@ type
|
||||
mnu_SampleEvery1Hour: TMenuItem;
|
||||
mnu_optionsSampleEvery: TMenuItem;
|
||||
mnu_optionsTakeReadingNow: TMenuItem;
|
||||
mnu_optionsShowHighsAndLows: TMenuItem;
|
||||
mnu_optionsShowMinimalDisplay: TMenuItem;
|
||||
mnu_options: TMenuItem;
|
||||
mnu_fileExit: TMenuItem;
|
||||
mnu_file: TMenuItem;
|
||||
@ -101,7 +123,6 @@ type
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormWindowStateChange(Sender: TObject);
|
||||
procedure mnupopup_fileRestoreClick(Sender: TObject);
|
||||
procedure mnu_fileExitClick(Sender: TObject);
|
||||
@ -109,7 +130,7 @@ type
|
||||
procedure mnu_optionsMinimiseToTrayClick(Sender: TObject);
|
||||
procedure mnu_optionsOnlineHelpClick(Sender: TObject);
|
||||
procedure mnu_optionsSaveHighLowsClick(Sender: TObject);
|
||||
procedure mnu_optionsShowHighsAndLowsClick(Sender: TObject);
|
||||
procedure mnu_optionsShowMinimalDisplayClick(Sender: TObject);
|
||||
procedure mnu_optionsTakeReadingNowClick(Sender: TObject);
|
||||
procedure mnu_SampleEvery1HourClick(Sender: TObject);
|
||||
procedure mnu_SampleEvery24HoursClick(Sender: TObject);
|
||||
@ -120,12 +141,14 @@ type
|
||||
procedure TrayIcon1Click(Sender: TObject);
|
||||
private
|
||||
sSecretKey, sFoobotUserName, sUUID: string;
|
||||
bShowHighsAndLows: boolean;
|
||||
bShowMinimalDisplay: boolean;
|
||||
iFudgeFactor: integer;
|
||||
iSampleInterval:Integer;
|
||||
procedure SetUpColours;
|
||||
procedure DisplayReadings;
|
||||
procedure UpdateGuage(Sender: TAnalogSensor; SensorNumber: integer);
|
||||
procedure UpdateHighLow(SensorNumber: integer);
|
||||
procedure DrawGraphHistory;
|
||||
procedure DrawGraph;
|
||||
public
|
||||
INI: TCryptINIfile;
|
||||
end;
|
||||
@ -156,28 +179,33 @@ begin
|
||||
FreeAndNil(INI);
|
||||
Application.Terminate;
|
||||
end;
|
||||
INI.SectionHashing:=FALSE;
|
||||
INI.SectionHashing := False;
|
||||
ResetHighLows;
|
||||
iFudgeFactor := 20;
|
||||
ClientHeight := grp_sensorDisplay.Height + grp_highlow.Height + iFudgeFactor;
|
||||
bShowHighsAndLows := True;
|
||||
TrayIcon1.Icon:=Application.Icon;
|
||||
TrayIcon1.Hint:=Application.Title;
|
||||
iFudgeFactor := 20; // only needed if height set here
|
||||
bShowMinimalDisplay := False;
|
||||
TrayIcon1.Icon := Application.Icon;
|
||||
TrayIcon1.Hint := Application.Title;
|
||||
DateTimeIntervalChartSource1.DateTimeFormat := 'hh:nn';
|
||||
SetUpColours;
|
||||
end;
|
||||
|
||||
procedure Tmainform.FormActivate(Sender: TObject);
|
||||
Var sTempFoobotUserName,sTempSecretKey:String;
|
||||
var
|
||||
sTempFoobotUserName, sTempSecretKey: string;
|
||||
|
||||
begin
|
||||
ClientHeight := grp_sensorDisplay.Height + grp_highlow.Height +
|
||||
grp_chart.Height;
|
||||
|
||||
// Allow user to enter values in INIFile
|
||||
sTempFoobotUserName:=INI.ReadUnencryptedString('Config','Foobot User','unknown');
|
||||
sTempSecretKey:=INI.ReadUnencryptedString('Config', 'Secret Key', 'unknown');
|
||||
sTempFoobotUserName := INI.ReadUnencryptedString('Config', 'Foobot User', 'unknown');
|
||||
sTempSecretKey := INI.ReadUnencryptedString('Config', 'Secret Key', 'unknown');
|
||||
if ((sTempFoobotUserName <> 'unknown') and (sTempSecretKey <> 'unknown')) then
|
||||
begin
|
||||
INI.WriteString('Foobot', 'Foobot User', sTempFoobotUserName);
|
||||
INI.DeleteKey('Config','Foobot User');
|
||||
INI.DeleteKey('Config', 'Foobot User');
|
||||
INI.WriteString('Foobot', 'Secret Key', sTempSecretKey);
|
||||
INI.DeleteKey('Config','Secret Key');
|
||||
INI.DeleteKey('Config', 'Secret Key');
|
||||
end;
|
||||
// Fetch Username and API_KEY
|
||||
sFoobotUserName := INI.ReadString('Foobot', 'Foobot User', 'unknown');
|
||||
@ -190,17 +218,24 @@ begin
|
||||
if FoobotIdentityObject.FoobotIdentityList.Count > 0 then
|
||||
begin
|
||||
sUUID := FoobotIdentityObject.FoobotIdentityList.Items[0].uuid;
|
||||
SaveLoadHighLows:=INI.ReadBool('Foobot','SaveLoadHighLows',TRUE);
|
||||
mnu_optionsSaveHighLows.Checked:=SaveLoadHighLows;
|
||||
If SaveLoadHighLows then LoadHighLows;
|
||||
SaveLoadHighLows := INI.ReadBool('Foobot', 'SaveLoadHighLows', True);
|
||||
mnu_optionsSaveHighLows.Checked := SaveLoadHighLows;
|
||||
if SaveLoadHighLows then
|
||||
LoadHighLows;
|
||||
DrawGraphHistory;
|
||||
{$IFNDEF DEBUGMODE}
|
||||
mnu_optionsTakeReadingNow.Click;
|
||||
{$ENDIF}
|
||||
// Switch off for testing
|
||||
tmr_foobot.Interval:=ONEHOUR;
|
||||
tmr_foobot.Enabled:=TRUE;
|
||||
tmr_foobot.Interval := ONEHOUR;
|
||||
{$IFNDEF DEBUGMODE}
|
||||
tmr_foobot.Enabled := True;
|
||||
{$ENDIF}
|
||||
Show;
|
||||
end;
|
||||
end
|
||||
else Close;
|
||||
else
|
||||
Close;
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -209,7 +244,7 @@ begin
|
||||
Application.ProcessMessages;
|
||||
configform.ShowModal;
|
||||
// If user quit without data, then bail out
|
||||
If NOT configform.bValid then
|
||||
if not configform.bValid then
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
@ -218,7 +253,8 @@ begin
|
||||
INI.WriteString('Foobot', 'Secret Key', configform.FoobotSecretKey);
|
||||
//sFoobotUserName := INI.ReadString('Foobot', 'Foobot User', 'unknown');
|
||||
//sSecretKey := INI.ReadString('Foobot', 'Secret Key', 'unknown');
|
||||
ShowMessage('Click OK to store settings and close the app.' + LineEnding + 'New settings are applied on resart.');
|
||||
ShowMessage('Click OK to store settings and close the app.' +
|
||||
LineEnding + 'New settings are applied on resart.');
|
||||
Close;
|
||||
end;
|
||||
end;
|
||||
@ -228,23 +264,35 @@ begin
|
||||
FreeAndNil(INI);
|
||||
end;
|
||||
|
||||
procedure Tmainform.FormShow(Sender: TObject);
|
||||
procedure Tmainform.SetUpColours;
|
||||
begin
|
||||
as_pm.ColorFore := COL_PM;
|
||||
lineSeries_pm.SeriesColor := COL_PM;
|
||||
as_tmp.ColorFore := COL_TMP;
|
||||
lineSeries_tmp.SeriesColor := COL_TMP;
|
||||
as_hum.ColorFore := COL_HUM;
|
||||
lineSeries_hum.SeriesColor := COL_HUM;
|
||||
as_co2.ColorFore := COL_CO2;
|
||||
lineSeries_co2.SeriesColor := COL_CO2;
|
||||
as_voc.ColorFore := COL_VOC;
|
||||
lineSeries_voc.SeriesColor := COL_VOC;
|
||||
as_allpollu.ColorFore := COL_ALLPOLLU;
|
||||
lineSeries_allpollu.SeriesColor := COL_ALLPOLLU;
|
||||
end;
|
||||
|
||||
procedure Tmainform.FormWindowStateChange(Sender: TObject);
|
||||
begin
|
||||
if mainform.WindowState = wsMinimized then
|
||||
begin
|
||||
mainform.WindowState := wsNormal;
|
||||
mainform.Hide;
|
||||
mainform.ShowInTaskBar := stNever;
|
||||
mainform.WindowState := wsNormal;
|
||||
mainform.Hide;
|
||||
mainform.ShowInTaskBar := stNever;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure Tmainform.mnupopup_fileRestoreClick(Sender: TObject);
|
||||
begin
|
||||
mainform.show;
|
||||
mainform.Show;
|
||||
end;
|
||||
|
||||
procedure Tmainform.mnu_fileExitClick(Sender: TObject);
|
||||
@ -273,9 +321,10 @@ begin
|
||||
MessageDlg('About ' + Application.Title, s,
|
||||
mtInformation, [mbOK], 0);
|
||||
end;
|
||||
|
||||
procedure Tmainform.mnu_optionsMinimiseToTrayClick(Sender: TObject);
|
||||
begin
|
||||
mainform.WindowState:=wsMinimized;
|
||||
mainform.WindowState := wsMinimized;
|
||||
mainform.FormWindowStateChange(Self);
|
||||
end;
|
||||
|
||||
@ -286,17 +335,18 @@ end;
|
||||
|
||||
procedure Tmainform.mnu_optionsSaveHighLowsClick(Sender: TObject);
|
||||
begin
|
||||
SaveLoadHighLows:=mnu_optionsSaveHighLows.Checked;
|
||||
INI.WriteBool('Foobot','SaveLoadHighLows',SaveLoadHighLows);
|
||||
SaveLoadHighLows := mnu_optionsSaveHighLows.Checked;
|
||||
INI.WriteBool('Foobot', 'SaveLoadHighLows', SaveLoadHighLows);
|
||||
end;
|
||||
|
||||
procedure Tmainform.mnu_optionsShowHighsAndLowsClick(Sender: TObject);
|
||||
procedure Tmainform.mnu_optionsShowMinimalDisplayClick(Sender: TObject);
|
||||
begin
|
||||
if mnu_optionsShowHighsAndLows.Checked then
|
||||
mainform.ClientHeight := grp_sensorDisplay.Height + grp_highlow.Height + iFudgeFactor
|
||||
if mnu_optionsShowMinimalDisplay.Checked then
|
||||
mainform.ClientHeight := grp_sensorDisplay.Height// + iFudgeFactor
|
||||
else
|
||||
mainform.ClientHeight := grp_sensorDisplay.Height;// + iFudgeFactor;
|
||||
bShowHighsAndLows := mnu_optionsShowHighsAndLows.Checked;
|
||||
mainform.ClientHeight := grp_sensorDisplay.Height + grp_chart.Height +
|
||||
grp_highlow.Height;// + iFudgeFactor;
|
||||
bShowMinimalDisplay := mnu_optionsShowMinimalDisplay.Checked;
|
||||
end;
|
||||
|
||||
procedure Tmainform.mnu_optionsTakeReadingNowClick(Sender: TObject);
|
||||
@ -312,37 +362,37 @@ end;
|
||||
|
||||
procedure Tmainform.mnu_SampleEvery1HourClick(Sender: TObject);
|
||||
begin
|
||||
tmr_foobot.Enabled:=FALSE;
|
||||
tmr_foobot.Interval:=ONEHOUR;
|
||||
tmr_foobot.Enabled:=TRUE;
|
||||
tmr_foobot.Enabled := False;
|
||||
tmr_foobot.Interval := ONEHOUR;
|
||||
tmr_foobot.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure Tmainform.mnu_SampleEvery24HoursClick(Sender: TObject);
|
||||
begin
|
||||
tmr_foobot.Enabled:=FALSE;
|
||||
tmr_foobot.Interval:=TWENTYFOURHOURS;
|
||||
tmr_foobot.Enabled:=TRUE;
|
||||
tmr_foobot.Enabled := False;
|
||||
tmr_foobot.Interval := TWENTYFOURHOURS;
|
||||
tmr_foobot.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure Tmainform.mnu_SampleEvery2HoursClick(Sender: TObject);
|
||||
begin
|
||||
tmr_foobot.Enabled:=FALSE;
|
||||
tmr_foobot.Interval:=TWOHOURS;
|
||||
tmr_foobot.Enabled:=TRUE;
|
||||
tmr_foobot.Enabled := False;
|
||||
tmr_foobot.Interval := TWOHOURS;
|
||||
tmr_foobot.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure Tmainform.mnu_SampleEvery4HoursClick(Sender: TObject);
|
||||
begin
|
||||
tmr_foobot.Enabled:=FALSE;
|
||||
tmr_foobot.Interval:=FOURHOURS;
|
||||
tmr_foobot.Enabled:=TRUE;
|
||||
tmr_foobot.Enabled := False;
|
||||
tmr_foobot.Interval := FOURHOURS;
|
||||
tmr_foobot.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure Tmainform.mnu_SampleEvery8HoursClick(Sender: TObject);
|
||||
begin
|
||||
tmr_foobot.Enabled:=FALSE;
|
||||
tmr_foobot.Interval:=EIGHTHOURS;
|
||||
tmr_foobot.Enabled:=TRUE;
|
||||
tmr_foobot.Enabled := False;
|
||||
tmr_foobot.Interval := EIGHTHOURS;
|
||||
tmr_foobot.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure Tmainform.tmr_foobotTimer(Sender: TObject);
|
||||
@ -353,7 +403,7 @@ end;
|
||||
|
||||
procedure Tmainform.TrayIcon1Click(Sender: TObject);
|
||||
begin
|
||||
mainform.show;
|
||||
mainform.Show;
|
||||
end;
|
||||
|
||||
procedure Tmainform.UpdateHighLow(SensorNumber: integer);
|
||||
@ -361,61 +411,56 @@ begin
|
||||
case SensorNumber of
|
||||
1:
|
||||
begin
|
||||
lbl_pmhigh.Caption := Format(
|
||||
'High: %f %s', [double(FoobotDataHighs[SensorNumber]),
|
||||
FoobotDataObject.Units[SensorNumber]]) + LineEnding + 'on ' +
|
||||
FormatDateTime('dd/mm tt', TDateTime(FoobotDataHighTimes[SensorNumber]));
|
||||
lbl_pmLow.Caption := Format(
|
||||
'Low: %f %s', [double(FoobotDataLows[SensorNumber]),
|
||||
FoobotDataObject.Units[SensorNumber]]) +
|
||||
lbl_pmhigh.Caption := Format('High: %f %s',
|
||||
[double(FoobotDataHighs[SensorNumber]), FoobotDataObject.Units[SensorNumber]]) +
|
||||
LineEnding + 'on ' + FormatDateTime('dd/mm tt',
|
||||
TDateTime(FoobotDataHighTimes[SensorNumber]));
|
||||
lbl_pmLow.Caption := Format('Low: %f %s',
|
||||
[double(FoobotDataLows[SensorNumber]), FoobotDataObject.Units[SensorNumber]]) +
|
||||
LineEnding + 'on ' + FormatDateTime('dd/mm tt', TDateTime(
|
||||
FoobotDataLowTimes[SensorNumber]));
|
||||
end;
|
||||
2:
|
||||
begin
|
||||
lbl_tmphigh.Caption := Format(
|
||||
'High: %f %s', [double(FoobotDataHighs[SensorNumber]),
|
||||
FoobotDataObject.Units[SensorNumber]]) + LineEnding + 'on ' +
|
||||
FormatDateTime('dd/mm tt', TDateTime(FoobotDataHighTimes[SensorNumber]));
|
||||
lbl_tmpLow.Caption := Format(
|
||||
'Low: %f %s', [double(FoobotDataLows[SensorNumber]),
|
||||
FoobotDataObject.Units[SensorNumber]]) +
|
||||
lbl_tmphigh.Caption := Format('High: %f %s',
|
||||
[double(FoobotDataHighs[SensorNumber]), FoobotDataObject.Units[SensorNumber]]) +
|
||||
LineEnding + 'on ' + FormatDateTime('dd/mm tt',
|
||||
TDateTime(FoobotDataHighTimes[SensorNumber]));
|
||||
lbl_tmpLow.Caption := Format('Low: %f %s',
|
||||
[double(FoobotDataLows[SensorNumber]), FoobotDataObject.Units[SensorNumber]]) +
|
||||
LineEnding + 'on ' + FormatDateTime('dd/mm tt', TDateTime(
|
||||
FoobotDataLowTimes[SensorNumber]));
|
||||
end;
|
||||
3:
|
||||
begin
|
||||
lbl_humhigh.Caption := Format(
|
||||
'High: %f %s', [double(FoobotDataHighs[SensorNumber]),
|
||||
FoobotDataObject.Units[SensorNumber]]) + LineEnding + 'on ' +
|
||||
FormatDateTime('dd/mm tt', TDateTime(FoobotDataHighTimes[SensorNumber]));
|
||||
lbl_humLow.Caption := Format(
|
||||
'Low: %f %s', [double(FoobotDataLows[SensorNumber]),
|
||||
FoobotDataObject.Units[SensorNumber]]) +
|
||||
lbl_humhigh.Caption := Format('High: %f %s',
|
||||
[double(FoobotDataHighs[SensorNumber]), FoobotDataObject.Units[SensorNumber]]) +
|
||||
LineEnding + 'on ' + FormatDateTime('dd/mm tt',
|
||||
TDateTime(FoobotDataHighTimes[SensorNumber]));
|
||||
lbl_humLow.Caption := Format('Low: %f %s',
|
||||
[double(FoobotDataLows[SensorNumber]), FoobotDataObject.Units[SensorNumber]]) +
|
||||
LineEnding + 'on ' + FormatDateTime('dd/mm tt', TDateTime(
|
||||
FoobotDataLowTimes[SensorNumber]));
|
||||
end;
|
||||
4:
|
||||
begin
|
||||
lbl_co2high.Caption := Format(
|
||||
'High: %f %s', [double(FoobotDataHighs[SensorNumber]),
|
||||
FoobotDataObject.Units[SensorNumber]]) + LineEnding + 'on ' +
|
||||
FormatDateTime('dd/mm tt', TDateTime(FoobotDataHighTimes[SensorNumber]));
|
||||
lbl_co2Low.Caption := Format(
|
||||
'Low: %f %s', [double(FoobotDataLows[SensorNumber]),
|
||||
FoobotDataObject.Units[SensorNumber]]) +
|
||||
lbl_co2high.Caption := Format('High: %f %s',
|
||||
[double(FoobotDataHighs[SensorNumber]), FoobotDataObject.Units[SensorNumber]]) +
|
||||
LineEnding + 'on ' + FormatDateTime('dd/mm tt',
|
||||
TDateTime(FoobotDataHighTimes[SensorNumber]));
|
||||
lbl_co2Low.Caption := Format('Low: %f %s',
|
||||
[double(FoobotDataLows[SensorNumber]), FoobotDataObject.Units[SensorNumber]]) +
|
||||
LineEnding + 'on ' + FormatDateTime('dd/mm tt', TDateTime(
|
||||
FoobotDataLowTimes[SensorNumber]));
|
||||
end;
|
||||
5:
|
||||
begin
|
||||
lbl_vochigh.Caption := Format(
|
||||
'High: %f %s', [double(FoobotDataHighs[SensorNumber]),
|
||||
FoobotDataObject.Units[SensorNumber]]) + LineEnding + 'on ' +
|
||||
FormatDateTime('dd/mm tt', TDateTime(FoobotDataHighTimes[SensorNumber]));
|
||||
lbl_vocLow.Caption := Format(
|
||||
'Low: %f %s', [double(FoobotDataLows[SensorNumber]),
|
||||
FoobotDataObject.Units[SensorNumber]]) +
|
||||
lbl_vochigh.Caption := Format('High: %f %s',
|
||||
[double(FoobotDataHighs[SensorNumber]), FoobotDataObject.Units[SensorNumber]]) +
|
||||
LineEnding + 'on ' + FormatDateTime('dd/mm tt',
|
||||
TDateTime(FoobotDataHighTimes[SensorNumber]));
|
||||
lbl_vocLow.Caption := Format('Low: %f %s',
|
||||
[double(FoobotDataLows[SensorNumber]), FoobotDataObject.Units[SensorNumber]]) +
|
||||
LineEnding + 'on ' + FormatDateTime('dd/mm tt', TDateTime(
|
||||
FoobotDataLowTimes[SensorNumber]));
|
||||
end;
|
||||
@ -483,7 +528,7 @@ var
|
||||
begin
|
||||
if FoobotDataObjectToArrays = True then
|
||||
begin
|
||||
mainform.Caption := Format('Foobot "%s" - ',
|
||||
mainform.Caption := Format('Foobot "%s" - Last reading: ',
|
||||
[FoobotIdentityObject.FoobotIdentityList[0].Name]) +
|
||||
FormatDateTime('dd/mm/yyyy - tt', FoobotData_time[0]);
|
||||
UpdateGuage(as_pm, 1);
|
||||
@ -492,10 +537,63 @@ begin
|
||||
UpdateGuage(as_co2, 4);
|
||||
UpdateGuage(as_voc, 5);
|
||||
UpdateGuage(as_allpollu, 6);
|
||||
if bShowHighsAndLows then
|
||||
if not bShowMinimalDisplay then
|
||||
begin
|
||||
for iCount := 1 to 6 do
|
||||
UpdateHighLow(iCount);
|
||||
end;
|
||||
DrawGraph;
|
||||
end;
|
||||
end;
|
||||
|
||||
function AsPercent(aValue, aMax: double): double;
|
||||
begin
|
||||
if aMax > 0 then
|
||||
Result := aValue / aMax * 100
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
procedure Tmainform.DrawGraph;
|
||||
begin
|
||||
lineseries_pm.AddXY(FoobotData_time[0], AsPercent(FoobotData_pm[0], as_pm.ValueMax));
|
||||
lineseries_tmp.AddXY(FoobotData_time[0], AsPercent(FoobotData_tmp[0], as_tmp.ValueMax));
|
||||
lineseries_hum.AddXY(FoobotData_time[0], AsPercent(FoobotData_hum[0], as_hum.ValueMax));
|
||||
lineseries_co2.AddXY(FoobotData_time[0], AsPercent(FoobotData_co2[0], as_co2.ValueMax));
|
||||
lineseries_voc.AddXY(FoobotData_time[0], AsPercent(FoobotData_voc[0], as_voc.ValueMax));
|
||||
lineseries_allpollu.AddXY(FoobotData_time[0],
|
||||
AsPercent(FoobotData_allpollu[0], as_allpollu.ValueMax));
|
||||
end;
|
||||
|
||||
procedure Tmainform.DrawGraphHistory;
|
||||
// Fetch Hourly readings for the previous 2 days (AverageBy=3600)
|
||||
// Populate FoobotDataObjectToArrays
|
||||
var
|
||||
iCount: integer;
|
||||
iStartSeconds, iEndSeconds: int64;
|
||||
begin
|
||||
iEndSeconds := DateTimeToUnix(Now) - 3600;
|
||||
iStartSeconds := iEndSeconds - (2 * (24 * 3600));
|
||||
if FetchFoobotData(dfStartEnd, 0, 0, 3600, iStartSeconds, iEndSeconds, sSecretKey) =
|
||||
False then
|
||||
exit;
|
||||
if FoobotDataObjectToArrays then
|
||||
for iCount := 0 to Pred(High(FoobotData_time)) do
|
||||
begin
|
||||
lineseries_pm.AddXY(FoobotData_time[iCount],
|
||||
AsPercent(FoobotData_pm[iCount], as_pm.ValueMax));
|
||||
lineseries_tmp.AddXY(FoobotData_time[iCount],
|
||||
AsPercent(FoobotData_tmp[iCount], as_tmp.ValueMax));
|
||||
lineseries_hum.AddXY(FoobotData_time[iCount],
|
||||
AsPercent(FoobotData_hum[iCount], as_hum.ValueMax));
|
||||
lineseries_co2.AddXY(FoobotData_time[iCount],
|
||||
AsPercent(FoobotData_co2[iCount], as_co2.ValueMax));
|
||||
lineseries_voc.AddXY(FoobotData_time[iCount],
|
||||
AsPercent(FoobotData_voc[iCount], as_voc.ValueMax));
|
||||
lineseries_allpollu.AddXY(FoobotData_time[iCount],
|
||||
AsPercent(FoobotData_allpollu[iCount], as_allpollu.ValueMax));
|
||||
end;
|
||||
ResetArrays; // at end
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user