1
// thefreeman's BST21 BST20-FWxA (no button LED)
2
// Copyright (C) 2023 TBD (thefreeman), Selene ToyKeeper
3
// SPDX-License-Identifier: GPL-3.0-or-later
6
#define MODEL_NUMBER "1631"
7
#include "hwdef-thefreeman-boost21-mp3431-hdr-dac-argb.h"
10
// HPRsense : 1.7+0.3+5 = 7mR (DMN22M5UFG+trace resistance+5mR)
11
// Vsense=42.46mV, R1= 191k
13
// transition DAC level 8, ramp level 45
14
// fifth power ramp 0.1mA to 6066mA
24
#define PWM1_LEVELS 2, 3, 4, 5, 7, 9, 11, 13, 16, 19, 23, 28, 33, 39, 45, 53, 61, 71, 81, 93,106,121,137,155,175,196,220,246, \
25
60, 67, 74, 82, 91,100,110,121,133,146,159,174,190,207,224,244, \
26
8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 23, 24, 26, 27, 29, 31, 33, 35, 37, 40, 42, 45, 47, 50, 53, 56, 59, 62, 66, 69, 73, 77, 81, 85, 90, 94, 99,104,109,114,120,126,132,138,144,151,158,165,173,180,188,196,205,214,223,232,242,252, \
27
57, 60, 62, 65, 67, 70, 73, 76, 78, 82, 85, 88, 91, 95, 98,102,105,109,113,117,121,126,130,135,139,144,149,154,159,164,170,175,181,187,193,199,206,212,219,225,232,240,247,255
28
// PWM Tops: VREF selector (0.55V=16,1.1V=17, 2.5V=18, 4.3V=19, 1.5V=20)
29
#define PWM_TOPS 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \
30
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, \
31
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, \
32
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18
35
#define DEFAULT_LEVEL 44
36
#define HDR_ENABLE_LEVEL_MIN 45 // when HDR FET turns ON
38
// no PWM, so MCU clock speed can be slow
39
#define HALFSPEED_LEVEL 41
40
#define QUARTERSPEED_LEVEL 40 // seems to run fine at 10kHz/4, try reducing more
42
#define RAMP_SMOOTH_FLOOR 1
43
#define RAMP_SMOOTH_CEIL 130 // 50% / 3A / 1000 lm
44
// 1 22 [44] 65 87 108 130
45
#define RAMP_DISCRETE_FLOOR 1
46
#define RAMP_DISCRETE_CEIL 130
47
#define RAMP_DISCRETE_STEPS 7
50
#define SIMPLE_UI_FLOOR 20
51
#define SIMPLE_UI_CEIL 120 // ~2.25A / ~750 lm
52
#define SIMPLE_UI_STEPS 5
54
// don't blink mid-ramp
55
#ifdef BLINK_AT_RAMP_MIDDLE
56
#undef BLINK_AT_RAMP_MIDDLE
62
#define THERM_FASTER_LEVEL 130 // stop panicking at 50%/3A
63
#define MIN_THERM_STEPDOWN MAX_1x7135
65
//#define THERM_LOOKAHEAD 4 // 4 by default -> decrease for longer turbo
66
#define THERM_NEXT_WARNING_THRESHOLD 48 // 24 by default -> increase for fewer adjustments (more stable output on large time scale)
67
#define THERM_RESPONSE_MAGNITUDE 32 // 64 by default -> decrease for smaller adjustments (removes dip post turbo)
68
//#define THERM_WINDOW_SIZE 1 // 2 by default -> decrease for tighter temperature regulation
73
//#define SIMPLE_UI_ACTIVE 0 // advanced UI by default
75
// allow Aux Config and Strobe Modes in Simple UI
76
#define USE_EXTENDED_SIMPLE_UI
78
// Allow 3C in Simple UI for switching between smooth and stepped ramping
79
#define USE_SIMPLE_UI_RAMPING_TOGGLE
81
#define DEFAULT_2C_STYLE 1 // enable 2 click turbo
86
//#define USE_BUTTON_LED
88
// this light has three aux LED channels: R, G, B
89
#define USE_AUX_RGB_LEDS
91
// show each channel while it scroll by in the menu
92
#define USE_CONFIG_COLORS
94
// blink numbers on the main LEDs by default
95
#define DEFAULT_BLINK_CHANNEL CM_MAIN
97
// use aux red + aux blue for police strobe
98
#define USE_POLICE_COLOR_STROBE_MODE
99
#define POLICE_STROBE_USES_AUX
100
#define POLICE_COLOR_STROBE_CH1 CM_AUXRED
101
#define POLICE_COLOR_STROBE_CH2 CM_AUXBLU
103
// the aux LEDs are front-facing, so turn them off while main LEDs are on
104
#ifdef USE_INDICATOR_LED_WHILE_RAMPING
105
#undef USE_INDICATOR_LED_WHILE_RAMPING
111
#define PARTY_STROBE_ONTIME 1 // slow down party strobe
112
#define STROBE_OFF_LEVEL 1 // keep the regulator chip on between pulses
114
// smoother candle mode with bigger oscillations
115
#define CANDLE_AMPLITUDE 40
117
// enable 13H factory reset so it can be used on tail e-switch lights
118
#define USE_SOFT_FACTORY_RESET