Browse Source

Bug: no default language

F #4: now austrian language is set to german
F #5: the delay command can now be ignored
Wilfried Klaas 3 years ago
parent
commit
0b0e53e585
15 changed files with 441 additions and 363 deletions
  1. 7 4
      Beispiele/Tone.tps
  2. 14 0
      Beispiele/servos.tps
  3. 6 0
      README.md
  4. 4 4
      SPS_EMU.000
  5. 2 0
      SPS_EMU.001
  6. 2 0
      SPS_EMU.043
  7. 2 0
      SPS_EMU.044
  8. 2 0
      SPS_EMU.049
  9. 28 27
      SPS_Emu.lpi
  10. BIN
      SPS_Emu.lsu
  11. 1 0
      build.cmd
  12. 4 0
      release.cmd
  13. 301 289
      ugui.lfm
  14. 10 0
      ugui.pas
  15. 58 39
      usps.pas

+ 7 - 4
Beispiele/Tone.tps

@@ -1,7 +1,10 @@
 #TPS:BBC micro:bit V2
 0x00,4,0,""
 0x01,0,3,""
-0x02,7,1,""
-0x03,2,6,""
-0x04,3,3,""
-0x05,F,F,""
+0x02,C,C,""
+0x03,7,1,""
+0x04,2,6,""
+0x05,3,4,""
+0x06,F,F,""
+0x07,0,0,""
+0x08,0,0,""

+ 14 - 0
Beispiele/servos.tps

@@ -0,0 +1,14 @@
+#TPS:Willies SPS Arduino
+0x00,0,0,""
+0x01,7,1,""
+0x02,5,4,""
+0x03,5,B,""
+0x04,5,C,""
+0x05,2,8,""
+0x06,C,C,""
+0x07,3,6,""
+0x08,3,0,""
+0x09,0,0,""
+0x0A,0,0,""
+0x0B,0,0,""
+0x0C,0,0,""

+ 6 - 0
README.md

@@ -1,4 +1,10 @@
 # **SPS_Emulator Version History**
+**12.06.2021 Version 0.2.1.100**
+
+  * Bug: On PCs with an unknown language, the user interface shows internal LSU keys (ID _ #####). Now the user interface starts with English as the default
+  * Feature: Austrian language added
+  * Feature: When executing in the emulator, the delay command can now be bypassed.
+
 **10.06.2021 Version 0.2.1.94**
 
   * Bug: more stable auto programming feature, now for the ArduinoSPS, too.

+ 4 - 4
SPS_EMU.000

@@ -2,9 +2,9 @@
 LSUTextFile=1
 Copyrigth=MCS Media Computer Software
 [LSUInfo]
-CompileDate=11.06.2021
-CompileTime=21:56:52
+CompileDate=12.06.2021
+CompileTime=09:51:47
 Name=Wilfried Klaas
-LSUBinFile=E:\DATEN\Git-box\SPS_Emulator\SPS_Emu.lsu
-LSUTextFile=E:\DATEN\Git-box\SPS_Emulator\SPS_Emu.
+LSUBinFile=.\SPS_EMU.lsu
+LSUTextFile=.\SPS_EMU.
 RegString=

+ 2 - 0
SPS_EMU.001

@@ -63,6 +63,7 @@ ID_INPUT_3=Input &3
 ID_INPUT_2=Input &2
 ID_INPUT_1=Input &1
 ID_REFRESH_ADDR=Refresh address
+ID_IGNORE_DELAY=Ignore Delay
 ID_MNEMONIC=Instruction
 ID_MNE_DATA=Data
 ID_CAPTION=TPS/PLC Emulator
@@ -94,6 +95,7 @@ ID_INPUT_3=Input 3
 ID_INPUT_2=Input 2
 ID_INPUT_1=Input 1
 ID_REFRESH_ADDR=Refresh address
+ID_IGNORE_DELAY=on execution ignore any delay command
 ID_MNEMONIC=Instruction
 ID_MNE_DATA=Data
 ID_CAPTION=

+ 2 - 0
SPS_EMU.043

@@ -63,6 +63,7 @@ ID_INPUT_3=Eingang &3
 ID_INPUT_2=Eingang &2
 ID_INPUT_1=Eingang &1
 ID_REFRESH_ADDR=Adresse aktualisieren
+ID_IGNORE_DELAY=Delay ignorieren
 ID_MNEMONIC=Befehle
 ID_MNE_DATA=Daten
 ID_CAPTION=TPS/SPS Emulator
@@ -94,6 +95,7 @@ ID_INPUT_3=Eingang 3
 ID_INPUT_2=Eingang 2
 ID_INPUT_1=Eingang 1
 ID_REFRESH_ADDR=Adresse aktualisieren
+ID_IGNORE_DELAY=Delay bei der Ausführung ignorieren
 ID_MNEMONIC=Befehle
 ID_MNE_DATA=Daten
 ID_CAPTION=

+ 2 - 0
SPS_EMU.044

@@ -63,6 +63,7 @@ ID_INPUT_3=Input &3
 ID_INPUT_2=Input &2
 ID_INPUT_1=Input &1
 ID_REFRESH_ADDR=Refresh address
+ID_IGNORE_DELAY=Ignore Delay
 ID_MNEMONIC=Instruction
 ID_MNE_DATA=Data
 ID_CAPTION=TPS/PLC Emulator
@@ -94,6 +95,7 @@ ID_INPUT_3=Input 3
 ID_INPUT_2=Input 2
 ID_INPUT_1=Input 1
 ID_REFRESH_ADDR=Refresh address
+ID_IGNORE_DELAY=on execution ignore any delay command
 ID_MNEMONIC=Instruction
 ID_MNE_DATA=Data
 ID_CAPTION=

+ 2 - 0
SPS_EMU.049

@@ -63,6 +63,7 @@ ID_INPUT_3=Eingang &3
 ID_INPUT_2=Eingang &2
 ID_INPUT_1=Eingang &1
 ID_REFRESH_ADDR=Adresse aktualisieren
+ID_IGNORE_DELAY=Delay ignorieren
 ID_MNEMONIC=Befehle
 ID_MNE_DATA=Daten
 ID_CAPTION=TPS/SPS Emulator
@@ -94,6 +95,7 @@ ID_INPUT_3=Eingang 3
 ID_INPUT_2=Eingang 2
 ID_INPUT_1=Eingang 1
 ID_REFRESH_ADDR=Adresse aktualisieren
+ID_IGNORE_DELAY=Delay bei der Ausführung ignorieren
 ID_MNEMONIC=Befehle
 ID_MNE_DATA=Daten
 ID_CAPTION=

+ 28 - 27
SPS_Emu.lpi

@@ -23,7 +23,7 @@
       <AutoIncrementBuild Value="True"/>
       <MinorVersionNr Value="2"/>
       <RevisionNr Value="1"/>
-      <BuildNr Value="96"/>
+      <BuildNr Value="101"/>
       <Language Value="0407"/>
       <StringTable CompanyName="MCS" FileDescription="TPS/SPS Emulator" InternalName="SPS_EMU" LegalCopyright="MCS (C) Wilfried Klaas" OriginalFilename="SPS_EMU.exe" ProductName="TPS/SPS Emulator" ProductVersion="0.2"/>
     </VersionInfo>
@@ -68,7 +68,7 @@
         <PackageName Value="LCL"/>
       </Item3>
     </RequiredPackages>
-    <Units Count="10">
+    <Units Count="15">
       <Unit0>
         <Filename Value="SPS_Emu.lpr"/>
         <IsPartOfProject Value="True"/>
@@ -134,6 +134,26 @@
         <ComponentName Value="Form3"/>
         <ResourceBaseClass Value="Form"/>
       </Unit9>
+      <Unit10>
+        <Filename Value="SPS_EMU.000"/>
+        <IsPartOfProject Value="True"/>
+      </Unit10>
+      <Unit11>
+        <Filename Value="SPS_EMU.001"/>
+        <IsPartOfProject Value="True"/>
+      </Unit11>
+      <Unit12>
+        <Filename Value="SPS_EMU.043"/>
+        <IsPartOfProject Value="True"/>
+      </Unit12>
+      <Unit13>
+        <Filename Value="SPS_EMU.044"/>
+        <IsPartOfProject Value="True"/>
+      </Unit13>
+      <Unit14>
+        <Filename Value="SPS_EMU.049"/>
+        <IsPartOfProject Value="True"/>
+      </Unit14>
     </Units>
   </ProjectOptions>
   <CompilerOptions>
@@ -159,30 +179,11 @@
         </Win32>
       </Options>
     </Linking>
+    <Other>
+      <ExecuteAfter>
+        <Command Value="C:\e-platte\daten\git-sourcen\LCC_Compiler\lcc.exe /B /C /Q &quot;$TargetFile()&quot;"/>
+        <CompileReasons Compile="False" Run="False"/>
+      </ExecuteAfter>
+    </Other>
   </CompilerOptions>
-  <Debugging>
-    <Exceptions Count="7">
-      <Item1>
-        <Name Value="EAbort"/>
-      </Item1>
-      <Item2>
-        <Name Value="ECodetoolError"/>
-      </Item2>
-      <Item3>
-        <Name Value="EFOpenError"/>
-      </Item3>
-      <Item4>
-        <Name Value="Exception"/>
-      </Item4>
-      <Item5>
-        <Name Value="EScannerError"/>
-      </Item5>
-      <Item6>
-        <Name Value="RunError(103)"/>
-      </Item6>
-      <Item7>
-        <Name Value="EInOutError"/>
-      </Item7>
-    </Exceptions>
-  </Debugging>
 </CONFIG>

BIN
SPS_Emu.lsu


+ 1 - 0
build.cmd

@@ -0,0 +1 @@
+lazbuild sps_emu.lpi

+ 4 - 0
release.cmd

@@ -0,0 +1,4 @@
+lazbuild -B sps_emu.lpi
+lcc /B /C /Q .\SPS_EMU.EXE
+"C:\Program Files\7-Zip\7z.exe" a SPS_EMU.ZIP SPS_EMU.EXE
+copy SPS_EMU.ZIP dist\SPS_EMU.ZIP

File diff suppressed because it is too large
+ 301 - 289
ugui.lfm


+ 10 - 0
ugui.pas

@@ -35,6 +35,7 @@ type
     ActionList1: TActionList;
     acFileOpen: TFileOpen;
     btnTone: TBitBtn;
+    cbIgnDly: TCheckBox;
     cbTPSVersion: TComboBox;
     cbAdrActual: TCheckBox;
     EditDelay: TLabeledEdit;
@@ -164,6 +165,7 @@ type
     procedure btnToneClick(Sender: TObject);
     procedure cbCommandChange(Sender: TObject);
     procedure cbDataChange(Sender: TObject);
+    procedure cbIgnDlyChange(Sender: TObject);
     procedure cbTPSVersionChange(Sender: TObject);
     procedure FormActivate(Sender: TObject);
     procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
@@ -271,6 +273,7 @@ begin
   ToolButton18.Align := alRight;
   MCSLabel.Align := alRight;
   cbAdrActual.Enabled := False;
+  cbIgnDly.Enabled := False;
   checkPresets();
   tbResetClick(nil);
   if Application.ParamCount >= 1 then
@@ -645,6 +648,7 @@ begin
     acDebug.Enabled := True;
     acDebug.ImageIndex := 57;
     cbAdrActual.Enabled := True;
+    cbIgnDly.Enabled:= True;
     acNextStep.Enabled := False;
     // sps programmieren
     programSps();
@@ -786,6 +790,7 @@ begin
   end;
   // endekennzeichnung schreiben
   sps.writeEEProm(i, $ff);
+  sps.setIgnoreDelay(cbIgnDly.Checked);
 end;
 
 procedure TForm1.acNextStepExecute(Sender: TObject);
@@ -1340,6 +1345,11 @@ begin
   end;
 end;
 
+procedure TForm1.cbIgnDlyChange(Sender: TObject);
+begin
+  sps.SetIgnoreDelay(cbIgnDly.Checked);
+end;
+
 procedure TForm1.cbTPSVersionChange(Sender: TObject);
 begin
   if (cbTPSVersion.ItemIndex = 0) then

+ 58 - 39
usps.pas

@@ -206,6 +206,7 @@ type
     gesture: byte;
     soundLevel: byte;
     lightLevel: byte;
+    ignoreDelay: boolean;
 
     errorMessage: string;
 
@@ -272,10 +273,10 @@ type
     procedure break();
     procedure doSingleCommand(command: byte);
     procedure preFetch();
-    function getLastError():string;
+    function getLastError(): string;
 
     procedure writeEEProm(adr: word; Data: byte);
-    function getE2E():word;
+    function getE2E(): word;
 
     function isActive(): boolean;
     function isDelayActive(): boolean;
@@ -292,6 +293,8 @@ type
     function getFRegister(): byte;
 
     procedure setTPSVersion(tpsversion: TTPSVersion);
+    procedure setIgnoreDelay(ignDly: boolean);
+    function isIgnoreDelay(): boolean;
 
     procedure getCommands(list: TStrings);
     procedure getDatas(cmd: byte; list: TStrings);
@@ -436,7 +439,7 @@ end;
 procedure TSPS.nextStep();
 var
   Value: byte;
-  oldAddr : word;
+  oldAddr: word;
 begin
   errorMessage := '';
   Value := eeprom[addr];
@@ -450,7 +453,8 @@ begin
     // errorMessage := 'Address out of range after address: 0x' + IntToHex(oldAddr, 2);
     // doReset();
   end
-  else begin
+  else
+  begin
     preFetch();
   end;
 end;
@@ -633,18 +637,18 @@ end;
 
 function TSPS.getLastError(): string;
 begin
-  result := errorMessage;
+  Result := errorMessage;
 end;
 
 procedure TSPS.writeEEProm(adr: word; Data: byte);
 begin
   if adr < e2e then
-  eeprom[adr] := Data;
+    eeprom[adr] := Data;
 end;
 
 function TSPS.getE2E(): word;
 begin
-   Result := e2e;
+  Result := e2e;
 end;
 
 function TSPS.isActive(): boolean;
@@ -725,6 +729,16 @@ begin
   end;
 end;
 
+procedure TSPS.setIgnoreDelay(ignDly: boolean);
+begin
+  ignoreDelay := ignDly;
+end;
+
+function TSPS.isIgnoreDelay(): boolean;
+begin
+  Result := ignoreDelay;
+end;
+
 procedure TSPS.getCommands(list: TStrings);
 begin
   MCSStrings.copyArray2List(COMMANDS, list);
@@ -886,35 +900,38 @@ var
   delayValue: integer;
   x: integer;
 begin
-  case Data of
-    0: delayValue := 1;
-    1: delayValue := 2;
-    2: delayValue := 5;
-    3: delayValue := 10;
-    4: delayValue := 20;
-    5: delayValue := 50;
-    6: delayValue := 100;
-    7: delayValue := 200;
-    8: delayValue := 500;
-    9: delayValue := 1000;
-    10: delayValue := 2000;
-    11: delayValue := 5000;
-    12: delayValue := 10000;
-    13: delayValue := 20000;
-    14: delayValue := 30000;
-    15: delayValue := 60000;
-  end;
-  delayActive := True;
-  repeat
-    if (delayValue >= 100) then
-    begin
-      Dec(delayValue, 100);
-      Sleep(100);
-      delayCallback(delayValue);
+  if not ignoreDelay then
+  begin
+    case Data of
+      0: delayValue := 1;
+      1: delayValue := 2;
+      2: delayValue := 5;
+      3: delayValue := 10;
+      4: delayValue := 20;
+      5: delayValue := 50;
+      6: delayValue := 100;
+      7: delayValue := 200;
+      8: delayValue := 500;
+      9: delayValue := 1000;
+      10: delayValue := 2000;
+      11: delayValue := 5000;
+      12: delayValue := 10000;
+      13: delayValue := 20000;
+      14: delayValue := 30000;
+      15: delayValue := 60000;
     end;
-  until ((delayValue <= 100) or stop);
-  delayCallback(0);
-  delayActive := False;
+    delayActive := True;
+    repeat
+      if (delayValue >= 100) then
+      begin
+        Dec(delayValue, 100);
+        Sleep(100);
+        delayCallback(delayValue);
+      end;
+    until ((delayValue <= 100) or stop);
+    delayCallback(0);
+    delayActive := False;
+  end;
 end;
 
 // jump relative back
@@ -1010,7 +1027,7 @@ begin
     11:
     begin
       if (servo1.attached()) then
-        servo1.Write(((a and 15)  * 10) + 10);
+        servo1.Write(((a and 15) * 10) + 10);
     end;
     12:
     begin
@@ -1162,7 +1179,8 @@ begin
     addr := saveaddr[saveCnt];
     exit;
   end;
-  if ((Data <= 6) and ((version = ATTiny84) or (version = Arduino) or (version = MicroBitV2))) then
+  if ((Data <= 6) and ((version = ATTiny84) or (version = Arduino) or
+    (version = MicroBitV2))) then
   begin
     // call subroutine number
     saveaddr[saveCnt] := addr;
@@ -1170,8 +1188,8 @@ begin
     addr := subs[Data];
     exit;
   end;
-  if ((Data = $0f) and ((version = ATTiny84) or (version = Arduino) or (version = MicroBitV2))) then
-
+  if ((Data = $0f) and ((version = ATTiny84) or (version = Arduino) or
+    (version = MicroBitV2))) then
 
   begin
     doReset();
@@ -1319,6 +1337,7 @@ begin
   stack := TByteStack.Create;
   stop := False;
   delayActive := False;
+  ignoreDelay := False;
 end;
 
 destructor TSPS.Destroy;

Some files were not shown because too many files changed in this diff