aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-04-19 03:29:43 -0600
committerSelene ToyKeeper2020-04-19 03:29:43 -0600
commit536e9c0d3e89fea0e37a840c0c72136c25f71889 (patch)
tree83586becc61d16f41a311e74ed0948b84a448f68 /spaghetti-monster
parentmade thermal response larger when error is large, smaller when error is small (diff)
downloadanduril-536e9c0d3e89fea0e37a840c0c72136c25f71889.tar.gz
anduril-536e9c0d3e89fea0e37a840c0c72136c25f71889.tar.bz2
anduril-536e9c0d3e89fea0e37a840c0c72136c25f71889.zip
added tweakable thermal_response_magnitude option, adjusted KR4 thermal vars, made KR4 rainbow mode faster
Diffstat (limited to '')
-rw-r--r--spaghetti-monster/anduril/cfg-noctigon-kr4.h4
-rw-r--r--spaghetti-monster/fsm-adc.c20
2 files changed, 12 insertions, 12 deletions
diff --git a/spaghetti-monster/anduril/cfg-noctigon-kr4.h b/spaghetti-monster/anduril/cfg-noctigon-kr4.h
index 01310b5..66c5a28 100644
--- a/spaghetti-monster/anduril/cfg-noctigon-kr4.h
+++ b/spaghetti-monster/anduril/cfg-noctigon-kr4.h
@@ -8,6 +8,7 @@
//#define USE_INDICATOR_LED_WHILE_RAMPING
#define RGB_LED_OFF_DEFAULT 0x17 // low, rainbow
#define RGB_LED_LOCKOUT_DEFAULT 0x37 // blinking, rainbow
+#define RGB_RAINBOW_SPEED 0x03 // half a second per color
// enable blinking aux LEDs
#define TICK_DURING_STANDBY
@@ -42,8 +43,7 @@
// stop panicking at ~25% power or ~1000 lm
#define THERM_FASTER_LEVEL 100
#define MIN_THERM_STEPDOWN DEFAULT_LEVEL
-#define THERM_LOOKAHEAD 6
-#define THERM_NEXT_WARNING_THRESHOLD 12
+#define THERM_NEXT_WARNING_THRESHOLD 16
// easier access to thermal config mode, for Noctigon
#define USE_TENCLICK_THERMAL_CONFIG
diff --git a/spaghetti-monster/fsm-adc.c b/spaghetti-monster/fsm-adc.c
index 760acc4..68361ae 100644
--- a/spaghetti-monster/fsm-adc.c
+++ b/spaghetti-monster/fsm-adc.c
@@ -286,21 +286,21 @@ static inline void ADC_voltage_handler() {
static inline void ADC_temperature_handler() {
// coarse adjustment
#ifndef THERM_LOOKAHEAD
- #define THERM_LOOKAHEAD 4 // can be tweaked per build target
+ #define THERM_LOOKAHEAD 4
#endif
// reduce frequency of minor warnings
#ifndef THERM_NEXT_WARNING_THRESHOLD
#define THERM_NEXT_WARNING_THRESHOLD 24
#endif
// fine-grained adjustment
- // how proportional should the adjustments be? (not used yet)
+ // how proportional should the adjustments be?
#ifndef THERM_RESPONSE_MAGNITUDE
#define THERM_RESPONSE_MAGNITUDE 128
#endif
// acceptable temperature window size in C
#define THERM_WINDOW_SIZE 2
- // TODO: make this configurable per build target?
+ // TODO? make this configurable per build target?
// (shorter time for hosts with a lower power-to-mass ratio)
// (because then it'll have smaller responses)
#define NUM_TEMP_HISTORY_STEPS 8 // don't change; it'll break stuff
@@ -377,14 +377,14 @@ static inline void ADC_temperature_handler() {
if (warning_threshold > 0) {
warning_threshold -= offset;
} else { // error is big enough; send a warning
- //warning_threshold = THERM_NEXT_WARNING_THRESHOLD - offset;
-
// how far above the ceiling?
- //int16_t howmuch = offset * THERM_RESPONSE_MAGNITUDE / 128;
- //int16_t howmuch = offset;
- // increase the amount, except for small values
- // 1:1, 2:1, 3:3, 4:5, 6:9, 8:13, 10:17, 40:77
- int16_t howmuch = offset + offset - 3;
+ // original method works, but is too slow on some small hosts:
+ // (and typically has a minimum response magnitude of 2 instead of 1)
+ // int16_t howmuch = offset;
+ // ... so increase the amount, except for small values
+ // (for example, 1:1, 2:1, 3:3, 4:5, 6:9, 8:13, 10:17, 40:77)
+ // ... and let us tune the response per build target if desired
+ int16_t howmuch = (offset + offset - 3) * THERM_RESPONSE_MAGNITUDE / 128;
if (howmuch < 1) howmuch = 1;
warning_threshold = THERM_NEXT_WARNING_THRESHOLD - (uint8_t)howmuch;