Commit 6c8ac37b authored by Käppler's avatar Käppler
Browse files

Breathing: Return immediately in night mode

This is more in line with the other effects
that are deactivated in night mode.
Additionally, waiting at the end of the function
does not make sense if it does nothing.
parent 8dd70ec1
......@@ -180,14 +180,15 @@ namespace led_effects {
}
void breathe(int16_t co2) {
if (!config::night_mode) {
static uint16_t breathing_offset = 0;
uint16_t brightness = config::min_brightness
+ pixels.sine8(breathing_offset) * config::brightness_amplitude / 255;
pixels.setBrightness(brightness);
pixels.show();
breathing_offset += 3; // breathing speed. +3 looks like slow human breathing.
if (config::night_mode) {
return;
}
static uint16_t breathing_offset = 0;
uint16_t brightness = config::min_brightness
+ pixels.sine8(breathing_offset) * config::brightness_amplitude / 255;
pixels.setBrightness(brightness);
pixels.show();
breathing_offset += 3; // breathing speed. +3 looks like slow human breathing.
delay(co2 > 1600 ? 50 : 100); // faster breathing for higher CO2 values
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment