Skip to content

Commit

Permalink
Merge pull request #50 from andysheen/master
Browse files Browse the repository at this point in the history
fixed casting of long fade
  • Loading branch information
andysheen authored Oct 8, 2020
2 parents cd9a2a5 + 98e5ce4 commit 28ea154
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ESP32-SOCKETIO.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions rgbled.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down
2 changes: 1 addition & 1 deletion utility.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 28ea154

Please sign in to comment.