aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spaghetti-monster/anduril/aux-leds.c4
-rw-r--r--spaghetti-monster/anduril/battcheck-mode-fsm.h7
-rw-r--r--spaghetti-monster/anduril/battcheck-mode.c13
-rw-r--r--spaghetti-monster/anduril/load-save-config-fsm.h3
-rw-r--r--spaghetti-monster/anduril/load-save-config.h4
5 files changed, 29 insertions, 2 deletions
diff --git a/spaghetti-monster/anduril/aux-leds.c b/spaghetti-monster/anduril/aux-leds.c
index 237390c..d833d82 100644
--- a/spaghetti-monster/anduril/aux-leds.c
+++ b/spaghetti-monster/anduril/aux-leds.c
@@ -104,11 +104,13 @@ void rgb_led_update(uint8_t mode, uint16_t arg) {
// always preview in high mode
if (! go_to_standby) { pattern = 2; }
+ #ifdef USE_POST_OFF_VOLTAGE
// use voltage high mode for a few seconds after initial poweroff
- else if (arg < (SLEEP_TICKS_PER_SECOND*3)) {
+ else if (arg < (cfg.post_off_voltage * SLEEP_TICKS_PER_SECOND)) {
pattern = 2;
color = RGB_LED_NUM_COLORS - 1;
}
+ #endif
const uint8_t *colors = rgb_led_colors;
uint8_t actual_color = 0;
diff --git a/spaghetti-monster/anduril/battcheck-mode-fsm.h b/spaghetti-monster/anduril/battcheck-mode-fsm.h
index 4ab8f06..580080c 100644
--- a/spaghetti-monster/anduril/battcheck-mode-fsm.h
+++ b/spaghetti-monster/anduril/battcheck-mode-fsm.h
@@ -5,3 +5,10 @@
#define USE_BATTCHECK
+#ifdef USE_AUX_RGB_LEDS
+ // show voltage colors for a few seconds after going to standby
+ #define USE_POST_OFF_VOLTAGE
+ #ifndef DEFAULT_POST_OFF_VOLTAGE_SECONDS
+ #define DEFAULT_POST_OFF_VOLTAGE_SECONDS 5
+ #endif
+#endif
diff --git a/spaghetti-monster/anduril/battcheck-mode.c b/spaghetti-monster/anduril/battcheck-mode.c
index 7e25f79..0ef6b0a 100644
--- a/spaghetti-monster/anduril/battcheck-mode.c
+++ b/spaghetti-monster/anduril/battcheck-mode.c
@@ -61,11 +61,22 @@ uint8_t battcheck_state(Event event, uint16_t arg) {
// ...
// 13 = add 0.30V
void voltage_config_save(uint8_t step, uint8_t value) {
+ #ifdef USE_POST_OFF_VOLTAGE
+ if (2 == step) cfg.post_off_voltage = value;
+ else
+ #endif
if (value) cfg.voltage_correction = value;
}
uint8_t voltage_config_state(Event event, uint16_t arg) {
- return config_state_base(event, arg, 1, voltage_config_save);
+ #ifdef USE_POST_OFF_VOLTAGE
+ #define VOLTAGE_CONFIG_STEPS 2
+ #else
+ #define VOLTAGE_CONFIG_STEPS 1
+ #endif
+ return config_state_base(event, arg,
+ VOLTAGE_CONFIG_STEPS,
+ voltage_config_save);
}
#endif // #ifdef USE_VOLTAGE_CORRECTION
diff --git a/spaghetti-monster/anduril/load-save-config-fsm.h b/spaghetti-monster/anduril/load-save-config-fsm.h
index df46fc5..862cf26 100644
--- a/spaghetti-monster/anduril/load-save-config-fsm.h
+++ b/spaghetti-monster/anduril/load-save-config-fsm.h
@@ -97,6 +97,9 @@ typedef struct Config {
#ifdef USE_AUX_RGB_LEDS
uint8_t rgb_led_off_mode;
uint8_t rgb_led_lockout_mode;
+ #ifdef USE_POST_OFF_VOLTAGE
+ uint8_t post_off_voltage;
+ #endif
#endif
///// misc other mode settings
diff --git a/spaghetti-monster/anduril/load-save-config.h b/spaghetti-monster/anduril/load-save-config.h
index 278d286..8ae9d96 100644
--- a/spaghetti-monster/anduril/load-save-config.h
+++ b/spaghetti-monster/anduril/load-save-config.h
@@ -135,6 +135,10 @@ Config cfg = {
#ifdef USE_AUX_RGB_LEDS
.rgb_led_off_mode = RGB_LED_OFF_DEFAULT,
.rgb_led_lockout_mode = RGB_LED_LOCKOUT_DEFAULT,
+ #ifdef USE_POST_OFF_VOLTAGE
+ // display voltage readout for a while after turning off?
+ .post_off_voltage = DEFAULT_POST_OFF_VOLTAGE_SECONDS,
+ #endif
#endif
///// misc other mode settings
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.