aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/anduril.c2
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4k-3ch.h2
-rw-r--r--spaghetti-monster/fsm-ramping.c33
-rw-r--r--spaghetti-monster/fsm-ramping.h1
4 files changed, 33 insertions, 5 deletions
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index ab43df6..6399ef6 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -267,7 +267,7 @@ void loop() {
#ifdef USE_AUX_RGB_LEDS_WHILE_ON
// display battery charge on RGB button during use
- if (! setting_rgb_mode_now)
+ if (state == steady_state)
rgb_led_voltage_readout(actual_level > USE_AUX_RGB_LEDS_WHILE_ON);
#endif
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4k-3ch.h b/spaghetti-monster/anduril/cfg-emisar-d4k-3ch.h
index 46d5796..c015295 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d4k-3ch.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d4k-3ch.h
@@ -13,7 +13,7 @@
// turn on the aux LEDs while main LEDs are on
// (in case there's a RGB button)
-#define USE_AUX_RGB_LEDS_WHILE_ON 20
+#define USE_AUX_RGB_LEDS_WHILE_ON 25
#define USE_INDICATOR_LED_WHILE_RAMPING
// channel modes...
diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c
index a970f0e..89f540b 100644
--- a/spaghetti-monster/fsm-ramping.c
+++ b/spaghetti-monster/fsm-ramping.c
@@ -36,6 +36,25 @@ inline void set_level_aux_leds(uint8_t level) {
}
#endif // ifdef HAS_AUX_LEDS
+#ifdef USE_AUX_RGB_LEDS_WHILE_ON
+// TODO: maybe move this stuff into FSM
+#include "anduril/aux-leds.h" // for rgb_led_voltage_readout()
+inline void set_level_aux_rgb_leds(uint8_t level) {
+ if (! go_to_standby) {
+ if (level > 0) {
+ rgb_led_voltage_readout(level > USE_AUX_RGB_LEDS_WHILE_ON);
+ } else {
+ rgb_led_set(0);
+ }
+ // some drivers can be wired with RGB or single color to button
+ // ... so support both even though only one is connected
+ #ifdef USE_BUTTON_LED
+ button_led_set((level > 0) + (level > DEFAULT_LEVEL));
+ #endif
+ }
+}
+#endif // ifdef USE_AUX_RGB_LEDS_WHILE_ON
+
void set_level(uint8_t level) {
#ifdef USE_JUMP_START
@@ -58,9 +77,17 @@ void set_level(uint8_t level) {
set_level_aux_leds(level);
#endif
- // call the relevant hardware-specific set_level_*()
- SetLevelFuncPtr set_level_func = channels[channel_mode].set_level;
- set_level_func(level);
+ #ifdef USE_AUX_RGB_LEDS_WHILE_ON
+ set_level_aux_rgb_leds(level);
+ #endif
+
+ if (0 == level) {
+ set_level_zero();
+ } else {
+ // call the relevant hardware-specific set_level_*()
+ SetLevelFuncPtr set_level_func = channels[channel_mode].set_level;
+ set_level_func(level - 1);
+ }
if (actual_level != level) prev_level = actual_level;
actual_level = level;
diff --git a/spaghetti-monster/fsm-ramping.h b/spaghetti-monster/fsm-ramping.h
index cae9a4d..bfcc5fb 100644
--- a/spaghetti-monster/fsm-ramping.h
+++ b/spaghetti-monster/fsm-ramping.h
@@ -13,6 +13,7 @@ uint8_t prev_level = 0;
void set_level(uint8_t level);
//void set_level_smooth(uint8_t level);
+void set_level_zero(); // implement this in a hwdef
#ifdef USE_SET_LEVEL_GRADUALLY
// adjust brightness very smoothly