From b90e9ab2814c1623c0b0068e8230c003923e6d51 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 1 Jul 2018 14:31:45 -0600 Subject: Made it easier to define thermal parameters per driver type. Renamed THERM_DOUBLE_SPEED_LEVEL to THERM_FASTER_LEVEL, since it's not really 2X speed, it's 4X or more. This parameter defines approximately how bright the light can be without being considered risky or "turbo". Or the threshold between optimizing for rapid response vs optimizing for no oscillations. --- spaghetti-monster/anduril/anduril.c | 40 ++++++++++++++++++------------- spaghetti-monster/anduril/cfg-blf-gt.h | 3 +++ spaghetti-monster/anduril/cfg-blf-q8.h | 3 +++ spaghetti-monster/anduril/cfg-emisar-d4.h | 2 ++ spaghetti-monster/anduril/cfg-fw3a.h | 6 ++--- 5 files changed, 34 insertions(+), 20 deletions(-) diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index ab6a0af..cff5386 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -27,17 +27,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 @@ -81,6 +73,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 @@ -587,11 +595,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(); } @@ -613,7 +621,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 ++; @@ -643,11 +651,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/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-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-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 -- cgit v1.2.3 From ebe2cf08b60c5fbae19b1af3098cde3d134e4803 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 1 Jul 2018 19:48:49 -0600 Subject: Added hardware profiles and build targets for Emisar D1 and D1S. (same as D4, except with lower power-to-mass ratio) --- hwdef-Emisar_D1.h | 4 ++++ hwdef-Emisar_D1S.h | 4 ++++ spaghetti-monster/anduril/build-all.sh | 2 ++ spaghetti-monster/anduril/cfg-emisar-d1.h | 6 ++++++ spaghetti-monster/anduril/cfg-emisar-d1s.h | 6 ++++++ tk-attiny.h | 6 ++++++ 6 files changed, 28 insertions(+) create mode 100644 hwdef-Emisar_D1.h create mode 100644 hwdef-Emisar_D1S.h create mode 100644 spaghetti-monster/anduril/cfg-emisar-d1.h create mode 100644 spaghetti-monster/anduril/cfg-emisar-d1s.h 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/build-all.sh b/spaghetti-monster/anduril/build-all.sh index 4100805..07f33b1 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 \ FW3A \ ; do 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/tk-attiny.h b/tk-attiny.h index b3edb6d..a36fef0 100644 --- a/tk-attiny.h +++ b/tk-attiny.h @@ -84,6 +84,12 @@ #elif defined(FSM_EMISAR_D4_DRIVER) #include "hwdef-Emisar_D4.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" -- cgit v1.2.3