aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spaghetti-monster/anduril/anduril.c48
-rw-r--r--spaghetti-monster/anduril/cfg-blf-lantern.h3
2 files changed, 44 insertions, 7 deletions
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index 48f4ac1..3ab97cb 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -90,6 +90,8 @@
// so don't enable them at the same time as any of the above strobes)
//#define USE_POLICE_STROBE_MODE
//#define USE_SOS_MODE
+//#define USE_SOS_MODE_IN_FF_GROUP // put SOS in the "boring strobes" mode
+//#define USE_SOS_MODE_IN_BLINKY_GROUP // put SOS in the blinkies mode group
/***** specific settings for known driver types *****/
#include "tk.h"
@@ -146,7 +148,7 @@
#define USE_STROBE_STATE
#endif
-#if defined(USE_POLICE_STROBE_MODE) || defined(USE_SOS_MODE)
+#if defined(USE_POLICE_STROBE_MODE) || defined(USE_SOS_MODE_IN_FF_GROUP)
#define USE_BORING_STROBE_STATE
#endif
@@ -282,6 +284,10 @@ uint8_t goodnight_state(Event event, uint16_t arg);
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
+uint8_t sos_state(Event event, uint16_t arg);
+#endif
// soft lockout
#define MOON_DURING_LOCKOUT_MODE
// if enabled, 2nd lockout click goes to the other ramp's floor level
@@ -1507,8 +1513,29 @@ inline void police_strobe_iter() {
}
}
#endif
+#endif // #ifdef USE_BORING_STROBE_STATE
#ifdef USE_SOS_MODE
+#ifdef USE_SOS_MODE_IN_BLINKY_GROUP
+uint8_t sos_state(Event event, uint16_t arg) {
+ // 1 click: off
+ if (event == EV_1click) {
+ set_state(off_state, 0);
+ return MISCHIEF_MANAGED;
+ }
+ // 2 clicks: next mode
+ else if (event == EV_2clicks) {
+ #ifdef USE_THERMAL_REGULATION
+ set_state(tempcheck_state, 0);
+ #else
+ set_state(battcheck_state, 0);
+ #endif
+ return MISCHIEF_MANAGED;
+ }
+ return EVENT_NOT_HANDLED;
+}
+#endif
+
void sos_blink(uint8_t num, uint8_t dah) {
#define DIT_LENGTH 200
for (; num > 0; num--) {
@@ -1527,14 +1554,13 @@ void sos_blink(uint8_t num, uint8_t dah) {
inline void sos_mode_iter() {
// one iteration of main loop()
- nice_delay_ms(1000);
+ //nice_delay_ms(1000);
sos_blink(3, 0); // S
sos_blink(3, 1); // O
sos_blink(3, 0); // S
- nice_delay_ms(1000);
+ nice_delay_ms(2000);
}
#endif // #ifdef USE_SOS_MODE
-#endif // #ifdef USE_BORING_STROBE_STATE
#ifdef USE_BATTCHECK
@@ -1585,9 +1611,11 @@ uint8_t beacon_state(Event event, uint16_t arg) {
}
// TODO: use sleep ticks to measure time between pulses,
// to save power
- // 2 clicks: tempcheck mode
+ // 2 clicks: next mode
else if (event == EV_2clicks) {
- #ifdef USE_THERMAL_REGULATION
+ #ifdef USE_SOS_MODE_IN_BLINKY_GROUP
+ set_state(sos_state, 0);
+ #elif defined(USE_THERMAL_REGULATION)
set_state(tempcheck_state, 0);
#else
set_state(battcheck_state, 0);
@@ -2646,7 +2674,7 @@ void loop() {
break;
#endif
- #ifdef USE_SOS_MODE
+ #ifdef USE_SOS_MODE_IN_FF_GROUP
default: // SOS
sos_mode_iter();
break;
@@ -2667,6 +2695,12 @@ void loop() {
}
#endif
+ #ifdef USE_SOS_MODE_IN_BLINKY_GROUP
+ else if (state == sos_state) {
+ sos_mode_iter();
+ }
+ #endif
+
#ifdef USE_THERMAL_REGULATION
// TODO: blink out therm_ceil during thermal_config_state?
else if (state == tempcheck_state) {
diff --git a/spaghetti-monster/anduril/cfg-blf-lantern.h b/spaghetti-monster/anduril/cfg-blf-lantern.h
index bf183eb..bdcd893 100644
--- a/spaghetti-monster/anduril/cfg-blf-lantern.h
+++ b/spaghetti-monster/anduril/cfg-blf-lantern.h
@@ -54,6 +54,9 @@
#define MUGGLE_FLOOR 15 // about 20 lm
#define MUGGLE_CEILING 115 // about 350 lm
+#define USE_SOS_MODE
+#define USE_SOS_MODE_IN_BLINKY_GROUP
+
// the sensor (attiny85) is nowhere near the emitters
// so thermal regulation can't work
#ifdef USE_THERMAL_REGULATION
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.