-
Notifications
You must be signed in to change notification settings - Fork 1
/
load-save-config.h
164 lines (141 loc) · 4.92 KB
/
load-save-config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// load-save-config.h: Load/save/eeprom functions for Anduril.
// Copyright (C) 2017-2023 Selene ToyKeeper
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
// remember stuff even after battery was changed
void load_config();
void save_config();
#ifdef START_AT_MEMORIZED_LEVEL
void save_config_wl();
#endif
// a struct to hold config values
Config cfg = {
///// ramp vars
// smooth vs discrete ramping
.ramp_style = RAMP_STYLE, // 0 = smooth, 1 = discrete
#ifdef USE_2C_STYLE_CONFIG
// 1 = A1 style, 2 = A2 style
.ramp_2c_style = DEFAULT_2C_STYLE,
#endif
// settings for each ramp (smooth, stepped, simple UI)
#ifdef USE_RAMP_CONFIG
.ramp_floors = {
RAMP_SMOOTH_FLOOR,
RAMP_DISCRETE_FLOOR,
#ifdef USE_SIMPLE_UI
SIMPLE_UI_FLOOR,
#endif
},
.ramp_ceils = {
RAMP_SMOOTH_CEIL,
RAMP_DISCRETE_CEIL,
#ifdef USE_SIMPLE_UI
SIMPLE_UI_CEIL,
#endif
},
.ramp_stepss = {
DEFAULT_RAMP_SPEED,
RAMP_DISCRETE_STEPS,
#ifdef USE_SIMPLE_UI
SIMPLE_UI_STEPS,
#endif
},
#endif
#ifdef USE_SIMPLE_UI
// whether to enable the simplified interface or not
.simple_ui_active = SIMPLE_UI_ACTIVE,
#ifdef USE_2C_STYLE_CONFIG
// 0 = no turbo, 1 = A1 style, 2 = A2 style
.ramp_2c_style_simple = DEFAULT_2C_STYLE_SIMPLE,
#endif
#endif
.dont_ramp_after_moon = DEFAULT_DONT_RAMP_AFTER_MOON,
#ifdef USE_MANUAL_MEMORY
.manual_memory_simple = DEFAULT_MANUAL_MEMORY,
.manual_memory_smooth = DEFAULT_MANUAL_MEMORY,
.manual_memory_stepped = DEFAULT_MANUAL_MEMORY,
#ifdef USE_MANUAL_MEMORY_TIMER
.manual_memory_timer = DEFAULT_MANUAL_MEMORY_TIMER,
#endif
#endif
///// channel modes / color modes
#if NUM_CHANNEL_MODES > 1
// current multi-channel mode
.channel_mode = DEFAULT_CHANNEL_MODE,
// user can take unwanted modes out of the rotation (bitmask)
.channel_modes_enabled = CHANNEL_MODES_ENABLED,
#ifdef USE_MANUAL_MEMORY
// reset w/ manual memory
.manual_memory_channel_mode_simple = DEFAULT_CHANNEL_MODE,
.manual_memory_channel_mode_stepped = DEFAULT_CHANNEL_MODE,
.manual_memory_channel_mode_smooth = DEFAULT_CHANNEL_MODE,
#endif
#ifdef DEFAULT_BLINK_CHANNEL
// blink numbers in a specific channel (user configurable)
.blink_channel = DEFAULT_BLINK_CHANNEL,
#endif
#endif
#ifdef USE_CHANNEL_MODE_ARGS
// one byte of extra data per channel mode, like for tint value
.channel_mode_args = { CHANNEL_MODE_ARGS },
#ifdef USE_MANUAL_MEMORY
// remember and reset 1 extra parameter per channel mode (like tint)
.manual_memory_channel_args = { CHANNEL_MODE_ARGS },
#endif
#ifdef USE_STEPPED_TINT_RAMPING
.tint_ramp_style = DEFAULT_TINT_RAMP_STYLE,
#endif
#endif
///// strobe / blinky mode settings
#ifdef USE_STROBE_STATE
.strobe_type = DEFAULT_STROBE,
#endif
#if defined(USE_PARTY_STROBE_MODE) || defined(USE_TACTICAL_STROBE_MODE)
// party / tactical strobe timing
// party strobe 24 Hz, tactical strobe 10 Hz
.strobe_delays = { 41, 67 },
#endif
#ifdef USE_BIKE_FLASHER_MODE
.bike_flasher_brightness = MAX_1x7135,
#endif
#ifdef USE_BEACON_MODE
// beacon timing
.beacon_seconds = 2,
#endif
///// voltage and temperature
#ifdef USE_VOLTAGE_CORRECTION
// same 0.05V units as fudge factor,
// but 7 is neutral, and the expected range is from 1 to 13
.voltage_correction = 7,
#endif
#ifdef USE_THERMAL_REGULATION
.therm_ceil = DEFAULT_THERM_CEIL,
.therm_cal_offset = 0,
#endif
///// aux LEDs
#ifdef USE_INDICATOR_LED
// bits 2-3 control lockout mode
// bits 0-1 control "off" mode
// modes are: 0=off, 1=low, 2=high, 3=blinking (if TICK_DURING_STANDBY enabled)
.indicator_led_mode = INDICATOR_LED_DEFAULT_MODE,
#endif
#ifdef USE_AUX_RGB_LEDS
.rgb_led_off_mode = RGB_LED_OFF_DEFAULT,
.rgb_led_lockout_mode = RGB_LED_LOCKOUT_DEFAULT,
#ifdef USE_POST_OFF_VOLTAGE
// display voltage readout for a while after turning off?
.post_off_voltage = DEFAULT_POST_OFF_VOLTAGE_SECONDS,
#endif
#endif
///// misc other mode settings
#ifdef USE_AUTOLOCK
.autolock_time = DEFAULT_AUTOLOCK_TIME,
#endif
#ifdef USE_TACTICAL_MODE
.tactical_levels = { TACTICAL_LEVELS },
#endif
///// hardware config / globals menu
#ifdef USE_JUMP_START
.jump_start_level = DEFAULT_JUMP_START_LEVEL,
#endif
};