aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2017-08-27 22:40:49 -0600
committerSelene ToyKeeper2017-08-27 22:40:49 -0600
commitf688f4c149a590b89cd850a899a0baa0149cdd27 (patch)
treea5a80f28df22fc0b0e727ec4a60353116436aae0
parentFixed bug: double-click from off didn't *really* go to the top of the ramp. (diff)
downloadanduril-f688f4c149a590b89cd850a899a0baa0149cdd27.tar.gz
anduril-f688f4c149a590b89cd850a899a0baa0149cdd27.tar.bz2
anduril-f688f4c149a590b89cd850a899a0baa0149cdd27.zip
Use different speed values for party and tactical strobes.
-rw-r--r--spaghetti-monster/anduril.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/spaghetti-monster/anduril.c b/spaghetti-monster/anduril.c
index eba21d1..4fb6118 100644
--- a/spaghetti-monster/anduril.c
+++ b/spaghetti-monster/anduril.c
@@ -31,7 +31,7 @@
#define RAMP_LENGTH 150
#define MAX_CLICKS 6
#define USE_EEPROM
-#define EEPROM_BYTES 9
+#define EEPROM_BYTES 10
#include "spaghetti-monster.h"
// FSM states
@@ -78,7 +78,7 @@ uint8_t target_level = 0;
#endif
// strobe timing
-volatile uint8_t strobe_delay = 67;
+volatile uint8_t strobe_delays[] = { 40, 67 }; // party strobe, tactical strobe
volatile uint8_t strobe_type = 2; // 0 == party strobe, 1 == tactical strobe, 2 == bike flasher
volatile uint8_t bike_flasher_brightness = MAX_1x7135;
@@ -315,7 +315,7 @@ uint8_t strobe_state(EventPtr event, uint16_t arg) {
else if (event == EV_click1_hold) {
if (strobe_type < 2) {
if ((arg & 1) == 0) {
- if (strobe_delay > 8) strobe_delay --;
+ if (strobe_delays[strobe_type] > 8) strobe_delays[strobe_type] --;
}
}
// biking mode brighter
@@ -331,7 +331,7 @@ uint8_t strobe_state(EventPtr event, uint16_t arg) {
else if (event == EV_click2_hold) {
if (strobe_type < 2) {
if ((arg & 1) == 0) {
- if (strobe_delay < 255) strobe_delay ++;
+ if (strobe_delays[strobe_type] < 255) strobe_delays[strobe_type] ++;
}
}
// biking mode dimmer
@@ -632,8 +632,9 @@ void load_config() {
ramp_discrete_ceil = eeprom[4];
ramp_discrete_steps = eeprom[5];
strobe_type = eeprom[6];
- strobe_delay = eeprom[7];
- bike_flasher_brightness = eeprom[8];
+ strobe_delays[0] = eeprom[7];
+ strobe_delays[1] = eeprom[8];
+ bike_flasher_brightness = eeprom[9];
}
}
@@ -645,8 +646,9 @@ void save_config() {
eeprom[4] = ramp_discrete_ceil;
eeprom[5] = ramp_discrete_steps;
eeprom[6] = strobe_type;
- eeprom[7] = strobe_delay;
- eeprom[8] = bike_flasher_brightness;
+ eeprom[7] = strobe_delays[0];
+ eeprom[8] = strobe_delays[1];
+ eeprom[9] = bike_flasher_brightness;
save_eeprom();
}
@@ -698,13 +700,13 @@ void loop() {
if (strobe_type < 2) {
set_level(MAX_LEVEL);
if (strobe_type == 0) { // party strobe
- if (strobe_delay < 30) delay_zero();
+ if (strobe_delays[strobe_type] < 42) delay_zero();
else delay_ms(1);
} else { //tactical strobe
- nice_delay_ms(strobe_delay >> 1);
+ nice_delay_ms(strobe_delays[strobe_type] >> 1);
}
set_level(0);
- nice_delay_ms(strobe_delay);
+ nice_delay_ms(strobe_delays[strobe_type]);
}
// bike flasher
else if (strobe_type == 2) {
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.