aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2019-05-10 22:41:45 -0600
committerSelene ToyKeeper2019-05-10 22:41:45 -0600
commit396b4a95abf7a6d5466e9f089993144b203e6b0e (patch)
tree6ac35871136c9e37c6589b375d3877862a5bdce0
parentmade candle mode amplitude configurable at compile time, (diff)
downloadanduril-396b4a95abf7a6d5466e9f089993144b203e6b0e.tar.gz
anduril-396b4a95abf7a6d5466e9f089993144b203e6b0e.tar.bz2
anduril-396b4a95abf7a6d5466e9f089993144b203e6b0e.zip
reworked candle mode a bit more, now specifies the amplitude of each wave in percent,
with a higher potential brightness but more of a low bias overall (looks good on the lantern; haven't tried it elsewhere yet)
-rw-r--r--spaghetti-monster/anduril/anduril.c26
-rw-r--r--spaghetti-monster/anduril/cfg-blf-lantern.h4
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
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.