~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/anduril/config-default.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
// config-default.h: Default configuration for Anduril.
 
2
// Copyright (C) 2017-2023 Selene ToyKeeper
 
3
// SPDX-License-Identifier: GPL-3.0-or-later
 
4
 
 
5
#pragma once
 
6
 
 
7
/*
 
8
 * This file specifies the default settings for Anduril.
 
9
 *
 
10
 * These settings can be overridden per build target, in cfg-*.h files...
 
11
 * ... but most are not.  So changing one here will make it change in
 
12
 * almost every build target.
 
13
 *
 
14
 * Some configurable settings are also in other *.h files.
 
15
 */
 
16
 
 
17
/********* User-configurable options *********/
 
18
// low voltage protection (also required for battery check mode)
 
19
#define USE_LVP
 
20
 
 
21
// overheat protection
 
22
#define USE_THERMAL_REGULATION
 
23
#if (ATTINY==85) || (ATTINY==1634)
 
24
// sloppy temperature sensor needs bigger error margin
 
25
#define DEFAULT_THERM_CEIL 45  // try not to get hotter than this (in C)
 
26
#else
 
27
// more accurate temperature sensor can regulate higher safely
 
28
#define DEFAULT_THERM_CEIL 50  // try not to get hotter than this (in C)
 
29
#endif
 
30
// Comment out to disable automatic calibration on factory reset
 
31
//   - If so, be sure to set THERM_CAL_OFFSET to the correct calibration offset
 
32
//   - Calibration can still be overridden in temperature check mode
 
33
// Or uncomment to use the default auto-calibrate on factory reset
 
34
//
 
35
// To determine THERM_CAL_OFFSET, comment out USE_THERM_AUTOCALIBRATE to
 
36
// disable auto-calibration, compile and flash, let flashlight rest at a known
 
37
// temperature, then enter temp check mode (do NOT enter calibration mode).
 
38
//
 
39
// THERM_CAL_OFFSET = known_temperature - temp_check_blinks + THERM_CAL_OFFSET
 
40
//
 
41
// (include THERM_CAL_OFFSET in sum as it might already be a non-zero number)
 
42
#define USE_THERM_AUTOCALIBRATE
 
43
 
 
44
// Include a simplified UI for non-enthusiasts?
 
45
#define USE_SIMPLE_UI
 
46
 
 
47
 
 
48
///// Ramp mode options /////
 
49
 
 
50
// button timing for turning light on/off:
 
51
// B_PRESS_T:   activate as soon as button is pressed
 
52
// B_RELEASE_T: activate when user lets go of button
 
53
// B_TIMEOUT_T: activate when we're sure the user won't double-click
 
54
// defaults are release on, timeout off
 
55
#define B_TIMING_ON B_RELEASE_T
 
56
#define B_TIMING_OFF B_TIMEOUT_T
 
57
 
 
58
// default ramp style: 0 = smooth, 1 = stepped
 
59
#define RAMP_STYLE 0
 
60
 
 
61
// smooth ramp speed: 1, 2, 3, 4, ...  for 1X speed, 1/2, 1/3rd, 1/4th, ...
 
62
#define USE_RAMP_SPEED_CONFIG
 
63
 
 
64
// after ramping, how long until the direction resets to "up"?
 
65
#define AUTO_REVERSE_TIME (TICKS_PER_SECOND * 2 / 3)
 
66
 
 
67
// add runtime option for whether hold-from-off should ramp or stay at moon
 
68
#define USE_RAMP_AFTER_MOON_CONFIG
 
69
 
 
70
// short blip when crossing from "click" to "hold" from off
 
71
// (helps the user hit moon mode exactly, instead of holding too long
 
72
//  or too short)
 
73
#define MOON_TIMING_HINT  // only applies if B_TIMING_ON == B_PRESS_T
 
74
// short blips while ramping
 
75
#define BLINK_AT_RAMP_MIDDLE
 
76
//#define BLINK_AT_RAMP_FLOOR
 
77
#define BLINK_AT_RAMP_CEIL
 
78
//#define BLINK_AT_STEPS  // whenever a discrete ramp mode is passed in smooth mode
 
79
 
 
80
// Uncomment for Anduril1 "Ramp 2C" behavior:
 
81
//   - Ramp 2C goes to turbo (advanced UI) or ceiling (simple UI), like in Anduril1
 
82
// Or comment out to use Anduril2 behavior instead:
 
83
//   - Ramp 2C goes to ceiling, unless already at ceiling or in simple UI.
 
84
//     (Advanced UI ceiling 2C goes to turbo)
 
85
//#define USE_2C_MAX_TURBO
 
86
// Or uncomment to let the user decide which style they want:
 
87
#define USE_2C_STYLE_CONFIG
 
88
// 0 = no turbo
 
89
// 1 = A1 style: Off 2C = ceil, On 2C = turbo
 
90
// 2 = A2 style: Off 2C = ceil, On 2C = ceil, Ramped ceil 2C = turbo
 
91
// All styles allow momentary turbo in advanced UI
 
92
//#define DEFAULT_2C_STYLE 2  // default to Anduril 2 style
 
93
//#define DEFAULT_2C_STYLE_SIMPLE 0  // no turbo at all
 
94
 
 
95
// make the ramps configurable by the user
 
96
#define USE_RAMP_CONFIG
 
97
 
 
98
// adds a runtime option to switch between automatic memory (default)
 
99
// and manual memory (only available if compiled in)
 
100
// (manual memory makes 1-click-from-off start at the same level each time)
 
101
// (the level can be set explicitly with 10 clicks from on,
 
102
// or the user can go back to automatic with 10H)
 
103
#define USE_MANUAL_MEMORY
 
104
// if enabled, user can use "hybrid memory"
 
105
// The light will use automatic or manual memory level, depending on how long
 
106
// the light was off.  Short off = automatic, long off = manual.
 
107
// This also remaps 10C/10H:
 
108
// - 10C toggles manual mem on/off at current level.
 
109
// - 10H configures the timer value.
 
110
#define USE_MANUAL_MEMORY_TIMER
 
111
 
 
112
// enable sunset timer (ramp-down and automatic shutoff)
 
113
// timer is available in regular ramp mode and candle mode
 
114
#define USE_SUNSET_TIMER
 
115
 
 
116
 
 
117
///// What to do when power is connected /////
 
118
// factory reset function erases user's runtime configuration in eeprom
 
119
#define USE_FACTORY_RESET
 
120
//#define USE_SOFT_FACTORY_RESET  // only needed on models which can't use hold-button-at-boot
 
121
 
 
122
// dual-switch support (second switch is a tail clicky)
 
123
// (currently incompatible with factory reset)
 
124
//#define START_AT_MEMORIZED_LEVEL
 
125
 
 
126
 
 
127
///// extra modes (enable / disable / configure each mode) /////
 
128
 
 
129
// include a function to blink out the firmware version
 
130
#define USE_VERSION_CHECK
 
131
 
 
132
// enable the battery check mode (shows remaining charge) (requires USE_LVP)
 
133
#define USE_BATTCHECK_MODE
 
134
// battery readout style (pick one)
 
135
// TODO: allow VpT and 4-bar simultaneously,
 
136
//       so one can be in "simple mode" and the other in "advanced mode"
 
137
#define BATTCHECK_VpT
 
138
//#define BATTCHECK_8bars  // FIXME: breaks build
 
139
//#define BATTCHECK_4bars  // FIXME: breaks build
 
140
// allow the user to calibrate the voltage readings?
 
141
// (adjust in 0.05V increments from -0.30V to +0.30V)
 
142
// (1 = -0.30V, 2 = -0.25V, ... 7 = 0V, ... 13 = +0.30V)
 
143
#define USE_VOLTAGE_CORRECTION
 
144
 
 
145
// enable beacon mode
 
146
#define USE_BEACON_MODE
 
147
 
 
148
// enable/disable various strobe modes
 
149
#define USE_BIKE_FLASHER_MODE
 
150
#define USE_PARTY_STROBE_MODE
 
151
#define USE_TACTICAL_STROBE_MODE
 
152
#define USE_LIGHTNING_MODE
 
153
#define USE_CANDLE_MODE
 
154
 
 
155
// boring strobes nobody really likes, but sometimes flashlight companies want
 
156
// (these replace the fun strobe group,
 
157
//  so don't enable them at the same time as any of the above strobes)
 
158
//#define USE_POLICE_STROBE_MODE
 
159
#define USE_SOS_MODE
 
160
//#define USE_SOS_MODE_IN_FF_GROUP  // put SOS in the "boring strobes" mode
 
161
#define USE_SOS_MODE_IN_BLINKY_GROUP  // put SOS in the blinkies mode group
 
162
 
 
163
// enable a mode for locking the light for safe carry
 
164
#define USE_LOCKOUT_MODE
 
165
// should lockout mode function as a momentary moon mode?
 
166
#define USE_MOON_DURING_LOCKOUT_MODE
 
167
// add an optional setting to lock the light after being off for a while
 
168
#define USE_AUTOLOCK
 
169
 
 
170
// enable momentary mode
 
171
#define USE_MOMENTARY_MODE
 
172
 
 
173
// enable tactical mode
 
174
#define USE_TACTICAL_MODE
 
175
 
 
176
 
 
177
// enable a shortcut for +10 in number entry mode
 
178
// (click for +1, hold for +10)
 
179
#define USE_NUMBER_ENTRY_PLUS10
 
180
 
 
181
// cut clock speed at very low modes for better efficiency
 
182
// (defined here so config files can override it)
 
183
#define USE_DYNAMIC_UNDERCLOCKING
 
184
 
 
185
// if the aux LEDs oscillate between "full battery" and "empty battery"
 
186
// while in "voltage" mode, enable this to reduce the amplitude of
 
187
// those oscillations
 
188
#if (ATTINY==1616) || (ATTINY==1634)
 
189
#define USE_LOWPASS_WHILE_ASLEEP
 
190
#endif
 
191
 
 
192
// if there's tint ramping, allow user to set it smooth or stepped
 
193
#define USE_STEPPED_TINT_RAMPING
 
194
#define DEFAULT_TINT_RAMP_STYLE 0  // smooth
 
195
 
 
196
// Use "smooth steps" to soften on/off and step changes
 
197
// on MCUs with enough room for extra stuff like this
 
198
#if (ATTINY==1616) || (ATTINY==1634)
 
199
#define USE_SMOOTH_STEPS
 
200
#endif
 
201
// 0 = none, 1 = smooth, 2+ = undefined
 
202
#define DEFAULT_SMOOTH_STEPS_STYLE  1
 
203
 
 
204
// by default, allow user to set the channel for each strobe-group mode
 
205
// (but allow disabling this feature per build)
 
206
#define USE_CHANNEL_PER_STROBE
 
207