|
@@ -14,6 +14,7 @@ void handleButtonLogic() {
|
|
|
HandleAddButtonPress();
|
|
|
delay(BUTTON_HOLD_DELAY);
|
|
|
}
|
|
|
+ delay(BUTTON_DEBOUNCE);
|
|
|
} else if (minusPressed) {
|
|
|
//Minus button pressed
|
|
|
HandleMinusButtonPress();
|
|
@@ -23,16 +24,17 @@ void handleButtonLogic() {
|
|
|
HandleMinusButtonPress();
|
|
|
delay(BUTTON_HOLD_DELAY);
|
|
|
}
|
|
|
+ delay(BUTTON_DEBOUNCE);
|
|
|
} else if (colorPressed) {
|
|
|
//Color button pressed
|
|
|
HandleColorButtonPress();
|
|
|
- delay(50);
|
|
|
+ delay(BUTTON_DEBOUNCE);
|
|
|
while (digitalRead(BUTTON_COLOR) == LOW) {
|
|
|
//Wait for button up before continue
|
|
|
delay(BUTTON_HOLD_DELAY);
|
|
|
}
|
|
|
//Debounce
|
|
|
- delay(50);
|
|
|
+ delay(BUTTON_DEBOUNCE);
|
|
|
|
|
|
} else if (modePressed) {
|
|
|
HandleModeButtonPress();
|
|
@@ -41,7 +43,7 @@ void handleButtonLogic() {
|
|
|
delay(BUTTON_HOLD_DELAY);
|
|
|
}
|
|
|
//Debounce
|
|
|
- delay(50);
|
|
|
+ delay(BUTTON_DEBOUNCE);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -50,7 +52,7 @@ void handleButtonLogic() {
|
|
|
void HandleModeButtonPress() {
|
|
|
//Update the mode number
|
|
|
currentMode += 1;
|
|
|
- if (currentMode > 3) {
|
|
|
+ if (currentMode > 2) {
|
|
|
currentMode = 0;
|
|
|
}
|
|
|
|
|
@@ -64,8 +66,7 @@ void HandleModeButtonPress() {
|
|
|
loadRGBModeDefault();
|
|
|
} else if (currentMode == 2) {
|
|
|
Serial.println("Switched to Color Palette Mode");
|
|
|
- } else if (currentMode == 3) {
|
|
|
- Serial.println("Switched to Preset Mode");
|
|
|
+ loadPresetsDefault();
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -84,6 +85,7 @@ void HandleColorButtonPress() {
|
|
|
setControlLEDColor(MAX_CTRLBRIGHTNESS, MAX_CTRLBRIGHTNESS, MAX_CTRLBRIGHTNESS);
|
|
|
}
|
|
|
} else if (currentMode == 1) {
|
|
|
+ //RGB Adjustable Mode
|
|
|
if (adjustingCatergory == 0) {
|
|
|
//Red -> Green
|
|
|
adjustingCatergory = 1;
|
|
@@ -98,6 +100,17 @@ void HandleColorButtonPress() {
|
|
|
//Set LED to yellow for brightness
|
|
|
setControlLEDColor(MAX_CTRLBRIGHTNESS, 0, 0);
|
|
|
}
|
|
|
+ } else if (currentMode == 2){
|
|
|
+ //Color pallete mode
|
|
|
+ if (adjustingCatergory == 0) {
|
|
|
+ //Enter brightness control mode
|
|
|
+ adjustingCatergory = 1;
|
|
|
+ setControlLEDColor(MAX_CTRLBRIGHTNESS, MAX_CTRLBRIGHTNESS, 0);
|
|
|
+ }else{
|
|
|
+ //Enter pallete select mode
|
|
|
+ adjustingCatergory = 0;
|
|
|
+ renderColorPallete(values[0]);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -124,7 +137,11 @@ void HandleAddButtonPress() {
|
|
|
}
|
|
|
setColorTemperature(values[0], values[1]);
|
|
|
} else if (currentMode == 1) {
|
|
|
+ //RGB Color Mode
|
|
|
handleRGBModeAdd();
|
|
|
+ } else if (currentMode == 2){
|
|
|
+ //Color Pallete Mode
|
|
|
+ handlePresetsAdd();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -134,8 +151,8 @@ void HandleMinusButtonPress() {
|
|
|
if (adjustingCatergory == 0) {
|
|
|
//reduce 500 from K value
|
|
|
values[0] = values[0] - 100;
|
|
|
- if (values[0] < 1500) {
|
|
|
- values[0] = 1500;
|
|
|
+ if (values[0] < 2500) {
|
|
|
+ values[0] = 2500;
|
|
|
blinkLowerLimit();
|
|
|
}
|
|
|
|
|
@@ -152,6 +169,10 @@ void HandleMinusButtonPress() {
|
|
|
}
|
|
|
setColorTemperature(values[0], values[1]);
|
|
|
} else if (currentMode == 1) {
|
|
|
+ //RGB Color Mode
|
|
|
handleRGBModeMinus();
|
|
|
+ } else if (currentMode == 2){
|
|
|
+ //Color Pallete Mode
|
|
|
+ handlePresetsMinus();
|
|
|
}
|
|
|
}
|