aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spaghetti-monster/anduril/anduril.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index c89e5fe..380e2f9 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -79,6 +79,9 @@
// enable beacon mode
#define USE_BEACON_MODE
+// enable momentary mode
+#define USE_MOMENTARY_MODE
+
//Muggle mode for easy UI
#define USE_MUGGLE_MODE
@@ -293,10 +296,12 @@ uint8_t sos_state(Event event, uint16_t arg);
// if enabled, 2nd lockout click goes to the other ramp's floor level
#define LOCKOUT_MOON_FANCY
uint8_t lockout_state(Event event, uint16_t arg);
+#ifdef USE_MOMENTARY_MODE
// momentary / signalling mode
uint8_t momentary_state(Event event, uint16_t arg);
uint8_t momentary_mode = 0; // 0 = ramping, 1 = strobe
uint8_t momentary_active = 0; // boolean, true if active *right now*
+#endif
#ifdef USE_MUGGLE_MODE
// muggle mode, super-simple, hard to exit
uint8_t muggle_state(Event event, uint16_t arg);
@@ -630,12 +635,14 @@ uint8_t off_state(Event event, uint16_t arg) {
set_state(lockout_state, 0);
return MISCHIEF_MANAGED;
}
+ #ifdef USE_MOMENTARY_MODE
// 5 clicks: momentary mode
else if (event == EV_5clicks) {
blink_confirm(1);
set_state(momentary_state, 0);
return MISCHIEF_MANAGED;
}
+ #endif
#ifdef USE_MUGGLE_MODE
// 6 clicks: muggle mode
else if (event == EV_6clicks) {
@@ -733,7 +740,9 @@ uint8_t steady_state(Event event, uint16_t arg) {
// turn LED on when we first enter the mode
if ((event == EV_enter_state) || (event == EV_reenter_state)) {
+ #if defined(USE_MOMENTARY_MODE) && defined(USE_STROBE_STATE)
momentary_mode = 0; // 0 = ramping, 1 = strobes
+ #endif
// if we just got back from config mode, go back to memorized level
if (event == EV_reenter_state) {
arg = memorized_level;
@@ -1129,7 +1138,9 @@ uint8_t strobe_state(Event event, uint16_t arg) {
// (maybe I should just make it nonvolatile?)
strobe_mode_te st = strobe_type;
+ #ifdef USE_MOMENTARY_MODE
momentary_mode = 1; // 0 = ramping, 1 = strobes
+ #endif
#ifdef USE_CANDLE_MODE
// pass all events to candle mode, when it's active
@@ -1808,6 +1819,7 @@ uint8_t lockout_state(Event event, uint16_t arg) {
}
+#ifdef USE_MOMENTARY_MODE
uint8_t momentary_state(Event event, uint16_t arg) {
// TODO: momentary strobe here? (for light painting)
@@ -1857,6 +1869,7 @@ uint8_t momentary_state(Event event, uint16_t arg) {
return EVENT_NOT_HANDLED;
}
+#endif
#ifdef USE_MUGGLE_MODE
@@ -2665,7 +2678,11 @@ void loop() {
#ifdef USE_STROBE_STATE
else if ((state == strobe_state)
- || ((state == momentary_state) && (momentary_mode == 1) && (momentary_active)) ) { // also handle momentary strobes
+ #ifdef USE_MOMENTARY_MODE
+ // also handle momentary strobes
+ || ((state == momentary_state) && (momentary_mode == 1) && (momentary_active))
+ #endif
+ ) {
uint8_t st = strobe_type;
switch(st) {
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.