diff --git a/ESP32-SOCKETIO.ino b/ESP32-SOCKETIO.ino index da6e074..c5974c2 100644 --- a/ESP32-SOCKETIO.ino +++ b/ESP32-SOCKETIO.ino @@ -72,7 +72,7 @@ using namespace ace_button; #define REMOTELED 1 #define RGBLEDPWMSTART 120 #define FASTLONGFADE 120 -int LONGFADEMINUTESMAX = 360; +unsigned long LONGFADEMINUTESMAX = 360; #define LONGFADECHECKMILLIS 60000 unsigned long prevLongFadeVal = 0; uint8_t hue[NUMPIXELS]; diff --git a/rgbled.ino b/rgbled.ino index dbb99cb..8f234a3 100644 --- a/rgbled.ino +++ b/rgbled.ino @@ -112,11 +112,11 @@ void longFadeHandler() { if (millis() - prevLongFadeMillis > LONGFADECHECKMILLIS) { prevLongFadeMillis = millis(); longFadeMinutes--; - unsigned long currLongFadeVal = longFadeMinutes / (LONGFADEMINUTESMAX / RGBLEDPWMSTART); + unsigned long currLongFadeVal = long((float)longFadeMinutes / ((float)LONGFADEMINUTESMAX / (float)RGBLEDPWMSTART)); if (currLongFadeVal != prevLongFadeVal) { prevLongFadeVal = currLongFadeVal; currLongFadeVal = currLongFadeVal - 1; - value[REMOTELED] = (byte)fscale(0,RGBLEDPWMSTART,0,RGBLEDPWMSTART,currLongFadeVal,-3); + value[REMOTELED] = (byte)fscale(0, RGBLEDPWMSTART, 0, RGBLEDPWMSTART, currLongFadeVal, -3); ledChanged[REMOTELED] = true; Serial.println(value[REMOTELED]); } diff --git a/utility.ino b/utility.ino index cc757d5..787b60f 100644 --- a/utility.ino +++ b/utility.ino @@ -184,7 +184,7 @@ void setupCapacitiveTouch() { touchConfig.setThreshold(TOUCH_THRESHOLD); } -int checkFadingLength() { +long checkFadingLength() { if (digitalRead(FADE_3) == 0 && digitalRead(FADE_1) == 1) { Serial.println("Your fade time is 3 hours"); return 180;