FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
LightSaberOS/ConfigMenu.cpp at master · neskweek/LightSaberOS · GitHub
neskweek
/
LightSaberOS
Public
Notifications
You must be signed in to change notification settings
Fork
23
Star
88
Code
Issues
27
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
LightSaberOS
/
ConfigMenu.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
187 lines (177 loc) · 3.63 KB
Breadcrumbs
LightSaberOS
/
ConfigMenu.cpp
Copy path
File metadata and controls
187 lines (177 loc) · 3.63 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
* Config.cpp
*
* author: Sebastien CAPOU (neskweek@gmail.com)
* Source : https://github.com/neskweek/LightSaberOS
* Author: neskw
*/
#
include
"
ConfigMenu.h
"
#
include
"
Config.h
"
#
include
"
Light.h
"
extern
int8_t
modification;
extern
bool
play;
extern
int16_t
value;
// ====================================================================================
// === CONFIG MODE FUNCTIONS ===
// ====================================================================================
void
confParseValue
(
uint16_t
variable,
uint16_t
min,
uint16_t
max,
short
int
multiplier, DFPlayer& dfplayer) {
value = variable + (multiplier * modification);
if
(value < (
int
) min) {
value = max;
}
else
if
(value > (
int
) max) {
value = min;
}
else
if
(value == (
int
) min
and
play) {
play =
false
;
dfplayer.
playPhysicalTrack
(
15
);
delay
(
150
);
}
else
if
(value == (
int
) max
and
play) {
play =
false
;
dfplayer.
playPhysicalTrack
(
14
);
delay
(
150
);
}
}
//
confParseValue
void
confMenuStart
(
uint16_t
variable,
uint16_t
sound, DFPlayer& dfplayer) {
extern
uint8_t
ledPins[];
#
if
defined LUXEON
extern
uint8_t
currentColor[];
#
endif
#
if
defined NEOPIXEL
extern
cRGB currentColor;
#
endif
extern
bool
enterMenu;
if
(enterMenu) {
dfplayer.
playPhysicalTrack
(sound);
delay
(
500
);
switch
(sound) {
case
4
:
#
if
defined LS_INFO
Serial.
print
(
F
(
"
VOL
\n
Cur:
"
));
#
endif
#
if
defined LEDSTRINGS
lightOff
();
lightOn
(ledPins,
0
);
#
endif
break
;
case
5
:
#
if
defined LS_INFO
Serial.
print
(
F
(
"
SNDFT
\n
Cur:
"
));
#
endif
#
if
defined LEDSTRINGS
lightOff
();
lightOn
(ledPins,
1
);
#
endif
break
;
case
6
:
#
if
defined LS_INFO
Serial.
print
(
F
(
"
SWING
\n
Cur:
"
));
#
endif
#
if
defined LEDSTRINGS
lightOff
();
lightOn
(ledPins,
5
);
#
endif
break
;
#
if
defined LUXEON
case
9
:
lightOff
(ledPins);
#
if
defined LS_INFO
Serial.
print
(
F
(
"
COLOR1
\n
Cur:
"
));
#
endif
getColor
(currentColor, variable);
lightOn
(ledPins, currentColor);
break
;
case
10
:
lightOff
(ledPins);
#
if
defined LS_INFO
Serial.
print
(
F
(
"
COLOR2
\n
Cur:
"
));
#
endif
getColor
(currentColor, variable);
lightOn
(ledPins, currentColor);
break
;
case
11
:
lightOff
(ledPins);
#
if
defined LS_INFO
Serial.
println
(
F
(
"
SAVE?
\n
"
));
#
endif
break
;
#
endif
#
if
defined LEDSTRINGS
case
17
:
#
if
defined LS_INFO
Serial.
print
(
F
(
"
PWRON
\n
Cur:
"
));
#
endif
lightOff
();
lightOn
(ledPins,
2
);
break
;
case
18
:
#
if
defined LS_INFO
Serial.
print
(
F
(
"
PWROFF
\n
Cur:
"
));
#
endif
lightOff
();
lightOn
(ledPins,
3
);
break
;
case
19
:
#
if
defined LS_INFO
Serial.
print
(
F
(
"
FLICK
\n
Cur:
"
));
#
endif
lightOff
();
lightOn
(ledPins,
4
);
break
;
#
endif
//
LEDSTRINGS
#
if
defined NEOPIXEL
case
9
:
lightOff
();
#
if
defined LS_INFO
Serial.
print
(
F
(
"
COLOR1
\n
Cur:
"
));
#
endif
getColor
(variable);
for
(
uint8_t
i =
0
; i <
3
; i++) {
digitalWrite
(ledPins[i],
HIGH
);
}
lightOn
(currentColor);
break
;
case
10
:
lightOff
();
#
if
defined LS_INFO
Serial.
print
(
F
(
"
COLOR2
\n
Cur:
"
));
#
endif
getColor
(variable);
lightOn
(currentColor);
break
;
//
case 11:
//
//
#if defined LS_INFO
//
Serial.println(F("SAVE?\n"));
//
#endif
//
break;
case
17
:
lightOff
();
for
(
uint8_t
i =
0
; i <
3
; i++) {
digitalWrite
(ledPins[i],
LOW
);
}
#
if
defined LS_INFO
Serial.
print
(
F
(
"
PWRON
\n
Cur:
"
));
#
endif
break
;
case
18
:
#
if
defined LS_INFO
Serial.
print
(
F
(
"
PWROFF
\n
Cur:
"
));
#
endif
break
;
case
19
:
#
if
defined LS_INFO
Serial.
print
(
F
(
"
FLICK
\n
Cur:
"
));
#
endif
lightOff
();
lightOn
(currentColor);
break
;
#
endif
}
#
if
defined LS_INFO
Serial.
println
(variable);
#
endif
value = variable;
enterMenu =
false
;
delay
(
100
);
}
}
//
confMenuStart
Back
|
FazBrowse Home
|
New Git URL