change parameters

This commit is contained in:
interfisch 2021-10-16 14:43:55 +02:00
parent e8fb1f2bb3
commit 2b8f5381d9
2 changed files with 12 additions and 10 deletions

View File

@ -165,7 +165,8 @@ void setup() {
myPort = new Serial(this, "/dev/ttyUSB0", 115200); //myPort = new Serial(this, "/dev/ttyUSB0", 115200);
myPort = new Serial(this, "COM3", 115200);
} }
void Set() { void Set() {

View File

@ -46,7 +46,7 @@ long lastRoutineUpdate=0;
#define ROUTINEUPDATETIME 20 #define ROUTINEUPDATETIME 20
long lastCheckspawn=0; long lastCheckspawn=0;
#define CHECKSPAWNDELAY 2000 //delay in ms to check random spawn #define CHECKSPAWNDELAY 2000 //delay in ms to check random spawn
#define SPAWNCHANCE 20 //1 out of x times wagon will spawn #define SPAWNCHANCE 10 //1 out of x times wagon will spawn
#define SPAWNCHANCEDOUBLE 5 //change of spawning a two trains simultaneously #define SPAWNCHANCEDOUBLE 5 //change of spawning a two trains simultaneously
long lastCheckspawnEffect=0; long lastCheckspawnEffect=0;
#define CHECKSPAWNDELAY_EFFECT 5000 //delay in ms to check random effect #define CHECKSPAWNDELAY_EFFECT 5000 //delay in ms to check random effect
@ -263,22 +263,23 @@ void spawnWagon(){
// pos, wagonlength, startvel , startacc, trainmass, wagoncolor // pos, wagonlength, startvel , startacc, trainmass, wagoncolor
//Wagon tmpr = Wagon(maxid++,NUMPIXELS,&strip, height, random(0, 20), _randomlength, random(map(_randomlength,3,40,1,1), map(_randomlength,3,40, 13,40))/10.0 , 0 , 5 , Wheel((uint8_t)random(0,255))); //spawn new wagon //Wagon tmpr = Wagon(maxid++,NUMPIXELS,&strip, height, random(0, 20), _randomlength, random(map(_randomlength,3,40,1,1), map(_randomlength,3,40, 13,40))/10.0 , 0 , 5 , Wheel((uint8_t)random(0,255))); //spawn new wagon
int side_startpos=0; int side_startpos=0; //start at beginning of strip
int side_multi=1; int side_multi=1; //start in forward direction
/*
if (random(0,2)==0){ //spawn from other side if (random(0,2)==0){ //spawn from other side
side_startpos=NUMPIXELS+_randomlength; side_startpos=NUMPIXELS+_randomlength;
side_multi=-1; side_multi=-1;
} }
*/
//Force start from end of strip //Force start from end of strip
side_startpos=NUMPIXELS+_randomlength; //side_startpos=NUMPIXELS+_randomlength; //start at end of strip
side_multi=-1; //side_multi=-1; //start in backward direction
Wagon tmpr = Wagon(maxid++,NUMPIXELS,&strip, height, side_startpos, _randomlength, side_multi*random(map(_randomlength,3,20,0,10)/10.0, map(_randomlength,3,20, 5,40))/10.0 , 0 , random(3.0,7.0) , Wheel((uint8_t)random(0,255))); //spawn new wagon
//Wagon tmpr = Wagon(maxid++,NUMPIXELS,&strip, height, side_startpos, _randomlength, side_multi*random(map(_randomlength,3,30,0,40)/10.0, map(_randomlength,3,30, 5,60))/10.0 , 0 , random(3.0,7.0) , Wheel((uint8_t)random(0,255))); //spawn new wagon
Wagon tmpr = Wagon(maxid++,NUMPIXELS,&strip, height, side_startpos, _randomlength, side_multi*random(map(_randomlength,3,30,30,100)/10.0, map(_randomlength,3,30, 5,60))/10.0 , 0 , 1.8 , Wheel((uint8_t)random(0,255))); //spawn new wagon
//Mass: the lighter the faster is changes speed