aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril.c8
-rw-r--r--spaghetti-monster/anduril.txt11
2 files changed, 16 insertions, 3 deletions
diff --git a/spaghetti-monster/anduril.c b/spaghetti-monster/anduril.c
index e169f18..6eafb5d 100644
--- a/spaghetti-monster/anduril.c
+++ b/spaghetti-monster/anduril.c
@@ -26,9 +26,9 @@
#define USE_DELAY_4MS
#define USE_DELAY_ZERO
#define USE_RAMPING
+#define RAMP_LENGTH 150
#define USE_BATTCHECK
#define BATTCHECK_VpT
-#define RAMP_LENGTH 150
#define MAX_CLICKS 6
#define USE_EEPROM
#define EEPROM_BYTES 12
@@ -684,6 +684,8 @@ uint8_t number_entry_state(EventPtr event, uint16_t arg) {
}
+// find the ramp level closest to the target,
+// using only the levels which are allowed in the current state
uint8_t nearest_level(int16_t target) {
// bounds check
// using int16_t here saves us a bunch of logic elsewhere,
@@ -781,6 +783,7 @@ void low_voltage() {
void setup() {
+ // blink at power-on to let user know power is connected
set_level(RAMP_SIZE/8);
delay_4ms(3);
set_level(0);
@@ -792,6 +795,7 @@ void setup() {
void loop() {
+
// deferred "off" so we won't suspend in a weird state
// (like... during the middle of a strobe pulse)
if (go_to_standby) {
@@ -825,6 +829,7 @@ void loop() {
if (! nice_delay_ms(720)) return;
}
}
+
#ifdef USE_BATTCHECK
else if (current_state == battcheck_state) {
battcheck();
@@ -835,6 +840,7 @@ void loop() {
}
// TODO: blink out therm_ceil during thermal_config_state
#endif
+
else if (current_state == beacon_state) {
set_level(memorized_level);
if (! nice_delay_ms(500)) return;
diff --git a/spaghetti-monster/anduril.txt b/spaghetti-monster/anduril.txt
index 5e6d4b9..a9790b1 100644
--- a/spaghetti-monster/anduril.txt
+++ b/spaghetti-monster/anduril.txt
@@ -1,6 +1,6 @@
From off:
* 1 click: memorized level
- * Hold: Lowest level then ramp up
+ * Hold: lowest level then ramp up
* 2 clicks: highest ramp level
* Click, hold: highest level then ramp down
* 3 clicks: battcheck mode
@@ -60,7 +60,7 @@ Tempcheck mode:
- Hold: thermal calibration mode
Thermal config mode:
- * Click N times to set thermal limit to roughly 30 C + N.
+ * At buzz, click N times to set thermal limit to roughly 30 C + N.
Thermal calibration mode:
- Hold until hot: set new ceiling value
@@ -71,6 +71,9 @@ Beacon mode:
* 2 clicks: battcheck mode
* 3 clicks: configure time between pulses
+Beacon config mode:
+ * At buzz, click N times to set beacon frequency to N seconds.
+
Momentary mode:
* Press button: Light on (at memorized level).
* Release button: Light off.
@@ -79,6 +82,10 @@ Momentary mode:
TODO:
* save settings in eeprom
- decide on "hold until hot" or "click N times" for thermal config mode
+ - test thermal regulation on an actual light
+ - improve thermal regulation
- a way to blink out the firmware version?
- indicator LED support
- a way to configure indicator LED behavior?
+ - add goodnight mode?
+ - add lightning mode?