aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/anduril/cfg-noctigon-k9.3.h
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-08-03 19:15:34 -0600
committerSelene ToyKeeper2023-08-03 19:15:34 -0600
commitbcaa751aa1b29cb3b4c76df2075feb1941d043fe (patch)
tree194d28ff7de40ecef734570467a9ccca090c6ce4 /spaghetti-monster/anduril/cfg-noctigon-k9.3.h
parentconverted BLF GT to multi-channel (diff)
downloadanduril-bcaa751aa1b29cb3b4c76df2075feb1941d043fe.tar.gz
anduril-bcaa751aa1b29cb3b4c76df2075feb1941d043fe.tar.bz2
anduril-bcaa751aa1b29cb3b4c76df2075feb1941d043fe.zip
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet)
to multi-channel, and removed old K9.3 builds which aren't relevant any more, and old D4Sv2-tintramp builds
Diffstat (limited to '')
-rw-r--r--spaghetti-monster/anduril/cfg-noctigon-k9.3.h107
1 files changed, 66 insertions, 41 deletions
diff --git a/spaghetti-monster/anduril/cfg-noctigon-k9.3.h b/spaghetti-monster/anduril/cfg-noctigon-k9.3.h
index bf504d2..1811f1b 100644
--- a/spaghetti-monster/anduril/cfg-noctigon-k9.3.h
+++ b/spaghetti-monster/anduril/cfg-noctigon-k9.3.h
@@ -4,20 +4,13 @@
#pragma once
#define MODEL_NUMBER "0261"
-#include "hwdef-Noctigon_K9.3.h"
+#include "hwdef-emisar-2ch-fet.h"
#include "hank-cfg.h"
// ATTINY: 1634
-// this model requires some special code
-#define OVERRIDES_FILE cfg-noctigon-k9.3.c
-#define OVERRIDE_SET_LEVEL
-#define OVERRIDE_GRADUAL_TICK
-inline void set_level_override(uint8_t level);
-
// this light has three aux LED channels: R, G, B
#define USE_AUX_RGB_LEDS
// the aux LEDs are front-facing, so turn them off while main LEDs are on
-//#define USE_AUX_RGB_LEDS_WHILE_ON
// it also has an independent LED in the button
#define USE_BUTTON_LED
// TODO: the whole "indicator LED" thing needs to be refactored into
@@ -27,60 +20,92 @@ inline void set_level_override(uint8_t level);
#undef USE_INDICATOR_LED_WHILE_RAMPING
#endif
-// has two channels of independent LEDs
-#define USE_TINT_RAMPING
-// ... but it doesn't make sense to ramp between; only toggle
-#define TINT_RAMP_TOGGLE_ONLY
+// channel modes...
+// CM_CH1, CM_CH2, CM_BOTH, CM_BLEND, CM_AUTO
+// enable max brightness out of the box
+#define DEFAULT_CHANNEL_MODE CM_BLEND
+
+#define USE_CONFIG_COLORS
+
+// blink numbers on the main LEDs by default (but allow user to change it)
+#define DEFAULT_BLINK_CHANNEL CM_BLEND
+
+#define POLICE_COLOR_STROBE_CH1 CM_CH1
+#define POLICE_COLOR_STROBE_CH2 CM_CH2
+
+// how much to increase total brightness at middle tint
+// (0 = 100% brightness, 64 = 200% brightness)
+#define TINT_RAMPING_CORRECTION 0 // none, linear regulator doesn't need it
+
// main LEDs
// max regulated: ~1750 lm
// FET: ~8000 lm
// 2nd LEDs
// max regulated: ~1500 lm
-// maxreg at 120: level_calc.py cube 2 150 7135 0 2.5 1740 FET 1 10 3190
-#define RAMP_LENGTH 150
-// main LEDs
-#define PWM1_LEVELS 0,0,1,1,2,2,3,3,4,4,5,6,7,8,9,10,11,13,14,15,17,19,20,22,24,26,28,30,33,35,38,40,43,46,49,52,55,59,62,66,70,74,78,82,86,91,96,100,105,111,116,121,127,133,139,145,151,158,165,172,179,186,193,201,209,217,225,234,243,251,261,270,280,289,299,310,320,331,342,353,364,376,388,400,412,425,438,451,464,478,492,506,521,536,551,566,582,597,614,630,647,664,681,699,717,735,754,772,792,811,831,851,871,892,913,935,956,978,1001,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,0
-#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,51,79,109,138,168,198,229,260,292,324,357,390,423,457,492,527,562,598,634,671,708,746,784,822,861,901,941,982,1023
-// 2nd LEDs
-#define PWM3_LEVELS 0,0,1,1,2,2,3,3,4,4,5,5,6,7,8,9,10,11,12,13,15,16,17,18,20,21,23,24,26,27,29,31,33,35,37,39,41,43,45,48,50,53,55,58,61,63,66,69,72,75,79,82,85,89,92,96,100,104,108,112,116,120,125,129,134,138,143,148,153,158,163,169,174,180,185,191,197,203,209,215,222,228,235,242,248,255,263,270,277,285,292,300,308,316,324,333,341,350,359,368,377,386,395,405,414,424,434,444,454,465,475,486,497,508,519,531,542,554,566,578,590,603,615,628,641,654,667,680,694,708,722,736,750,765,779,794,809,825,840,856,872,888,904,920,937,954,971,988,1005,1023
-#define DEFAULT_LEVEL 46
-#define MAX_1x7135 120
-#define MAX_Nx7135 MAX_1x7135
-#define HALFSPEED_LEVEL 10
-#define QUARTERSPEED_LEVEL 2
-
-#define USE_MANUAL_MEMORY_TIMER_FOR_TINT
-//#define DEFAULT_MANUAL_MEMORY DEFAULT_LEVEL
-//#define DEFAULT_MANUAL_MEMORY_TIMER 10
-
-#define RAMP_SMOOTH_FLOOR 3 // level 1 is unreliable (?)
-#define RAMP_SMOOTH_CEIL 120
-// 10, 28, [46], 65, 83, 101, [120]
+#define RAMP_SIZE 150
+
+// linear+FET ramp: maxreg at 110/150
+// level_calc.py 4.3398 2 150 7135 1 0.1 1750 FET 1 10 6000 --pwm dyn:63:4096:255:3 --clock 8:16:0
+// linear segment
+#define PWM1_LEVELS 1,1,1,1,1,1,1,1,2,2,2,2,3,3,3,4,4,4,5,5,5,6,6,7,7,7,8,8,8,9,9,9,10,10,10,11,11,11,12,12,12,13,13,13,14,14,14,15,15,16,17,17,18,19,20,21,22,23,25,27,28,30,32,33,35,37,39,42,44,46,49,51,54,57,59,62,65,69,72,75,79,83,87,91,95,99,103,108,113,118,123,128,133,139,145,151,157,163,169,176,183,190,197,205,213,221,229,237,246,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
+// DD FET segment
+#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,12,16,20,25,29,34,38,43,48,53,58,64,69,75,80,86,92,98,105,111,118,124,131,138,145,153,160,168,176,184,192,201,209,218,227,236,245,255
+// PWM TOPS values
+#define PWM3_LEVELS 4096,3746,3391,3029,2662,2293,1922,1553,2591,2163,1745,1341,1986,1836,1526,1901,1644,1402,1603,1400,1212,1329,1170,1232,1097,974,1012,907,812,836,754,681,695,631,574,582,532,487,491,451,415,417,386,356,357,331,307,308,286,286,284,265,264,261,258,255,251,247,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
+
+// linear-only ramp
+// level_calc.py 3.11 1 150 7135 1 0.1 1750 --pwm dyn:64:4096:255:3 --clock 8:16:0
+#define PWM4_LEVELS 1,1,1,1,1,1,2,2,2,3,3,3,4,4,4,5,5,6,6,6,7,7,7,8,8,8,9,9,9,10,10,10,10,10,10,11,11,11,11,11,11,11,12,12,12,12,12,12,13,13,13,14,14,14,15,15,16,17,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,37,38,39,41,42,44,45,47,48,50,52,53,55,57,59,61,63,65,67,69,71,73,75,77,79,82,84,86,89,91,94,97,99,102,105,107,110,113,116,119,122,125,128,132,135,138,141,145,148,152,156,159,163,167,170,174,178,182,186,190,195,199,203,208,212,217,221,226,230,235,240,245,250,255
+// PWM_TOPS values for linear-only ramp
+#define PWM5_LEVELS 4096,3681,3247,2794,2328,1856,2937,2393,1860,2690,2273,1875,2281,1959,1658,1893,1646,1774,1569,1381,1466,1309,1166,1224,1104,996,1033,942,858,882,810,746,687,634,586,604,561,522,487,454,425,397,409,385,362,341,321,302,311,295,279,286,271,257,263,250,255,258,246,249,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
+
+#define DEFAULT_LEVEL 60
+#define MAX_1x7135 110
+#define MAX_Nx7135 MAX_1x7135
+#define HALFSPEED_LEVEL 16
+#define QUARTERSPEED_LEVEL 8
+
+#define RAMP_SMOOTH_FLOOR 10 // level 1 is unreliable (?)
+#define RAMP_SMOOTH_CEIL 110
+// 10, 26, 43, [60], 76, 93, 110
#define RAMP_DISCRETE_FLOOR 10
#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
#define RAMP_DISCRETE_STEPS 7
-// safe limit highest regulated power (no FET or turbo)
-#define SIMPLE_UI_FLOOR RAMP_DISCRETE_FLOOR
-#define SIMPLE_UI_CEIL RAMP_DISCRETE_CEIL
-#define SIMPLE_UI_STEPS 5
+// 10, 35, [60], 85, 110
+#define SIMPLE_UI_FLOOR RAMP_DISCRETE_FLOOR
+#define SIMPLE_UI_CEIL RAMP_DISCRETE_CEIL
+#define SIMPLE_UI_STEPS 5
// stop panicking at ~25% power or ~1000 lm
#define THERM_FASTER_LEVEL 100
-#define MIN_THERM_STEPDOWN DEFAULT_LEVEL
-//#define THERM_NEXT_WARNING_THRESHOLD 16 // accumulate less error before adjusting
-//#define THERM_RESPONSE_MAGNITUDE 128 // bigger adjustments
+#define MIN_THERM_STEPDOWN 60 // should be above highest dyn_pwm level
+
+#define USE_POLICE_COLOR_STROBE_MODE
+#undef TACTICAL_LEVELS
+#define TACTICAL_LEVELS 110,30,(RAMP_SIZE+3) // high, low, police strobe
// use the brightest setting for strobe
#define STROBE_BRIGHTNESS MAX_LEVEL
// slow down party strobe; this driver can't pulse for 1ms or less
#define PARTY_STROBE_ONTIME 2
+// TODO: change speed per channel mode
+// (the FET is really fast, but the regulator is not)
+//#undef PARTY_STROBE_ONTIME
+
+// the default of 26 looks a bit flat, so increase it
+#define CANDLE_AMPLITUDE 33
+// the power regulator is a bit slow, so push it harder for a quick response from off
+#define DEFAULT_JUMP_START_LEVEL 10
+#define BLINK_BRIGHTNESS 30
#define BLINK_ONCE_TIME 12 // longer blink, since main LEDs are slow
#define THERM_CAL_OFFSET 5
-// for consistency with KR4 (not otherwise necessary though)
-#define USE_SOFT_FACTORY_RESET
+// don't blink while ramping
+#ifdef BLINK_AT_RAMP_MIDDLE
+#undef BLINK_AT_RAMP_MIDDLE
+#endif