aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2018-07-01 20:34:56 -0600
committerSelene ToyKeeper2018-07-01 20:34:56 -0600
commit05f0ecb4fdbd58973d29677808385717ef259095 (patch)
treecbe07125721529f956ada56388b84d184dbc9784
parentHigher thermal elbow. This light has some decent thermal mass, and the curve... (diff)
parentAdded hardware profiles and build targets for Emisar D1 and D1S. (diff)
downloadanduril-05f0ecb4fdbd58973d29677808385717ef259095.tar.gz
anduril-05f0ecb4fdbd58973d29677808385717ef259095.tar.bz2
anduril-05f0ecb4fdbd58973d29677808385717ef259095.zip
merged upstream fsm changes
-rw-r--r--hwdef-Emisar_D1.h4
-rw-r--r--hwdef-Emisar_D1S.h4
-rw-r--r--spaghetti-monster/anduril/anduril.c40
-rwxr-xr-xspaghetti-monster/anduril/build-all.sh2
-rw-r--r--spaghetti-monster/anduril/cfg-blf-gt.h3
-rw-r--r--spaghetti-monster/anduril/cfg-blf-q8.h3
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d1.h6
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d1s.h6
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4.h2
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4s.h3
-rw-r--r--spaghetti-monster/anduril/cfg-fw3a.h6
-rw-r--r--tk-attiny.h6
12 files changed, 63 insertions, 22 deletions
diff --git a/hwdef-Emisar_D1.h b/hwdef-Emisar_D1.h
new file mode 100644
index 0000000..6df8705
--- /dev/null
+++ b/hwdef-Emisar_D1.h
@@ -0,0 +1,4 @@
+/* Emisar D1 driver layout
+ */
+// D1 driver is exactly the same as a D4
+#include "hwdef-Emisar_D4.h"
diff --git a/hwdef-Emisar_D1S.h b/hwdef-Emisar_D1S.h
new file mode 100644
index 0000000..31792c7
--- /dev/null
+++ b/hwdef-Emisar_D1S.h
@@ -0,0 +1,4 @@
+/* Emisar D1S driver layout
+ */
+// D1S driver is exactly the same as a D4
+#include "hwdef-Emisar_D4.h"
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index 5ad7e6e..0c53042 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -28,17 +28,9 @@
#define USE_LVP // FIXME: won't build when this option is turned off
+// parameters for this defined below or per-driver
#define USE_THERMAL_REGULATION
-#define DEFAULT_THERM_CEIL 45
-#define MIN_THERM_STEPDOWN MAX_1x7135 // lowest value it'll step down to
-#ifdef MAX_Nx7135
-#define THERM_DOUBLE_SPEED_LEVEL MAX_Nx7135 // throttle back faster when high
-#else
-#define THERM_DOUBLE_SPEED_LEVEL (RAMP_SIZE*4/5) // throttle back faster when high
-#endif
-#ifdef USE_THERMAL_REGULATION
-#define USE_SET_LEVEL_GRADUALLY // isn't used except for thermal adjustments
-#endif
+#define DEFAULT_THERM_CEIL 45 // try not to get hotter than this
// short blips while ramping
#define BLINK_AT_CHANNEL_BOUNDARIES
@@ -85,6 +77,22 @@
#endif
+// thermal properties, if not defined per-driver
+#ifndef MIN_THERM_STEPDOWN
+#define MIN_THERM_STEPDOWN MAX_1x7135 // lowest value it'll step down to
+#endif
+#ifndef THERM_FASTER_LEVEL
+ #ifdef MAX_Nx7135
+ #define THERM_FASTER_LEVEL MAX_Nx7135 // throttle back faster when high
+ #else
+ #define THERM_FASTER_LEVEL (RAMP_SIZE*4/5) // throttle back faster when high
+ #endif
+#endif
+#ifdef USE_THERMAL_REGULATION
+#define USE_SET_LEVEL_GRADUALLY // isn't used except for thermal adjustments
+#endif
+
+
/********* Configure SpaghettiMonster *********/
#define USE_DELAY_ZERO
#define USE_RAMPING
@@ -595,11 +603,11 @@ uint8_t steady_state(EventPtr event, uint16_t arg) {
#endif
#ifdef USE_SET_LEVEL_GRADUALLY
// make thermal adjustment speed scale with magnitude
- if ((arg & 1) && (actual_level < THERM_DOUBLE_SPEED_LEVEL)) {
+ if ((arg & 1) && (actual_level < THERM_FASTER_LEVEL)) {
return MISCHIEF_MANAGED; // adjust slower when not a high mode
}
#ifdef THERM_HARD_TURBO_DROP
- else if ((! (actual_level < THERM_DOUBLE_SPEED_LEVEL))
+ else if ((! (actual_level < THERM_FASTER_LEVEL))
&& (actual_level > gradual_target)) {
gradual_tick();
}
@@ -621,7 +629,7 @@ uint8_t steady_state(EventPtr event, uint16_t arg) {
uint8_t magnitude = 0;
#ifndef THERM_HARD_TURBO_DROP
// if we're on a really high mode, drop faster
- if (actual_level >= THERM_DOUBLE_SPEED_LEVEL) { magnitude ++; }
+ if (actual_level >= THERM_FASTER_LEVEL) { magnitude ++; }
#endif
while (diff) {
magnitude ++;
@@ -651,11 +659,11 @@ uint8_t steady_state(EventPtr event, uint16_t arg) {
set_level(foo);
#endif
#ifdef THERM_HARD_TURBO_DROP
- if (actual_level > THERM_DOUBLE_SPEED_LEVEL) {
+ if (actual_level > THERM_FASTER_LEVEL) {
#ifdef USE_SET_LEVEL_GRADUALLY
- set_level_gradually(THERM_DOUBLE_SPEED_LEVEL);
+ set_level_gradually(THERM_FASTER_LEVEL);
#else
- set_level(THERM_DOUBLE_SPEED_LEVEL);
+ set_level(THERM_FASTER_LEVEL);
#endif
} else
#endif
diff --git a/spaghetti-monster/anduril/build-all.sh b/spaghetti-monster/anduril/build-all.sh
index 9c7a07d..c488d77 100755
--- a/spaghetti-monster/anduril/build-all.sh
+++ b/spaghetti-monster/anduril/build-all.sh
@@ -3,6 +3,8 @@
for TARGET in \
BLF_GT \
BLF_Q8 \
+ EMISAR_D1 \
+ EMISAR_D1S \
EMISAR_D4 \
EMISAR_D4S \
FW3A \
diff --git a/spaghetti-monster/anduril/cfg-blf-gt.h b/spaghetti-monster/anduril/cfg-blf-gt.h
index a576d04..369d028 100644
--- a/spaghetti-monster/anduril/cfg-blf-gt.h
+++ b/spaghetti-monster/anduril/cfg-blf-gt.h
@@ -40,3 +40,6 @@
#define RAMP_DISCRETE_CEIL POWER_80PX
#define RAMP_DISCRETE_STEPS 7
+// stop panicking at 80% power, this light has plenty of thermal mass
+#define THERM_FASTER_LEVEL POWER_80PX // throttle back faster when high
+
diff --git a/spaghetti-monster/anduril/cfg-blf-q8.h b/spaghetti-monster/anduril/cfg-blf-q8.h
index 7733721..269aae9 100644
--- a/spaghetti-monster/anduril/cfg-blf-q8.h
+++ b/spaghetti-monster/anduril/cfg-blf-q8.h
@@ -22,3 +22,6 @@
#define HALFSPEED_LEVEL 14
#define QUARTERSPEED_LEVEL 5
+// stop panicking at ~75% power or ~3000 lm, this light has high thermal mass
+#define THERM_FASTER_LEVEL (RAMP_SIZE*9/10) // throttle back faster when high
+
diff --git a/spaghetti-monster/anduril/cfg-emisar-d1.h b/spaghetti-monster/anduril/cfg-emisar-d1.h
new file mode 100644
index 0000000..e9064ac
--- /dev/null
+++ b/spaghetti-monster/anduril/cfg-emisar-d1.h
@@ -0,0 +1,6 @@
+// Emisar D1 config options for Anduril
+#include "cfg-emisar-d4.h"
+
+// stop panicking at ~75% power or ~1000 lm (D1 has a decent power-to-thermal-mass ratio)
+#undef THERM_FASTER_LEVEL
+#define THERM_FASTER_LEVEL (RAMP_SIZE*9/10) // throttle back faster when high
diff --git a/spaghetti-monster/anduril/cfg-emisar-d1s.h b/spaghetti-monster/anduril/cfg-emisar-d1s.h
new file mode 100644
index 0000000..7e73fa7
--- /dev/null
+++ b/spaghetti-monster/anduril/cfg-emisar-d1s.h
@@ -0,0 +1,6 @@
+// Emisar D1S config options for Anduril
+#include "cfg-emisar-d4.h"
+
+// stop panicking at ~90% power or ~1200 lm (D1S has a good power-to-thermal-mass ratio)
+#undef THERM_FASTER_LEVEL
+#define THERM_FASTER_LEVEL 144 // throttle back faster when high
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4.h b/spaghetti-monster/anduril/cfg-emisar-d4.h
index a90d318..4ac1f5e 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d4.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d4.h
@@ -16,3 +16,5 @@
// optional, makes initial turbo step-down faster so first peak isn't as hot
//#define THERM_HARD_TURBO_DROP
+// stop panicking at ~25% power or ~1000 lm, this light is a hotrod
+#define THERM_FASTER_LEVEL (RAMP_SIZE*2/3) // throttle back faster when high
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4s.h b/spaghetti-monster/anduril/cfg-emisar-d4s.h
index 7a8b342..568ff67 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d4s.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d4s.h
@@ -41,6 +41,5 @@
// thermal regulation parameters
#undef MIN_THERM_STEPDOWN // this should be lower, because 3x7135 instead of 1x7135
#define MIN_THERM_STEPDOWN 60 // lowest value it'll step down to
-#undef THERM_DOUBLE_SPEED_LEVEL
-#define THERM_DOUBLE_SPEED_LEVEL (RAMP_SIZE*9/10) // throttle back faster when high
+#define THERM_FASTER_LEVEL (RAMP_SIZE*9/10) // throttle back faster when high
diff --git a/spaghetti-monster/anduril/cfg-fw3a.h b/spaghetti-monster/anduril/cfg-fw3a.h
index 2790086..262ef13 100644
--- a/spaghetti-monster/anduril/cfg-fw3a.h
+++ b/spaghetti-monster/anduril/cfg-fw3a.h
@@ -16,9 +16,7 @@
#define HALFSPEED_LEVEL 14
#define QUARTERSPEED_LEVEL 5
-#ifdef THERM_DOUBLE_SPEED_LEVEL
-#undef THERM_DOUBLE_SPEED_LEVEL
-#endif
-#define THERM_DOUBLE_SPEED_LEVEL MAX_Nx7135
+// stop panicking at about 3A or ~1100 lm, this light is a hotrod
+#define THERM_FASTER_LEVEL MAX_Nx7135
// optional, makes initial turbo step-down faster so first peak isn't as hot
//#define THERM_HARD_TURBO_DROP
diff --git a/tk-attiny.h b/tk-attiny.h
index 4973ed5..1b7722c 100644
--- a/tk-attiny.h
+++ b/tk-attiny.h
@@ -87,6 +87,12 @@
#elif defined(FSM_EMISAR_D4S_DRIVER)
#include "hwdef-Emisar_D4S.h"
+#elif defined(FSM_EMISAR_D1_DRIVER)
+#include "hwdef-Emisar_D1.h"
+
+#elif defined(FSM_EMISAR_D1S_DRIVER)
+#include "hwdef-Emisar_D1S.h"
+
#elif defined(FSM_FW3A_DRIVER)
#include "hwdef-FW3A.h"