Added Gamma correction
This commit is contained in:
parent
b09f450171
commit
05a757ede3
10
TODO.txt
10
TODO.txt
@ -9,7 +9,14 @@ add preferred colors to settings -> quickly t. UI, button select,
|
|||||||
use iframe for settings, seperate tabs for wifi and application confg
|
use iframe for settings, seperate tabs for wifi and application confg
|
||||||
use iframe for all adv. features?
|
use iframe for all adv. features?
|
||||||
/dumpeeprom and /pusheeprom (ota lock!)
|
/dumpeeprom and /pusheeprom (ota lock!)
|
||||||
aux trigger pin
|
(aux trigger pin) partially impl.
|
||||||
|
get NTP working
|
||||||
|
audioWLED
|
||||||
|
Broadcast
|
||||||
|
Less traffic (distr. and scroll proc. on module)
|
||||||
|
Make webserver accessible while receiving
|
||||||
|
More modes?
|
||||||
|
|
||||||
randomizer
|
randomizer
|
||||||
ir, touch, pin input
|
ir, touch, pin input
|
||||||
Automations
|
Automations
|
||||||
@ -36,5 +43,6 @@ toggle notifier
|
|||||||
var. brightness
|
var. brightness
|
||||||
|
|
||||||
BUGS
|
BUGS
|
||||||
|
NTP crash (1-48h)
|
||||||
static ip disables mdns
|
static ip disables mdns
|
||||||
? authentification for security relevant areas ([/settings, /reset])
|
? authentification for security relevant areas ([/settings, /reset])
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// send HTTP request
|
// send HTTP request
|
||||||
request.open("GET", "ajax_in/" + strA + strR + strG + strB + nocache, true);
|
request.open("GET", "win/" + strA + strR + strG + strB + nocache, true);
|
||||||
request.send(null);
|
request.send(null);
|
||||||
strA = "";
|
strA = "";
|
||||||
strR = "";
|
strR = "";
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
document.S_form.CLDFA.value = this.responseXML.getElementsByTagName('cldfa')[0].innerHTML;
|
document.S_form.CLDFA.value = this.responseXML.getElementsByTagName('cldfa')[0].innerHTML;
|
||||||
document.S_form.FXDEF.value = this.responseXML.getElementsByTagName('fxdef')[0].innerHTML;
|
document.S_form.FXDEF.value = this.responseXML.getElementsByTagName('fxdef')[0].innerHTML;
|
||||||
document.S_form.SXDEF.value = this.responseXML.getElementsByTagName('sxdef')[0].innerHTML;
|
document.S_form.SXDEF.value = this.responseXML.getElementsByTagName('sxdef')[0].innerHTML;
|
||||||
|
document.S_form.GCBRI.checked = (this.responseXML.getElementsByTagName('gcbri')[0].innerHTML)!=0?true:false;
|
||||||
|
document.S_form.GCRGB.checked = (this.responseXML.getElementsByTagName('gcrgb')[0].innerHTML)!=0?true:false;
|
||||||
document.S_form.BTNON.checked = (this.responseXML.getElementsByTagName('btnon')[0].innerHTML)!=0?true:false;
|
document.S_form.BTNON.checked = (this.responseXML.getElementsByTagName('btnon')[0].innerHTML)!=0?true:false;
|
||||||
document.S_form.TFADE.checked = (this.responseXML.getElementsByTagName('tfade')[0].innerHTML)!=0?true:false;
|
document.S_form.TFADE.checked = (this.responseXML.getElementsByTagName('tfade')[0].innerHTML)!=0?true:false;
|
||||||
document.S_form.TDLAY.value = this.responseXML.getElementsByTagName('tdlay')[0].innerHTML;
|
document.S_form.TDLAY.value = this.responseXML.getElementsByTagName('tdlay')[0].innerHTML;
|
||||||
@ -122,6 +124,8 @@
|
|||||||
Default effect ID: <input name="FXDEF" maxlength="3" size="2"> <br>
|
Default effect ID: <input name="FXDEF" maxlength="3" size="2"> <br>
|
||||||
Default effect speed: <input name="SXDEF" maxlength="3" size="2"> <br>
|
Default effect speed: <input name="SXDEF" maxlength="3" size="2"> <br>
|
||||||
Ignore and use current color, brightness and effects: <input type="checkbox" name="CBEOR" value="0"> <br>
|
Ignore and use current color, brightness and effects: <input type="checkbox" name="CBEOR" value="0"> <br>
|
||||||
|
Use Gamma correction for brightness: <input type="checkbox" name="GCBRI" value="0"> <br>
|
||||||
|
Use Gamma correction for color: <input type="checkbox" name="GCRGB" value="0"> <br>
|
||||||
Brightness factor: <input name="NRBRI" maxlength="3" size="2"> % <br>
|
Brightness factor: <input name="NRBRI" maxlength="3" size="2"> % <br>
|
||||||
<h3>Button setup</h3>
|
<h3>Button setup</h3>
|
||||||
On/Off button enabled: <input type="checkbox" name="BTNON" value="0"> <br>
|
On/Off button enabled: <input type="checkbox" name="BTNON" value="0"> <br>
|
||||||
|
@ -92,6 +92,8 @@ boolean nixieClockDisplaySeconds = false;
|
|||||||
boolean nixieClock12HourFormat = false;
|
boolean nixieClock12HourFormat = false;
|
||||||
boolean overlayReverse = true;
|
boolean overlayReverse = true;
|
||||||
uint8_t overlaySpeed = 200;
|
uint8_t overlaySpeed = 200;
|
||||||
|
boolean useGammaCorrectionBri = true;
|
||||||
|
boolean useGammaCorrectionRGB = true;
|
||||||
|
|
||||||
double transitionResolution = 0.011;
|
double transitionResolution = 0.011;
|
||||||
|
|
||||||
@ -155,6 +157,24 @@ int lastWifiState = 3;
|
|||||||
long wifiStateChangedTime = 0;
|
long wifiStateChangedTime = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const uint8_t gamma8[] = {
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5,
|
||||||
|
5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10,
|
||||||
|
10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16,
|
||||||
|
17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25,
|
||||||
|
25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36,
|
||||||
|
37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50,
|
||||||
|
51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68,
|
||||||
|
69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89,
|
||||||
|
90, 92, 93, 95, 96, 98, 99,101,102,104,105,107,109,110,112,114,
|
||||||
|
115,117,119,120,122,124,126,127,129,131,133,135,137,138,140,142,
|
||||||
|
144,146,148,150,152,154,156,158,160,162,164,167,169,171,173,175,
|
||||||
|
177,180,182,184,186,189,191,193,196,198,200,203,205,208,210,213,
|
||||||
|
215,218,220,223,225,228,231,233,236,239,241,244,247,249,252,255 };
|
||||||
|
|
||||||
void down()
|
void down()
|
||||||
{
|
{
|
||||||
bri_t = 0;
|
bri_t = 0;
|
||||||
|
@ -88,6 +88,8 @@ void saveSettingsToEEPROM()
|
|||||||
EEPROM.write(327, ntpEnabled);
|
EEPROM.write(327, ntpEnabled);
|
||||||
//328 reserved for timezone setting
|
//328 reserved for timezone setting
|
||||||
//329 reserved for dst setting
|
//329 reserved for dst setting
|
||||||
|
EEPROM.write(330, useGammaCorrectionBri);
|
||||||
|
EEPROM.write(331, useGammaCorrectionRGB);
|
||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,4 +181,6 @@ void loadSettingsFromEEPROM()
|
|||||||
effectDefault = EEPROM.read(324); effectCurrent = effectDefault;
|
effectDefault = EEPROM.read(324); effectCurrent = effectDefault;
|
||||||
effectSpeedDefault = EEPROM.read(325); effectSpeed = effectSpeedDefault;
|
effectSpeedDefault = EEPROM.read(325); effectSpeed = effectSpeedDefault;
|
||||||
ntpEnabled = EEPROM.read(327);
|
ntpEnabled = EEPROM.read(327);
|
||||||
|
useGammaCorrectionBri = EEPROM.read(330);
|
||||||
|
useGammaCorrectionRGB = EEPROM.read(331);
|
||||||
}
|
}
|
||||||
|
@ -115,6 +115,11 @@ void XML_response_settings()
|
|||||||
resp = resp + "<sxdef>";
|
resp = resp + "<sxdef>";
|
||||||
resp = resp + effectSpeedDefault;
|
resp = resp + effectSpeedDefault;
|
||||||
resp = resp + "</sxdef>";
|
resp = resp + "</sxdef>";
|
||||||
|
resp = resp + "<gcbri>";
|
||||||
|
resp = resp + bool2int(useGammaCorrectionBri);
|
||||||
|
resp = resp + "</gcbri><gcrgb>";
|
||||||
|
resp = resp + bool2int(useGammaCorrectionRGB);
|
||||||
|
resp = resp + "</gcrgb>";
|
||||||
resp = resp + "<btnon>";
|
resp = resp + "<btnon>";
|
||||||
resp = resp + bool2int(buttonEnabled);
|
resp = resp + bool2int(buttonEnabled);
|
||||||
resp = resp + "</btnon><tfade>";
|
resp = resp + "</btnon><tfade>";
|
||||||
|
@ -138,6 +138,8 @@ void handleSettingsSet()
|
|||||||
if (i >= 0 && i <= 255) effectSpeedDefault = i;
|
if (i >= 0 && i <= 255) effectSpeedDefault = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
useGammaCorrectionBri = server.hasArg("GCBRI");
|
||||||
|
useGammaCorrectionRGB = server.hasArg("GCRGB");
|
||||||
buttonEnabled = server.hasArg("BTNON");
|
buttonEnabled = server.hasArg("BTNON");
|
||||||
fadeTransition = server.hasArg("TFADE");
|
fadeTransition = server.hasArg("TFADE");
|
||||||
if (server.hasArg("TDLAY"))
|
if (server.hasArg("TDLAY"))
|
||||||
@ -194,7 +196,7 @@ void handleSettingsSet()
|
|||||||
boolean handleSet(String req)
|
boolean handleSet(String req)
|
||||||
{
|
{
|
||||||
boolean effectUpdated = false;
|
boolean effectUpdated = false;
|
||||||
if (!(req.indexOf("ajax_in") >= 0)) {
|
if (!(req.indexOf("win") >= 0)) {
|
||||||
if (req.indexOf("get-settings") >= 0)
|
if (req.indexOf("get-settings") >= 0)
|
||||||
{
|
{
|
||||||
XML_response_settings();
|
XML_response_settings();
|
||||||
|
@ -75,11 +75,16 @@ void handleNotifications()
|
|||||||
for (int i = 2; i < packetSize -3; i += 4)
|
for (int i = 2; i < packetSize -3; i += 4)
|
||||||
{
|
{
|
||||||
if (udpIn[i] < LEDCOUNT)
|
if (udpIn[i] < LEDCOUNT)
|
||||||
|
if (useGammaCorrectionRGB)
|
||||||
|
{
|
||||||
|
strip.setIndividual(udpIn[i], ((uint32_t)gamma8[udpIn[i+1]] << 16) | ((uint32_t)gamma8[udpIn[i+2]] << 8) | gamma8[udpIn[i+3]]);
|
||||||
|
} else {
|
||||||
strip.setIndividual(udpIn[i], ((uint32_t)udpIn[i+1] << 16) | ((uint32_t)udpIn[i+2] << 8) | udpIn[i+3]);
|
strip.setIndividual(udpIn[i], ((uint32_t)udpIn[i+1] << 16) | ((uint32_t)udpIn[i+2] << 8) | udpIn[i+3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (arlsTimeout && millis() > arlsTimeoutTime)
|
if (arlsTimeout && millis() > arlsTimeoutTime)
|
||||||
{
|
{
|
||||||
strip.unlockAll();
|
strip.unlockAll();
|
||||||
|
@ -5,8 +5,18 @@
|
|||||||
void setAllLeds() {
|
void setAllLeds() {
|
||||||
double d = bri_t*bri_n;
|
double d = bri_t*bri_n;
|
||||||
int val = d/100;
|
int val = d/100;
|
||||||
|
if (useGammaCorrectionBri)
|
||||||
|
{
|
||||||
|
strip.setBrightness(gamma8[val]);
|
||||||
|
} else {
|
||||||
strip.setBrightness(val);
|
strip.setBrightness(val);
|
||||||
|
}
|
||||||
|
if (useGammaCorrectionBri)
|
||||||
|
{
|
||||||
|
strip.setColor(gamma8[col_t[0]], gamma8[col_t[1]], gamma8[col_t[2]]);
|
||||||
|
} else {
|
||||||
strip.setColor(col_t[0], col_t[1], col_t[2]);
|
strip.setColor(col_t[0], col_t[1], col_t[2]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLedsStandard()
|
void setLedsStandard()
|
||||||
|
Loading…
Reference in New Issue
Block a user