~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/anduril/cfg-noctigon-k9.3.h

  • Committer: Selene ToyKeeper
  • Date: 2023-11-04 15:09:10 UTC
  • mfrom: (483.1.175 anduril2)
  • Revision ID: bzr@toykeeper.net-20231104150910-ddd3afw4nhfvof2l
merged anduril2 branch -> fsm, with *years* of changes
(this also means this code is now Anduril 2 instead of Anduril 1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Noctigon K9.3 config options for Anduril
 
2
// Copyright (C) 2020-2023 Selene ToyKeeper
 
3
// SPDX-License-Identifier: GPL-3.0-or-later
 
4
#pragma once
 
5
 
 
6
#define MODEL_NUMBER "0261"
 
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
 
26
#define DEFAULT_CHANNEL_MODE           CM_BOTH
 
27
 
 
28
#define USE_CONFIG_COLORS
 
29
 
 
30
// blink numbers on the main LEDs by default (but allow user to change it)
 
31
#define DEFAULT_BLINK_CHANNEL  CM_BOTH
 
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
// main LEDs
 
42
//   max regulated: 1500 to 2000 lm?
 
43
//   FET: 5000 to 8000 lm?
 
44
// 2nd LEDs
 
45
//   max regulated: ~1500 lm
 
46
#define RAMP_SIZE 150
 
47
 
 
48
// linear+FET ramp: maxreg at 120/150
 
49
// level_calc.py 5.01 2 150 7135 1 0.1 1872 FET 1 10 5000 --pwm dyn:63:4096:255:3 --clock 8:16:0
 
50
// linear segment
 
51
#define PWM1_LEVELS 1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,8,8,8,8,9,9,10,10,10,11,12,12,13,14,14,16,17,18,19,20,21,22,24,25,26,28,29,31,33,35,36,38,40,42,45,47,49,52,54,57,60,63,66,69,72,76,79,83,87,91,95,99,103,108,112,117,122,127,133,138,144,150,156,162,169,175,182,189,197,204,212,220,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
 
52
// DD FET segment
 
53
#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,6,11,17,24,30,36,43,50,57,64,71,79,87,95,103,111,120,129,138,147,157,167,177,187,198,209,220,231,243,255
 
54
// PWM TOPS values
 
55
#define PWM3_LEVELS 4096,3798,3504,3214,2926,2645,2368,2098,1834,1579,1333,2304,2017,1744,1486,1242,1174,1700,1505,1323,1155,1037,1299,1163,1038,923,819,967,874,789,712,641,577,655,598,545,497,453,413,456,419,386,355,326,352,326,301,278,296,275,287,267,249,258,265,248,253,256,240,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
 
56
 
 
57
// linear-only ramp
 
58
// level_calc.py 3.11 1 150 7135 1 0.1 1750 --pwm dyn:64:4096:255:3 --clock 8:16:0
 
59
#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
 
60
// PWM_TOPS values for linear-only ramp
 
61
#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
 
62
 
 
63
#define DEFAULT_LEVEL      65
 
64
#define MAX_1x7135         120
 
65
#define MAX_Nx7135         MAX_1x7135
 
66
#define HALFSPEED_LEVEL    16
 
67
#define QUARTERSPEED_LEVEL 8
 
68
 
 
69
#define RAMP_SMOOTH_FLOOR  10  // level 1 is unreliable (?)
 
70
#define RAMP_SMOOTH_CEIL   120
 
71
// 10, 28, 46, [65], 83, 101, 120
 
72
#define RAMP_DISCRETE_FLOOR 10
 
73
#define RAMP_DISCRETE_CEIL  RAMP_SMOOTH_CEIL
 
74
#define RAMP_DISCRETE_STEPS 7
 
75
 
 
76
// 10, 37, [65], 92, 120
 
77
#define SIMPLE_UI_FLOOR  RAMP_DISCRETE_FLOOR
 
78
#define SIMPLE_UI_CEIL   RAMP_DISCRETE_CEIL
 
79
#define SIMPLE_UI_STEPS  5
 
80
 
 
81
// stop panicking at ~25% power or ~1000 lm
 
82
#define THERM_FASTER_LEVEL 100
 
83
#define MIN_THERM_STEPDOWN 60  // should be above highest dyn_pwm level
 
84
 
 
85
#define USE_POLICE_COLOR_STROBE_MODE
 
86
#undef  TACTICAL_LEVELS
 
87
#define TACTICAL_LEVELS 120,30,(RAMP_SIZE+3)  // high, low, police strobe
 
88
 
 
89
// use the brightest setting for strobe
 
90
#define STROBE_BRIGHTNESS MAX_LEVEL
 
91
// slow down party strobe; this driver can't pulse for 1ms or less
 
92
#define PARTY_STROBE_ONTIME 2
 
93
// TODO: change speed per channel mode
 
94
// (the FET is really fast, but the regulator is not)
 
95
//#undef PARTY_STROBE_ONTIME
 
96
 
 
97
// the default of 26 looks a bit flat, so increase it
 
98
#define CANDLE_AMPLITUDE 33
 
99
 
 
100
// the power regulator is a bit slow, so push it harder for a quick response from off
 
101
#define DEFAULT_JUMP_START_LEVEL 35
 
102
#define BLINK_BRIGHTNESS 30
 
103
#define BLINK_ONCE_TIME 12  // longer blink, since main LEDs are slow
 
104
 
 
105
#define THERM_CAL_OFFSET 5
 
106
 
 
107
// don't blink while ramping
 
108
#ifdef BLINK_AT_RAMP_MIDDLE
 
109
#undef BLINK_AT_RAMP_MIDDLE
 
110
#endif
 
111