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
41typedef 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
52
53
55typedef struct{
56
57 uint8_t alpha = 0;
58 uint8_t noise_thresh = 0;
59 uint8_t mode = 0;
60 uint8_t pattern_count = 1;
62
64
66typedef 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
75
76
77void load_slot(int slot);
78void set_slot(int slot);
79void save_to_nvs();
80void clear_all();
81void load_from_nvs();
83void verify_saves();
84
85#endif
Config_Data config
The currently-loaded device config.
Definition main.ino:61
void save_config_to_nvs()
Saves configuration data to the NVS.
Definition storage.cpp:157
void load_slot(int slot)
Move patterns in a slot to the main buffer.
Definition storage.cpp:94
void set_slot(int slot)
Saves the currently-loaded pattern to a save slot.
Definition storage.cpp:111
#define PATTERN_LIMIT
The number of patterns that can run at maximum.
Definition storage.h:37
void verify_saves()
Ensures that saved settings have reasonable data.
Definition storage.cpp:167
void load_from_nvs()
Load all patterns from the NVS.
Definition storage.cpp:178
void clear_all()
Clears all patterns stored in NVS.
Definition storage.cpp:140
void save_to_nvs()
Saves all currently-loaded patterns to NVS.
Definition storage.cpp:127
A structure holding system configuration data.
Definition storage.h:66
Definition storage.h:41
A structure holding strip configuration data.
Definition storage.h:55