aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-08-05 21:35:25 -0600
committerSelene ToyKeeper2020-08-05 21:35:25 -0600
commit9a901abc668cf2cfecb8910b8ad3511a58a9ed3f (patch)
tree5020e5ce028211f8b56978b5721f6d52bc789a2e /spaghetti-monster
parentadded support for 1-step ramps in stepped ramp mode (diff)
downloadanduril-9a901abc668cf2cfecb8910b8ad3511a58a9ed3f.tar.gz
anduril-9a901abc668cf2cfecb8910b8ad3511a58a9ed3f.tar.bz2
anduril-9a901abc668cf2cfecb8910b8ad3511a58a9ed3f.zip
made lockout momentary always use lowest first, and use manual mem level on second click if enabled
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/config-default.h4
-rw-r--r--spaghetti-monster/anduril/lockout-mode.c27
2 files changed, 13 insertions, 18 deletions
diff --git a/spaghetti-monster/anduril/config-default.h b/spaghetti-monster/anduril/config-default.h
index 21e345b..da79068 100644
--- a/spaghetti-monster/anduril/config-default.h
+++ b/spaghetti-monster/anduril/config-default.h
@@ -111,9 +111,7 @@
// enable a mode for locking the light for safe carry
#define USE_LOCKOUT_MODE
// should lockout mode function as a momentary moon mode?
-#define MOON_DURING_LOCKOUT_MODE
-// if enabled, 2nd lockout click goes to the other ramp's floor level
-#define LOCKOUT_MOON_FANCY
+#define USE_MOON_DURING_LOCKOUT_MODE
// add an optional setting to lock the light after being off for a while
#define USE_AUTOLOCK
diff --git a/spaghetti-monster/anduril/lockout-mode.c b/spaghetti-monster/anduril/lockout-mode.c
index 9414a67..f78c4cc 100644
--- a/spaghetti-monster/anduril/lockout-mode.c
+++ b/spaghetti-monster/anduril/lockout-mode.c
@@ -23,7 +23,7 @@
#include "lockout-mode.h"
uint8_t lockout_state(Event event, uint16_t arg) {
- #ifdef MOON_DURING_LOCKOUT_MODE
+ #ifdef USE_MOON_DURING_LOCKOUT_MODE
// momentary(ish) moon mode during lockout
// button is being held
#ifdef USE_AUX_RGB_LEDS
@@ -31,27 +31,24 @@ uint8_t lockout_state(Event event, uint16_t arg) {
if (event == EV_click7_hold) { set_level(0); } else
#endif
if ((event & (B_CLICK | B_PRESS)) == (B_CLICK | B_PRESS)) {
- #ifdef LOCKOUT_MOON_LOWEST
- // Use lowest moon configured
+ // hold: lowest floor
+ // click, hold: highest floor (or manual mem level)
uint8_t lvl = ramp_floors[0];
- if (ramp_floors[1] < lvl) lvl = ramp_floors[1];
- set_level(lvl);
- #elif defined(LOCKOUT_MOON_FANCY)
- if ((event & 0x0f) == 2) {
- set_level(ramp_floors[ramp_style^1]);
- } else {
- set_level(ramp_floors[ramp_style]);
+ if ((event & 0x0f) == 2) { // second click
+ if (ramp_floors[1] > lvl) lvl = ramp_floors[1];
+ #ifdef USE_MANUAL_MEMORY
+ if (manual_memory) lvl = manual_memory;
+ #endif
+ } else { // anything except second click
+ if (ramp_floors[1] < lvl) lvl = ramp_floors[1];
}
- #else
- // Use moon from current ramp
- set_level(nearest_level(1));
- #endif
+ set_level(lvl);
}
// button was released
else if ((event & (B_CLICK | B_PRESS)) == (B_CLICK)) {
set_level(0);
}
- #endif
+ #endif // ifdef USE_MOON_DURING_LOCKOUT_MODE
// regular event handling
// conserve power while locked out
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.