Added Gamma correction

pull/46/head
cschwinne 2017-02-01 19:25:36 +01:00
rodzic b09f450171
commit 05a757ede3
9 zmienionych plików z 64 dodań i 6 usunięć

Wyświetl plik

@ -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 all adv. features?
/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
ir, touch, pin input
Automations
@ -36,5 +43,6 @@ toggle notifier
var. brightness
BUGS
NTP crash (1-48h)
static ip disables mdns
? authentification for security relevant areas ([/settings, /reset])

Wyświetl plik

@ -31,7 +31,7 @@
}
}
// 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);
strA = "";
strR = "";

Wyświetl plik

@ -38,6 +38,8 @@
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.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.TFADE.checked = (this.responseXML.getElementsByTagName('tfade')[0].innerHTML)!=0?true:false;
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 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>
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>
<h3>Button setup</h3>
On/Off button enabled: <input type="checkbox" name="BTNON" value="0"> <br>

Wyświetl plik

@ -92,6 +92,8 @@ boolean nixieClockDisplaySeconds = false;
boolean nixieClock12HourFormat = false;
boolean overlayReverse = true;
uint8_t overlaySpeed = 200;
boolean useGammaCorrectionBri = true;
boolean useGammaCorrectionRGB = true;
double transitionResolution = 0.011;
@ -155,6 +157,24 @@ int lastWifiState = 3;
long wifiStateChangedTime = 0;
#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()
{
bri_t = 0;

Wyświetl plik

@ -88,6 +88,8 @@ void saveSettingsToEEPROM()
EEPROM.write(327, ntpEnabled);
//328 reserved for timezone setting
//329 reserved for dst setting
EEPROM.write(330, useGammaCorrectionBri);
EEPROM.write(331, useGammaCorrectionRGB);
EEPROM.commit();
}
@ -179,4 +181,6 @@ void loadSettingsFromEEPROM()
effectDefault = EEPROM.read(324); effectCurrent = effectDefault;
effectSpeedDefault = EEPROM.read(325); effectSpeed = effectSpeedDefault;
ntpEnabled = EEPROM.read(327);
useGammaCorrectionBri = EEPROM.read(330);
useGammaCorrectionRGB = EEPROM.read(331);
}

Wyświetl plik

@ -115,6 +115,11 @@ void XML_response_settings()
resp = resp + "<sxdef>";
resp = resp + effectSpeedDefault;
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 + bool2int(buttonEnabled);
resp = resp + "</btnon><tfade>";

Wyświetl plik

@ -138,6 +138,8 @@ void handleSettingsSet()
if (i >= 0 && i <= 255) effectSpeedDefault = i;
}
}
useGammaCorrectionBri = server.hasArg("GCBRI");
useGammaCorrectionRGB = server.hasArg("GCRGB");
buttonEnabled = server.hasArg("BTNON");
fadeTransition = server.hasArg("TFADE");
if (server.hasArg("TDLAY"))
@ -194,7 +196,7 @@ void handleSettingsSet()
boolean handleSet(String req)
{
boolean effectUpdated = false;
if (!(req.indexOf("ajax_in") >= 0)) {
if (!(req.indexOf("win") >= 0)) {
if (req.indexOf("get-settings") >= 0)
{
XML_response_settings();

Wyświetl plik

@ -75,7 +75,12 @@ void handleNotifications()
for (int i = 2; i < packetSize -3; i += 4)
{
if (udpIn[i] < LEDCOUNT)
strip.setIndividual(udpIn[i], ((uint32_t)udpIn[i+1] << 16) | ((uint32_t)udpIn[i+2] << 8) | udpIn[i+3]);
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]);
}
}
}
}

Wyświetl plik

@ -5,8 +5,18 @@
void setAllLeds() {
double d = bri_t*bri_n;
int val = d/100;
strip.setBrightness(val);
strip.setColor(col_t[0], col_t[1], col_t[2]);
if (useGammaCorrectionBri)
{
strip.setBrightness(gamma8[val]);
} else {
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]);
}
}
void setLedsStandard()