|
@@ -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;
|