|
@@ -200,7 +200,7 @@ type
|
|
|
procedure initMidi;
|
|
|
procedure playNote(note: byte);
|
|
|
procedure loadFromList(Lines: TStringList; filename: string);
|
|
|
- function readString(var line: string): boolean;
|
|
|
+ function readString(var line: string; wait: boolean): boolean;
|
|
|
procedure saveSection(filename: string; key: string);
|
|
|
procedure loadSection(filename: string; key: string);
|
|
|
|
|
@@ -648,7 +648,7 @@ begin
|
|
|
acDebug.Enabled := True;
|
|
|
acDebug.ImageIndex := 57;
|
|
|
cbAdrActual.Enabled := True;
|
|
|
- cbIgnDly.Enabled:= True;
|
|
|
+ cbIgnDly.Enabled := True;
|
|
|
acNextStep.Enabled := False;
|
|
|
// sps programmieren
|
|
|
programSps();
|
|
@@ -720,7 +720,7 @@ var
|
|
|
eot: boolean;
|
|
|
begin
|
|
|
eot := False;
|
|
|
- i := StringGrid1.RowCount-1;
|
|
|
+ i := StringGrid1.RowCount - 1;
|
|
|
if (i >= (sps.getE2E())) then
|
|
|
begin
|
|
|
LSUAutoMsgBox('Messages', 'ID_PRG_TO_LONG', MB_OK + MB_ICONERROR);
|
|
@@ -750,9 +750,9 @@ end;
|
|
|
procedure TForm1.acNextInsertExecute(Sender: TObject);
|
|
|
var
|
|
|
myPos: integer;
|
|
|
- i : integer;
|
|
|
+ i: integer;
|
|
|
begin
|
|
|
- i := StringGrid1.RowCount-1;
|
|
|
+ i := StringGrid1.RowCount - 1;
|
|
|
if (i >= (sps.getE2E())) then
|
|
|
begin
|
|
|
LSUAutoMsgBox('Messages', 'ID_PRG_TO_LONG', MB_OK + MB_ICONERROR);
|
|
@@ -925,6 +925,7 @@ begin
|
|
|
end;
|
|
|
Form2.addHexFile(list);
|
|
|
Form2.ShowModal;
|
|
|
+ Form2.Destroy;
|
|
|
list.Free;
|
|
|
end;
|
|
|
|
|
@@ -1056,6 +1057,10 @@ begin
|
|
|
|
|
|
if (return = mrOk) then
|
|
|
begin
|
|
|
+ Form2 := TForm2.Create(self);
|
|
|
+ Form2.Memo1.Clear;
|
|
|
+ Form2.Show;
|
|
|
+
|
|
|
hexFile := serialUpload;
|
|
|
SdpoSerial1.BaudRate := br__9600;
|
|
|
|
|
@@ -1067,38 +1072,66 @@ begin
|
|
|
|
|
|
SdpoSerial1.Device := comService;
|
|
|
SdpoSerial1.Active := True;
|
|
|
-
|
|
|
- error := true;
|
|
|
- while retries < 10 do
|
|
|
+ retries := 10;
|
|
|
+ error := True;
|
|
|
+ while retries > 0 do
|
|
|
begin
|
|
|
- SdpoSerial1.WriteData('p');
|
|
|
- if (readString(line)) then
|
|
|
- begin
|
|
|
- if (pos('command', line) > 0) then
|
|
|
- begin
|
|
|
- retries := 10;
|
|
|
- error := false;
|
|
|
- end;
|
|
|
- end;
|
|
|
- SdpoSerial1.WriteData('h');
|
|
|
- inc(retries);
|
|
|
+ Form2.Memo1.Append('>p');
|
|
|
+ SdpoSerial1.WriteData('p');
|
|
|
+ if (readString(line, True)) then
|
|
|
+ begin
|
|
|
+ Form2.Memo1.Append(line);
|
|
|
+ if (pos('command', line) > 0) then
|
|
|
+ begin
|
|
|
+ retries := 0;
|
|
|
+ error := False;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ if error then
|
|
|
+ begin
|
|
|
+ Form2.Memo1.Append('>h');
|
|
|
+ SdpoSerial1.WriteData('h');
|
|
|
+ end;
|
|
|
+ Dec(retries);
|
|
|
end;
|
|
|
if (not error) then
|
|
|
begin
|
|
|
+ Form2.Memo1.Append('>w');
|
|
|
SdpoSerial1.WriteData('w');
|
|
|
- if (readString(line)) then
|
|
|
+ if (readString(line, True)) then
|
|
|
begin
|
|
|
+ Form2.Memo1.Append(line);
|
|
|
if (pos('ready', line) > 0) then
|
|
|
begin
|
|
|
Lines := TStringList.Create;
|
|
|
Lines.LoadFromFile(hexFile);
|
|
|
for x := 0 to Lines.Count - 1 do
|
|
|
begin
|
|
|
- SdpoSerial1.WriteData(Lines.Strings[x]);
|
|
|
- SdpoSerial1.WriteData(CRLF);
|
|
|
+ Form2.Memo1.Append('>' + Lines.Strings[x]);
|
|
|
+ SdpoSerial1.WriteData(Lines.Strings[x] + CRLF);
|
|
|
Sleep(250);
|
|
|
+ if (readString(line, False)) then
|
|
|
+ begin
|
|
|
+ if line <> '' then
|
|
|
+ begin
|
|
|
+ line := StringReplace(line, '\r', '', []);
|
|
|
+ line := StringReplace(line, '\n', '', []);
|
|
|
+ Form2.Memo1.Append(line);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
end;
|
|
|
+ Form2.Memo1.Append('>e');
|
|
|
SdpoSerial1.WriteData('e');
|
|
|
+ Sleep(250);
|
|
|
+ if (readString(line, True)) then
|
|
|
+ begin
|
|
|
+ if line <> '' then
|
|
|
+ begin
|
|
|
+ line := StringReplace(line, '\r', '', []);
|
|
|
+ line := StringReplace(line, '\n', '', []);
|
|
|
+ Form2.Memo1.Append(line);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
@@ -1106,7 +1139,6 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
-
|
|
|
if (error) then
|
|
|
begin
|
|
|
LSUAutoMsgBox('Messages', 'ID_NOT_READY', MB_OK + MB_ICONERROR);
|
|
@@ -1115,6 +1147,8 @@ begin
|
|
|
begin
|
|
|
LSUAutoMsgBox('Messages', 'ID_UPLOAD_OK', MB_OK + MB_ICONINFORMATION);
|
|
|
end;
|
|
|
+ Form2.Close();
|
|
|
+ Form2.Destroy();
|
|
|
SdpoSerial1.Active := False;
|
|
|
DeleteFile(hexFile);
|
|
|
end;
|
|
@@ -1122,16 +1156,19 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
-function TForm1.readString(var line: string): boolean;
|
|
|
+function TForm1.readString(var line: string; wait: boolean): boolean;
|
|
|
var
|
|
|
TimeOut: integer;
|
|
|
begin
|
|
|
Result := False;
|
|
|
TimeOut := 10;
|
|
|
- while ((not SdpoSerial1.DataAvailable) and (TimeOut > 0)) do
|
|
|
+ if (wait) then
|
|
|
begin
|
|
|
- Dec(TimeOut);
|
|
|
- Sleep(1000);
|
|
|
+ while ((not SdpoSerial1.DataAvailable) and (TimeOut > 0)) do
|
|
|
+ begin
|
|
|
+ Dec(TimeOut);
|
|
|
+ Sleep(1000);
|
|
|
+ end;
|
|
|
end;
|
|
|
if (Timeout > 0) then
|
|
|
begin
|
|
@@ -1536,7 +1573,8 @@ begin
|
|
|
Value := trim(Value);
|
|
|
if (Value <> '') then
|
|
|
begin
|
|
|
- if StringGrid1.RowCount <= sps.getE2E() then begin
|
|
|
+ if StringGrid1.RowCount <= sps.getE2E() then
|
|
|
+ begin
|
|
|
setDirty(True);
|
|
|
StringGrid1.RowCount := StringGrid1.RowCount + 1;
|
|
|
renumberGrid();
|