From 64a0f1b51e74af2dea767f5fe755b6a4169bf15f Mon Sep 17 00:00:00 2001 From: Fisch Date: Sun, 13 Dec 2020 12:59:38 +0100 Subject: [PATCH] changes for balcony setup --- .../achterbahnconfig/achterbahnconfig.pde | 33 ++++++++++++++++--- src/main.cpp | 10 ++++-- src/wagon.cpp | 4 +-- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/achterbahnconfig/achterbahnconfig/achterbahnconfig.pde b/achterbahnconfig/achterbahnconfig/achterbahnconfig.pde index 6921bb1..dd55e7e 100644 --- a/achterbahnconfig/achterbahnconfig/achterbahnconfig.pde +++ b/achterbahnconfig/achterbahnconfig/achterbahnconfig.pde @@ -83,6 +83,11 @@ void setup() { .setPosition(10, 80+60+5+15*2) .setSize(100, 10); + cp5.addButton("printHeightmap") + .setPosition(10, 80+60+5+15*3) + .setSize(100, 10); + + cp5.addButton("Remove") .setPosition(100, 80) .setSize(50, 50); @@ -135,19 +140,27 @@ void setup() { cp5.addButton("Debug") - .setPosition(10, 200) + .setPosition(10, 205) .setSize(100, 30); cp5.addButton("Run") - .setPosition(10, 240) + .setPosition(10, 205+40) .setSize(100, 30); + + + + cp5.addButton("FX_Scanner") .setPosition(200, 200) .setSize(100, 20); cp5.addButton("FX_Flash") - .setPosition(200, 220) + .setPosition(200, 200+20*1) + .setSize(100, 20); + + cp5.addButton("FX_Stars") + .setPosition(200, 200+20*2) .setSize(100, 20); @@ -173,6 +186,10 @@ void save_heightmap(){ String writeserial="save\n"; myPort.write(writeserial); } +void printHeightmap() { + String writeserial="print\n"; + myPort.write(writeserial); +} void Debug() { @@ -211,6 +228,14 @@ void FX_Flash() { String writeserial="fx_flash\n"; myPort.write(writeserial); } +void FX_Stars() { + String writeserial="fx_stars\n"; + myPort.write(writeserial); +} + + + + @@ -228,4 +253,4 @@ void draw() { } -} \ No newline at end of file +} diff --git a/src/main.cpp b/src/main.cpp index 525a64f..6e8215c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -44,12 +44,12 @@ long lastRoutineUpdate=0; #define ROUTINEUPDATETIME 20 long lastCheckspawn=0; #define CHECKSPAWNDELAY 4000 //delay in ms to check random spawn -#define SPAWNCHANCE 7 //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 long lastCheckspawnEffect=0; #define CHECKSPAWNDELAY_EFFECT 10000 //delay in ms to check random effect #define SPAWNCHANCE_EFFECT_SCANNER 1000 //1 out of x times spawn effect -#define SPAWNCHANCE_EFFECT_FLASH 1000 //1 out of x times spawn effect +#define SPAWNCHANCE_EFFECT_FLASH 4000 //1 out of x times spawn effect #define BRIGHTNESS_RUN 200 #define BRIGHTNESS_DEBUG 150 @@ -250,10 +250,16 @@ void spawnWagon(){ int side_startpos=0; int side_multi=1; + /* if (random(0,2)==0){ //spawn from other side side_startpos=NUMPIXELS+_randomlength; side_multi=-1; } + */ + + //Force start from end of strip + side_startpos=NUMPIXELS+_randomlength; + side_multi=-1; Wagon tmpr = Wagon(maxid++,NUMPIXELS,&strip, height, side_startpos, _randomlength, side_multi*random(map(_randomlength,3,20,5,10), map(_randomlength,3,20, 5,40))/10.0 , 0 , 5.0 , Wheel((uint8_t)random(0,255))); //spawn new wagon diff --git a/src/wagon.cpp b/src/wagon.cpp index 206a43e..1f246bb 100644 --- a/src/wagon.cpp +++ b/src/wagon.cpp @@ -2,8 +2,8 @@ #define WAGONLENGTH 3 -//#define EDGE_KILL -#define EDGE_WALL +#define EDGE_KILL +//#define EDGE_WALL //#define EDGE_BOUNCE //#define EDGE_WRAP #define WRAPLEDENDPOS _numpixels //default