aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spaghetti-monster/anduril/anduril.c10
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d18.h2
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4.h4
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4s.h5
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4sv2.h14
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4v2.h12
-rw-r--r--spaghetti-monster/anduril/cfg-ff-pl47.h5
-rw-r--r--spaghetti-monster/anduril/cfg-ff-pl47g2.h5
-rw-r--r--spaghetti-monster/anduril/cfg-ff-rot66.h3
-rw-r--r--spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h5
-rw-r--r--spaghetti-monster/anduril/cfg-sofirn-sp36.h7
-rw-r--r--spaghetti-monster/fsm-adc.c5
-rw-r--r--spaghetti-monster/fsm-adc.h12
-rw-r--r--spaghetti-monster/fsm-standby.c4
-rw-r--r--spaghetti-monster/spaghetti-monster.txt12
15 files changed, 18 insertions, 87 deletions
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index 469d0d8..bc2f9c6 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -22,7 +22,7 @@
// Anduril config file name (set it here or define it at the gcc command line)
//#define CONFIGFILE cfg-blf-q8.h
-#define USE_LVP // FIXME: won't build when this option is turned off
+#define USE_LVP
// parameters for this defined below or per-driver
#define USE_THERMAL_REGULATION
@@ -275,6 +275,7 @@ void sos_blink(uint8_t num, uint8_t dah);
uint8_t battcheck_state(Event event, uint16_t arg);
#endif
#ifdef USE_THERMAL_REGULATION
+#define USE_BLINK_NUM
uint8_t tempcheck_state(Event event, uint16_t arg);
uint8_t thermal_config_state(Event event, uint16_t arg);
#endif
@@ -497,6 +498,7 @@ volatile uint8_t beacon_seconds = 2;
#endif
#ifdef USE_VERSION_CHECK
+#define USE_BLINK_DIGIT
#include "version.h"
const PROGMEM uint8_t version_number[] = VERSION_NUMBER;
uint8_t version_check_state(Event event, uint16_t arg);
@@ -1585,11 +1587,13 @@ uint8_t tempcheck_state(Event event, uint16_t arg) {
set_state(off_state, 0);
return MISCHIEF_MANAGED;
}
+ #ifdef USE_BATTCHECK
// 2 clicks: battcheck mode
else if (event == EV_2clicks) {
set_state(battcheck_state, 0);
return MISCHIEF_MANAGED;
}
+ #endif
// 4 clicks: thermal config mode
else if (event == EV_4clicks) {
push_state(thermal_config_state, 0);
@@ -1615,7 +1619,7 @@ uint8_t beacon_state(Event event, uint16_t arg) {
set_state(sos_state, 0);
#elif defined(USE_THERMAL_REGULATION)
set_state(tempcheck_state, 0);
- #else
+ #elif defined(USE_BATTCHECK)
set_state(battcheck_state, 0);
#endif
return MISCHIEF_MANAGED;
@@ -1997,6 +2001,7 @@ uint8_t muggle_state(Event event, uint16_t arg) {
return MISCHIEF_MANAGED;
}
#endif
+ #ifdef USE_LVP
// low voltage is handled specially in muggle mode
else if(event == EV_voltage_low) {
uint8_t lvl = (actual_level >> 1) + (actual_level >> 2);
@@ -2007,6 +2012,7 @@ uint8_t muggle_state(Event event, uint16_t arg) {
}
return MISCHIEF_MANAGED;
}
+ #endif
return EVENT_NOT_HANDLED;
}
diff --git a/spaghetti-monster/anduril/cfg-emisar-d18.h b/spaghetti-monster/anduril/cfg-emisar-d18.h
index 16fbacd..155a747 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d18.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d18.h
@@ -42,5 +42,3 @@
// stop panicking at about ~40% power or ~5000 lm
#define THERM_FASTER_LEVEL 125
-// optional, makes initial turbo step-down faster so first peak isn't as hot
-//#define THERM_HARD_TURBO_DROP
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4.h b/spaghetti-monster/anduril/cfg-emisar-d4.h
index c86a534..501b9c7 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d4.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d4.h
@@ -24,8 +24,4 @@
// stop panicking at ~30% power or ~1200 lm
#define THERM_FASTER_LEVEL 105
-// respond to thermal changes faster
-#define THERMAL_WARNING_SECONDS 3
-#define THERMAL_UPDATE_SPEED 1
-#define THERM_PREDICTION_STRENGTH 4
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4s.h b/spaghetti-monster/anduril/cfg-emisar-d4s.h
index 6fe95a6..88465da 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d4s.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d4s.h
@@ -42,8 +42,3 @@
#ifdef THERM_HARD_TURBO_DROP
#undef THERM_HARD_TURBO_DROP
#endif
-
-#define THERMAL_WARNING_SECONDS 3
-#define THERMAL_UPDATE_SPEED 2
-#define THERM_PREDICTION_STRENGTH 4
-
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4sv2.h b/spaghetti-monster/anduril/cfg-emisar-d4sv2.h
index c47e774..c578c4a 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d4sv2.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d4sv2.h
@@ -42,16 +42,6 @@
// stop panicking at ~50% power or ~2000 lm
#define THERM_FASTER_LEVEL 130
-// no need to be extra-careful on this light
-#ifdef THERM_HARD_TURBO_DROP
-#undef THERM_HARD_TURBO_DROP
-#endif
-
-// respond to thermal changes faster
-#define THERMAL_WARNING_SECONDS 3
-#define THERMAL_UPDATE_SPEED 2
-#define THERM_PREDICTION_STRENGTH 4
-
// easier access to thermal config mode, for Emisar
#define USE_TENCLICK_THERMAL_CONFIG
@@ -61,7 +51,3 @@
// seems relevant on attiny1634
#define THERM_CAL_OFFSET 5
-
-// attiny1634 has enough space to smooth out voltage readings
-#define USE_VOLTAGE_LOWPASS
-
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4v2.h b/spaghetti-monster/anduril/cfg-emisar-d4v2.h
index 3da877e..241ca7e 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d4v2.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d4v2.h
@@ -37,22 +37,10 @@
#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
#define RAMP_DISCRETE_STEPS 7
-// optional, makes initial turbo step-down faster so first peak isn't as hot
-// the D4 runs very very hot, so be extra careful
-//#define THERM_HARD_TURBO_DROP
-
// stop panicking at ~30% power or ~1200 lm
#define THERM_FASTER_LEVEL 105
-// respond to thermal changes faster
-#define THERMAL_WARNING_SECONDS 3
-#define THERMAL_UPDATE_SPEED 1
-#define THERM_PREDICTION_STRENGTH 4
-//#define THERM_RESPONSE_MAGNITUDE 128
// easier access to thermal config mode, for Emisar
#define USE_TENCLICK_THERMAL_CONFIG
#define THERM_CAL_OFFSET 5
-
-// attiny1634 has enough space to smooth out voltage readings
-#define USE_VOLTAGE_LOWPASS
diff --git a/spaghetti-monster/anduril/cfg-ff-pl47.h b/spaghetti-monster/anduril/cfg-ff-pl47.h
index 7a81c25..e6907c1 100644
--- a/spaghetti-monster/anduril/cfg-ff-pl47.h
+++ b/spaghetti-monster/anduril/cfg-ff-pl47.h
@@ -61,11 +61,6 @@
// regulate down faster when the FET is active, slower otherwise
#define THERM_FASTER_LEVEL 135 // throttle back faster when high
-// play it safe, don't try to regulate above the recommended safe level
-#ifdef THERM_HARD_TURBO_DROP
-#undef THERM_HARD_TURBO_DROP
-#endif
-
// don't do this
#undef BLINK_AT_RAMP_MIDDLE
#undef BLINK_AT_RAMP_CEILING
diff --git a/spaghetti-monster/anduril/cfg-ff-pl47g2.h b/spaghetti-monster/anduril/cfg-ff-pl47g2.h
index d5dd79d..cab008c 100644
--- a/spaghetti-monster/anduril/cfg-ff-pl47g2.h
+++ b/spaghetti-monster/anduril/cfg-ff-pl47g2.h
@@ -49,11 +49,6 @@
// regulate down faster when the FET is active, slower otherwise
#define THERM_FASTER_LEVEL 135 // throttle back faster when high
-// hard drop doesn't seem to be needed on this light
-#ifdef THERM_HARD_TURBO_DROP
-#undef THERM_HARD_TURBO_DROP
-#endif
-
// don't do this
#undef BLINK_AT_RAMP_MIDDLE
#undef BLINK_AT_RAMP_CEILING
diff --git a/spaghetti-monster/anduril/cfg-ff-rot66.h b/spaghetti-monster/anduril/cfg-ff-rot66.h
index 2a90343..a87b66d 100644
--- a/spaghetti-monster/anduril/cfg-ff-rot66.h
+++ b/spaghetti-monster/anduril/cfg-ff-rot66.h
@@ -38,9 +38,6 @@
// regulate down faster when the FET is active, slower otherwise
#define THERM_FASTER_LEVEL 130 // throttle back faster when high
-// play it safe, don't try to regulate above the recommended safe level
-//#define THERM_HARD_TURBO_DROP
-
// don't do this
#undef BLINK_AT_RAMP_MIDDLE
#undef BLINK_AT_RAMP_CEILING
diff --git a/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h
index bbf751b..28c77c2 100644
--- a/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h
+++ b/spaghetti-monster/anduril/cfg-mateminco-mf01-mini.h
@@ -48,8 +48,3 @@
#define USE_TENCLICK_THERMAL_CONFIG // by request
#define THERM_FASTER_LEVEL 130 // throttle back faster when high
-//#define THERM_HARD_TURBO_DROP // this light is massively overpowered
-#define THERMAL_WARNING_SECONDS 1 // FIXME: increase by 2 after merging newer code
-//#define THERMAL_UPDATE_SPEED 1
-//#define THERM_PREDICTION_STRENGTH 4
-
diff --git a/spaghetti-monster/anduril/cfg-sofirn-sp36.h b/spaghetti-monster/anduril/cfg-sofirn-sp36.h
index 494a263..d808e2a 100644
--- a/spaghetti-monster/anduril/cfg-sofirn-sp36.h
+++ b/spaghetti-monster/anduril/cfg-sofirn-sp36.h
@@ -28,10 +28,3 @@
#undef THERM_FASTER_LEVEL
#endif
#define THERM_FASTER_LEVEL 130
-
-// be extra-careful at high levels
-// (or not... this host seems to heat up pretty slowly)
-//#ifndef THERM_HARD_TURBO_DROP
-//#define THERM_HARD_TURBO_DROP
-//#endif
-
diff --git a/spaghetti-monster/fsm-adc.c b/spaghetti-monster/fsm-adc.c
index dd43cb9..59d624b 100644
--- a/spaghetti-monster/fsm-adc.c
+++ b/spaghetti-monster/fsm-adc.c
@@ -119,8 +119,8 @@ static inline uint8_t calc_voltage_divider(uint16_t value) {
}
#endif
-// Each full cycle runs ~4X per second with just voltage enabled,
-// or ~2X per second with voltage and temperature.
+// Each full cycle runs ~2X per second with just voltage enabled,
+// or ~1X per second with voltage and temperature.
#if defined(USE_LVP) && defined(USE_THERMAL_REGULATION)
#define ADC_CYCLES_PER_SECOND 1
#else
@@ -276,6 +276,7 @@ static inline void ADC_voltage_handler() {
#ifdef USE_THERMAL_REGULATION
+// generally happens once per second while awake
static inline void ADC_temperature_handler() {
// coarse adjustment
#ifndef THERM_LOOKAHEAD
diff --git a/spaghetti-monster/fsm-adc.h b/spaghetti-monster/fsm-adc.h
index 6283b2c..241dee4 100644
--- a/spaghetti-monster/fsm-adc.h
+++ b/spaghetti-monster/fsm-adc.h
@@ -52,7 +52,9 @@ void adc_deferred(); // do the actual ADC-related calculations
static inline void ADC_voltage_handler();
volatile uint8_t voltage = 0;
+#ifdef USE_LVP
void low_voltage();
+#endif
#ifdef USE_BATTCHECK
void battcheck();
@@ -67,10 +69,6 @@ void battcheck();
#ifdef USE_THERMAL_REGULATION
-// default 1 seconds between thermal regulation events
-#ifndef THERMAL_WARNING_SECONDS
-#define THERMAL_WARNING_SECONDS 1
-#endif
// try to keep temperature below 45 C
#ifndef DEFAULT_THERM_CEIL
#define DEFAULT_THERM_CEIL 45
@@ -83,14 +81,10 @@ void battcheck();
#ifndef THERM_CAL_OFFSET
#define THERM_CAL_OFFSET 0
#endif
-// temperature now, in C (ish) * 2 (14.1 fixed-point)
+// temperature now, in C (ish)
volatile int16_t temperature;
-// temperature in a few seconds, in C (ish) * 2 (14.1 fixed-point)
-volatile int16_t projected_temperature; // Fight the future!
uint8_t therm_ceil = DEFAULT_THERM_CEIL;
int8_t therm_cal_offset = 0;
-//void low_temperature();
-//void high_temperature();
volatile uint8_t reset_thermal_history = 1;
static inline void ADC_temperature_handler();
#endif // ifdef USE_THERMAL_REGULATION
diff --git a/spaghetti-monster/fsm-standby.c b/spaghetti-monster/fsm-standby.c
index 14b6df1..b002b91 100644
--- a/spaghetti-monster/fsm-standby.c
+++ b/spaghetti-monster/fsm-standby.c
@@ -87,10 +87,6 @@ void sleep_until_eswitch_pressed()
#ifdef USE_THERMAL_REGULATION
// forget what the temperature was last time we were on
reset_thermal_history = 1;
- // FIXME: not sure if this should be here
- // (the intent is to make sure temperature gets measured before
- // thermal logic gets executed)
- //set_admux_therm();
#endif
// go back to normal running mode
diff --git a/spaghetti-monster/spaghetti-monster.txt b/spaghetti-monster/spaghetti-monster.txt
index 9e051f1..434e1bc 100644
--- a/spaghetti-monster/spaghetti-monster.txt
+++ b/spaghetti-monster/spaghetti-monster.txt
@@ -124,14 +124,13 @@ Event types:
between events.
- EV_temperature_high: Sent whenever the MCU's projected temperature
- is higher than therm_ceil. Minimum of THERMAL_WARNING_SECONDS
- between events. The 'arg' indicates how far the temperature
- exceeds the limit.
+ is higher than therm_ceil. Minimum of one second between events.
+ The 'arg' indicates how far the temperature exceeds the limit.
- EV_temperature_low: Sent whenever the MCU's projected temperature
is lower than (therm_ceil - THERMAL_WINDOW_SIZE). Minimum of
- THERMAL_WARNING_SECONDS between events. The 'arg' indicates how
- far the temperature exceeds the limit.
+ one second between events. The 'arg' indicates how far the
+ temperature exceeds the limit.
Button presses:
@@ -297,9 +296,6 @@ Useful #defines:
- DEFAULT_THERM_CEIL: Set the temperature limit to use by default
when the user hasn't configured anything.
- - THERMAL_WARNING_SECONDS: How long to wait between temperature
- events.
-
- USE_RAMPING: Enable smooth ramping helpers.
- RAMP_LENGTH: Pick a pre-defined ramp by length. Defined sizes
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.