mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 15:46:14 +01:00
smaller random
Saves over 300 bytes of progmem on a uno by omitting the random library
This commit is contained in:
parent
6104311ccb
commit
7d6c2c8afb
|
@ -706,7 +706,7 @@ void RMFT2::loop2() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_IFRANDOM: // do block on random percentage
|
case OPCODE_IFRANDOM: // do block on random percentage
|
||||||
skipIf=(int16_t)random(100)>=operand;
|
skipIf=(int16_t)(micros()%100) >= operand;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_IFRESERVE: // do block if we successfully RERSERVE
|
case OPCODE_IFRESERVE: // do block if we successfully RERSERVE
|
||||||
|
@ -750,7 +750,7 @@ void RMFT2::loop2() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_RANDWAIT:
|
case OPCODE_RANDWAIT:
|
||||||
delayMe(random(operand)*100L);
|
delayMe((micros()%operand) *100L);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_RED:
|
case OPCODE_RED:
|
||||||
|
|
|
@ -2,7 +2,7 @@ ECHO ON
|
||||||
FOR /F "delims=" %%i IN ('dir %TMP%\arduino_build_* /b /ad-h /t:c /od') DO SET a=%%i
|
FOR /F "delims=" %%i IN ('dir %TMP%\arduino_build_* /b /ad-h /t:c /od') DO SET a=%%i
|
||||||
echo Most recent subfolder: %a% >%TMP%\OBJDUMP_%a%.txt
|
echo Most recent subfolder: %a% >%TMP%\OBJDUMP_%a%.txt
|
||||||
SET ELF=%TMP%\%a%\CommandStation-EX.ino.elf
|
SET ELF=%TMP%\%a%\CommandStation-EX.ino.elf
|
||||||
|
set PATH="C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\";%PATH%
|
||||||
avr-objdump --private=mem-usage %ELF% >>%TMP%\OBJDUMP_%a%.txt
|
avr-objdump --private=mem-usage %ELF% >>%TMP%\OBJDUMP_%a%.txt
|
||||||
ECHO ++++++++++++++++++++++++++++++++++ >>%TMP%\OBJDUMP_%a%.txt
|
ECHO ++++++++++++++++++++++++++++++++++ >>%TMP%\OBJDUMP_%a%.txt
|
||||||
avr-objdump -x -C %ELF% | find ".text" | sort /+25 /R >>%TMP%\OBJDUMP_%a%.txt
|
avr-objdump -x -C %ELF% | find ".text" | sort /+25 /R >>%TMP%\OBJDUMP_%a%.txt
|
||||||
|
|
Loading…
Reference in New Issue
Block a user