|
@@ -206,6 +206,7 @@ type
|
|
gesture: byte;
|
|
gesture: byte;
|
|
soundLevel: byte;
|
|
soundLevel: byte;
|
|
lightLevel: byte;
|
|
lightLevel: byte;
|
|
|
|
+ ignoreDelay: boolean;
|
|
|
|
|
|
errorMessage: string;
|
|
errorMessage: string;
|
|
|
|
|
|
@@ -272,10 +273,10 @@ type
|
|
procedure break();
|
|
procedure break();
|
|
procedure doSingleCommand(command: byte);
|
|
procedure doSingleCommand(command: byte);
|
|
procedure preFetch();
|
|
procedure preFetch();
|
|
- function getLastError():string;
|
|
|
|
|
|
+ function getLastError(): string;
|
|
|
|
|
|
procedure writeEEProm(adr: word; Data: byte);
|
|
procedure writeEEProm(adr: word; Data: byte);
|
|
- function getE2E():word;
|
|
|
|
|
|
+ function getE2E(): word;
|
|
|
|
|
|
function isActive(): boolean;
|
|
function isActive(): boolean;
|
|
function isDelayActive(): boolean;
|
|
function isDelayActive(): boolean;
|
|
@@ -292,6 +293,8 @@ type
|
|
function getFRegister(): byte;
|
|
function getFRegister(): byte;
|
|
|
|
|
|
procedure setTPSVersion(tpsversion: TTPSVersion);
|
|
procedure setTPSVersion(tpsversion: TTPSVersion);
|
|
|
|
+ procedure setIgnoreDelay(ignDly: boolean);
|
|
|
|
+ function isIgnoreDelay(): boolean;
|
|
|
|
|
|
procedure getCommands(list: TStrings);
|
|
procedure getCommands(list: TStrings);
|
|
procedure getDatas(cmd: byte; list: TStrings);
|
|
procedure getDatas(cmd: byte; list: TStrings);
|
|
@@ -436,7 +439,7 @@ end;
|
|
procedure TSPS.nextStep();
|
|
procedure TSPS.nextStep();
|
|
var
|
|
var
|
|
Value: byte;
|
|
Value: byte;
|
|
- oldAddr : word;
|
|
|
|
|
|
+ oldAddr: word;
|
|
begin
|
|
begin
|
|
errorMessage := '';
|
|
errorMessage := '';
|
|
Value := eeprom[addr];
|
|
Value := eeprom[addr];
|
|
@@ -450,7 +453,8 @@ begin
|
|
// errorMessage := 'Address out of range after address: 0x' + IntToHex(oldAddr, 2);
|
|
// errorMessage := 'Address out of range after address: 0x' + IntToHex(oldAddr, 2);
|
|
// doReset();
|
|
// doReset();
|
|
end
|
|
end
|
|
- else begin
|
|
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
preFetch();
|
|
preFetch();
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -633,18 +637,18 @@ end;
|
|
|
|
|
|
function TSPS.getLastError(): string;
|
|
function TSPS.getLastError(): string;
|
|
begin
|
|
begin
|
|
- result := errorMessage;
|
|
|
|
|
|
+ Result := errorMessage;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TSPS.writeEEProm(adr: word; Data: byte);
|
|
procedure TSPS.writeEEProm(adr: word; Data: byte);
|
|
begin
|
|
begin
|
|
if adr < e2e then
|
|
if adr < e2e then
|
|
- eeprom[adr] := Data;
|
|
|
|
|
|
+ eeprom[adr] := Data;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TSPS.getE2E(): word;
|
|
function TSPS.getE2E(): word;
|
|
begin
|
|
begin
|
|
- Result := e2e;
|
|
|
|
|
|
+ Result := e2e;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TSPS.isActive(): boolean;
|
|
function TSPS.isActive(): boolean;
|
|
@@ -725,6 +729,16 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TSPS.setIgnoreDelay(ignDly: boolean);
|
|
|
|
+begin
|
|
|
|
+ ignoreDelay := ignDly;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function TSPS.isIgnoreDelay(): boolean;
|
|
|
|
+begin
|
|
|
|
+ Result := ignoreDelay;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TSPS.getCommands(list: TStrings);
|
|
procedure TSPS.getCommands(list: TStrings);
|
|
begin
|
|
begin
|
|
MCSStrings.copyArray2List(COMMANDS, list);
|
|
MCSStrings.copyArray2List(COMMANDS, list);
|
|
@@ -886,35 +900,38 @@ var
|
|
delayValue: integer;
|
|
delayValue: integer;
|
|
x: integer;
|
|
x: integer;
|
|
begin
|
|
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;
|
|
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;
|
|
end;
|
|
|
|
|
|
// jump relative back
|
|
// jump relative back
|
|
@@ -1010,7 +1027,7 @@ begin
|
|
11:
|
|
11:
|
|
begin
|
|
begin
|
|
if (servo1.attached()) then
|
|
if (servo1.attached()) then
|
|
- servo1.Write(((a and 15) * 10) + 10);
|
|
|
|
|
|
+ servo1.Write(((a and 15) * 10) + 10);
|
|
end;
|
|
end;
|
|
12:
|
|
12:
|
|
begin
|
|
begin
|
|
@@ -1162,7 +1179,8 @@ begin
|
|
addr := saveaddr[saveCnt];
|
|
addr := saveaddr[saveCnt];
|
|
exit;
|
|
exit;
|
|
end;
|
|
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
|
|
begin
|
|
// call subroutine number
|
|
// call subroutine number
|
|
saveaddr[saveCnt] := addr;
|
|
saveaddr[saveCnt] := addr;
|
|
@@ -1170,8 +1188,8 @@ begin
|
|
addr := subs[Data];
|
|
addr := subs[Data];
|
|
exit;
|
|
exit;
|
|
end;
|
|
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
|
|
begin
|
|
doReset();
|
|
doReset();
|
|
@@ -1319,6 +1337,7 @@ begin
|
|
stack := TByteStack.Create;
|
|
stack := TByteStack.Create;
|
|
stop := False;
|
|
stop := False;
|
|
delayActive := False;
|
|
delayActive := False;
|
|
|
|
+ ignoreDelay := False;
|
|
end;
|
|
end;
|
|
|
|
|
|
destructor TSPS.Destroy;
|
|
destructor TSPS.Destroy;
|