Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Käppler
ampel-firmware
Commits
962aa081
Commit
962aa081
authored
Apr 15, 2021
by
Eric Duminil
Browse files
Code Format
parent
62016309
Changes
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/led_effects.cpp
View file @
962aa081
...
...
@@ -4,11 +4,11 @@
*****************************************************************/
namespace
config
{
const
uint8_t
max_brightness
=
MAX_BRIGHTNESS
;
#if defined(MIN_BRIGHTNESS)
const
uint8_t
min_brightness
=
MIN_BRIGHTNESS
;
#else
const
uint8_t
min_brightness
=
MAX_BRIGHTNESS
;
#endif
#if defined(MIN_BRIGHTNESS)
const
uint8_t
min_brightness
=
MIN_BRIGHTNESS
;
#else
const
uint8_t
min_brightness
=
MAX_BRIGHTNESS
;
#endif
const
uint8_t
brightness_amplitude
=
config
::
max_brightness
-
config
::
min_brightness
;
const
int
kitt_tail
=
3
;
// How many dimmer LEDs follow in K.I.T.T. wheel
const
uint16_t
poor_air_quality_ppm
=
1600
;
// Above this threshold, LED breathing effect is faster.
...
...
@@ -135,14 +135,12 @@ namespace led_effects {
*/
void
breathe
(
int16_t
co2
)
{
static
uint8_t
breathing_offset
=
0
;
uint16_t
brightness
=
config
::
min_brightness
+
pixels
.
sine8
(
breathing_offset
)
*
config
::
brightness_amplitude
/
255
;
uint16_t
brightness
=
config
::
min_brightness
+
pixels
.
sine8
(
breathing_offset
)
*
config
::
brightness_amplitude
/
255
;
pixels
.
setBrightness
(
brightness
);
pixels
.
show
();
breathing_offset
+=
co2
>
config
::
poor_air_quality_ppm
?
6
:
3
;
// breathing speed. +3 looks like slow human breathing.
}
/**
* Fills the whole ring with green, yellow, orange or black, depending on co2 input and CO2_TICKS.
*/
...
...
@@ -156,7 +154,7 @@ namespace led_effects {
pixels
.
setPixelColor
(
ledId
,
pixels
.
ColorHSV
(
LED_HUES
[
ledId
],
255
,
brightness
));
}
pixels
.
show
();
if
(
config
::
brightness_amplitude
>
0
){
if
(
config
::
brightness_amplitude
>
0
)
{
breathe
(
co2
);
}
}
...
...
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