1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
// Wurkkos TS26
// Copyright (C) 2023 Selene ToyKeeper
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#define HWDEF_H wurkkos/ts26/hwdef.h
#include "wurkkos/anduril.h"
// this light has three aux LED channels: R, G, B
#define USE_AUX_RGB_LEDS
// don't turn on the aux LEDs while main LEDs are on
#ifdef USE_INDICATOR_LED_WHILE_RAMPING
#undef USE_INDICATOR_LED_WHILE_RAMPING
#endif
// (nope, 20250210 prototype has front aux instead of RGB button)
// show real-time battery status on RGB button
// when main LEDs are bright enough to overpower the front aux
//#define USE_INDICATOR_LED_WHILE_RAMPING
//#define USE_AUX_RGB_LEDS_WHILE_ON 20
#define RAMP_SIZE 150
// delta-sigma modulated PWM (0b0HHHHHHHHLLLLLLL = 0, 8xHigh, 7xLow bits)
// (max is (255 << 7), because it's 8-bit PWM plus 7 bits of DSM)
// full power, lowest floor
// level_calc.py 5.01 1 150 7135 0 0.2 2000 --pwm 32640
//#define PWM1_LEVELS 0,1,2,3,4,5,6,7,9,10,12,14,17,19,22,25,28,32,36,41,45,50,56,62,69,76,84,92,101,110,121,132,143,156,169,184,199,215,232,251,270,291,313,336,360,386,414,442,473,505,539,574,612,651,693,736,782,829,880,932,987,1045,1105,1168,1233,1302,1374,1449,1527,1608,1693,1781,1873,1969,2068,2172,2279,2391,2507,2628,2753,2883,3018,3158,3303,3454,3609,3771,3938,4111,4289,4475,4666,4864,5068,5280,5498,5724,5957,6197,6445,6701,6965,7237,7518,7808,8106,8413,8730,9056,9392,9737,10093,10459,10835,11223,11621,12031,12452,12884,13329,13786,14255,14737,15232,15741,16262,16798,17347,17911,18489,19082,19691,20314,20954,21609,22281,22969,23674,24397,25137,25895,26671,27465,28279,29111,29963,30835,31727,32640
// full power but higher floor, because the driver can't go low
// level_calc.py 5.01 1 150 7135 20 2 2000 --pwm 32640
#define PWM1_LEVELS 20,24,27,31,36,40,45,51,56,62,69,76,83,91,100,109,119,129,140,151,163,176,190,204,219,236,252,270,289,309,330,352,375,399,424,451,479,508,538,570,604,639,675,714,754,795,839,884,931,980,1031,1084,1140,1197,1257,1320,1384,1451,1521,1593,1668,1746,1827,1911,1997,2087,2180,2276,2376,2479,2585,2695,2809,2927,3048,3174,3303,3437,3575,3718,3865,4016,4172,4333,4499,4670,4846,5028,5215,5407,5605,5809,6018,6234,6455,6683,6917,7158,7406,7660,7921,8189,8465,8748,9038,9336,9642,9955,10277,10607,10946,11293,11649,12014,12387,12770,13163,13565,13977,14399,14830,15273,15725,16189,16663,17148,17645,18152,18672,19203,19747,20302,20870,21451,22045,22651,23271,23904,24552,25213,25888,26577,27282,28001,28735,29484,30249,31030,31827,32640
// limit to 3/4ths power
// level_calc.py 5.01 1 150 7135 0 0.2 1500 --pwm 24480
//#define PWM1_LEVELS 0,1,2,3,4,5,6,7,8,9,11,13,15,17,19,22,25,28,31,35,39,43,48,53,59,64,71,77,85,93,101,110,119,129,140,152,164,177,191,205,221,237,255,273,292,313,335,357,381,407,433,461,490,521,553,587,623,660,699,740,783,827,874,922,973,1026,1082,1139,1199,1262,1327,1395,1466,1539,1615,1695,1777,1863,1951,2044,2139,2239,2341,2448,2558,2673,2791,2914,3041,3172,3307,3448,3593,3743,3898,4057,4223,4393,4569,4750,4938,5131,5330,5535,5747,5964,6189,6420,6658,6903,7155,7415,7682,7956,8239,8529,8828,9134,9450,9774,10106,10448,10799,11159,11529,11909,12299,12698,13108,13529,13960,14402,14856,15320,15797,16285,16785,17297,17822,18359,18909,19472,20049,20639,21244,21862,22494,23141,23803,24480
// limit to 2/3rds power
// level_calc.py 5.01 1 150 7135 0 0.2 1333 --pwm 21760
//#define PWM1_LEVELS 0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,21,24,26,30,33,37,41,45,50,55,60,66,72,79,86,94,102,111,120,130,140,152,164,176,189,204,219,234,251,269,287,307,328,349,372,396,422,448,476,505,536,568,602,637,674,712,752,794,838,884,932,981,1033,1087,1144,1202,1263,1326,1392,1461,1532,1606,1683,1762,1845,1930,2019,2111,2207,2305,2408,2513,2623,2736,2854,2975,3100,3230,3363,3502,3644,3791,3943,4100,4262,4429,4601,4778,4961,5149,5343,5543,5749,5961,6179,6403,6634,6871,7115,7366,7624,7890,8162,8442,8730,9025,9329,9640,9960,10288,10625,10971,11325,11689,12062,12444,12837,13238,13650,14072,14505,14948,15402,15866,16342,16830,17328,17839,18361,18896,19443,20003,20576,21161,21760
// half power
// level_calc.py 5.01 1 150 7135 0 0.2 1000 --pwm 16320
//#define PWM1_LEVELS 0,1,2,3,4,5,6,7,8,9,10,11,12,14,16,18,21,23,26,29,32,35,39,43,47,51,56,61,67,73,79,85,93,100,108,117,126,135,145,156,167,179,192,205,219,234,249,266,283,301,320,340,361,382,405,429,454,480,508,537,566,598,630,664,700,737,775,815,857,900,945,992,1041,1092,1144,1199,1255,1314,1375,1438,1504,1571,1642,1714,1789,1867,1948,2031,2117,2206,2298,2393,2492,2593,2698,2806,2917,3032,3150,3272,3398,3528,3662,3800,3941,4088,4238,4393,4552,4716,4884,5057,5236,5419,5607,5800,5999,6203,6413,6628,6849,7076,7309,7548,7793,8044,8302,8567,8838,9116,9401,9693,9993,10299,10613,10935,11265,11602,11947,12301,12663,13033,13412,13800,14197,14603,15018,15442,15876,16320
#define MIN_THERM_STEPDOWN 50
#define DEFAULT_LEVEL 70
#define MAX_1x7135 150
// moon at 1/4th speed for max runtime
// the rest at full speed, to reduce PWM
// (speed changes make a big visible bump because PWM)
#define HALFSPEED_LEVEL 1
#define QUARTERSPEED_LEVEL 1
#define RAMP_SMOOTH_FLOOR 5
#define RAMP_SMOOTH_CEIL 150
// 10, 30, 50, [70], 90, 110, 130
#define RAMP_DISCRETE_FLOOR 10
#define RAMP_DISCRETE_CEIL 130
#define RAMP_DISCRETE_STEPS 7
// at Wurkkos's request, reduce the Simple UI ceiling a little bit
// 25 50 [75] 100 125
#define SIMPLE_UI_FLOOR 25
#define SIMPLE_UI_CEIL 125
#define SIMPLE_UI_STEPS 5
// stop panicking at ~50% power
#define THERM_FASTER_LEVEL 120 // throttle back faster when high
#define BLINK_BRIGHTNESS 30
#define BLINK_ONCE_TIME 12
// show each channel while it scroll by in the menu
#define USE_CONFIG_COLORS
// blink numbers on the main LEDs by default
// (so battcheck will be visible while charging)
#define DEFAULT_BLINK_CHANNEL CM_MAIN
// blink numbers on the aux LEDs by default
//#define DEFAULT_BLINK_CHANNEL CM_AUXWHT
// slow down party strobe; this driver can't pulse for less than 2ms
#define PARTY_STROBE_ONTIME 2
//#define STROBE_OFF_LEVEL 1 // keep the regulator chip on between pulses
// use aux red + aux blue for police strobe
#define USE_POLICE_COLOR_STROBE_MODE
#define POLICE_STROBE_USES_AUX
#define POLICE_COLOR_STROBE_CH1 CM_AUXRED
#define POLICE_COLOR_STROBE_CH2 CM_AUXBLU
// the default of 26 looks a bit rough, so increase it to make it smoother
#define CANDLE_AMPLITUDE 33
// don't blink mid-ramp
#ifdef BLINK_AT_RAMP_MIDDLE
#undef BLINK_AT_RAMP_MIDDLE
#endif
|