483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
1 |
// Emisar 2-channel generic (plus FET) config options for Anduril (based on Noctigon K9.3)
|
2 |
// Copyright (C) 2021-2023 Selene ToyKeeper
|
|
3 |
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
4 |
#pragma once
|
|
5 |
||
6 |
#define MODEL_NUMBER "0136"
|
|
7 |
#include "hwdef-emisar-2ch-fet.h" |
|
8 |
#include "hank-cfg.h" |
|
9 |
// ATTINY: 1634
|
|
10 |
||
11 |
// this light has three aux LED channels: R, G, B
|
|
12 |
#define USE_AUX_RGB_LEDS
|
|
13 |
// the aux LEDs are front-facing, so turn them off while main LEDs are on
|
|
14 |
// it also has an independent LED in the button
|
|
15 |
#define USE_BUTTON_LED
|
|
16 |
// TODO: the whole "indicator LED" thing needs to be refactored into
|
|
17 |
// "aux LED(s)" and "button LED(s)" since they work a bit differently
|
|
18 |
// enabling this option breaks the button LED on D4v2.5
|
|
19 |
#ifdef USE_INDICATOR_LED_WHILE_RAMPING
|
|
20 |
#undef USE_INDICATOR_LED_WHILE_RAMPING
|
|
21 |
#endif
|
|
22 |
||
23 |
// channel modes...
|
|
24 |
// CM_CH1, CM_CH2, CM_BOTH, CM_BLEND, CM_AUTO
|
|
25 |
// enable max brightness out of the box
|
|
483.12.90
by Selene ToyKeeper
calculated new ramps for noctigon-k9.3 and emisar-2ch-fet builds, |
26 |
#define DEFAULT_CHANNEL_MODE CM_BOTH
|
483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
27 |
|
28 |
#define USE_CONFIG_COLORS
|
|
29 |
||
30 |
// blink numbers on the main LEDs by default (but allow user to change it)
|
|
483.12.90
by Selene ToyKeeper
calculated new ramps for noctigon-k9.3 and emisar-2ch-fet builds, |
31 |
#define DEFAULT_BLINK_CHANNEL CM_BOTH
|
483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
32 |
|
33 |
#define POLICE_COLOR_STROBE_CH1 CM_CH1
|
|
34 |
#define POLICE_COLOR_STROBE_CH2 CM_CH2
|
|
35 |
||
36 |
// how much to increase total brightness at middle tint
|
|
37 |
// (0 = 100% brightness, 64 = 200% brightness)
|
|
38 |
#define TINT_RAMPING_CORRECTION 0 // none, linear regulator doesn't need it |
|
39 |
||
40 |
||
41 |
// channel 1 / main LEDs (w/ DD FET)
|
|
42 |
// output: unknown, 1750 lm?
|
|
43 |
// FET: unknown, 3000 lm?
|
|
44 |
// channel 2
|
|
45 |
// output: unknown, 1750 lm?
|
|
46 |
// combined: 4000 to 5000 lm?
|
|
47 |
#define RAMP_SIZE 150
|
|
48 |
||
483.12.90
by Selene ToyKeeper
calculated new ramps for noctigon-k9.3 and emisar-2ch-fet builds, |
49 |
// linear+FET ramp: maxreg at 140/150
|
50 |
// level_calc.py 5.01 2 150 7135 1 0.1 1924 FET 1 10 2600 --pwm dyn:68:4096:255:3 --clock 8:16:0
|
|
483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
51 |
// linear segment
|
483.12.90
by Selene ToyKeeper
calculated new ramps for noctigon-k9.3 and emisar-2ch-fet builds, |
52 |
#define PWM1_LEVELS 1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,8,8,8,9,9,9,10,10,11,12,13,13,14,15,16,17,17,18,19,20,21,22,23,25,26,27,28,30,31,33,34,36,37,39,41,43,44,46,48,50,53,55,57,60,62,65,67,70,73,76,79,82,85,88,92,95,99,103,106,110,114,119,123,127,132,137,142,147,152,157,162,168,174,179,185,192,198,204,211,218,225,232,240,247,255,255,255,255,255,255,255,255,255,255,255
|
483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
53 |
// DD FET segment
|
483.12.90
by Selene ToyKeeper
calculated new ramps for noctigon-k9.3 and emisar-2ch-fet builds, |
54 |
#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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,44,68,93,118,144,171,198,226,255
|
483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
55 |
// PWM TOPS values
|
483.12.90
by Selene ToyKeeper
calculated new ramps for noctigon-k9.3 and emisar-2ch-fet builds, |
56 |
#define PWM3_LEVELS 4096,3831,3570,3314,3063,2817,2577,2342,2115,1894,1682,1477,1281,2237,2005,1784,1576,1380,1196,1111,1026,1442,1348,1215,1091,976,871,774,1031,942,860,784,714,650,591,538,652,602,555,513,473,437,403,372,343,398,370,345,322,299,278,311,292,273,255,278,261,245,263,247,232,246,231,243,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
|
483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
57 |
|
58 |
// linear-only ramp
|
|
59 |
// level_calc.py 3.11 1 150 7135 1 0.1 1750 --pwm dyn:64:4096:255:3 --clock 8:16:0
|
|
60 |
#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
|
|
61 |
// PWM_TOPS values for linear-only ramp
|
|
62 |
#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
|
|
63 |
||
483.12.90
by Selene ToyKeeper
calculated new ramps for noctigon-k9.3 and emisar-2ch-fet builds, |
64 |
#define DEFAULT_LEVEL 75
|
65 |
#define MAX_1x7135 140
|
|
483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
66 |
#define MAX_Nx7135 MAX_1x7135
|
67 |
#define HALFSPEED_LEVEL 16
|
|
68 |
#define QUARTERSPEED_LEVEL 8
|
|
69 |
||
70 |
#define RAMP_SMOOTH_FLOOR 10 // level 1 is unreliable (?) |
|
483.12.90
by Selene ToyKeeper
calculated new ramps for noctigon-k9.3 and emisar-2ch-fet builds, |
71 |
#define RAMP_SMOOTH_CEIL 140
|
72 |
// 10, 31, 53, [75], 96, 118, [140]
|
|
483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
73 |
#define RAMP_DISCRETE_FLOOR 10
|
74 |
#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
|
|
75 |
#define RAMP_DISCRETE_STEPS 7
|
|
76 |
||
77 |
// safe limit highest regulated power (no FET or turbo)
|
|
483.12.90
by Selene ToyKeeper
calculated new ramps for noctigon-k9.3 and emisar-2ch-fet builds, |
78 |
// 10, 42, [75], 107, 140
|
483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
79 |
#define SIMPLE_UI_FLOOR RAMP_DISCRETE_FLOOR
|
80 |
#define SIMPLE_UI_CEIL RAMP_DISCRETE_CEIL
|
|
81 |
#define SIMPLE_UI_STEPS 5
|
|
82 |
||
83 |
// stop panicking at ~1500 lm
|
|
483.12.90
by Selene ToyKeeper
calculated new ramps for noctigon-k9.3 and emisar-2ch-fet builds, |
84 |
#define THERM_FASTER_LEVEL 130
|
483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
85 |
#define MIN_THERM_STEPDOWN 65 // should be above highest dyn_pwm level |
86 |
||
87 |
#define USE_POLICE_COLOR_STROBE_MODE
|
|
88 |
#undef TACTICAL_LEVELS
|
|
483.12.90
by Selene ToyKeeper
calculated new ramps for noctigon-k9.3 and emisar-2ch-fet builds, |
89 |
#define TACTICAL_LEVELS 140,30,(RAMP_SIZE+3) // high, low, police strobe |
483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
90 |
|
91 |
// use the brightest setting for strobe
|
|
92 |
#define STROBE_BRIGHTNESS MAX_LEVEL
|
|
93 |
// slow down party strobe; this driver can't pulse for 1ms or less
|
|
94 |
#define PARTY_STROBE_ONTIME 2
|
|
95 |
// TODO: change speed per channel mode
|
|
96 |
// (the FET is really fast, but the regulator is not)
|
|
97 |
//#undef PARTY_STROBE_ONTIME
|
|
98 |
||
99 |
// the default of 26 looks a bit flat, so increase it
|
|
100 |
#define CANDLE_AMPLITUDE 33
|
|
101 |
||
102 |
// the power regulator is a bit slow, so push it harder for a quick response from off
|
|
483.12.90
by Selene ToyKeeper
calculated new ramps for noctigon-k9.3 and emisar-2ch-fet builds, |
103 |
#define DEFAULT_JUMP_START_LEVEL 40
|
104 |
#define BLINK_BRIGHTNESS 45
|
|
483.12.88
by Selene ToyKeeper
converted all K9.3 builds and D4Sv2-tintramp-fet (now emisar-2ch-fet) |
105 |
#define BLINK_ONCE_TIME 12 // longer blink, since main LEDs are slow |
106 |
||
107 |
#define THERM_CAL_OFFSET 5
|
|
108 |
||
109 |
// don't blink while ramping
|
|
110 |
#ifdef BLINK_AT_RAMP_MIDDLE
|
|
111 |
#undef BLINK_AT_RAMP_MIDDLE
|
|
112 |
#endif
|
|
113 |