aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-07-12 23:37:53 -0600
committerSelene ToyKeeper2020-07-12 23:37:53 -0600
commit5c8a230d532843e8d4d8a32bfaba68beab9afbab (patch)
treee880d6be640aed501a49f95dc51008d8fba1f5f2 /spaghetti-monster
parentfixed bug: button release events were sending 0 as the arg instead of the num... (diff)
downloadanduril-5c8a230d532843e8d4d8a32bfaba68beab9afbab.tar.gz
anduril-5c8a230d532843e8d4d8a32bfaba68beab9afbab.tar.bz2
anduril-5c8a230d532843e8d4d8a32bfaba68beab9afbab.zip
removed beacon config mode... replaced "click N times" with "hold for N seconds" to configure it
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/anduril.c54
1 files changed, 26 insertions, 28 deletions
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index 9ef4270..7ab7aee 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -305,7 +305,6 @@ uint8_t goodnight_state(Event event, uint16_t arg);
#ifdef USE_BEACON_MODE
// beacon mode and its related config mode
uint8_t beacon_state(Event event, uint16_t arg);
-uint8_t beacon_config_state(Event event, uint16_t arg);
#endif
#ifdef USE_SOS_MODE_IN_BLINKY_GROUP
// automatic SOS emergency signal
@@ -1349,6 +1348,20 @@ uint8_t strobe_state(Event event, uint16_t arg) {
return EVENT_NOT_HANDLED;
}
+
+#ifdef USE_BEACON_MODE
+inline void beacon_mode_iter() {
+ // one iteration of main loop()
+ if (! button_last_state) {
+ set_level(memorized_level);
+ nice_delay_ms(100);
+ set_level(0);
+ nice_delay_ms(((beacon_seconds) * 1000) - 100);
+ }
+}
+#endif // #ifdef USE_BEACON_MODE
+
+
#if defined(USE_PARTY_STROBE_MODE) || defined(USE_TACTICAL_STROBE_MODE)
inline void party_tactical_strobe_mode_iter(uint8_t st) {
// one iteration of main loop()
@@ -1747,9 +1760,17 @@ uint8_t beacon_state(Event event, uint16_t arg) {
#endif
return MISCHIEF_MANAGED;
}
- // 7 clicks: beacon config mode
- else if (event == EV_7clicks) {
- push_state(beacon_config_state, 0);
+ // hold: configure beacon timing
+ else if (event == EV_click1_hold) {
+ if (0 == (arg % TICKS_PER_SECOND)) {
+ blink_confirm(1);
+ }
+ return MISCHIEF_MANAGED;
+ }
+ // release hold: save new timing
+ else if (event == EV_click1_hold_release) {
+ beacon_seconds = 1 + (arg / TICKS_PER_SECOND);
+ save_config();
return MISCHIEF_MANAGED;
}
return EVENT_NOT_HANDLED;
@@ -2110,30 +2131,6 @@ uint8_t thermal_config_state(Event event, uint16_t arg) {
#endif // #ifdef USE_THERMAL_REGULATION
-#ifdef USE_BEACON_MODE
-void beacon_config_save() {
- // parse values
- uint8_t val = config_state_values[0];
- if (val) {
- beacon_seconds = val;
- }
-}
-
-uint8_t beacon_config_state(Event event, uint16_t arg) {
- return config_state_base(event, arg,
- 1, beacon_config_save);
-}
-
-inline void beacon_mode_iter() {
- // one iteration of main loop()
- set_level(memorized_level);
- nice_delay_ms(100);
- set_level(0);
- nice_delay_ms(((beacon_seconds) * 1000) - 100);
-}
-#endif // #ifdef USE_BEACON_MODE
-
-
uint8_t number_entry_state(Event event, uint16_t arg) {
static uint8_t value;
static uint8_t blinks_left;
@@ -2271,6 +2268,7 @@ void blink_confirm(uint8_t num) {
set_level(MAX_LEVEL/4);
delay_4ms(10/4);
set_level(0);
+ // TODO: only do this delay if num > 1
delay_4ms(100/4);
}
}
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.