To 0.2.0.0 Foobot selection menu added

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5604 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
gbamber
2017-01-07 08:57:48 +00:00
parent 3d44ae5324
commit 35b432fc18
10 changed files with 179 additions and 136 deletions

View File

@ -138,6 +138,7 @@ begin
HLINI.WriteDateTime(sFoobotName, 'allpolluHighTime', TDateTime(FoobotDataHighTimes[6]));
HLINI.WriteFloat(sFoobotName, 'allpolluLow', double(FoobotDataLows[6]));
HLINI.WriteDateTime(sFoobotName, 'allpolluLowTime', TDateTime(FoobotDataLowTimes[6]));
Result:=TRUE;
end;
function LoadHighLows: boolean;
@ -186,6 +187,7 @@ begin
FoobotDataHighTimes[6] := HLINI.ReadDateTime(sFoobotName, 'allpolluHighTime', Now);
FoobotDataLows[6] := HLINI.ReadFloat(sFoobotName, 'allpolluLow', 0);
FoobotDataLowTimes[6] := HLINI.ReadDateTime(sFoobotName, 'allpolluLowTime', Now);
Result:=TRUE;
end;
// ToDo: Multiple Foobots?

View File

@ -22,8 +22,7 @@
</General>
<VersionInfo>
<UseVersionInfo Value="True"/>
<MinorVersionNr Value="1"/>
<RevisionNr Value="3"/>
<MinorVersionNr Value="2"/>
<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">
@ -41,13 +40,18 @@
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="i386"/>
<TargetOS Value="win32"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
@ -74,13 +78,18 @@
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="x86_64"/>
<TargetOS Value="win64"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
@ -107,13 +116,18 @@
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="i386"/>
<TargetOS Value="linux"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
@ -140,13 +154,18 @@
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="x86_64"/>
<TargetOS Value="linux"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
@ -171,13 +190,18 @@
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="i386"/>
<TargetOS Value="win32"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>

View File

@ -3,14 +3,14 @@
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="10"/>
<BuildModes Active="linux64"/>
<BuildModes Active="win32GTK2"/>
<Units Count="32">
<Unit0>
<Filename Value="foobotmonitor.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="14"/>
<CursorPos Y="31"/>
<UsageCount Value="94"/>
<EditorIndex Value="13"/>
<CursorPos X="55" Y="27"/>
<UsageCount Value="95"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@ -20,9 +20,9 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<TopLine Value="209"/>
<CursorPos X="61" Y="229"/>
<UsageCount Value="94"/>
<TopLine Value="774"/>
<CursorPos X="42" Y="828"/>
<UsageCount Value="95"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
@ -34,18 +34,18 @@
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="8"/>
<TopLine Value="33"/>
<CursorPos Y="89"/>
<UsageCount Value="84"/>
<CursorPos X="41" Y="45"/>
<UsageCount Value="85"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit2>
<Unit3>
<Filename Value="..\foobot_httpclient.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="76"/>
<TopLine Value="380"/>
<CursorPos X="35" Y="387"/>
<UsageCount Value="77"/>
</Unit3>
<Unit4>
<Filename Value="..\foobot_objects.pas"/>
@ -54,15 +54,15 @@
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="76"/>
<UsageCount Value="77"/>
</Unit4>
<Unit5>
<Filename Value="..\foobot_utility.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="11"/>
<TopLine Value="34"/>
<CursorPos X="18" Y="83"/>
<UsageCount Value="94"/>
<EditorIndex Value="10"/>
<TopLine Value="141"/>
<CursorPos X="16" Y="190"/>
<UsageCount Value="95"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
@ -72,7 +72,7 @@
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="76"/>
<UsageCount Value="77"/>
</Unit6>
<Unit7>
<Filename Value="foobot_sensors.pas"/>
@ -80,7 +80,7 @@
<EditorIndex Value="5"/>
<TopLine Value="299"/>
<CursorPos X="14" Y="321"/>
<UsageCount Value="28"/>
<UsageCount Value="29"/>
<Loaded Value="True"/>
</Unit7>
<Unit8>
@ -91,7 +91,7 @@
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="1"/>
<CursorPos X="21" Y="35"/>
<UsageCount Value="23"/>
<UsageCount Value="24"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit8>
@ -100,14 +100,14 @@
<EditorIndex Value="9"/>
<TopLine Value="43"/>
<CursorPos X="47" Y="13"/>
<UsageCount Value="63"/>
<UsageCount Value="64"/>
<Loaded Value="True"/>
</Unit9>
<Unit10>
<Filename Value="..\latest_stable\foobot_objects.pas"/>
<EditorIndex Value="13"/>
<EditorIndex Value="12"/>
<CursorPos X="32" Y="61"/>
<UsageCount Value="63"/>
<UsageCount Value="64"/>
<Loaded Value="True"/>
</Unit10>
<Unit11>
@ -140,11 +140,10 @@
</Unit14>
<Unit15>
<Filename Value="..\umainform.pas"/>
<EditorIndex Value="10"/>
<TopLine Value="284"/>
<CursorPos X="38" Y="313"/>
<UsageCount Value="43"/>
<Loaded Value="True"/>
<EditorIndex Value="-1"/>
<TopLine Value="145"/>
<CursorPos X="81" Y="158"/>
<UsageCount Value="44"/>
</Unit15>
<Unit16>
<Filename Value="C:\trunklatest\lazarus\lcl\lclmessageglue.pas"/>
@ -179,7 +178,7 @@
<EditorIndex Value="6"/>
<TopLine Value="101"/>
<CursorPos Y="154"/>
<UsageCount Value="14"/>
<UsageCount Value="15"/>
<Loaded Value="True"/>
</Unit20>
<Unit21>
@ -205,17 +204,17 @@
</Unit23>
<Unit24>
<Filename Value="C:\trunklatest\fpc\packages\rtl-objpas\src\inc\dateutil.inc"/>
<EditorIndex Value="12"/>
<EditorIndex Value="11"/>
<TopLine Value="381"/>
<CursorPos X="24" Y="409"/>
<UsageCount Value="32"/>
<CursorPos X="13" Y="384"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
</Unit24>
<Unit25>
<Filename Value="..\latest_stable\udataform.pas"/>
<EditorIndex Value="7"/>
<TopLine Value="70"/>
<UsageCount Value="32"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
</Unit25>
<Unit26>
@ -223,7 +222,7 @@
<EditorIndex Value="4"/>
<TopLine Value="781"/>
<CursorPos X="28" Y="795"/>
<UsageCount Value="17"/>
<UsageCount Value="18"/>
<Loaded Value="True"/>
</Unit26>
<Unit27>
@ -245,7 +244,7 @@
<EditorIndex Value="3"/>
<TopLine Value="190"/>
<CursorPos X="33" Y="205"/>
<UsageCount Value="14"/>
<UsageCount Value="15"/>
<Loaded Value="True"/>
</Unit29>
<Unit30>
@ -261,133 +260,126 @@
<EditorIndex Value="2"/>
<TopLine Value="1811"/>
<CursorPos X="13" Y="1834"/>
<UsageCount Value="10"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit31>
</Units>
<OtherDefines Count="1">
<Define0 Value="DEBUGMODE"/>
</OtherDefines>
<JumpHistory Count="30" HistoryIndex="29">
<JumpHistory Count="29" HistoryIndex="28">
<Position1>
<Filename Value="umainform.pas"/>
<Caret Line="208" TopLine="186"/>
<Filename Value="foobotmonitor.lpr"/>
<Caret Line="29"/>
</Position1>
<Position2>
<Filename Value="foobotmonitor.lpr"/>
<Caret Line="29"/>
<Caret Line="30" Column="17"/>
</Position2>
<Position3>
<Filename Value="umainform.pas"/>
<Caret Line="43" Column="28" TopLine="16"/>
<Filename Value="foobotmonitor.lpr"/>
<Caret Line="28" Column="35"/>
</Position3>
<Position4>
<Filename Value="umainform.pas"/>
<Caret Line="207" TopLine="180"/>
<Filename Value="usplash.pas"/>
</Position4>
<Position5>
<Filename Value="umainform.pas"/>
<Caret Line="209" TopLine="182"/>
<Caret Line="281" Column="26" TopLine="245"/>
</Position5>
<Position6>
<Filename Value="umainform.pas"/>
<Caret Line="311" Column="24" TopLine="309"/>
<Filename Value="usplash.pas"/>
<Caret Line="33" Column="3"/>
</Position6>
<Position7>
<Filename Value="umainform.pas"/>
<Caret Line="41" Column="49" TopLine="21"/>
<Filename Value="usplash.pas"/>
<Caret Line="16" Column="33"/>
</Position7>
<Position8>
<Filename Value="umainform.pas"/>
<Caret Line="255" Column="31" TopLine="235"/>
<Filename Value="usplash.pas"/>
<Caret Line="35" Column="49"/>
</Position8>
<Position9>
<Filename Value="umainform.pas"/>
<Caret Line="256" Column="31" TopLine="236"/>
<Filename Value="usplash.pas"/>
<Caret Line="34" Column="49"/>
</Position9>
<Position10>
<Filename Value="umainform.pas"/>
<Caret Line="255" Column="31" TopLine="235"/>
<Filename Value="usplash.pas"/>
<Caret Line="37" Column="37"/>
</Position10>
<Position11>
<Filename Value="umainform.pas"/>
<Caret Line="248" Column="31" TopLine="235"/>
<Filename Value="usplash.pas"/>
<Caret Line="38" Column="12"/>
</Position11>
<Position12>
<Filename Value="umainform.pas"/>
<Caret Line="247" Column="31" TopLine="234"/>
<Filename Value="usplash.pas"/>
<Caret Line="33" Column="32"/>
</Position12>
<Position13>
<Filename Value="umainform.pas"/>
<Caret Line="280" Column="25" TopLine="234"/>
<Filename Value="usplash.pas"/>
<Caret Line="24" Column="41"/>
</Position13>
<Position14>
<Filename Value="umainform.pas"/>
<Caret Line="201" Column="13" TopLine="174"/>
<Filename Value="usplash.pas"/>
<Caret Line="34" Column="30"/>
</Position14>
<Position15>
<Filename Value="foobotmonitor.lpr"/>
<Caret Line="18" Column="77"/>
<Filename Value="umainform.pas"/>
<Caret Line="229" Column="61" TopLine="209"/>
</Position15>
<Position16>
<Filename Value="foobotmonitor.lpr"/>
<Caret Line="26" Column="22"/>
<Filename Value="umainform.pas"/>
<Caret Line="352" Column="13" TopLine="308"/>
</Position16>
<Position17>
<Filename Value="foobotmonitor.lpr"/>
<Caret Line="29"/>
<Filename Value="umainform.pas"/>
<Caret Line="333" Column="28" TopLine="306"/>
</Position17>
<Position18>
<Filename Value="foobotmonitor.lpr"/>
<Caret Line="30" Column="17"/>
<Filename Value="umainform.pas"/>
<Caret Line="348" Column="43" TopLine="306"/>
</Position18>
<Position19>
<Filename Value="foobotmonitor.lpr"/>
<Caret Line="28" Column="35"/>
<Filename Value="umainform.pas"/>
<Caret Line="333" Column="20" TopLine="306"/>
</Position19>
<Position20>
<Filename Value="usplash.pas"/>
<Filename Value="umainform.pas"/>
<Caret Line="345" Column="33" TopLine="317"/>
</Position20>
<Position21>
<Filename Value="umainform.pas"/>
<Caret Line="281" Column="26" TopLine="245"/>
<Caret Line="348" Column="37" TopLine="320"/>
</Position21>
<Position22>
<Filename Value="usplash.pas"/>
<Caret Line="33" Column="3"/>
<Filename Value="umainform.pas"/>
<Caret Line="352" Column="13" TopLine="325"/>
</Position22>
<Position23>
<Filename Value="usplash.pas"/>
<Caret Line="16" Column="33"/>
<Filename Value="umainform.pas"/>
<Caret Line="2" Column="21"/>
</Position23>
<Position24>
<Filename Value="usplash.pas"/>
<Caret Line="35" Column="49"/>
<Filename Value="umainform.pas"/>
<Caret Line="544" Column="44" TopLine="497"/>
</Position24>
<Position25>
<Filename Value="usplash.pas"/>
<Caret Line="34" Column="49"/>
<Filename Value="umainform.pas"/>
<Caret Line="596" Column="44" TopLine="549"/>
</Position25>
<Position26>
<Filename Value="usplash.pas"/>
<Caret Line="37" Column="37"/>
<Filename Value="umainform.pas"/>
<Caret Line="838" Column="48" TopLine="791"/>
</Position26>
<Position27>
<Filename Value="usplash.pas"/>
<Caret Line="38" Column="12"/>
<Filename Value="umainform.pas"/>
<Caret Line="828" Column="42" TopLine="774"/>
</Position27>
<Position28>
<Filename Value="usplash.pas"/>
<Caret Line="33" Column="32"/>
<Filename Value="..\foobot_utility.pas"/>
<Caret Line="141" Column="16" TopLine="89"/>
</Position28>
<Position29>
<Filename Value="usplash.pas"/>
<Caret Line="24" Column="41"/>
<Filename Value="..\foobot_utility.pas"/>
<Caret Line="190" Column="16" TopLine="141"/>
</Position29>
<Position30>
<Filename Value="usplash.pas"/>
<Caret Line="34" Column="30"/>
</Position30>
</JumpHistory>
</ProjectSession>
</CONFIG>

View File

@ -9,7 +9,7 @@
[Setup]
AppName=Foobot Monitor
AppVersion=0.1.3.0
AppVersion=0.2.0.0
DefaultDirName={pf}\foobotmonitor
DefaultGroupName=Foobot
UninstallDisplayIcon={app}\foobotmonitor.exe

View File

@ -8,6 +8,7 @@ object configform: Tconfigform
Caption = 'configform'
ClientHeight = 197
ClientWidth = 592
Font.Height = -12
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
Position = poMainFormCenter

View File

@ -1,7 +1,7 @@
object mainform: Tmainform
Left = 1072
Left = 516
Height = 451
Top = 245
Top = 144
Width = 784
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
@ -9,12 +9,12 @@ object mainform: Tmainform
ClientHeight = 431
ClientWidth = 784
DefaultMonitor = dmDesktop
Font.Height = -12
Menu = MainMenu1
OnActivate = FormActivate
OnClose = FormClose
OnCreate = FormCreate
OnDestroy = FormDestroy
OnShow = FormShow
OnWindowStateChange = FormWindowStateChange
Position = poWorkAreaCenter
ShowInTaskBar = stNever
@ -466,7 +466,6 @@ object mainform: Tmainform
end
object mnu_optionsDisplay: TMenuItem
Caption = 'Display...'
OnClick = mnu_optionsDisplayClick
object mnu_optionsDisplayGuagesOnly: TMenuItem
AutoCheck = True
Caption = 'Guages only'
@ -494,6 +493,9 @@ object mainform: Tmainform
OnClick = mnu_optionsResetHighsLowsClick
end
end
object mnu_foobot: TMenuItem
Caption = '&Foobot'
end
object mnu_help: TMenuItem
Caption = '&Help'
object mnu_optionsOnlineHelp: TMenuItem

View File

@ -40,7 +40,7 @@ interface
uses
SysUtils, TAGraph, TAIntervalSources, TASeries, foobot_sensors,
Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, Menus, lclIntf,
foobot_utility, uCryptIni, dateutils, uconfigform, Classes;
foobot_utility, uCryptIni, dateutils, uconfigform;
const
// Timer milliseconds
@ -123,6 +123,7 @@ type
lbl_voclow: TLabel;
lbl_allpollulow: TLabel;
MainMenu1: TMainMenu;
mnu_foobot: TMenuItem;
mnu_optionsDisplayRedLines: TMenuItem;
mnu_optionsDisplayYellowLines: TMenuItem;
mnu_optionsDisplayGuagesOnly: TMenuItem;
@ -150,12 +151,10 @@ type
traypopup: TPopupMenu;
tmr_foobot: TTimer;
TrayIcon1: TTrayIcon;
procedure ApplicationProperties1IdleEnd(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
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);
@ -167,7 +166,6 @@ type
procedure mnu_optionsOnlineHelpClick(Sender: TObject);
procedure mnu_optionsResetHighsLowsClick(Sender: TObject);
procedure mnu_optionsSaveHighLowsClick(Sender: TObject);
procedure mnu_optionsDisplayClick(Sender: TObject);
procedure mnu_optionsTakeReadingNowClick(Sender: TObject);
procedure mnu_SampleEvery1HourClick(Sender: TObject);
procedure mnu_SampleEvery24HoursClick(Sender: TObject);
@ -181,6 +179,8 @@ type
sSecretKey, sFoobotUserName, sUUID: string;
bDisplayGuagesOnly, bDisplayYellowLines, bDisplayRedLines: boolean;
iFudgeFactor: integer;
iCurrentFoobot: integer;
foobotmenuarray: array of TMenuItem;
procedure DisplayReadings;
procedure UpdateGuage(Sender: TAnalogSensor; SensorNumber: integer);
procedure UpdateHighLow(SensorNumber: integer);
@ -188,6 +188,8 @@ type
procedure GraphCurrentReading;
procedure SetYellowRecommendedLevels;
procedure SetRedSessionMax;
procedure PopulateFoobotMenu;
procedure ChangeCurrentFoobot(Sender: TObject);
procedure SaveConfig;
procedure LoadConfig;
public
@ -198,7 +200,9 @@ var
mainform: Tmainform;
implementation
Uses uSplash;
uses uSplash;
{$R *.lfm}
{ Tmainform }
@ -224,12 +228,12 @@ begin
ResetHighLows;
iFudgeFactor := 20; // only needed if height set in form.create
bDisplayGuagesOnly := False;
INI.PlainTextMode:=TRUE;
bDisplayYellowLines := INI.ReadBool('Config','DisplayYellowLines',False);
mnu_optionsDisplayYellowLines.Checked:=bDisplayYellowLines;
bDisplayRedLines := INI.ReadBool('Config','DisplayRedLines',False);
mnu_optionsDisplayRedLines.Checked:=bDisplayRedLines;
INI.PlainTextMode:=FALSE;
INI.PlainTextMode := True;
bDisplayYellowLines := INI.ReadBool('Config', 'DisplayYellowLines', False);
mnu_optionsDisplayYellowLines.Checked := bDisplayYellowLines;
bDisplayRedLines := INI.ReadBool('Config', 'DisplayRedLines', False);
mnu_optionsDisplayRedLines.Checked := bDisplayRedLines;
INI.PlainTextMode := False;
SetYellowRecommendedLevels;
SetRedSessionMax;
TrayIcon1.Icon := Application.Icon;
@ -280,13 +284,15 @@ begin
tmr_foobot.Enabled := True;
{$ENDIF}
// Everything OK - lets go!
iCurrentFoobot := 0;
PopulateFoobotMenu;
Show;
grp_sensorDisplay.Refresh;
grp_highlow.Refresh;
Update;
Application.Processmessages;
Application.ProcessMessages;
splashform.hide;
Application.Processmessages;
Application.ProcessMessages;
end
else
begin
@ -322,9 +328,35 @@ begin
end;
procedure Tmainform.ApplicationProperties1IdleEnd(Sender: TObject);
procedure Tmainform.ChangeCurrentFoobot(Sender: TObject);
begin
iCurrentFoobot := (Sender as TMenuItem).Tag;
mnu_optionsTakeReadingNow.Click;
end;
procedure Tmainform.PopulateFoobotMenu;
// uses foobotmenuarray
var
iCount: integer;
begin
if FoobotIdentityObject.FoobotIdentityList.Count = 0 then
Exit;
SetLength(foobotmenuarray, FoobotIdentityObject.FoobotIdentityList.Count);
for iCount := 0 to Pred(FoobotIdentityObject.FoobotIdentityList.Count) do
begin
foobotmenuarray[iCount] := TMenuItem.Create(MainMenu1);
with foobotmenuarray[iCount] do
begin
Caption := FoobotIdentityObject.FoobotIdentityList[iCount].Name;
AutoCheck := True;
RadioItem := True;
OnClick := @ChangeCurrentFoobot;
Tag := iCount;
if iCount = 0 then
Checked := True;
end;
end;
mnu_foobot.Add(foobotmenuarray);
end;
procedure Tmainform.FormClose(Sender: TObject; var CloseAction: TCloseAction);
@ -339,11 +371,6 @@ begin
FreeAndNil(INI);
end;
procedure Tmainform.FormShow(Sender: TObject);
begin
end;
procedure Tmainform.SaveConfig;
begin
INI.PlainTextMode := True;
@ -368,8 +395,8 @@ begin
INI.WriteFloat('Config', 'vocMaxValue', as_voc.ValueMax);
INI.WriteFloat('Config', 'allpolluMinValue', as_allpollu.ValueMin);
INI.WriteFloat('Config', 'allpolluMaxValue', as_allpollu.ValueMax);
INI.WriteBool('Config','DisplayYellowLines',bDisplayYellowLines);
INI.WriteBool('Config','DisplayRedLines',bDisplayRedLines);
INI.WriteBool('Config', 'DisplayYellowLines', bDisplayYellowLines);
INI.WriteBool('Config', 'DisplayRedLines', bDisplayRedLines);
INI.PlainTextMode := False;
end;
@ -500,15 +527,10 @@ begin
INI.WriteBool('Foobot', 'SaveLoadHighLows', SaveLoadHighLows);
end;
procedure Tmainform.mnu_optionsDisplayClick(Sender: TObject);
begin
end;
procedure Tmainform.mnu_optionsTakeReadingNowClick(Sender: TObject);
begin
mainform.Cursor := crHourGlass;
// Only Foobot #0
if FetchFoobotData(dfLast, 0, 0, 0, 0, 0, sSecretKey) then
if FetchFoobotData(dfLast, iCurrentFoobot, 0, 0, 0, 0, sSecretKey) then
DisplayReadings
else
ShowMessage('Sorry - no readings available');
@ -560,7 +582,7 @@ end;
procedure Tmainform.tmr_foobotTimer(Sender: TObject);
begin
if FetchFoobotData(dfLast, 0, 0, 0, 0, 0, sSecretKey) then
if FetchFoobotData(dfLast, iCurrentFoobot, 0, 0, 0, 0, sSecretKey) then
DisplayReadings;
end;
@ -802,8 +824,8 @@ begin
iStartSeconds := iEndSeconds - (2 * (24 * 3600)); // 49 hours before Now
grp_chart.Caption := Format('History from %s',
[FormatDateTime('dd/mm/yyyy hh:nn', UnixToDateTime(iStartSeconds))]);
if FetchFoobotData(dfStartEnd, 0, 0, 3600, iStartSeconds, iEndSeconds, sSecretKey) =
False then
if FetchFoobotData(dfStartEnd, iCurrentFoobot, 0, 3600, iStartSeconds,
iEndSeconds, sSecretKey) = False then
exit;
if FoobotDataObjectToArrays then
for iCount := 0 to Pred(High(FoobotData_time)) do