diff --git a/applications/foobot/monitor/foobotmonitor.lps b/applications/foobot/monitor/foobotmonitor.lps index 379ee1a16..c2876882e 100644 --- a/applications/foobot/monitor/foobotmonitor.lps +++ b/applications/foobot/monitor/foobotmonitor.lps @@ -3,14 +3,14 @@ - + - + @@ -19,10 +19,9 @@ - - - - + + + @@ -35,7 +34,7 @@ - + @@ -43,8 +42,9 @@ + - + @@ -54,7 +54,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -72,7 +72,7 @@ - + @@ -80,7 +80,7 @@ - + @@ -90,8 +90,8 @@ - - + + @@ -100,9 +100,11 @@ + - - + + + @@ -111,7 +113,7 @@ - + @@ -119,7 +121,7 @@ - + @@ -190,7 +192,7 @@ - + @@ -219,14 +221,14 @@ - + - + @@ -270,7 +272,7 @@ - + @@ -284,124 +286,124 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/applications/foobot/monitor/umainform.lfm b/applications/foobot/monitor/umainform.lfm index 1c0fa8eee..a093daf52 100644 --- a/applications/foobot/monitor/umainform.lfm +++ b/applications/foobot/monitor/umainform.lfm @@ -1,12 +1,12 @@ object mainform: Tmainform Left = 589 - Height = 506 + Height = 500 Top = 145 Width = 784 BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle Caption = 'mainform' - ClientHeight = 486 + ClientHeight = 480 ClientWidth = 784 DefaultMonitor = dmDesktop Font.Height = -12 @@ -833,9 +833,9 @@ object mainform: Tmainform OnClick = mnu_optionsResetHighsLowsClick end object mnu_optionsFoobotTriggers: TMenuItem - Caption = 'Foobot Triggers...' + Caption = 'Foobot Triggers and Recommended values...' object mnu_options_triggersSetTriggers: TMenuItem - Caption = 'Set Trigger Values...' + Caption = 'Set Trigger and Recommended Values...' OnClick = mnu_options_triggersSetTriggersClick end object mnu_options_triggersActivateTriggers: TMenuItem diff --git a/applications/foobot/monitor/umainform.pas b/applications/foobot/monitor/umainform.pas index 90b7f3c7f..8d5207f44 100644 --- a/applications/foobot/monitor/umainform.pas +++ b/applications/foobot/monitor/umainform.pas @@ -233,7 +233,7 @@ type procedure SaveConfig; procedure LoadConfig; procedure SetMinMaxTriggers; - procedure SetTrafficLightStats(iSensorNum: integer; HIGHLOW: integer); + procedure SetTrafficLightStats(const iSensorNum: integer; const HIGHLOW: integer); procedure DoHighTriggerAlert(const iSensorNum: integer; const aValue: variant); procedure DoLowTriggerAlert(const iSensorNum: integer; const aValue: variant); procedure RestoreNormalColour(const iSensorNum: integer); @@ -342,7 +342,7 @@ begin PopulateFoobotMenu; LoadTriggers; // This can only be done if we have a Foobot Identity // as each Foobot has its own trigger values - SetMinMaxTriggers; // Adjust if necesarry for Guage High/Low limits + SetMinMaxTriggers; // Adjust if necesarry for preset Guage High/Low limits for iCount := C_PM to C_ALLPOLLU do SetTrafficLightStats(iCount, C_HIGH); Show; @@ -363,6 +363,7 @@ begin end else begin // Unable to fetch foobot identity + ShowMessage('Cannot locate your Foobot. Click OK to close the application'); Close; end; end @@ -387,18 +388,21 @@ begin LineEnding + 'New settings are applied on resart.'); Close; end; - end; procedure Tmainform.ChangeCurrentFoobot(Sender: TObject); // Called from 'Foobot' TSubmenuitem.click begin iCurrentFoobot := (Sender as TMenuItem).Tag; - mnu_optionsTakeReadingNow.Click; + mnu_optionsTakeReadingNow.Click; // also triggers DoDisplay end; -procedure Tmainform.SetTrafficLightStats(iSensorNum: integer; HIGHLOW: integer); +procedure Tmainform.SetTrafficLightStats(const iSensorNum: integer; const HIGHLOW: integer); +// Called via a loop in form.create with HIGHLOW=C_HIGH (all traffic light captions set) +// Called in DoHighTriggerAlert with HIGHLOW=C_HIGH (specific traffic light caption set) +// Called in DoLowTriggerAlert with HIGHLOW=C_LOW (specific traffic light caption set) begin + {$IFDEF DEBUGMODE}Exit;{$ENDIF} if iSensorNum = C_PM then if (HIGHLOW = C_HIGH) then lbl_redlightpm.Caption := @@ -770,9 +774,13 @@ procedure Tmainform.mnu_options_triggersSetTriggersClick(Sender: TObject); begin triggersform.ShowModal; if triggersform.ModalResult = mrCancel then - ShowMessage('Cancel') + begin + // Cancelled form + end else + begin mnu_options_triggersActivateTriggers.Enabled := True; + end; end; procedure Tmainform.mnu_SampleEveryHalfHourClick(Sender: TObject); diff --git a/applications/foobot/monitor/usplash.lfm b/applications/foobot/monitor/usplash.lfm index c4a3b7a1d..e0a5c10a9 100644 --- a/applications/foobot/monitor/usplash.lfm +++ b/applications/foobot/monitor/usplash.lfm @@ -1,14 +1,15 @@ object splashform: Tsplashform - Left = 596 - Height = 484 - Top = 136 + Left = 669 + Height = 530 + Top = 171 Width = 794 BorderStyle = bsNone Caption = 'splashform' - ClientHeight = 484 + ClientHeight = 530 ClientWidth = 794 DefaultMonitor = dmDesktop FormStyle = fsStayOnTop + OnActivate = FormActivate OnCreate = FormCreate Position = poWorkAreaCenter ShowInTaskBar = stNever @@ -16,7 +17,7 @@ object splashform: Tsplashform Scaled = True object img: TImage Left = 0 - Height = 484 + Height = 530 Top = 0 Width = 794 Align = alClient diff --git a/applications/foobot/monitor/usplash.pas b/applications/foobot/monitor/usplash.pas index f893b3e9c..8e3bb7871 100644 --- a/applications/foobot/monitor/usplash.pas +++ b/applications/foobot/monitor/usplash.pas @@ -13,6 +13,7 @@ type Tsplashform = class(TForm) img: TImage; + procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); private @@ -30,12 +31,16 @@ implementation { Tsplashform } procedure Tsplashform.FormCreate(Sender: TObject); +begin +end; + +procedure Tsplashform.FormActivate(Sender: TObject); var jpg:TJPEGImage; begin jpg:=TJPEGImage.Create; try jpg.LoadFromResourceName(HInstance,'SPLASHIMAGE'); - img.Canvas.Draw(0,0,jpg); + img.Picture.Jpeg:=jpg; finally jpg.Free; end; diff --git a/applications/foobot/monitor/utriggersform.lfm b/applications/foobot/monitor/utriggersform.lfm index f984962cf..d999d440b 100644 --- a/applications/foobot/monitor/utriggersform.lfm +++ b/applications/foobot/monitor/utriggersform.lfm @@ -1,92 +1,845 @@ object triggersform: Ttriggersform - Left = 686 - Height = 484 - Top = 279 + Left = 543 + Height = 565 + Top = 191 Width = 794 + ActiveControl = edt_newrec_pm BorderIcons = [biSystemMenu] BorderStyle = bsSingle Caption = 'triggersform' - ClientHeight = 484 + ClientHeight = 565 ClientWidth = 794 DefaultMonitor = dmDesktop FormStyle = fsStayOnTop + OnActivate = FormActivate OnCreate = FormCreate + OnShow = FormShow Position = poWorkAreaCenter ShowInTaskBar = stNever LCLVersion = '1.7' Scaled = True object grp_main: TGroupBox Left = 0 - Height = 428 + Height = 506 Top = 0 Width = 794 Align = alTop AutoSize = True - Caption = 'All Foobot Triggers' + Caption = 'All Foobot Recommended values and Triggers' ChildSizing.EnlargeVertical = crsScaleChilds ChildSizing.ControlsPerLine = 1 - ClientHeight = 408 + ClientHeight = 486 ClientWidth = 790 TabOrder = 0 object grp_pm: TGroupBox Left = 0 - Height = 68 + Height = 81 Top = 0 Width = 790 Align = alTop Caption = 'Particulates' + ChildSizing.EnlargeVertical = crsHomogenousSpaceResize + ClientHeight = 61 + ClientWidth = 786 + Font.Style = [fsBold] + ParentFont = False TabOrder = 0 + object lbl_currentrec_pm: TLabel + Left = 8 + Height = 15 + Top = 0 + Width = 304 + AutoSize = False + Caption = 'Current recommended level: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_currenthightrigger_pm: TLabel + Left = 8 + Height = 15 + Top = 20 + Width = 304 + AutoSize = False + Caption = 'Current high trigger: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_currentlowtrigger_pm: TLabel + Left = 8 + Height = 15 + Top = 40 + Width = 304 + AutoSize = False + Caption = 'Current low trigger: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_newrec_pm: TLabel + Left = 312 + Height = 15 + Top = 0 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New recommended level:' + ParentColor = False + ParentFont = False + end + object lbl_newhightrigger_pm: TLabel + Left = 312 + Height = 15 + Top = 20 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New high trigger:' + ParentColor = False + ParentFont = False + end + object lbl_newlowtrigger_pm: TLabel + Left = 312 + Height = 15 + Top = 40 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New low trigger:' + ParentColor = False + ParentFont = False + end + object edt_newrec_pm: TEdit + Left = 504 + Height = 15 + Top = 0 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 0 + Text = '0.00' + end + object edt_newhightrigger_pm: TEdit + Left = 504 + Height = 15 + Top = 20 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 1 + Text = '0.00' + end + object edt_newlowtrigger_pm: TEdit + Left = 504 + Height = 15 + Top = 40 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 2 + Text = '0.00' + end + object lbl_currentrecunits_pm: TLabel + Left = 584 + Height = 15 + Top = 0 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end + object lbl_currenthightriggerunits_pm: TLabel + Left = 584 + Height = 15 + Top = 20 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end + object lbl_currentlowtriggerunits_pm: TLabel + Left = 584 + Height = 15 + Top = 40 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end end object grp_tmp: TGroupBox Left = 0 - Height = 68 - Top = 340 + Height = 81 + Top = 405 Width = 790 Align = alTop Caption = 'All Pollution' + ChildSizing.EnlargeVertical = crsHomogenousSpaceResize + ClientHeight = 61 + ClientWidth = 786 + Font.Style = [fsBold] + ParentFont = False TabOrder = 1 + object lbl_currentrec_allpollu: TLabel + Left = 8 + Height = 15 + Top = 0 + Width = 304 + AutoSize = False + Caption = 'Current recommended level: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_currenthightrigger_allpollu: TLabel + Left = 8 + Height = 15 + Top = 20 + Width = 304 + AutoSize = False + Caption = 'Current high trigger: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_currentlowtrigger_allpollu: TLabel + Left = 8 + Height = 15 + Top = 40 + Width = 304 + AutoSize = False + Caption = 'Current low trigger: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_newrec_allpollu: TLabel + Left = 312 + Height = 15 + Top = 0 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New recommended level:' + ParentColor = False + ParentFont = False + end + object lbl_newhightrigger_allpollu: TLabel + Left = 312 + Height = 15 + Top = 20 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New high trigger:' + ParentColor = False + ParentFont = False + end + object lbl_newlowtrigger_allpollu: TLabel + Left = 312 + Height = 15 + Top = 40 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New low trigger:' + ParentColor = False + ParentFont = False + end + object edt_newrec_allpollu: TEdit + Left = 504 + Height = 15 + Top = 0 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 0 + Text = '0.00' + end + object edt_newhightrigger_allpollu: TEdit + Left = 504 + Height = 15 + Top = 20 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 1 + Text = '0.00' + end + object edt_newlowtrigger_allpollu: TEdit + Left = 504 + Height = 15 + Top = 40 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 2 + Text = '0.00' + end + object lbl_currentrecunits_allpollu: TLabel + Left = 584 + Height = 15 + Top = 0 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end + object lbl_currenthightriggerunits_allpollu: TLabel + Left = 584 + Height = 15 + Top = 20 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end + object lbl_currentlowtriggerunits_allpollu: TLabel + Left = 584 + Height = 15 + Top = 40 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end end object grp_hum: TGroupBox Left = 0 - Height = 68 - Top = 272 + Height = 81 + Top = 324 Width = 790 Align = alTop Caption = 'Volatile Componds' + ChildSizing.EnlargeVertical = crsHomogenousSpaceResize + ClientHeight = 61 + ClientWidth = 786 + Font.Style = [fsBold] + ParentFont = False TabOrder = 2 + object lbl_currentrec_voc: TLabel + Left = 8 + Height = 15 + Top = 0 + Width = 304 + AutoSize = False + Caption = 'Current recommended level: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_currenthightrigger_voc: TLabel + Left = 8 + Height = 15 + Top = 20 + Width = 304 + AutoSize = False + Caption = 'Current high trigger: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_currentlowtrigger_voc: TLabel + Left = 8 + Height = 15 + Top = 40 + Width = 304 + AutoSize = False + Caption = 'Current low trigger: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_newrec_voc: TLabel + Left = 312 + Height = 15 + Top = 0 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New recommended level:' + ParentColor = False + ParentFont = False + end + object lbl_newhightrigger_voc: TLabel + Left = 312 + Height = 15 + Top = 20 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New high trigger:' + ParentColor = False + ParentFont = False + end + object lbl_newlowtrigger_voc: TLabel + Left = 312 + Height = 15 + Top = 40 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New low trigger:' + ParentColor = False + ParentFont = False + end + object edt_newrec_voc: TEdit + Left = 504 + Height = 15 + Top = 0 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 0 + Text = '0.00' + end + object edt_newhightrigger_voc: TEdit + Left = 504 + Height = 15 + Top = 20 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 1 + Text = '0.00' + end + object edt_newlowtrigger_voc: TEdit + Left = 504 + Height = 15 + Top = 40 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 2 + Text = '0.00' + end + object lbl_currentrecunits_voc: TLabel + Left = 584 + Height = 15 + Top = 0 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end + object lbl_currenthightriggerunits_voc: TLabel + Left = 584 + Height = 15 + Top = 20 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end + object lbl_currentlowtriggerunits_voc: TLabel + Left = 584 + Height = 15 + Top = 40 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end end object grp_co2: TGroupBox Left = 0 - Height = 68 - Top = 204 + Height = 81 + Top = 243 Width = 790 Align = alTop - Caption = 'Carbon Diaoxide' + Caption = 'Carbon Dioxide' + ChildSizing.EnlargeVertical = crsHomogenousSpaceResize + ClientHeight = 61 + ClientWidth = 786 + Font.Style = [fsBold] + ParentFont = False TabOrder = 3 + object lbl_currentrec_co2: TLabel + Left = 8 + Height = 15 + Top = 0 + Width = 304 + AutoSize = False + Caption = 'Current recommended level: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_currenthightrigger_co2: TLabel + Left = 8 + Height = 15 + Top = 20 + Width = 304 + AutoSize = False + Caption = 'Current high trigger: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_currentlowtrigger_co2: TLabel + Left = 8 + Height = 15 + Top = 40 + Width = 304 + AutoSize = False + Caption = 'Current low trigger: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_newrec_co2: TLabel + Left = 312 + Height = 15 + Top = 0 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New recommended level:' + ParentColor = False + ParentFont = False + end + object lbl_newhightrigger_co2: TLabel + Left = 312 + Height = 15 + Top = 20 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New high trigger:' + ParentColor = False + ParentFont = False + end + object lbl_newlowtrigger_co2: TLabel + Left = 312 + Height = 15 + Top = 40 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New low trigger:' + ParentColor = False + ParentFont = False + end + object edt_newrec_co2: TEdit + Left = 504 + Height = 15 + Top = 0 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 0 + Text = '0.00' + end + object edt_newhightrigger_co2: TEdit + Left = 504 + Height = 15 + Top = 20 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 1 + Text = '0.00' + end + object edt_newlowtrigger_co2: TEdit + Left = 504 + Height = 15 + Top = 40 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 2 + Text = '0.00' + end + object lbl_currentrecunits_co2: TLabel + Left = 584 + Height = 15 + Top = 0 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end + object lbl_currenthightriggerunits_co2: TLabel + Left = 584 + Height = 15 + Top = 20 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end + object lbl_currentlowtriggerunits_co2: TLabel + Left = 584 + Height = 15 + Top = 40 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end end object grp_voc: TGroupBox Left = 0 - Height = 68 - Top = 136 + Height = 81 + Top = 162 Width = 790 Align = alTop Caption = 'Humidity' + ChildSizing.EnlargeVertical = crsHomogenousSpaceResize + ClientHeight = 61 + ClientWidth = 786 + Font.Style = [fsBold] + ParentFont = False TabOrder = 4 + object lbl_currentrec_hum: TLabel + Left = 8 + Height = 15 + Top = 0 + Width = 304 + AutoSize = False + Caption = 'Current recommended level: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_currenthightrigger_hum: TLabel + Left = 8 + Height = 15 + Top = 20 + Width = 304 + AutoSize = False + Caption = 'Current high trigger: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_currentlowtrigger_hum: TLabel + Left = 8 + Height = 15 + Top = 40 + Width = 304 + AutoSize = False + Caption = 'Current low trigger: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_newrec_hum: TLabel + Left = 312 + Height = 15 + Top = 0 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New recommended level:' + ParentColor = False + ParentFont = False + end + object lbl_newhightrigger_hum: TLabel + Left = 312 + Height = 15 + Top = 20 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New high trigger:' + ParentColor = False + ParentFont = False + end + object lbl_newlowtrigger_hum: TLabel + Left = 312 + Height = 15 + Top = 40 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New low trigger:' + ParentColor = False + ParentFont = False + end + object edt_newrec_hum: TEdit + Left = 504 + Height = 15 + Top = 0 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 0 + Text = '0.00' + end + object edt_newhightrigger_hum: TEdit + Left = 504 + Height = 15 + Top = 20 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 1 + Text = '0.00' + end + object edt_newlowtrigger_hum: TEdit + Left = 504 + Height = 15 + Top = 40 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 2 + Text = '0.00' + end + object lbl_currentrecunits_hum: TLabel + Left = 584 + Height = 15 + Top = 0 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end + object lbl_currenthightriggerunits_hum: TLabel + Left = 584 + Height = 15 + Top = 20 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end + object lbl_currentlowtriggerunits_hum: TLabel + Left = 584 + Height = 15 + Top = 40 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end end object grp_allpollu: TGroupBox Left = 0 - Height = 68 - Top = 68 + Height = 81 + Top = 81 Width = 790 Align = alTop Caption = 'Temperature' + ChildSizing.EnlargeVertical = crsHomogenousSpaceResize + ClientHeight = 61 + ClientWidth = 786 + Font.Style = [fsBold] + ParentFont = False TabOrder = 5 + object lbl_currentrec_tmp: TLabel + Left = 8 + Height = 15 + Top = 0 + Width = 304 + AutoSize = False + Caption = 'Current recommended level: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_currenthightrigger_tmp: TLabel + Left = 8 + Height = 15 + Top = 20 + Width = 304 + AutoSize = False + Caption = 'Current high trigger: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_currentlowtrigger_tmp: TLabel + Left = 8 + Height = 15 + Top = 40 + Width = 304 + AutoSize = False + Caption = 'Current low trigger: No Stats' + ParentColor = False + ParentFont = False + end + object lbl_newrec_tmp: TLabel + Left = 312 + Height = 15 + Top = 0 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New recommended level:' + ParentColor = False + ParentFont = False + end + object lbl_newhightrigger_tmp: TLabel + Left = 312 + Height = 15 + Top = 20 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New high trigger:' + ParentColor = False + ParentFont = False + end + object lbl_newlowtrigger_tmp: TLabel + Left = 312 + Height = 15 + Top = 40 + Width = 168 + Alignment = taRightJustify + AutoSize = False + Caption = 'New low trigger:' + ParentColor = False + ParentFont = False + end + object edt_newrec_tmp: TEdit + Left = 504 + Height = 15 + Top = 0 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 0 + Text = '0.00' + end + object edt_newhightrigger_tmp: TEdit + Left = 504 + Height = 15 + Top = 20 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 1 + Text = '0.00' + end + object edt_newlowtrigger_tmp: TEdit + Left = 504 + Height = 15 + Top = 40 + Width = 72 + BorderStyle = bsNone + ParentFont = False + TabOrder = 2 + Text = '0.00' + end + object lbl_currentrecunits_tmp: TLabel + Left = 584 + Height = 15 + Top = 0 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end + object lbl_currenthightriggerunits_tmp: TLabel + Left = 584 + Height = 15 + Top = 20 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end + object lbl_currentlowtriggerunits_tmp: TLabel + Left = 584 + Height = 15 + Top = 40 + Width = 26 + Caption = 'units' + ParentColor = False + ParentFont = False + end end end object cmd_OK: TBitBtn Left = 360 Height = 30 - Top = 440 + Top = 520 Width = 75 Default = True DefaultCaption = True @@ -97,7 +850,7 @@ object triggersform: Ttriggersform object cmd_cancel: TBitBtn Left = 704 Height = 30 - Top = 440 + Top = 520 Width = 75 Cancel = True DefaultCaption = True diff --git a/applications/foobot/monitor/utriggersform.pas b/applications/foobot/monitor/utriggersform.pas index 4b2ab8d07..3bea742f0 100644 --- a/applications/foobot/monitor/utriggersform.pas +++ b/applications/foobot/monitor/utriggersform.pas @@ -15,6 +15,24 @@ type Ttriggersform = class(TForm) cmd_cancel: TBitBtn; cmd_OK: TBitBtn; + edt_newhightrigger_tmp: TEdit; + edt_newhightrigger_hum: TEdit; + edt_newhightrigger_co2: TEdit; + edt_newhightrigger_voc: TEdit; + edt_newhightrigger_allpollu: TEdit; + edt_newlowtrigger_tmp: TEdit; + edt_newlowtrigger_hum: TEdit; + edt_newlowtrigger_co2: TEdit; + edt_newlowtrigger_voc: TEdit; + edt_newlowtrigger_allpollu: TEdit; + edt_newrec_pm: TEdit; + edt_newhightrigger_pm: TEdit; + edt_newlowtrigger_pm: TEdit; + edt_newrec_tmp: TEdit; + edt_newrec_hum: TEdit; + edt_newrec_co2: TEdit; + edt_newrec_voc: TEdit; + edt_newrec_allpollu: TEdit; grp_pm: TGroupBox; grp_tmp: TGroupBox; grp_hum: TGroupBox; @@ -22,9 +40,66 @@ type grp_voc: TGroupBox; grp_allpollu: TGroupBox; grp_main: TGroupBox; + lbl_currenthightriggerunits_tmp: TLabel; + lbl_currenthightriggerunits_hum: TLabel; + lbl_currenthightriggerunits_co2: TLabel; + lbl_currenthightriggerunits_voc: TLabel; + lbl_currenthightriggerunits_allpollu: TLabel; + lbl_currenthightrigger_tmp: TLabel; + lbl_currenthightrigger_hum: TLabel; + lbl_currenthightrigger_co2: TLabel; + lbl_currenthightrigger_voc: TLabel; + lbl_currenthightrigger_allpollu: TLabel; + lbl_currentlowtriggerunits_tmp: TLabel; + lbl_currentlowtriggerunits_hum: TLabel; + lbl_currentlowtriggerunits_co2: TLabel; + lbl_currentlowtriggerunits_voc: TLabel; + lbl_currentlowtriggerunits_allpollu: TLabel; + lbl_currentlowtrigger_tmp: TLabel; + lbl_currentlowtrigger_hum: TLabel; + lbl_currentlowtrigger_co2: TLabel; + lbl_currentlowtrigger_voc: TLabel; + lbl_currentlowtrigger_allpollu: TLabel; + lbl_currenthightriggerunits_pm: TLabel; + lbl_currentlowtriggerunits_pm: TLabel; + lbl_currentrecunits_tmp: TLabel; + lbl_currentrecunits_hum: TLabel; + lbl_currentrecunits_co2: TLabel; + lbl_currentrecunits_voc: TLabel; + lbl_currentrecunits_allpollu: TLabel; + lbl_currentrec_pm: TLabel; + lbl_currenthightrigger_pm: TLabel; + lbl_currentlowtrigger_pm: TLabel; + lbl_currentrecunits_pm: TLabel; + lbl_newhightrigger_tmp: TLabel; + lbl_newhightrigger_hum: TLabel; + lbl_newhightrigger_co2: TLabel; + lbl_newhightrigger_voc: TLabel; + lbl_newhightrigger_allpollu: TLabel; + lbl_newlowtrigger_tmp: TLabel; + lbl_newlowtrigger_hum: TLabel; + lbl_newlowtrigger_co2: TLabel; + lbl_newlowtrigger_voc: TLabel; + lbl_newlowtrigger_allpollu: TLabel; + lbl_newrec_pm: TLabel; + lbl_currentrec_tmp: TLabel; + lbl_currentrec_hum: TLabel; + lbl_currentrec_co2: TLabel; + lbl_currentrec_voc: TLabel; + lbl_currentrec_allpollu: TLabel; + lbl_newhightrigger_pm: TLabel; + lbl_newlowtrigger_pm: TLabel; + lbl_newrec_tmp: TLabel; + lbl_newrec_hum: TLabel; + lbl_newrec_co2: TLabel; + lbl_newrec_voc: TLabel; + lbl_newrec_allpollu: TLabel; + procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); + procedure FormShow(Sender: TObject); private - + procedure DisplayCurrentValues; + procedure SetUpUnits; public end; @@ -33,16 +108,128 @@ var triggersform: Ttriggersform; implementation -Uses umainform; + +uses umainform, foobot_utility; + {$R *.lfm} { Ttriggersform } procedure Ttriggersform.FormCreate(Sender: TObject); begin - Icon:=Application.Icon; - Caption:=Application.Title + ' - Set Triggers'; + Icon := Application.Icon; + Caption := Application.Title + ' - Set Recommended values and Triggers'; +end; + +procedure Ttriggersform.FormActivate(Sender: TObject); +begin + SetUpUnits; +end; + +procedure Ttriggersform.FormShow(Sender: TObject); +begin + DisplayCurrentValues; + Update; +end; + +procedure Ttriggersform.DisplayCurrentValues; +begin + {$IFDEF DEBUGMODE} + Exit; +{$ENDIF} + // Recommended levels + lbl_currentrec_pm.Caption := + Format('Current recommended level: %.1f %s', [double(REC_PM), + FoobotDataObject.Units[C_PM]]); + lbl_currentrec_tmp.Caption := + Format('Current recommended level: %.1f %s', [double(REC_TMP), + FoobotDataObject.Units[C_TMP]]); + lbl_currentrec_hum.Caption := + Format('Current recommended level: %.1f %s', [double(REC_HUM), + FoobotDataObject.Units[C_HUM]]); + lbl_currentrec_co2.Caption := + Format('Current recommended level: %.0f %s', [double(REC_CO2), + FoobotDataObject.Units[C_CO2]]); + lbl_currentrec_voc.Caption := + Format('Current recommended level: %.0f %s', [double(REC_VOC), + FoobotDataObject.Units[C_VOC]]); + lbl_currentrec_allpollu.Caption := + Format('Current recommended level: %.1f %s', + [double(REC_ALLPOLLU), FoobotDataObject.Units[C_ALLPOLLU]]); + // Trigger highs + lbl_currenthightrigger_pm.Caption := + Format('Current high trigger: %.1f %s', + [double(FooBotTriggerArray[C_HIGH, C_PM]), FoobotDataObject.Units[C_PM]]); + lbl_currenthightrigger_tmp.Caption := + Format('Current high trigger: %.1f %s', + [double(FooBotTriggerArray[C_HIGH, C_TMP]), FoobotDataObject.Units[C_TMP]]); + lbl_currenthightrigger_hum.Caption := + Format('Current high trigger: %.1f %s', + [double(FooBotTriggerArray[C_HIGH, C_HUM]), FoobotDataObject.Units[C_HUM]]); + lbl_currenthightrigger_co2.Caption := + Format('Current high trigger: %.1f %s', + [double(FooBotTriggerArray[C_HIGH, C_CO2]), FoobotDataObject.Units[C_CO2]]); + lbl_currenthightrigger_voc.Caption := + Format('Current high trigger: %.1f %s', + [double(FooBotTriggerArray[C_HIGH, C_VOC]), FoobotDataObject.Units[C_VOC]]); + lbl_currenthightrigger_allpollu.Caption := + Format('Current high trigger: %.1f %s', + [double(FooBotTriggerArray[C_HIGH, C_ALLPOLLU]), + FoobotDataObject.Units[C_ALLPOLLU]]); + // Trigger lows + lbl_currentlowtrigger_pm.Caption := + Format('Current low trigger: %.1f %s', + [double(FooBotTriggerArray[C_LOW, C_PM]), FoobotDataObject.Units[C_PM]]); + lbl_currentlowtrigger_tmp.Caption := + Format('Current low trigger: %.1f %s', + [double(FooBotTriggerArray[C_LOW, C_TMP]), FoobotDataObject.Units[C_TMP]]); + lbl_currentlowtrigger_hum.Caption := + Format('Current low trigger: %.1f %s', + [double(FooBotTriggerArray[C_LOW, C_HUM]), FoobotDataObject.Units[C_HUM]]); + lbl_currentlowtrigger_co2.Caption := + Format('Current low trigger: %.1f %s', + [double(FooBotTriggerArray[C_LOW, C_CO2]), FoobotDataObject.Units[C_CO2]]); + lbl_currentlowtrigger_voc.Caption := + Format('Current low trigger: %.1f %s', + [double(FooBotTriggerArray[C_LOW, C_VOC]), FoobotDataObject.Units[C_VOC]]); + lbl_currentlowtrigger_allpollu.Caption := + Format('Current low trigger: %.1f %s', + [double(FooBotTriggerArray[C_LOW, C_ALLPOLLU]), FoobotDataObject.Units[C_ALLPOLLU]]); +end; + +procedure Ttriggersform.SetUpUnits; +var + s: string; +begin + s := Format('%s', [FoobotDataObject.Units[C_PM]]); + lbl_currentrecunits_pm.Caption := s; + lbl_currenthightriggerunits_pm.Caption := s; + lbl_currentlowtriggerunits_pm.Caption := s; + + s := Format('%s', [FoobotDataObject.Units[C_TMP]]); + lbl_currentrecunits_tmp.Caption := s; + lbl_currenthightriggerunits_tmp.Caption := s; + lbl_currentlowtriggerunits_tmp.Caption := s; + + s := Format('%s', [FoobotDataObject.Units[C_HUM]]); + lbl_currentrecunits_hum.Caption := s; + lbl_currenthightriggerunits_hum.Caption := s; + lbl_currentlowtriggerunits_hum.Caption := s; + + s := Format('%s', [FoobotDataObject.Units[C_CO2]]); + lbl_currentrecunits_co2.Caption := s; + lbl_currenthightriggerunits_co2.Caption := s; + lbl_currentlowtriggerunits_co2.Caption := s; + + s := Format('%s', [FoobotDataObject.Units[C_VOC]]); + lbl_currentrecunits_voc.Caption := s; + lbl_currenthightriggerunits_voc.Caption := s; + lbl_currentlowtriggerunits_voc.Caption := s; + + s := Format('%s', [FoobotDataObject.Units[C_ALLPOLLU]]); + lbl_currentrecunits_allpollu.Caption := s; + lbl_currenthightriggerunits_allpollu.Caption := s; + lbl_currentlowtriggerunits_allpollu.Caption := s; end; end. -