-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ino
More file actions
41 lines (31 loc) · 783 Bytes
/
Copy pathconfig.ino
File metadata and controls
41 lines (31 loc) · 783 Bytes
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
void config_setup() {
EEPROM.begin(32);
if(EEPROM.read(0) == 0xFF) {
// Reset!
config_writeValues();
delay(500);
}
config_readValues();
config_apply();
}
void config_writeValues() {
EEPROM.write(0, config_brightness);
EEPROM.write(1, config_explodeTime);
EEPROM.write(2, config_defuseTime);
EEPROM.commit();
}
void config_readValues() {
config_brightness = EEPROM.read(0);
config_explodeTime = EEPROM.read(1);
config_defuseTime = EEPROM.read(2);
}
void config_save(byte brightness, byte explodeTime, byte defuseTime) {
config_brightness = brightness;
config_explodeTime = explodeTime;
config_defuseTime = defuseTime;
config_writeValues();
config_apply();
}
void config_apply() {
strip.setBrightness(config_brightness);
}