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