diff --git a/OMX-27-firmware/src/config.cpp b/OMX-27-firmware/src/config.cpp index c88f9f0..96ae5be 100644 --- a/OMX-27-firmware/src/config.cpp +++ b/OMX-27-firmware/src/config.cpp @@ -55,9 +55,9 @@ int pots[NUM_CC_BANKS][NUM_CC_POTS] = { int potMinVal = 0; #if T4 -int potMaxVal = 1019; // T4 = 1019 // T3.2 = 8190; +int potMaxVal = 1019; // T4 = 1019 // T3.2 = 8191; #else -int potMaxVal = 8190; // T4 = 1019 // T3.2 = 8190; +int potMaxVal = 8191; // T4 = 1019 // T3.2 = 8191; #endif const int gridh = 32; diff --git a/OMX-27-firmware/src/modes/omx_screensaver.cpp b/OMX-27-firmware/src/modes/omx_screensaver.cpp index 2885297..f3cf5e1 100644 --- a/OMX-27-firmware/src/modes/omx_screensaver.cpp +++ b/OMX-27-firmware/src/modes/omx_screensaver.cpp @@ -7,14 +7,16 @@ void OmxScreensaver::setScreenSaverColor() { - colorConfig.screensaverColor = map(potSettings.analog[4]->getValue(), potMinVal, potMaxVal, 0, 32764); + colorConfig.screensaverColor = map(potSettings.analog[4]->getValue(), potMinVal, potMaxVal, 0, ssMaxColorDepth); } void OmxScreensaver::onPotChanged(int potIndex, int prevValue, int newValue, int analogDelta) { - // colorConfig.screensaverColor = potSettings.analog[4]->getValue() * 4; // value is 0-32764 for strip.ColorHSV - setScreenSaverColor(); - + // set screensaver color with pot 4 + if (potSettings.analog[4]->hasChanged()) + { + setScreenSaverColor(); + } // reset screensaver if (potSettings.analog[0]->hasChanged() || potSettings.analog[1]->hasChanged() || potSettings.analog[2]->hasChanged() || potSettings.analog[3]->hasChanged()) { @@ -26,8 +28,12 @@ void OmxScreensaver::updateScreenSaverState() { if (screenSaverCounter > screensaverInterval) { - screenSaverActive = true; - } + if (!screenSaverActive) + { + screenSaverActive = true; + setScreenSaverColor(); + } + } else if (screenSaverCounter < 10) { ssstep = 0; @@ -45,7 +51,6 @@ void OmxScreensaver::updateScreenSaverState() bool OmxScreensaver::shouldShowScreenSaver() { - setScreenSaverColor(); return screenSaverActive; } @@ -62,10 +67,12 @@ void OmxScreensaver::onDisplayUpdate() updateLEDs(); omxDisp.clearDisplay(); } + void OmxScreensaver::resetCounter() { screenSaverCounter = 0; } + void OmxScreensaver::updateLEDs() { unsigned long playstepmillis = millis(); @@ -81,7 +88,7 @@ void OmxScreensaver::updateLEDs() { strip.setPixelColor(z, 0); } - if (colorConfig.screensaverColor < 32639) + if (colorConfig.screensaverColor < ssMaxColorDepth) { if (!ssreverse) { diff --git a/OMX-27-firmware/src/modes/omx_screensaver.h b/OMX-27-firmware/src/modes/omx_screensaver.h index 0de1127..b7abd7b 100644 --- a/OMX-27-firmware/src/modes/omx_screensaver.h +++ b/OMX-27-firmware/src/modes/omx_screensaver.h @@ -30,10 +30,9 @@ class OmxScreensaver : public OmxModeInterface private: void setScreenSaverColor(); elapsedMillis screenSaverCounter = 0; - unsigned long screensaverInterval = 1000 * 60 * 3; // 3 minutes default? // 10000; 15000; // + unsigned long screensaverInterval = 1000 * 60 * 3; // 3 minutes default + uint32_t ssMaxColorDepth = 65528; // used by setScreenSaverColor(). Allows for full rainbow of colors, plus a little extra for 'black' - // Uncomment for 10 second screensaver for testing - // unsigned long screensaverInterval = 1000 * 10; int ssstep = 0; int ssloop = 0; volatile unsigned long nextStepTimeSS = 0;