-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUnit6.pas
121 lines (104 loc) · 2.91 KB
/
Unit6.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, AdvGlassButton, IniFiles, AdvEdit, AdvEdBtn,
AdvDirectoryEdit, ExtCtrls;
type
TForm6 = class(TForm)
Label2: TLabel;
but_save: TAdvGlassButton;
CheckBox4: TCheckBox;
Edit1: TEdit;
Label1: TLabel;
CheckBox2: TCheckBox;
AdvDirectoryEdit1: TAdvDirectoryEdit;
Label3: TLabel;
CheckBox1: TCheckBox;
AdvDirectoryEdit2: TAdvDirectoryEdit;
RadioGroup1: TRadioGroup;
RadioGroup2: TRadioGroup;
Label4: TLabel;
but_set: TAdvGlassButton;
Label5: TLabel;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure but_saveClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure but_setClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form6: TForm6;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm6.but_saveClick(Sender: TObject);
begin
Form6.Close;
end;
procedure TForm6.but_setClick(Sender: TObject);
var
tempdata:word;
begin
tempdata:=RadioGroup2.ItemIndex;
if tempdata>3 then
tempdata:=2; //default
settings_data:= RadioGroup1.ItemIndex;
if settings_data>7 then
settings_data:=0; //default
settings_data:=settings_data+ (tempdata shl 8);//pack into one word
send_new_settings_to_adapter(0); //rf sens
end;
procedure TForm6.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Ini := Tinifile.Create(savedir);
Ini.WriteBool('RX_SETTINGS', 'LOG_EN', CheckBox2.Checked);
Ini.Writestring('RX_SETTINGS', 'LOG_FILE', AdvDirectoryEdit1.Text);
Ini.WriteBool('RX_SETTINGS', 'HTTP_EN', CheckBox4.Checked);
Ini.Writestring('RX_SETTINGS', 'HTTP_ADDR', Edit1.Text);
Ini.WriteBool('RX_SETTINGS', 'SENSLOG_EN', CheckBox1.Checked);
Ini.Writestring('RX_SETTINGS', 'SENSLOG_FILE', AdvDirectoryEdit2.Text);
Ini.Free;
send_http_enable := CheckBox4.Checked;
send_http_address := Edit1.Text;
senslog_en:=CheckBox1.Checked;
senslog_patch:= AdvDirectoryEdit2.Text;
if senslog_en then
save_sensors_data();
end;
procedure TForm6.FormShow(Sender: TObject);
begin
CheckBox2.Checked := log_en;
CheckBox4.Checked := send_http_enable;
CheckBox1.Checked:= senslog_en;
AdvDirectoryEdit2.Text := senslog_patch;
AdvDirectoryEdit1.Text := log_patch;
Edit1.Text := send_http_address;
if (current_adapter=8) then begin //MTRF64A
but_set.Visible:=true;
Label4.Visible:=true;
Label5.Visible:=true;
RadioGroup2.Visible:=true;
if (adapterFirmware>0) then begin //baudrate and sensivity
RadioGroup1.Visible:=true;
RadioGroup2.Left:=163;
Label5.Left:=165;
end
else begin //sensivity
RadioGroup1.Visible:=false;
RadioGroup2.Left:=8;
Label5.Left:=10;
end;
end
else begin
Label4.Visible:=false;
Label5.Visible:=false;
RadioGroup1.Visible:=false;
RadioGroup2.Visible:=false;
but_set.Visible:=false;
end;
end;
end.