diff options
| -rw-r--r-- | spaghetti-monster/anduril/anduril.c | 26 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/cfg-blf-lantern.h | 4 |
2 files changed, 17 insertions, 13 deletions
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index 675062f..376c27a 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -1103,14 +1103,18 @@ inline void bike_flasher_iter() { #ifdef USE_CANDLE_MODE uint8_t candle_mode_state(Event event, uint16_t arg) { - #define MAX_CANDLE_LEVEL (RAMP_LENGTH-CANDLE_AMPLITUDE-20) + #define MAX_CANDLE_LEVEL (RAMP_LENGTH-CANDLE_AMPLITUDE-15) static uint8_t candle_wave1 = 0; static uint8_t candle_wave2 = 0; static uint8_t candle_wave3 = 0; static uint8_t candle_wave2_speed = 0; - static const uint8_t candle_wave1_depth = 8 * CANDLE_AMPLITUDE / 20; - static uint8_t candle_wave2_depth = 7 * CANDLE_AMPLITUDE / 20; - static uint8_t candle_wave3_depth = 5 * CANDLE_AMPLITUDE / 20; + // these should add up to 100 + #define CANDLE_WAVE1_MAXDEPTH 30 + #define CANDLE_WAVE2_MAXDEPTH 45 + #define CANDLE_WAVE3_MAXDEPTH 25 + static const uint8_t candle_wave1_depth = CANDLE_WAVE1_MAXDEPTH * CANDLE_AMPLITUDE / 100; + static uint8_t candle_wave2_depth = CANDLE_WAVE2_MAXDEPTH * CANDLE_AMPLITUDE / 100; + static uint8_t candle_wave3_depth = CANDLE_WAVE3_MAXDEPTH * CANDLE_AMPLITUDE / 100; static uint8_t candle_mode_brightness = 24; static uint8_t candle_mode_timer = 0; #define TICKS_PER_CANDLE_MINUTE 4096 // about 65 seconds @@ -1193,20 +1197,20 @@ uint8_t candle_mode_state(Event event, uint16_t arg) { if ((candle_wave2_depth > 0) && ((pseudo_rand() & 0b00111111) == 0)) candle_wave2_depth --; // random sawtooth retrigger - // TODO: trigger less often? - if ((pseudo_rand()) == 0) { - // TODO: random amplitude with higher maximum? - candle_wave2_depth = 7 * CANDLE_AMPLITUDE / 20; + if (pseudo_rand() == 0) { + // random amplitude + //candle_wave2_depth = 2 + (pseudo_rand() % ((CANDLE_WAVE2_MAXDEPTH * CANDLE_AMPLITUDE / 100) - 2)); + candle_wave2_depth = pseudo_rand() % (CANDLE_WAVE2_MAXDEPTH * CANDLE_AMPLITUDE / 100); //candle_wave3_depth = 5; candle_wave2 = 0; } // downward sawtooth on wave3 depth to simulate stabilizing if ((candle_wave3_depth > 2) && ((pseudo_rand() & 0b00011111) == 0)) candle_wave3_depth --; - // TODO: trigger less often? if ((pseudo_rand() & 0b01111111) == 0) - // TODO: random amplitude with higher maximum? - candle_wave3_depth = 5 * CANDLE_AMPLITUDE / 20; + // random amplitude + //candle_wave3_depth = 2 + (pseudo_rand() % ((CANDLE_WAVE3_MAXDEPTH * CANDLE_AMPLITUDE / 100) - 2)); + candle_wave3_depth = pseudo_rand() % (CANDLE_WAVE3_MAXDEPTH * CANDLE_AMPLITUDE / 100); return MISCHIEF_MANAGED; } return EVENT_NOT_HANDLED; diff --git a/spaghetti-monster/anduril/cfg-blf-lantern.h b/spaghetti-monster/anduril/cfg-blf-lantern.h index f4c2d1c..3d4c762 100644 --- a/spaghetti-monster/anduril/cfg-blf-lantern.h +++ b/spaghetti-monster/anduril/cfg-blf-lantern.h @@ -39,8 +39,8 @@ #define HALFSPEED_LEVEL 14 #define QUARTERSPEED_LEVEL 5 -// the default of 20 looks a bit flat, so increase it -#define CANDLE_AMPLITUDE 33 +// the default of 26 looks a bit flat, so increase it +#define CANDLE_AMPLITUDE 40 // set floor and ceiling as far apart as possible // because this lantern isn't overpowered |
