-
Notifications
You must be signed in to change notification settings - Fork 1
/
Unit3.pas
169 lines (145 loc) · 4.98 KB
/
Unit3.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, AdvGlassButton, ComCtrls;
type
TForm3 = class(TForm)
AdvGlassButton1: TAdvGlassButton;
ListBox1: TListBox;
Label1: TLabel;
AdvGlassButton2: TAdvGlassButton;
procedure AdvGlassButton2Click(Sender: TObject);
procedure AdvGlassButton1Click(Sender: TObject);
procedure ListBox1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
uses Unit1, Unit4;
{$R *.dfm}
procedure TForm3.AdvGlassButton1Click(Sender: TObject);
begin
if (ListBox1.ItemIndex > -1) then
begin
Form1.ComPort1.Port := com_name.Strings[ListBox1.ItemIndex];
Form1.ComPort1.BaudRate:=COMbaudrates[strtoint(baudrates.Strings[ListBox1.ItemIndex])];
Form1.ComPort1.Open;
Form1.AdvSmoothStatusIndicator1.Appearance.Fill.Color := color_good;
if boot_name.Strings[ListBox1.ItemIndex]='BOOT' then
Form1.Label19.Caption :='Îáíîâëåíèå ÏÎ ' + adapter_name.Strings[ListBox1.ItemIndex]
else
Form1.Label19.Caption := adapter_name.Strings[ListBox1.ItemIndex] + ' (v' +
main_ver.Strings[ListBox1.ItemIndex] + ')';
adapterFirmware:=strtoint(main_ver.Strings[ListBox1.ItemIndex]);
if adapter_name.Strings[ListBox1.ItemIndex]=DEV_TYPE_0 then
current_adapter:=0
else if adapter_name.Strings[ListBox1.ItemIndex]=DEV_TYPE_9 then
current_adapter:=8;
service_find := 0;
if boot_name.Strings[ListBox1.ItemIndex]='BOOT' then begin
if (MessageDlg('Âûáðàí àäàïòåð â ðåæèìå îáíîâëåíèÿ ÏÎ! Îáíîâèòü ÏÎ?',
mtCustom, [mbYes, mbNo], 0) = mrYes) then
begin
cancelUpdate:=false;
boot_mode := 1; // âõîäèì â ðåæèì áóòëîàäåðà
Form4.Show;
boot_mode_step := 3;
end
else begin
Form1.AdvGlassButton17.Enabled:=true;
cancelUpdate:=true;
boot_mode := 1; // âõîäèì â ðåæèì áóòëîàäåðà
boot_mode_step := 3;
end;
end
else begin
Form1.AdvGlassButton12.Enabled := true;
Form1.AdvGlassButton8.Enabled := true;
Form1.AdvGlassButton9.Enabled := true;
Form1.AdvGlassButton11.Enabled := true;
Form1.AdvGlassButton10.Enabled := true;
Form1.AdvGlassButton13.Enabled := true;
Form1.AdvGlassButton7.Enabled := true;
Form1.ListBox1.Enabled := true;
Form1.AdvGlassButton2.Enabled:=true;
Form1.AdvGlassButton1.Enabled:=true;
Form1.AdvGlassButton17.Enabled:=true;
Form1.Label6.Font.Color := clHotLight;
Form1.Label6.Caption:='Íàæìèòå "Ñ÷èòàòü ñîñòîÿíèå"';
end;
Form3.Close;
end
else
begin
Showmessage('Âûáåðèòå àäàïòåð èç ñïèñêà!');
end;
end;
procedure TForm3.AdvGlassButton2Click(Sender: TObject);
begin
Form1.Timer4.Enabled := true;
Form3.Close;
Form1.Close;
end;
procedure TForm3.ListBox1DblClick(Sender: TObject);
begin
if (ListBox1.ItemIndex > -1) then
begin
Form1.ComPort1.Port := com_name.Strings[ListBox1.ItemIndex];
Form1.ComPort1.BaudRate:=COMbaudrates[strtoint(baudrates.Strings[ListBox1.ItemIndex])];
Form1.ComPort1.Open;
Form1.AdvSmoothStatusIndicator1.Appearance.Fill.Color := color_good;
if boot_name.Strings[ListBox1.ItemIndex]='BOOT' then
Form1.Label19.Caption :='Îáíîâëåíèå ÏÎ ' + adapter_name.Strings[ListBox1.ItemIndex]
else
Form1.Label19.Caption := adapter_name.Strings[ListBox1.ItemIndex] + ' (v' +
main_ver.Strings[ListBox1.ItemIndex] + ')';
adapterFirmware:=strtoint(main_ver.Strings[ListBox1.ItemIndex]);
if adapter_name.Strings[ListBox1.ItemIndex]=DEV_TYPE_0 then
current_adapter:=0
else if adapter_name.Strings[ListBox1.ItemIndex]=DEV_TYPE_9 then
current_adapter:=8;
service_find := 0;
if boot_name.Strings[ListBox1.ItemIndex]='BOOT' then begin
if (MessageDlg('Âûáðàí àäàïòåð â ðåæèìå îáíîâëåíèÿ ÏÎ! Îáíîâèòü ÏÎ?',
mtCustom, [mbYes, mbNo], 0) = mrYes) then
begin
cancelUpdate:=false;
boot_mode := 1; // âõîäèì â ðåæèì áóòëîàäåðà
Form4.Show;
boot_mode_step := 3;
end
else begin
Form1.AdvGlassButton17.Enabled:=true;
cancelUpdate:=true;
boot_mode := 1; // âõîäèì â ðåæèì áóòëîàäåðà
boot_mode_step := 3;
end;
end
else begin
Form1.AdvGlassButton12.Enabled := true;
Form1.AdvGlassButton8.Enabled := true;
Form1.AdvGlassButton9.Enabled := true;
Form1.AdvGlassButton11.Enabled := true;
Form1.AdvGlassButton10.Enabled := true;
Form1.AdvGlassButton13.Enabled := true;
Form1.AdvGlassButton7.Enabled := true;
Form1.ListBox1.Enabled := true;
Form1.AdvGlassButton2.Enabled:=true;
Form1.AdvGlassButton1.Enabled:=true;
Form1.AdvGlassButton17.Enabled:=true;
Form1.Label6.Font.Color := clHotLight;
Form1.Label6.Caption:='Íàæìèòå "Ñ÷èòàòü ñîñòîÿíèå"';
end;
Form3.Close;
end
else
begin
Showmessage('Âûáåðèòå àäàïòåð èç ñïèñêà!');
end;
end;
end.