aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-04-14 20:51:40 -0600
committerSelene ToyKeeper2023-04-14 20:51:40 -0600
commit6142f73db27cef29246291fd09227cc7bc3d4b15 (patch)
treef913ecf4d8f15b478c7ba4a2351d0a1abbaab10c /spaghetti-monster
parentLT1S Pro: after measuring, perhaps low aux mode is better after all (diff)
downloadanduril-6142f73db27cef29246291fd09227cc7bc3d4b15.tar.gz
anduril-6142f73db27cef29246291fd09227cc7bc3d4b15.tar.bz2
anduril-6142f73db27cef29246291fd09227cc7bc3d4b15.zip
LT1S: added thermal regulation
... and a bunch of gradual_tick functions ... and abstracted out some of the tint calculations ... and moved some UI settings into cfg.h
Diffstat (limited to '')
-rw-r--r--spaghetti-monster/anduril/cfg-sofirn-lt1s-pro.h16
-rw-r--r--spaghetti-monster/fsm-ramping.c33
-rw-r--r--spaghetti-monster/fsm-ramping.h41
3 files changed, 51 insertions, 39 deletions
diff --git a/spaghetti-monster/anduril/cfg-sofirn-lt1s-pro.h b/spaghetti-monster/anduril/cfg-sofirn-lt1s-pro.h
index fb412a6..fbcbf59 100644
--- a/spaghetti-monster/anduril/cfg-sofirn-lt1s-pro.h
+++ b/spaghetti-monster/anduril/cfg-sofirn-lt1s-pro.h
@@ -16,6 +16,16 @@
// (it seriously would be more practical to just use moon instead)
#define INDICATOR_LED_DEFAULT_MODE ((3<<2) + 1)
+// channel modes...
+// CM_WHITE, CM_AUTO, CM_RED, CM_WHITE_RED
+#define DEFAULT_CHANNEL_MODE CM_AUTO
+
+#define FACTORY_RESET_WARN_CHANNEL CM_RED
+#define FACTORY_RESET_SUCCESS_CHANNEL CM_WHITE
+
+#define POLICE_COLOR_STROBE_CH1 CM_RED
+#define POLICE_COLOR_STROBE_CH2 CM_WHITE
+
// how much to increase total brightness at middle tint
// (0 = 100% brightness, 64 = 200% brightness)
// seems unnecessary on this light
@@ -32,6 +42,7 @@
// shared table for white and red
#define PWM1_LEVELS PWM_LEVELS
#define MAX_1x7135 75
+#define MIN_THERM_STEPDOWN 75 // should be above highest dyn_pwm level
// FIXME: clock at 5 MHz w/ full+half+quarter speeds,
// instead of 10 MHz with w/ only half+quarter
// (10 MHz is just wasting power)
@@ -77,11 +88,6 @@
#undef TACTICAL_LEVELS
#define TACTICAL_LEVELS 120,30,(RAMP_SIZE+3) // high, low, police strobe
-// FIXME: thermal regulation should actually work fine on this light
-#ifdef USE_THERMAL_REGULATION
-#undef USE_THERMAL_REGULATION
-#endif
-
// don't blink while ramping
#ifdef BLINK_AT_RAMP_MIDDLE
#undef BLINK_AT_RAMP_MIDDLE
diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c
index 5096dfd..a55c74b 100644
--- a/spaghetti-monster/fsm-ramping.c
+++ b/spaghetti-monster/fsm-ramping.c
@@ -344,39 +344,6 @@ void gradual_tick() {
}
-// reduce repetition with macros
-// common code at the beginning of every gradual tick handler
-#define GRADUAL_TICK_SETUP() \
- uint8_t gt = gradual_target; \
- if (gt < actual_level) gt = actual_level - 1; \
- else if (gt > actual_level) gt = actual_level + 1; \
- gt --; \
- PWM_DATATYPE target;
-
-// tick the top layer of the stack
-#define GRADUAL_ADJUST_1CH(TABLE,PWM) \
- target = PWM_GET(TABLE, gt); \
- if (PWM < target) PWM ++; \
- else if (PWM > target) PWM --;
-
-// tick a base level of the stack
-// (with support for special DD FET behavior
-// like "low=0, high=255" --> "low=255, high=254")
-#define GRADUAL_ADJUST(TABLE,PWM,TOP) \
- target = PWM_GET(TABLE, gt); \
- if ((gt < actual_level) \
- && (PWM == 0) \
- && (target == TOP)) PWM = TOP; \
- else \
- if (PWM < target) PWM ++; \
- else if (PWM > target) PWM --;
-
-// do this when output exactly matches a ramp level
-#define GRADUAL_IS_ACTUAL() \
- uint8_t orig = gradual_target; \
- set_level(gt + 1); \
- gradual_target = orig;
-
#ifdef USE_GRADUAL_TICK_1CH
void gradual_tick_1ch() {
GRADUAL_TICK_SETUP();
diff --git a/spaghetti-monster/fsm-ramping.h b/spaghetti-monster/fsm-ramping.h
index 028157f..8a12cc8 100644
--- a/spaghetti-monster/fsm-ramping.h
+++ b/spaghetti-monster/fsm-ramping.h
@@ -97,7 +97,46 @@ void set_level(uint8_t level);
uint8_t gradual_target;
inline void set_level_gradually(uint8_t lvl);
void gradual_tick();
-#endif
+
+// reduce repetition with macros
+// common code at the beginning of every gradual tick handler
+#define GRADUAL_TICK_SETUP() \
+ uint8_t gt = gradual_target; \
+ if (gt < actual_level) gt = actual_level - 1; \
+ else if (gt > actual_level) gt = actual_level + 1; \
+ gt --; \
+ PWM_DATATYPE target;
+
+// tick to a specific value
+#define GRADUAL_ADJUST_SIMPLE(TARGET,PWM) \
+ if (PWM < TARGET) PWM ++; \
+ else if (PWM > TARGET) PWM --;
+
+// tick the top layer of the stack
+#define GRADUAL_ADJUST_1CH(TABLE,PWM) \
+ target = PWM_GET(TABLE, gt); \
+ if (PWM < target) PWM ++; \
+ else if (PWM > target) PWM --;
+
+// tick a base level of the stack
+// (with support for special DD FET behavior
+// like "low=0, high=255" --> "low=255, high=254")
+#define GRADUAL_ADJUST(TABLE,PWM,TOP) \
+ target = PWM_GET(TABLE, gt); \
+ if ((gt < actual_level) \
+ && (PWM == 0) \
+ && (target == TOP)) PWM = TOP; \
+ else \
+ if (PWM < target) PWM ++; \
+ else if (PWM > target) PWM --;
+
+// do this when output exactly matches a ramp level
+#define GRADUAL_IS_ACTUAL() \
+ uint8_t orig = gradual_target; \
+ set_level(gt + 1); \
+ gradual_target = orig;
+
+#endif // ifdef USE_SET_LEVEL_GRADUALLY
// auto-detect the data type for PWM tables
// FIXME: PWM bits and data type should be per PWM table