added color correction

This commit is contained in:
Florian Schlegel 2014-10-31 23:17:52 +01:00
parent e5caab5692
commit ef0f57fd0d
2 changed files with 14 additions and 1 deletions

View File

@ -22,6 +22,11 @@ if(!in_array($mode, ['s', 'y', 'f'])) {
$mode = 's';
}
$stromstoss = $_GET['stromstoss'];
if(!$stromstoss==1) {
$stromstoss = 0;
}
$red = hexdec(substr($value, 0, 2));
$green = hexdec(substr($value, 2, 2));
$blue = hexdec(substr($value, 4, 2));
@ -37,6 +42,12 @@ if(is_int($step)) {
echo "\n";
}
if($stromstoss==0) {
$red=$red;
$green=$green*200/255;
$blue=$blue*128/255;
}
echo $url . '5' . '%20' . $red . '%20' . $mode . "\n";
echo http_response($ch, $url . '5' . '%20' . $red . '%20' . $mode);
echo "\n";

View File

@ -62,6 +62,8 @@
<label for="mode-instant">Sofort</label>
<input id="mode-fade" name="mode" type="radio" value="f" checked="checked">
<label for="mode-fade">Geschmeidig</label><br />
<input id="mode-stromstoss" name="stromstoss" type="checkbox" value="1">
<label for="mode-stromstoss">Stromstoß</label><br />
<button type="submit" id="submit">Erhelle mich!</button>
</form>
</div>
@ -88,7 +90,7 @@
values[data[i]['name']] = data[i]['value'];
};
$.get('color.php' ,{'value': values['color'], 'mode': values['mode'], 'fadestep': values['fadestep']});
$.get('color.php' ,{'value': values['color'], 'mode': values['mode'], 'fadestep': values['fadestep'], 'stromstoss': values['stromstoss']});
};
$('#changeLight').submit(callback);
$('#submit').on('click,enter', callback);