1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-30 11:36:13 +01:00

Automatic delay accuracy adjust

This commit is contained in:
Asbelos 2022-01-03 19:15:44 +00:00
parent 7017c6bbf5
commit e3bca1592c
3 changed files with 7 additions and 3 deletions

View File

@ -695,6 +695,10 @@ void RMFT2::loop2() {
case OPCODE_ENDIF: case OPCODE_ENDIF:
break; break;
case OPCODE_DELAYMS:
delayMe(operand);
break;
case OPCODE_DELAY: case OPCODE_DELAY:
delayMe(operand*100L); delayMe(operand*100L);
break; break;

View File

@ -35,7 +35,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
OPCODE_LATCH,OPCODE_UNLATCH,OPCODE_SET,OPCODE_RESET, OPCODE_LATCH,OPCODE_UNLATCH,OPCODE_SET,OPCODE_RESET,
OPCODE_IF,OPCODE_IFNOT,OPCODE_ENDIF,OPCODE_IFRANDOM,OPCODE_IFRESERVE, OPCODE_IF,OPCODE_IFNOT,OPCODE_ENDIF,OPCODE_IFRANDOM,OPCODE_IFRESERVE,
OPCODE_IFCLOSED, OPCODE_IFTHROWN,OPCODE_ELSE, OPCODE_IFCLOSED, OPCODE_IFTHROWN,OPCODE_ELSE,
OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_RANDWAIT, OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_DELAYMS,OPCODE_RANDWAIT,
OPCODE_FON,OPCODE_FOFF,OPCODE_XFON,OPCODE_XFOFF, OPCODE_FON,OPCODE_FOFF,OPCODE_XFON,OPCODE_XFOFF,
OPCODE_RED,OPCODE_GREEN,OPCODE_AMBER,OPCODE_DRIVE, OPCODE_RED,OPCODE_GREEN,OPCODE_AMBER,OPCODE_DRIVE,
OPCODE_SERVO,OPCODE_SIGNAL,OPCODE_TURNOUT,OPCODE_WAITFOR, OPCODE_SERVO,OPCODE_SIGNAL,OPCODE_TURNOUT,OPCODE_WAITFOR,

View File

@ -171,9 +171,9 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = {
#define CLOSE(id) OPCODE_CLOSE,V(id), #define CLOSE(id) OPCODE_CLOSE,V(id),
#define DEACTIVATE(addr,subaddr) OPCODE_DCCACTIVATE,V(addr<<3 | subaddr<<1), #define DEACTIVATE(addr,subaddr) OPCODE_DCCACTIVATE,V(addr<<3 | subaddr<<1),
#define DEACTIVATEL(addr) OPCODE_DCCACTIVATE,V((addr+3)<<3), #define DEACTIVATEL(addr) OPCODE_DCCACTIVATE,V((addr+3)<<3),
#define DELAY(ms) OPCODE_DELAY,V(ms/100L), #define DELAY(ms) ms<30000?OPCODE_DELAYMS:OPCODE_DELAY,V(ms/(ms<30000?1L:100L)),
#define DELAYMINS(mindelay) OPCODE_DELAYMINS,V(mindelay), #define DELAYMINS(mindelay) OPCODE_DELAYMINS,V(mindelay),
#define DELAYRANDOM(mindelay,maxdelay) OPCODE_DELAY,V(mindelay/100L),OPCODE_RANDWAIT,V((maxdelay-mindelay)/100L), #define DELAYRANDOM(mindelay,maxdelay) DELAY(mindelay),OPCODE_RANDWAIT,V((maxdelay-mindelay)/100L),
#define DONE OPCODE_ENDTASK,0,0, #define DONE OPCODE_ENDTASK,0,0,
#define DRIVE(analogpin) OPCODE_DRIVE,V(analogpin), #define DRIVE(analogpin) OPCODE_DRIVE,V(analogpin),
#define ELSE OPCODE_ELSE,0,0, #define ELSE OPCODE_ELSE,0,0,