|
@@ -6,8 +6,7 @@ import time
|
6
|
6
|
|
7
|
7
|
filter_fact = 0.9
|
8
|
8
|
|
9
|
|
-# out = out_b + out_a * in_a * (in_b + in)
|
10
|
|
-c_in = 1.0, -40.0, # in_a, in_b
|
|
9
|
+c_in = 0.6, -60.0, # in_a, in_b
|
11
|
10
|
calibration = {
|
12
|
11
|
"HPN:HP 27xq:CNK1072BJY": [
|
13
|
12
|
1.0, 30.0, # out_a, out_b
|
|
@@ -19,7 +18,8 @@ calibration = {
|
19
|
18
|
}
|
20
|
19
|
|
21
|
20
|
def cal(v, c):
|
22
|
|
- return c[1] + c[0] * c_in[0] * (c_in[1] + v)
|
|
21
|
+ # out = out_b + out_a * in_a * max(0, in_b + in)
|
|
22
|
+ return c[1] + c[0] * c_in[0] * max(0, c_in[1] + v)
|
23
|
23
|
|
24
|
24
|
def filter_lux(old, new):
|
25
|
25
|
return (old * filter_fact) + (new * (1.0 - filter_fact))
|
|
@@ -45,7 +45,7 @@ if __name__ == "__main__":
|
45
|
45
|
print("Display \"{}\" at {}".format(d["name"], d["prev"]))
|
46
|
46
|
|
47
|
47
|
print()
|
48
|
|
- print("Starting main loop")
|
|
48
|
+ print("{}: Starting main loop".format(time.ctime()))
|
49
|
49
|
print()
|
50
|
50
|
|
51
|
51
|
while True:
|
|
@@ -55,7 +55,7 @@ if __name__ == "__main__":
|
55
|
55
|
val = lux_to_disp(d["name"], brightness)
|
56
|
56
|
if val != d["prev"]:
|
57
|
57
|
d["prev"] = val
|
58
|
|
- print("Setting \"{}\" to {}".format(d["name"], val))
|
|
58
|
+ print("{}: Setting \"{}\" to {}".format(time.ctime(), d["name"], val))
|
59
|
59
|
ddc.ddc_set(d["id"], val)
|
60
|
60
|
|
61
|
61
|
time.sleep(1.0)
|