Alt Rotary Encoder & Alt 4LD enhancements.
This commit is contained in:
parent
b890b5f0dc
commit
12f2caa8d6
@ -254,7 +254,6 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
bool initDone = false;
|
bool initDone = false;
|
||||||
unsigned long lastTime = 0;
|
|
||||||
|
|
||||||
// HW interface & configuration
|
// HW interface & configuration
|
||||||
U8X8 *u8x8 = nullptr; // pointer to U8X8 display object
|
U8X8 *u8x8 = nullptr; // pointer to U8X8 display object
|
||||||
@ -296,7 +295,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
bool powerON = true;
|
bool powerON = true;
|
||||||
|
|
||||||
bool displayTurnedOff = false;
|
bool displayTurnedOff = false;
|
||||||
unsigned long lastUpdate = 0;
|
unsigned long nextUpdate = 0;
|
||||||
unsigned long lastRedraw = 0;
|
unsigned long lastRedraw = 0;
|
||||||
unsigned long overlayUntil = 0;
|
unsigned long overlayUntil = 0;
|
||||||
Line4Type lineType = FLD_LINE_BRIGHTNESS;
|
Line4Type lineType = FLD_LINE_BRIGHTNESS;
|
||||||
@ -401,15 +400,20 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
|
|
||||||
// gets called every time WiFi is (re-)connected. Initialize own network
|
// gets called every time WiFi is (re-)connected. Initialize own network
|
||||||
// interfaces here
|
// interfaces here
|
||||||
void connected() {}
|
void connected() {
|
||||||
|
knownSsid = apActive ? apSSID : WiFi.SSID(); //apActive ? WiFi.softAPSSID() :
|
||||||
|
knownIp = apActive ? IPAddress(4, 3, 2, 1) : Network.localIP();
|
||||||
|
networkOverlay(PSTR("NETWORK INFO"),7000);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Da loop.
|
* Da loop.
|
||||||
*/
|
*/
|
||||||
void loop() {
|
void loop() {
|
||||||
if (!enabled || millis() - lastUpdate < (clockMode?1000:refreshRate) || strip.isUpdating()) return;
|
if (!enabled || strip.isUpdating()) return;
|
||||||
lastUpdate = millis();
|
unsigned long now = millis();
|
||||||
|
if (now < nextUpdate) return;
|
||||||
|
nextUpdate = now + (clockMode?1000:refreshRate);
|
||||||
redraw(false);
|
redraw(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +465,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//function to update lastredraw
|
//function to update lastredraw
|
||||||
void updateRedrawTime(){
|
void updateRedrawTime() {
|
||||||
lastRedraw = millis();
|
lastRedraw = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,7 +489,6 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check if values which are shown on display changed from the last time.
|
// Check if values which are shown on display changed from the last time.
|
||||||
if (forceRedraw) {
|
if (forceRedraw) {
|
||||||
needRedraw = true;
|
needRedraw = true;
|
||||||
@ -493,40 +496,42 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
powerON = !powerON;
|
powerON = !powerON;
|
||||||
drawStatusIcons();
|
drawStatusIcons();
|
||||||
lastRedraw = millis();
|
lastRedraw = millis();
|
||||||
|
return;
|
||||||
} else if (knownnightlight != nightlightActive) { //trigger moon icon
|
} else if (knownnightlight != nightlightActive) { //trigger moon icon
|
||||||
knownnightlight = nightlightActive;
|
knownnightlight = nightlightActive;
|
||||||
drawStatusIcons();
|
drawStatusIcons();
|
||||||
if (knownnightlight) overlay(" Timer On", 1000, 6);
|
if (knownnightlight) overlay(PSTR(" Timer On"), 3000, 6);
|
||||||
lastRedraw = millis();
|
lastRedraw = millis();
|
||||||
}else if (wificonnected != interfacesInited){ //trigger wifi icon
|
return;
|
||||||
|
} else if (wificonnected != interfacesInited) { //trigger wifi icon
|
||||||
wificonnected = interfacesInited;
|
wificonnected = interfacesInited;
|
||||||
drawStatusIcons();
|
drawStatusIcons();
|
||||||
lastRedraw = millis();
|
lastRedraw = millis();
|
||||||
|
return;
|
||||||
} else if (knownMode != effectCurrent) {
|
} else if (knownMode != effectCurrent) {
|
||||||
knownMode = effectCurrent;
|
knownMode = effectCurrent;
|
||||||
if(displayTurnedOff)needRedraw = true;
|
if (displayTurnedOff) needRedraw = true;
|
||||||
else showCurrentEffectOrPalette(knownMode, JSON_mode_names, 3);
|
else showCurrentEffectOrPalette(knownMode, JSON_mode_names, 3);
|
||||||
} else if (knownPalette != effectPalette) {
|
} else if (knownPalette != effectPalette) {
|
||||||
knownPalette = effectPalette;
|
knownPalette = effectPalette;
|
||||||
if(displayTurnedOff)needRedraw = true;
|
if (displayTurnedOff) needRedraw = true;
|
||||||
else showCurrentEffectOrPalette(knownPalette, JSON_palette_names, 2);
|
else showCurrentEffectOrPalette(knownPalette, JSON_palette_names, 2);
|
||||||
} else if (knownBrightness != bri) {
|
} else if (knownBrightness != bri) {
|
||||||
if(displayTurnedOff && nightlightActive){needRedraw = false; knownBrightness = bri;}
|
if (displayTurnedOff && nightlightActive){needRedraw = false; knownBrightness = bri;}
|
||||||
else if(displayTurnedOff)needRedraw = true;
|
else if(displayTurnedOff) needRedraw = true;
|
||||||
else updateBrightness();
|
else updateBrightness();
|
||||||
} else if (knownEffectSpeed != effectSpeed) {
|
} else if (knownEffectSpeed != effectSpeed) {
|
||||||
if(displayTurnedOff)needRedraw = true;
|
if (displayTurnedOff) needRedraw = true;
|
||||||
else updateSpeed();
|
else updateSpeed();
|
||||||
} else if (knownEffectIntensity != effectIntensity) {
|
} else if (knownEffectIntensity != effectIntensity) {
|
||||||
if(displayTurnedOff)needRedraw = true;
|
if (displayTurnedOff) needRedraw = true;
|
||||||
else updateIntensity();
|
else updateIntensity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!needRedraw) {
|
if (!needRedraw) {
|
||||||
// Nothing to change.
|
// Nothing to change.
|
||||||
// Turn off display after 1 minutes with no change.
|
// Turn off display after 1 minutes with no change.
|
||||||
if(sleepMode && !displayTurnedOff && (now - lastRedraw > screenTimeout)) {
|
if (sleepMode && !displayTurnedOff && (now - lastRedraw > screenTimeout)) {
|
||||||
// We will still check if there is a change in redraw()
|
// We will still check if there is a change in redraw()
|
||||||
// and turn it back on if it changed.
|
// and turn it back on if it changed.
|
||||||
sleepOrClock(true);
|
sleepOrClock(true);
|
||||||
@ -547,8 +552,6 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update last known values.
|
// Update last known values.
|
||||||
knownSsid = apActive ? apSSID : WiFi.SSID(); //apActive ? WiFi.softAPSSID() :
|
|
||||||
knownIp = apActive ? IPAddress(4, 3, 2, 1) : Network.localIP();
|
|
||||||
knownBrightness = bri;
|
knownBrightness = bri;
|
||||||
knownMode = effectCurrent;
|
knownMode = effectCurrent;
|
||||||
knownPalette = effectPalette;
|
knownPalette = effectPalette;
|
||||||
@ -575,37 +578,40 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
showCurrentEffectOrPalette(knownMode, JSON_mode_names, 3); //Effect Mode info
|
showCurrentEffectOrPalette(knownMode, JSON_mode_names, 3); //Effect Mode info
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateBrightness(){
|
void updateBrightness() {
|
||||||
knownBrightness = bri;
|
knownBrightness = bri;
|
||||||
if(overlayUntil == 0){
|
if (overlayUntil == 0) {
|
||||||
brightness100 = (((float)(bri)/255)*100);
|
brightness100 = ((uint16_t)bri*100)/255;
|
||||||
char lineBuffer[4];
|
char lineBuffer[4];
|
||||||
sprintf_P(lineBuffer, PSTR("%-3d"), brightness100);
|
sprintf_P(lineBuffer, PSTR("%-3d"), brightness100);
|
||||||
drawString(1, lineHeight, lineBuffer);
|
drawString(1, lineHeight, lineBuffer);
|
||||||
lastRedraw = millis();}
|
lastRedraw = millis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateSpeed(){
|
void updateSpeed() {
|
||||||
knownEffectSpeed = effectSpeed;
|
knownEffectSpeed = effectSpeed;
|
||||||
if(overlayUntil == 0){
|
if (overlayUntil == 0) {
|
||||||
fxspeed100 = (((float)(effectSpeed)/255)*100);
|
fxspeed100 = ((uint16_t)effectSpeed*100)/255;
|
||||||
char lineBuffer[4];
|
char lineBuffer[4];
|
||||||
sprintf_P(lineBuffer, PSTR("%-3d"), fxspeed100);
|
sprintf_P(lineBuffer, PSTR("%-3d"), fxspeed100);
|
||||||
drawString(5, lineHeight, lineBuffer);
|
drawString(5, lineHeight, lineBuffer);
|
||||||
lastRedraw = millis();}
|
lastRedraw = millis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateIntensity(){
|
void updateIntensity() {
|
||||||
knownEffectIntensity = effectIntensity;
|
knownEffectIntensity = effectIntensity;
|
||||||
if(overlayUntil == 0){
|
if (overlayUntil == 0) {
|
||||||
fxintensity100 = (((float)(effectIntensity)/255)*100);
|
fxintensity100 = ((uint16_t)effectIntensity*100)/255;
|
||||||
char lineBuffer[4];
|
char lineBuffer[4];
|
||||||
sprintf_P(lineBuffer, PSTR("%-3d"), fxintensity100);
|
sprintf_P(lineBuffer, PSTR("%-3d"), fxintensity100);
|
||||||
drawString(9, lineHeight, lineBuffer);
|
drawString(9, lineHeight, lineBuffer);
|
||||||
lastRedraw = millis();}
|
lastRedraw = millis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw2x2GlyphIcons(){
|
void draw2x2GlyphIcons() {
|
||||||
if (lineHeight == 2) {
|
if (lineHeight == 2) {
|
||||||
drawGlyph(1, 0, 1, u8x8_font_benji_custom_icons_2x2, true);//brightness icon
|
drawGlyph(1, 0, 1, u8x8_font_benji_custom_icons_2x2, true);//brightness icon
|
||||||
drawGlyph(5, 0, 2, u8x8_font_benji_custom_icons_2x2, true);//speed icon
|
drawGlyph(5, 0, 2, u8x8_font_benji_custom_icons_2x2, true);//speed icon
|
||||||
@ -621,7 +627,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawStatusIcons(){
|
void drawStatusIcons() {
|
||||||
drawGlyph(14, 0, 80 + (wificonnected?0:1), u8x8_font_open_iconic_embedded_1x1, true); // wifi icon
|
drawGlyph(14, 0, 80 + (wificonnected?0:1), u8x8_font_open_iconic_embedded_1x1, true); // wifi icon
|
||||||
drawGlyph(15, 0, 78 + (bri > 0 ? 0 : 3), u8x8_font_open_iconic_embedded_1x1, true); // power icon
|
drawGlyph(15, 0, 78 + (bri > 0 ? 0 : 3), u8x8_font_open_iconic_embedded_1x1, true); // power icon
|
||||||
drawGlyph(13, 0, 66 + (nightlightActive?0:4), u8x8_font_open_iconic_weather_1x1, true); // moon icon for nighlight mode
|
drawGlyph(13, 0, 66 + (nightlightActive?0:4), u8x8_font_open_iconic_weather_1x1, true); // moon icon for nighlight mode
|
||||||
@ -638,8 +644,8 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Draw the arrow for the current setting beiong changed
|
//Draw the arrow for the current setting beiong changed
|
||||||
void drawArrow(){
|
void drawArrow() {
|
||||||
if(markColNum != 255 && markLineNum !=255)drawGlyph(markColNum, markLineNum*lineHeight, 69, u8x8_font_open_iconic_play_1x1);
|
if (markColNum != 255 && markLineNum !=255) drawGlyph(markColNum, markLineNum*lineHeight, 69, u8x8_font_open_iconic_play_1x1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Display the current effect or palette (desiredEntry)
|
//Display the current effect or palette (desiredEntry)
|
||||||
@ -657,15 +663,13 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
uint8_t smallChars1 = 0;
|
uint8_t smallChars1 = 0;
|
||||||
uint8_t smallChars2 = 0;
|
uint8_t smallChars2 = 0;
|
||||||
uint8_t smallChars3 = 0;
|
uint8_t smallChars3 = 0;
|
||||||
uint8_t totalCount = 0;
|
|
||||||
char singleJsonSymbol;
|
|
||||||
|
|
||||||
// Find the mode name in JSON
|
// Find the mode name in JSON
|
||||||
printedChars = extractModeName(inputEffPal, qstring, lineBuffer, LINE_BUFFER_SIZE-1);
|
printedChars = extractModeName(inputEffPal, qstring, lineBuffer, LINE_BUFFER_SIZE-1);
|
||||||
|
|
||||||
if (lineHeight == 2) { // use this code for 8 line display
|
if (lineHeight == 2) { // use this code for 8 line display
|
||||||
if (printedChars < MAX_MODE_LINE_SPACE) { // use big font if the text fits
|
if (printedChars < MAX_MODE_LINE_SPACE) { // use big font if the text fits
|
||||||
for (;printedChars < (MAX_MODE_LINE_SPACE-1); printedChars++) {lineBuffer[printedChars]=' '; }
|
for (;printedChars < (MAX_MODE_LINE_SPACE-1); printedChars++) lineBuffer[printedChars]=' ';
|
||||||
lineBuffer[printedChars] = 0;
|
lineBuffer[printedChars] = 0;
|
||||||
drawString(1, row*lineHeight, lineBuffer);
|
drawString(1, row*lineHeight, lineBuffer);
|
||||||
} else { // for long names divide the text into 2 lines and print them small
|
} else { // for long names divide the text into 2 lines and print them small
|
||||||
@ -750,19 +754,32 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
// Print the overlay
|
// Print the overlay
|
||||||
clear();
|
clear();
|
||||||
// First row string
|
// First row string
|
||||||
if (line1) drawString(0, 0, line1);
|
if (line1) {
|
||||||
|
String l1 = line1;
|
||||||
|
l1.trim();
|
||||||
|
center(l1, getCols());
|
||||||
|
drawString(0, 0, l1.c_str());
|
||||||
|
}
|
||||||
// Second row with Wifi name
|
// Second row with Wifi name
|
||||||
String ssidString = knownSsid.substring(0, getCols() > 1 ? getCols() - 2 : 0); //
|
String line = knownSsid.substring(0, getCols() > 1 ? getCols() - 2 : 0);
|
||||||
drawString(0, lineHeight, ssidString.c_str());
|
if (line.length() < getCols()) center(line, getCols());
|
||||||
|
drawString(0, lineHeight, line.c_str());
|
||||||
// Print `~` char to indicate that SSID is longer, than our display
|
// Print `~` char to indicate that SSID is longer, than our display
|
||||||
if (knownSsid.length() > getCols()) {
|
if (knownSsid.length() > getCols()) {
|
||||||
drawString(getCols() - 1, 0, "~");
|
drawString(getCols() - 1, 0, "~");
|
||||||
}
|
}
|
||||||
// Third row with IP and Psssword in AP Mode
|
// Third row with IP and Password in AP Mode
|
||||||
drawString(0, lineHeight*2, (knownIp.toString()).c_str());
|
line = knownIp.toString();
|
||||||
|
center(line, getCols());
|
||||||
|
drawString(0, lineHeight*2, line.c_str());
|
||||||
if (apActive) {
|
if (apActive) {
|
||||||
String appassword = apPass;
|
line = apPass;
|
||||||
drawString(0, lineHeight*3, appassword.c_str());
|
center(line, getCols());
|
||||||
|
drawString(0, lineHeight*3, line.c_str());
|
||||||
|
} else if (strcmp(serverDescription, "WLED") != 0) {
|
||||||
|
line = serverDescription;
|
||||||
|
center(line, getCols());
|
||||||
|
drawString(0, lineHeight*3, line.c_str());
|
||||||
}
|
}
|
||||||
overlayUntil = millis() + showHowLong;
|
overlayUntil = millis() + showHowLong;
|
||||||
}
|
}
|
||||||
@ -793,9 +810,12 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
*/
|
*/
|
||||||
void showTime() {
|
void showTime() {
|
||||||
if (type == NONE || !enabled) return;
|
if (type == NONE || !enabled) return;
|
||||||
if (knownMinute != minute(localTime)) { //only redraw clock if it has changed
|
|
||||||
char lineBuffer[LINE_BUFFER_SIZE];
|
|
||||||
|
|
||||||
|
char lineBuffer[LINE_BUFFER_SIZE];
|
||||||
|
static byte lastSecond;
|
||||||
|
byte secondCurrent = second(localTime);
|
||||||
|
|
||||||
|
if (knownMinute != minute(localTime)) { //only redraw clock if it has changed
|
||||||
//updateLocalTime();
|
//updateLocalTime();
|
||||||
byte AmPmHour = hour(localTime);
|
byte AmPmHour = hour(localTime);
|
||||||
boolean isitAM = true;
|
boolean isitAM = true;
|
||||||
@ -804,7 +824,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
if (AmPmHour == 0) AmPmHour = 12;
|
if (AmPmHour == 0) AmPmHour = 12;
|
||||||
if (hour(localTime) > 11) isitAM = false;
|
if (hour(localTime) > 11) isitAM = false;
|
||||||
}
|
}
|
||||||
clear();
|
|
||||||
drawStatusIcons(); //icons power, wifi, timer, etc
|
drawStatusIcons(); //icons power, wifi, timer, etc
|
||||||
|
|
||||||
sprintf_P(lineBuffer, PSTR("%s %2d "), monthShortStr(month(localTime)), day(localTime));
|
sprintf_P(lineBuffer, PSTR("%s %2d "), monthShortStr(month(localTime)), day(localTime));
|
||||||
@ -815,7 +835,13 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
|
|
||||||
if (useAMPM) drawString(12, lineHeight*2, (isitAM ? "AM" : "PM"), true); //draw am/pm if using 12 time
|
if (useAMPM) drawString(12, lineHeight*2, (isitAM ? "AM" : "PM"), true); //draw am/pm if using 12 time
|
||||||
knownMinute = minute(localTime);
|
knownMinute = minute(localTime);
|
||||||
|
} else {
|
||||||
|
if (secondCurrent == lastSecond) return;
|
||||||
}
|
}
|
||||||
|
lastSecond = secondCurrent;
|
||||||
|
draw2x2String(6, lineHeight*2, secondCurrent%2 ? " " : ":");
|
||||||
|
sprintf_P(lineBuffer, PSTR("%02d"), secondCurrent);
|
||||||
|
drawString(12, lineHeight*2+1, lineBuffer, true); // even with double sized rows print seconds in 1 line
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -55,7 +55,7 @@ private:
|
|||||||
int fadeAmount = 5; // Amount to change every step (brightness)
|
int fadeAmount = 5; // Amount to change every step (brightness)
|
||||||
unsigned long currentTime;
|
unsigned long currentTime;
|
||||||
unsigned long loopTime;
|
unsigned long loopTime;
|
||||||
unsigned long buttonHoldTIme;
|
unsigned long buttonHoldTime;
|
||||||
int8_t pinA = ENCODER_DT_PIN; // DT from encoder
|
int8_t pinA = ENCODER_DT_PIN; // DT from encoder
|
||||||
int8_t pinB = ENCODER_CLK_PIN; // CLK from encoder
|
int8_t pinB = ENCODER_CLK_PIN; // CLK from encoder
|
||||||
int8_t pinC = ENCODER_SW_PIN; // SW from encoder
|
int8_t pinC = ENCODER_SW_PIN; // SW from encoder
|
||||||
@ -63,7 +63,7 @@ private:
|
|||||||
unsigned char button_state = HIGH;
|
unsigned char button_state = HIGH;
|
||||||
unsigned char prev_button_state = HIGH;
|
unsigned char prev_button_state = HIGH;
|
||||||
bool networkShown = false;
|
bool networkShown = false;
|
||||||
uint16_t currentHue1 = 6425; // default reboot color
|
uint16_t currentHue1 = 16; // default boot color
|
||||||
byte currentSat1 = 255;
|
byte currentSat1 = 255;
|
||||||
|
|
||||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||||
@ -168,10 +168,10 @@ public:
|
|||||||
// is not yet initialized when setup is called.
|
// is not yet initialized when setup is called.
|
||||||
|
|
||||||
if (!currentEffectAndPaletteInitialized) {
|
if (!currentEffectAndPaletteInitialized) {
|
||||||
findCurrentEffectAndPalette();}
|
findCurrentEffectAndPalette();
|
||||||
|
}
|
||||||
|
|
||||||
if(modes_alpha_indexes[effectCurrentIndex] != effectCurrent
|
if (modes_alpha_indexes[effectCurrentIndex] != effectCurrent || palettes_alpha_indexes[effectPaletteIndex] != effectPalette) {
|
||||||
|| palettes_alpha_indexes[effectPaletteIndex] != effectPalette){
|
|
||||||
currentEffectAndPaletteInitialized = false;
|
currentEffectAndPaletteInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ public:
|
|||||||
button_state = digitalRead(pinC);
|
button_state = digitalRead(pinC);
|
||||||
if (prev_button_state != button_state)
|
if (prev_button_state != button_state)
|
||||||
{
|
{
|
||||||
if (button_state == HIGH && (millis()-buttonHoldTIme < 3000))
|
if (button_state == HIGH && (millis()-buttonHoldTime < 3000))
|
||||||
{
|
{
|
||||||
prev_button_state = button_state;
|
prev_button_state = button_state;
|
||||||
|
|
||||||
@ -191,25 +191,25 @@ public:
|
|||||||
if (display != nullptr) {
|
if (display != nullptr) {
|
||||||
switch(newState) {
|
switch(newState) {
|
||||||
case 0:
|
case 0:
|
||||||
changedState = changeState(" Brightness", 1, 0, 1);
|
changedState = changeState(PSTR("Brightness"), 1, 0, 1);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
changedState = changeState(" Speed", 1, 4, 2);
|
changedState = changeState(PSTR("Speed"), 1, 4, 2);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
changedState = changeState(" Intensity", 1 ,8, 3);
|
changedState = changeState(PSTR("Intensity"), 1 ,8, 3);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
changedState = changeState(" Color Palette", 2, 0, 4);
|
changedState = changeState(PSTR("Color Palette"), 2, 0, 4);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
changedState = changeState(" Effect", 3, 0, 5);
|
changedState = changeState(PSTR("Effect"), 3, 0, 5);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
changedState = changeState(" Main Color", 255, 255, 7);
|
changedState = changeState(PSTR("Main Color"), 255, 255, 7);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
changedState = changeState(" Saturation", 255, 255, 8);
|
changedState = changeState(PSTR("Saturation"), 255, 255, 8);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,11 +221,15 @@ public:
|
|||||||
{
|
{
|
||||||
prev_button_state = button_state;
|
prev_button_state = button_state;
|
||||||
networkShown = false;
|
networkShown = false;
|
||||||
if(!prev_button_state)buttonHoldTIme = millis();
|
if (!prev_button_state) buttonHoldTime = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prev_button_state && (millis()-buttonHoldTIme > 3000) && !networkShown) displayNetworkInfo(); //long press for network info
|
if (!prev_button_state && (millis()-buttonHoldTime > 3000) && !networkShown) {
|
||||||
|
displayNetworkInfo(); //long press for network info
|
||||||
|
loopTime = currentTime; // Updates loopTime
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Enc_A = digitalRead(pinA); // Read encoder pins
|
Enc_A = digitalRead(pinA); // Read encoder pins
|
||||||
Enc_B = digitalRead(pinB);
|
Enc_B = digitalRead(pinB);
|
||||||
@ -289,9 +293,9 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayNetworkInfo(){
|
void displayNetworkInfo() {
|
||||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||||
display->networkOverlay(" NETWORK INFO", 15000);
|
display->networkOverlay(PSTR("NETWORK INFO"), 10000);
|
||||||
networkShown = true;
|
networkShown = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -320,7 +324,10 @@ public:
|
|||||||
// Throw away wake up input
|
// Throw away wake up input
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
display->overlay(stateName, 750, glyph);
|
String line = stateName;
|
||||||
|
//line.trim();
|
||||||
|
display->center(line, display->getCols());
|
||||||
|
display->overlay(line.c_str(), 750, glyph);
|
||||||
display->setMarkLine(markedLine, markedCol);
|
display->setMarkLine(markedLine, markedCol);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -424,10 +431,11 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (increase) { if (currentHue1<256) currentHue1 += 4; else currentHue1 = 0; }
|
||||||
if(increase) currentHue1 += 321;
|
else { if (currentHue1>3) currentHue1 -= 4; else currentHue1 = 256; }
|
||||||
else currentHue1 -= 321;
|
colorHStoRGB(currentHue1*255, currentSat1, col);
|
||||||
colorHStoRGB(currentHue1, currentSat1, col);
|
strip.applyToAllSelected = true;
|
||||||
|
strip.setColor(0, colorFromRgbw(col));
|
||||||
lampUdated();
|
lampUdated();
|
||||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||||
display->updateRedrawTime();
|
display->updateRedrawTime();
|
||||||
@ -441,15 +449,15 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (increase) { if (currentSat1<252) currentSat1 += 4; }
|
||||||
if(increase) currentSat1 = (currentSat1 + 5 <= 255 ? (currentSat1 + 5) : 255);
|
else { if (currentSat1>3) currentSat1 -= 4; }
|
||||||
else currentSat1 = (currentSat1 - 5 >= 0 ? (currentSat1 - 5) : 0);
|
colorHStoRGB(currentHue1*256, currentSat1, col);
|
||||||
colorHStoRGB(currentHue1, currentSat1, col);
|
strip.applyToAllSelected = true;
|
||||||
|
strip.setColor(0, colorFromRgbw(col));
|
||||||
lampUdated();
|
lampUdated();
|
||||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||||
display->updateRedrawTime();
|
display->updateRedrawTime();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2112191
|
#define VERSION 2112201
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
|
Loading…
Reference in New Issue
Block a user