1
// Emisar D4K 3-channel config options for Anduril
2
// Copyright (C) 2023 Selene ToyKeeper
3
// SPDX-License-Identifier: GPL-3.0-or-later
6
#define MODEL_NUMBER "0151"
7
#include "hwdef-emisar-d4k-3ch.h"
11
// this light has three aux LED channels: R, G, B
12
#define USE_AUX_RGB_LEDS
14
// turn on the aux LEDs while main LEDs are on
15
// (in case there's a RGB button)
16
#define USE_AUX_RGB_LEDS_WHILE_ON 40
17
#define USE_INDICATOR_LED_WHILE_RAMPING
20
// CM_MAIN2, CM_LED3, CM_LED4, CM_ALL,
21
// CM_BLEND34A, CM_BLEND34B, CM_HSV, CM_AUTO3
22
#define DEFAULT_CHANNEL_MODE CM_ALL
24
#define FACTORY_RESET_WARN_CHANNEL CM_LED4
25
#define FACTORY_RESET_SUCCESS_CHANNEL CM_MAIN2
27
#define CONFIG_WAITING_CHANNEL CM_LED3
28
#define CONFIG_BLINK_CHANNEL CM_ALL
30
// blink numbers on the main LEDs by default (but allow user to change it)
31
#define DEFAULT_BLINK_CHANNEL CM_MAIN2
33
// LEDs 3 and 4 make a nice police strobe
34
#define POLICE_COLOR_STROBE_CH1 CM_LED3
35
#define POLICE_COLOR_STROBE_CH2 CM_LED4
36
// aux red + aux blue are the correct colors, but are dim
37
//#define POLICE_COLOR_STROBE_CH1 CM_AUXRED
38
//#define POLICE_COLOR_STROBE_CH2 CM_AUXBLU
40
// how much to increase total brightness at middle tint
41
// (0 = 100% brightness, 64 = 200% brightness)
42
#define TINT_RAMPING_CORRECTION 0 // none, linear regulator doesn't need it
45
// output: unknown, 2000 lm?
47
// output: unknown, 1000 lm each?
49
// delta-sigma modulated PWM (0b0HHHHHHHHLLLLLLL = 0, 8xHigh, 7xLow bits)
50
// level_calc.py 5.01 1 150 7135 0 0.2 2000 --pwm 32640
51
// (max is (255 << 7), because it's 8-bit PWM plus 7 bits of DSM)
52
#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
54
#define MIN_THERM_STEPDOWN 50
55
#define DEFAULT_LEVEL 70
57
// always run at 1/4th speed, because 4 kHz PWM is enough for this circuit
58
// and speed changes make a big visible bump
59
#define HALFSPEED_LEVEL 255
60
#define QUARTERSPEED_LEVEL 255
62
#define RAMP_SMOOTH_FLOOR 1
63
#define RAMP_SMOOTH_CEIL 130
64
// 10, 30, 50, [70], 90, 110, 130
65
#define RAMP_DISCRETE_FLOOR 10
66
#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
67
#define RAMP_DISCRETE_STEPS 7
70
#define SIMPLE_UI_FLOOR RAMP_DISCRETE_FLOOR
71
#define SIMPLE_UI_CEIL RAMP_DISCRETE_CEIL
72
#define SIMPLE_UI_STEPS 5
74
// stop panicking at ~1500 lm
75
#define THERM_FASTER_LEVEL 130
77
#define USE_POLICE_COLOR_STROBE_MODE
78
#undef TACTICAL_LEVELS
79
#define TACTICAL_LEVELS 120,30,(RAMP_SIZE+3) // high, low, police strobe
81
// use the brightest setting for strobe
82
#define STROBE_BRIGHTNESS MAX_LEVEL
83
// slow down party strobe; this driver can't pulse for 1ms or less
84
#define PARTY_STROBE_ONTIME 2
85
// #define STROBE_OFF_LEVEL 1 // nope, this makes strobe blurry
86
// bike strobe needs a longer pulse too?
87
//#define BIKE_STROBE_ONTIME 8
89
// the default of 26 looks a bit flat, so increase it
90
#define CANDLE_AMPLITUDE 33
92
// the power regulator is a bit slow, so push it harder for a quick response from off
93
#define DEFAULT_JUMP_START_LEVEL 21
94
#define BLINK_BRIGHTNESS 50
95
#define BLINK_ONCE_TIME 12 // longer blink, since main LEDs are slow
97
#define THERM_CAL_OFFSET 5
99
// don't blink while ramping
100
#ifdef BLINK_AT_RAMP_MIDDLE
101
#undef BLINK_AT_RAMP_MIDDLE
104
// for consistency with KR4 (not otherwise necessary though)
105
#define USE_SOFT_FACTORY_RESET