|
@@ -24,7 +24,7 @@ def cal(v, c):
|
24
|
24
|
return c[1] + c[0] * c_in[0] * max(0, c_in[1] + v)
|
25
|
25
|
|
26
|
26
|
def filter_lux(old, new):
|
27
|
|
- return (old * filter_fact) + (new * (1.0 - filter_fact))
|
|
27
|
+ return max(0.1, (old * filter_fact) + (new * (1.0 - filter_fact)))
|
28
|
28
|
|
29
|
29
|
def lux_to_disp(name, val):
|
30
|
30
|
if name in calibration:
|
|
@@ -93,10 +93,17 @@ if __name__ == "__main__":
|
93
|
93
|
if (time.time() - time_window) > 20.0:
|
94
|
94
|
time_window = time.time()
|
95
|
95
|
info = window.query()
|
|
96
|
+
|
96
|
97
|
if info["fullscreen"] and is_active:
|
97
|
|
- print("App \"{}\" is now fullscreen! Pausing.".format(info["name"]))
|
|
98
|
+ print("{}: App \"{}\" is now fullscreen! Pausing.".format(time.ctime(), info["name"]))
|
|
99
|
+
|
98
|
100
|
if (not info["fullscreen"]) and (not is_active):
|
99
|
|
- print("No longer fullscreen. Continuing.")
|
|
101
|
+ print("{}: No longer fullscreen. Continuing.".format(time.ctime()))
|
|
102
|
+
|
|
103
|
+ # re-apply previous brightness values soon
|
|
104
|
+ for d in disps:
|
|
105
|
+ d["prev"] = -1
|
|
106
|
+
|
100
|
107
|
is_active = not info["fullscreen"]
|
101
|
108
|
|
102
|
109
|
# set displays at most every 10s
|
|
@@ -114,4 +121,4 @@ if __name__ == "__main__":
|
114
|
121
|
print(e)
|
115
|
122
|
|
116
|
123
|
# set to zero to show display is disconnected
|
117
|
|
- d["prev"] = 0
|
|
124
|
+ d["prev"] = -1
|