aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/anduril-manual.txt10
-rw-r--r--spaghetti-monster/anduril/load-save-config-fsm.h1
-rw-r--r--spaghetti-monster/anduril/load-save-config.c2
-rw-r--r--spaghetti-monster/anduril/ramp-mode-fsm.h2
-rw-r--r--spaghetti-monster/anduril/ramp-mode.c7
-rw-r--r--spaghetti-monster/anduril/ramp-mode.h10
-rw-r--r--spaghetti-monster/anduril/tint-ramping.c46
-rw-r--r--spaghetti-monster/anduril/tint-ramping.h8
8 files changed, 54 insertions, 32 deletions
diff --git a/spaghetti-monster/anduril/anduril-manual.txt b/spaghetti-monster/anduril/anduril-manual.txt
index 34ae1bb..8d6ad75 100644
--- a/spaghetti-monster/anduril/anduril-manual.txt
+++ b/spaghetti-monster/anduril/anduril-manual.txt
@@ -692,6 +692,11 @@ Misc Config Menu
Some models may have an extra config menu for settings which don't fit
anywhere else. These settings are, in order:
+ - Tint ramp style:
+
+ 0 = smooth (blend channels in any proportion)
+ 1 = toggle (only one channel active at a time)
+
- Jump Start level:
Some lights are prone to starting up slowly at low levels, so they
@@ -728,6 +733,11 @@ be warm white while dim, or cool white while bright. Or vice-versa. To
access this, ramp to the end of the tint range, then keep holding until
the light blinks a second time.
+The misc config menu also has a setting to choose a tint ramp style.
+This can be smooth, allowing the user to smoothly blend both channels in
+whatever ratio they desire... or it can be "tint toggle" style, where
+only one channel is active at a time.
+
UI Reference Table
------------------
diff --git a/spaghetti-monster/anduril/load-save-config-fsm.h b/spaghetti-monster/anduril/load-save-config-fsm.h
index 894c344..ba3c69b 100644
--- a/spaghetti-monster/anduril/load-save-config-fsm.h
+++ b/spaghetti-monster/anduril/load-save-config-fsm.h
@@ -60,6 +60,7 @@ typedef enum {
#endif
#ifdef USE_TINT_RAMPING
tint_e,
+ tint_style_e,
#endif
#ifdef USE_JUMP_START
jump_start_level_e,
diff --git a/spaghetti-monster/anduril/load-save-config.c b/spaghetti-monster/anduril/load-save-config.c
index ee451ac..4987def 100644
--- a/spaghetti-monster/anduril/load-save-config.c
+++ b/spaghetti-monster/anduril/load-save-config.c
@@ -62,6 +62,7 @@ void load_config() {
#endif
#ifdef USE_TINT_RAMPING
tint = eeprom[tint_e];
+ tint_style = eeprom[tint_style_e];
#endif
#ifdef USE_JUMP_START
jump_start_level = eeprom[jump_start_level_e],
@@ -140,6 +141,7 @@ void save_config() {
#endif
#ifdef USE_TINT_RAMPING
eeprom[tint_e] = tint;
+ eeprom[tint_style_e] = tint_style;
#endif
#ifdef USE_JUMP_START
eeprom[jump_start_level_e] = jump_start_level,
diff --git a/spaghetti-monster/anduril/ramp-mode-fsm.h b/spaghetti-monster/anduril/ramp-mode-fsm.h
index 7f67d1e..1a062e9 100644
--- a/spaghetti-monster/anduril/ramp-mode-fsm.h
+++ b/spaghetti-monster/anduril/ramp-mode-fsm.h
@@ -47,7 +47,7 @@
#endif
// include an extra config mode for random stuff which doesn't fit elsewhere
-#if defined(USE_JUMP_START)
+#if defined(USE_TINT_RAMPING) || defined(USE_JUMP_START)
#define USE_GLOBALS_CONFIG
#endif
diff --git a/spaghetti-monster/anduril/ramp-mode.c b/spaghetti-monster/anduril/ramp-mode.c
index 6d85480..851f5a4 100644
--- a/spaghetti-monster/anduril/ramp-mode.c
+++ b/spaghetti-monster/anduril/ramp-mode.c
@@ -551,14 +551,17 @@ uint8_t ramp_extras_config_state(Event event, uint16_t arg) {
#ifdef USE_GLOBALS_CONFIG
void globals_config_save(uint8_t step, uint8_t value) {
if (0) {}
+ #ifdef USE_TINT_RAMPING
+ else if (step == 1+tint_style_config_step) { tint_style = value; }
+ #endif
#ifdef USE_JUMP_START
- else { jump_start_level = value; }
+ else if (step == 1+jump_start_config_step) { jump_start_level = value; }
#endif
}
uint8_t globals_config_state(Event event, uint16_t arg) {
// TODO: set number of steps based on how many configurable options
- return config_state_base(event, arg, 1, globals_config_save);
+ return config_state_base(event, arg, globals_config_num_steps, globals_config_save);
}
#endif
diff --git a/spaghetti-monster/anduril/ramp-mode.h b/spaghetti-monster/anduril/ramp-mode.h
index bba6d96..93756ab 100644
--- a/spaghetti-monster/anduril/ramp-mode.h
+++ b/spaghetti-monster/anduril/ramp-mode.h
@@ -224,6 +224,16 @@ uint8_t ramp_stepss[] = {
uint8_t ramp_discrete_step_size; // don't set this
#ifdef USE_GLOBALS_CONFIG
+typedef enum {
+ #ifdef USE_TINT_RAMPING
+ tint_style_config_step,
+ #endif
+ #ifdef USE_JUMP_START
+ jump_start_config_step,
+ #endif
+ globals_config_num_steps
+} globals_config_steps_e;
+
void globals_config_save(uint8_t step, uint8_t value);
uint8_t globals_config_state(Event event, uint16_t arg);
#endif
diff --git a/spaghetti-monster/anduril/tint-ramping.c b/spaghetti-monster/anduril/tint-ramping.c
index aa9b1f6..6cc0616 100644
--- a/spaghetti-monster/anduril/tint-ramping.c
+++ b/spaghetti-monster/anduril/tint-ramping.c
@@ -22,31 +22,6 @@
#include "tint-ramping.h"
-#ifdef TINT_RAMP_TOGGLE_ONLY
-
-uint8_t tint_ramping_state(Event event, uint16_t arg) {
- // click, click, hold: change the tint
- if (event == EV_click3_hold) {
- // toggle once on first frame; ignore other frames
- if (! arg) {
- tint = !tint;
- set_level(actual_level);
- //blink_once(); // unnecessary, and kind of annoying on moon
- }
- return EVENT_HANDLED;
- }
-
- // click, click, hold, release: save config
- else if (event == EV_click3_hold_release) {
- // remember tint after battery change
- save_config();
- return EVENT_HANDLED;
- }
-
- return EVENT_NOT_HANDLED;
-}
-
-#else // no TINT_RAMP_TOGGLE_ONLY
uint8_t tint_ramping_state(Event event, uint16_t arg) {
static int8_t tint_ramp_direction = 1;
@@ -61,6 +36,21 @@ uint8_t tint_ramping_state(Event event, uint16_t arg) {
// click, click, hold: change the tint
if (event == EV_click3_hold) {
+ ///// tint-toggle mode
+ // toggle once on first frame; ignore other frames
+ if (tint_style) {
+ // only respond on first frame
+ if (arg) return EVENT_NOT_HANDLED;
+
+ // force tint to be 1 or 254
+ if (tint != 254) { tint = 1; }
+ // invert between 1 and 254
+ tint = tint ^ 0xFF;
+ set_level(actual_level);
+ return EVENT_HANDLED;
+ }
+
+ ///// smooth tint-ramp mode
// reset at beginning of movement
if (! arg) {
active = 1; // first frame means this is for us
@@ -98,8 +88,8 @@ uint8_t tint_ramping_state(Event event, uint16_t arg) {
active = 0; // ignore next hold if it wasn't meant for us
// reverse
tint_ramp_direction = -tint_ramp_direction;
- if (tint == 0) tint_ramp_direction = 1;
- else if (tint == 255) tint_ramp_direction = -1;
+ if (tint <= 1) tint_ramp_direction = 1;
+ else if (tint >= 254) tint_ramp_direction = -1;
// remember tint after battery change
save_config();
return EVENT_HANDLED;
@@ -108,8 +98,6 @@ uint8_t tint_ramping_state(Event event, uint16_t arg) {
return EVENT_NOT_HANDLED;
}
-#endif // ifdef TINT_RAMP_TOGGLE_ONLY
-
#endif
diff --git a/spaghetti-monster/anduril/tint-ramping.h b/spaghetti-monster/anduril/tint-ramping.h
index e482999..1c5e22a 100644
--- a/spaghetti-monster/anduril/tint-ramping.h
+++ b/spaghetti-monster/anduril/tint-ramping.h
@@ -20,6 +20,14 @@
#ifndef TINT_RAMPING_H
#define TINT_RAMPING_H
+// 0: smooth tint ramp
+// 1: toggle tint only between two extremes
+#ifdef TINT_RAMP_TOGGLE_ONLY
+uint8_t tint_style = 1;
+#else
+uint8_t tint_style = 0;
+#endif
+
#ifdef USE_MANUAL_MEMORY
uint8_t manual_memory_tint;
#endif
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.