~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/anduril/cfg-noctigon-k1-boost.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 K1 12V config options for Anduril
2
 
#include "hwdef-Noctigon_K1-12V.h"
 
1
// Noctigon K1 boost config options for Anduril
 
2
// Copyright (C) 2019-2023 Selene ToyKeeper
 
3
// SPDX-License-Identifier: GPL-3.0-or-later
 
4
#pragma once
 
5
 
 
6
#define MODEL_NUMBER "0253"
 
7
#include "hwdef-noctigon-k1-boost.h"
 
8
#include "hank-cfg.h"
3
9
// ATTINY: 1634
4
10
 
5
11
// Most K1 lights can run hotter than default, but the 12V model
12
18
 
13
19
// this light has three aux LED channels: R, G, B
14
20
#define USE_AUX_RGB_LEDS
15
 
#define USE_AUX_RGB_LEDS_WHILE_ON
 
21
#define USE_AUX_RGB_LEDS_WHILE_ON  25
16
22
#define USE_INDICATOR_LED_WHILE_RAMPING
17
 
#define RGB_LED_OFF_DEFAULT 0x18  // low, voltage
18
 
#define RGB_LED_LOCKOUT_DEFAULT 0x37  // blinking, rainbow
19
 
 
20
 
// enable blinking aux LEDs
21
 
#define TICK_DURING_STANDBY
22
 
#define STANDBY_TICK_SPEED 3  // every 0.128 s
23
 
 
24
 
 
 
23
 
 
24
#if 0  // old, 10-bit PWM method
25
25
// level_calc.py cube 1 150 7135 0 4 1300
26
26
// (with max_pwm set to 1023)
27
27
// (level 0 is usable on this light)
28
28
#define RAMP_LENGTH 150
29
29
#define PWM1_LEVELS 0,0,1,1,2,2,3,3,4,5,5,6,7,8,9,10,11,12,13,14,15,16,17,19,20,22,23,25,26,28,30,31,33,35,37,39,42,44,46,48,51,53,56,59,61,64,67,70,73,76,80,83,86,90,94,97,101,105,109,113,117,122,126,130,135,140,144,149,154,159,165,170,175,181,187,193,198,204,211,217,223,230,236,243,250,257,264,271,279,286,294,302,310,318,326,334,343,351,360,369,378,387,397,406,416,426,436,446,456,466,477,488,499,510,521,532,544,555,567,579,591,604,616,629,642,655,668,682,695,709,723,737,751,766,780,795,810,825,841,856,872,888,904,921,937,954,971,988,1005,1023
30
30
#define MAX_1x7135 50
31
 
 
32
 
// the entire ramp is regulated; don't blink halfway up
33
 
#ifdef BLINK_AT_RAMP_MIDDLE
34
 
#undef BLINK_AT_RAMP_MIDDLE
35
 
#endif
36
 
 
37
31
// don't slow down at low levels; this isn't that sort of light
38
32
// (it needs to stay at full speed for the 10-bit PWM to work)
39
33
#ifdef USE_DYNAMIC_UNDERCLOCKING
40
34
#undef USE_DYNAMIC_UNDERCLOCKING
41
35
#endif
 
36
#endif
 
37
 
 
38
#define RAMP_SIZE 150
 
39
// delta-sigma modulated PWM (0b0HHHHHHHHLLLLLLL = 0, 8xHigh, 7xLow bits)
 
40
// level_calc.py 5.01 1 150 7135 0 0.2 2000 --pwm 32640
 
41
// (max is (255 << 7), because it's 8-bit PWM plus 7 bits of DSM)
 
42
#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
 
43
#define MIN_THERM_STEPDOWN 50
 
44
#define DEFAULT_LEVEL 70
 
45
#define MAX_1x7135 150
 
46
// always run at 1/4th speed, because 4 kHz PWM is enough for this circuit
 
47
// and speed changes make a big visible bump
 
48
#define HALFSPEED_LEVEL     255
 
49
#define QUARTERSPEED_LEVEL  255
42
50
 
43
51
#define RAMP_SMOOTH_FLOOR 1
44
 
#define RAMP_SMOOTH_CEIL 130
45
 
// 10, 30, [50], 70, 90, 110, 130
 
52
#define RAMP_SMOOTH_CEIL  130
 
53
// 10, 30, 50, [70], 90, 110, 130
46
54
#define RAMP_DISCRETE_FLOOR 10
47
 
#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
 
55
#define RAMP_DISCRETE_CEIL  RAMP_SMOOTH_CEIL
48
56
#define RAMP_DISCRETE_STEPS 7
49
57
 
50
 
#define MUGGLE_FLOOR RAMP_DISCRETE_FLOOR
51
 
#define MUGGLE_CEILING 70
52
 
 
53
 
// make candle mode wobble more
54
 
#define CANDLE_AMPLITUDE 32
 
58
// safe limit ~50% power
 
59
#define SIMPLE_UI_FLOOR RAMP_DISCRETE_FLOOR
 
60
#define SIMPLE_UI_CEIL 120
 
61
#define SIMPLE_UI_STEPS 5
55
62
 
56
63
// stop panicking at ~70% power or ~600 lm
57
64
#define THERM_FASTER_LEVEL 130
58
65
 
 
66
#define THERM_CAL_OFFSET 5
 
67
 
59
68
#define THERM_RESPONSE_MAGNITUDE 32  // smaller adjustments, this host changes temperature slowly
60
69
#define THERM_NEXT_WARNING_THRESHOLD 32  // more error tolerance before adjusting
61
70
 
62
 
// easier access to thermal config mode, for Noctigon
63
 
#define USE_TENCLICK_THERMAL_CONFIG
 
71
// show each channel while it scroll by in the menu
 
72
#define USE_CONFIG_COLORS
 
73
 
 
74
// blink numbers on the main LEDs by default (but allow user to change it)
 
75
#define DEFAULT_BLINK_CHANNEL  CM_MAIN
64
76
 
65
77
// slow down party strobe; this driver can't pulse for 1ms or less
66
78
#define PARTY_STROBE_ONTIME 4
67
79
 
68
 
#define THERM_CAL_OFFSET 5
 
80
// use aux red + aux blue for police strobe
 
81
#define USE_POLICE_COLOR_STROBE_MODE
 
82
#define POLICE_STROBE_USES_AUX
 
83
#define POLICE_COLOR_STROBE_CH1        CM_AUXRED
 
84
#define POLICE_COLOR_STROBE_CH2        CM_AUXBLU
 
85
 
 
86
// make candle mode wobble more
 
87
#define CANDLE_AMPLITUDE 33
 
88
 
 
89
// the entire ramp is regulated; don't blink halfway up
 
90
#ifdef BLINK_AT_RAMP_MIDDLE
 
91
#undef BLINK_AT_RAMP_MIDDLE
 
92
#endif
 
93
 
 
94
// added for convenience
 
95
#define USE_SOFT_FACTORY_RESET
69
96