Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
b13b1a6c
Commit
b13b1a6c
authored
May 05, 2021
by
Eric Duminil
Browse files
led_effects: rainbow wheel in both directions
parent
06467a3d
Pipeline
#3593
passed with stage
in 1 minute and 40 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/led_effects.cpp
View file @
b13b1a6c
...
...
@@ -168,17 +168,18 @@ namespace led_effects {
}
}
void
showRainbowWheel
(
uint16_t
duration_ms
,
uint16_t
hue_increment
)
{
void
showRainbowWheel
(
uint16_t
duration_ms
)
{
if
(
config
::
night_mode
)
{
return
;
}
static
uint16_t
wheel_offset
=
0
;
static
uint16_t
sine_offset
=
0
;
unsigned
long
t0
=
millis
();
pixels
.
setBrightness
(
config
::
max_brightness
);
while
(
millis
()
-
t0
<
duration_ms
)
{
for
(
int
i
=
0
;
i
<
NUMPIXELS
;
i
++
)
{
pixels
.
setPixelColor
(
i
,
pixels
.
ColorHSV
(
i
*
65535
/
NUMPIXELS
+
wheel_offset
));
wheel_offset
+=
hue_increment
;
wheel_offset
+=
(
pixels
.
sine8
(
sine_offset
++
/
50
)
-
127
)
/
2
;
}
pixels
.
show
();
delay
(
10
);
...
...
ampel-firmware/led_effects.h
View file @
b13b1a6c
...
...
@@ -29,7 +29,7 @@ namespace led_effects {
int
countdownToZero
();
void
showWaitingLED
(
uint32_t
color
);
void
showKITTWheel
(
uint32_t
color
,
uint16_t
duration_s
=
2
);
void
showRainbowWheel
(
uint16_t
duration_ms
=
1000
,
uint16_t
hue_increment
=
50
);
void
showRainbowWheel
(
uint16_t
duration_ms
=
1000
);
void
displayCO2color
(
uint16_t
co2
);
}
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment