|
@@ -38,6 +38,8 @@ type
|
|
cbIgnDly: TCheckBox;
|
|
cbIgnDly: TCheckBox;
|
|
cbTPSVersion: TComboBox;
|
|
cbTPSVersion: TComboBox;
|
|
cbAdrActual: TCheckBox;
|
|
cbAdrActual: TCheckBox;
|
|
|
|
+ cbHardwareEmu: TCheckBox;
|
|
|
|
+ cbSerialNames: TComboBox;
|
|
EditDelay: TLabeledEdit;
|
|
EditDelay: TLabeledEdit;
|
|
EditJump: TLabeledEdit;
|
|
EditJump: TLabeledEdit;
|
|
EditPage: TLabeledEdit;
|
|
EditPage: TLabeledEdit;
|
|
@@ -52,6 +54,7 @@ type
|
|
Label5: TLabel;
|
|
Label5: TLabel;
|
|
lbStack: TListBox;
|
|
lbStack: TListBox;
|
|
MCSLabel: TLabel;
|
|
MCSLabel: TLabel;
|
|
|
|
+ mmLogMessages: TMemo;
|
|
MenuItem1: TMenuItem;
|
|
MenuItem1: TMenuItem;
|
|
pmExamples: TPopupMenu;
|
|
pmExamples: TPopupMenu;
|
|
RC1: TSpinEdit;
|
|
RC1: TSpinEdit;
|
|
@@ -165,7 +168,9 @@ type
|
|
procedure btnToneClick(Sender: TObject);
|
|
procedure btnToneClick(Sender: TObject);
|
|
procedure cbCommandChange(Sender: TObject);
|
|
procedure cbCommandChange(Sender: TObject);
|
|
procedure cbDataChange(Sender: TObject);
|
|
procedure cbDataChange(Sender: TObject);
|
|
|
|
+ procedure cbHardwareEmuChange(Sender: TObject);
|
|
procedure cbIgnDlyChange(Sender: TObject);
|
|
procedure cbIgnDlyChange(Sender: TObject);
|
|
|
|
+ procedure cbSerialNamesChange(Sender: TObject);
|
|
procedure cbTPSVersionChange(Sender: TObject);
|
|
procedure cbTPSVersionChange(Sender: TObject);
|
|
procedure FormActivate(Sender: TObject);
|
|
procedure FormActivate(Sender: TObject);
|
|
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
|
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
|
@@ -951,6 +956,9 @@ begin
|
|
outputSps();
|
|
outputSps();
|
|
selectAddress(0);
|
|
selectAddress(0);
|
|
activateSps(False);
|
|
activateSps(False);
|
|
|
|
+ if SdpoSerial1.Active then begin
|
|
|
|
+ SdpoSerial1.Close;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TForm1.acThisStepExecute(Sender: TObject);
|
|
procedure TForm1.acThisStepExecute(Sender: TObject);
|
|
@@ -1382,11 +1390,70 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TForm1.cbHardwareEmuChange(Sender: TObject);
|
|
|
|
+var line : String;
|
|
|
|
+ comServices : TStringList;
|
|
|
|
+begin
|
|
|
|
+ if cbHardwareEmu.Checked then
|
|
|
|
+ begin
|
|
|
|
+ cbSerialNames.Enabled:=true;
|
|
|
|
+ line := GetSerialPortNames;
|
|
|
|
+ comServices := TStringList.Create;
|
|
|
|
+ MCSStrings.DelimTextToStringlist(line, ',', comServices);
|
|
|
|
+ line := XMLPropStorage1.ReadString('ComPort', comServices[0]);
|
|
|
|
+ cbSerialNames.Items.AddStrings(comServices);
|
|
|
|
+ cbSerialNames.Text := line;
|
|
|
|
+ comServices.Free;
|
|
|
|
+ cbSerialNamesChange(sender);
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TForm1.cbIgnDlyChange(Sender: TObject);
|
|
procedure TForm1.cbIgnDlyChange(Sender: TObject);
|
|
begin
|
|
begin
|
|
sps.SetIgnoreDelay(cbIgnDly.Checked);
|
|
sps.SetIgnoreDelay(cbIgnDly.Checked);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TForm1.cbSerialNamesChange(Sender: TObject);
|
|
|
|
+var retries : integer;
|
|
|
|
+ error : boolean;
|
|
|
|
+ line : string;
|
|
|
|
+begin
|
|
|
|
+ SdpoSerial1.Active := False;
|
|
|
|
+ SdpoSerial1.BaudRate := br__9600;
|
|
|
|
+ if cbTPSVersion.ItemIndex = 5 then
|
|
|
|
+ begin
|
|
|
|
+ // Micro:bit V2 auto programm
|
|
|
|
+ SdpoSerial1.BaudRate := br115200;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ SdpoSerial1.Device := cbSerialNames.Text;
|
|
|
|
+ SdpoSerial1.Active := True;
|
|
|
|
+ retries := 10;
|
|
|
|
+ error := True;
|
|
|
|
+ while retries > 0 do
|
|
|
|
+ begin
|
|
|
|
+ SdpoSerial1.WriteData('p');
|
|
|
|
+ if (readString(line, True)) then
|
|
|
|
+ begin
|
|
|
|
+ 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 (error) then
|
|
|
|
+ begin
|
|
|
|
+ LSUAutoMsgBox('Messages', 'ID_NOT_READY', MB_OK + MB_ICONERROR);
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TForm1.cbTPSVersionChange(Sender: TObject);
|
|
procedure TForm1.cbTPSVersionChange(Sender: TObject);
|
|
begin
|
|
begin
|
|
if (cbTPSVersion.ItemIndex = 0) then
|
|
if (cbTPSVersion.ItemIndex = 0) then
|
|
@@ -1951,7 +2018,26 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TForm1.inputSps;
|
|
procedure TForm1.inputSps;
|
|
|
|
+var line : string;
|
|
|
|
+ value : longint;
|
|
begin
|
|
begin
|
|
|
|
+ if cbHardwareEmu.Checked then begin
|
|
|
|
+ while SdpoSerial1.DataAvailable do
|
|
|
|
+ begin
|
|
|
|
+ readString(line, false);
|
|
|
|
+ mmLogMessages.Lines.Insert(0, line);
|
|
|
|
+ end;
|
|
|
|
+ SdpoSerial1.WriteData('i');
|
|
|
|
+ readString(line, true);
|
|
|
|
+ line := RightstrPos(line, 3);
|
|
|
|
+ value := HexToInt(line);
|
|
|
|
+ mmLogMessages.Lines.Insert(0, line + ' ' + IntToHex(value, 2));
|
|
|
|
+
|
|
|
|
+ Din1.Checked:= (value and $01) > 0;
|
|
|
|
+ Din2.Checked:= (value and $02) > 0;
|
|
|
|
+ Din3.Checked:= (value and $04) > 0;
|
|
|
|
+ Din4.Checked:= (value and $08) > 0;
|
|
|
|
+ end;
|
|
sps.setDin1(Din1.Checked);
|
|
sps.setDin1(Din1.Checked);
|
|
sps.setDin2(Din2.Checked);
|
|
sps.setDin2(Din2.Checked);
|
|
sps.setDin3(Din3.Checked);
|
|
sps.setDin3(Din3.Checked);
|