This commit is contained in:
Xose Pérez
2017-10-23 10:35:13 +02:00
parent efbfd04f10
commit bd5d997c25
2 changed files with 2 additions and 8 deletions

View File

@@ -63,12 +63,6 @@
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1
// Buttons
// No buttons on the D1 MINI alone, but defining it without adding a button doen't create problems
#define BUTTON1_PIN 0 // Connect a pushbutton between D3 and GND,
// it's the same as using a Wemos one button shield
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// -----------------------------------------------------------------------------
// ESPurna

View File

@@ -205,7 +205,7 @@ unsigned int _toPWM(unsigned long value, bool bright, bool gamma, bool reverse)
// Returns a PWM valule for the given channel ID
unsigned int _toPWM(unsigned char id) {
if (id < _channels.size()) {
bool isColor = (lightHasColor() && id < 3);
bool isColor = lightHasColor() && (id < 3);
bool bright = isColor;
bool gamma = isColor & (getSetting("useGamma", LIGHT_USE_GAMMA).toInt() == 1);
return _toPWM(_channels[id].shadow, bright, gamma, _channels[id].reverse);
@@ -227,7 +227,7 @@ void _shadow() {
bool useWhite = getSetting("useWhite", LIGHT_USE_WHITE).toInt() == 1;
if (_lightState && useWhite && _channels.size() > 3) {
if (_lightState && useWhite && (_channels.size() > 3)) {
if (_channels[0].shadow == _channels[1].shadow && _channels[1].shadow == _channels[2].shadow ) {
_channels[3].shadow = _channels[0].shadow * ((float) _brightness / LIGHT_MAX_BRIGHTNESS);
_channels[2].shadow = 0;