NanoLux (Device)
3.0
Codebase for the open-source AudioLux device.
Loading...
Searching...
No Matches
storage.h
Go to the documentation of this file.
1
9
#ifndef STORAGE_H
10
#define STORAGE_H
11
12
#include <stdint.h>
13
14
/******************************************************************
15
*
16
* STRIP AND PATTERN CONFIGURATIONS
17
*
18
* In the NanoLux codebase, the term "pattern" refers to the
19
* individual light pattern running on part of the LED strip.
20
* Therefore, in the case of strip splitting, up to PATTERN_LIMIT
21
* could run side-by-side. Each pattern has other data besides
22
* the pattern index, which includes a brightness value and a
23
* smoothing value.
24
*
25
* The term "strip config" refers to everything currently running on
26
* the strip. Each strip config contains patterns within
27
* them, and have extra data that pertains to the entire LED strip
28
* or audio analysis module that cannot run multiple times. Of note
29
* is the number of patterns that pattern is currently running.
30
*
31
******************************************************************/
32
34
#define NUM_SAVES 3
35
37
#define PATTERN_LIMIT 4
38
39
40
41
typedef
struct
{
42
43
uint8_t idx = 0;
44
uint8_t brightness = 255;
45
uint8_t smoothing = 0;
46
uint8_t minhue = 0;
47
uint8_t maxhue = 255;
48
uint8_t
config
= 0;
// diffrent configs
49
uint8_t postprocessing_mode = 0;
// The current mode for postprocessing
50
51
}
Pattern_Data
;
52
53
55
typedef
struct
{
56
57
uint8_t alpha = 0;
58
uint8_t noise_thresh = 0;
59
uint8_t mode = 0;
60
uint8_t pattern_count = 1;
61
Pattern_Data
pattern[
PATTERN_LIMIT
];
62
63
}
Strip_Data
;
64
66
typedef
struct
{
67
68
uint8_t length = 60;
69
uint8_t loop_ms = 40;
70
uint8_t debug_mode = 0;
71
bool
init =
true
;
72
char
pass[16] =
""
;
// The current device password
73
74
}
Config_Data
;
75
76
77
void
load_slot
(
int
slot);
78
void
set_slot
(
int
slot);
79
void
save_to_nvs
();
80
void
clear_all
();
81
void
load_from_nvs
();
82
void
save_config_to_nvs
();
83
void
verify_saves
();
84
85
#endif
config
Config_Data config
The currently-loaded device config.
Definition
main.ino:61
save_config_to_nvs
void save_config_to_nvs()
Saves configuration data to the NVS.
Definition
storage.cpp:157
load_slot
void load_slot(int slot)
Move patterns in a slot to the main buffer.
Definition
storage.cpp:94
set_slot
void set_slot(int slot)
Saves the currently-loaded pattern to a save slot.
Definition
storage.cpp:111
PATTERN_LIMIT
#define PATTERN_LIMIT
The number of patterns that can run at maximum.
Definition
storage.h:37
verify_saves
void verify_saves()
Ensures that saved settings have reasonable data.
Definition
storage.cpp:167
load_from_nvs
void load_from_nvs()
Load all patterns from the NVS.
Definition
storage.cpp:178
clear_all
void clear_all()
Clears all patterns stored in NVS.
Definition
storage.cpp:140
save_to_nvs
void save_to_nvs()
Saves all currently-loaded patterns to NVS.
Definition
storage.cpp:127
Config_Data
A structure holding system configuration data.
Definition
storage.h:66
Pattern_Data
Definition
storage.h:41
Strip_Data
A structure holding strip configuration data.
Definition
storage.h:55
main
storage.h
Generated by
1.11.0