瀏覽代碼

reduce brightness even more at night

Thomas Buck 9 月之前
父節點
當前提交
85ba4d1e6f
共有 2 個文件被更改,包括 23 次插入11 次删除
  1. 18
    10
      mapper.py
  2. 5
    1
      util.py

+ 18
- 10
mapper.py 查看文件

151
 
151
 
152
         # TODO ntptime is setting to UTC, host is on proper timezone
152
         # TODO ntptime is setting to UTC, host is on proper timezone
153
         if useNTP:
153
         if useNTP:
154
-            # 8pm utc == 10pm cest germany
155
-            night = (now[0], now[1], now[2], 20, 0, 0, 0, 0)
154
+            # 6pm utc == 8pm cest germany
155
+            evening = (now[0], now[1], now[2], 18, 0, 0, 0, 0)
156
 
156
 
157
-            # 5am utc == 7am cest germany
158
-            morning = (now[0], now[1], now[2], 5, 0, 0, 0, 0)
157
+            # 0am utc == 2am cest germany
158
+            night = (now[0], now[1], now[2], 0, 0, 0, 0, 0)
159
+
160
+            # 6am utc == 8am cest germany
161
+            morning = (now[0], now[1], now[2], 6, 0, 0, 0, 0)
159
         else:
162
         else:
160
-            # 10pm cest germany
161
-            night = (now[0], now[1], now[2], 22, 0, 0, 0, 0)
163
+            # 8pm cest germany
164
+            evening = (now[0], now[1], now[2], 20, 0, 0, 0, 0)
165
+
166
+            # 2am cest germany
167
+            night = (now[0], now[1], now[2], 2, 0, 0, 0, 0)
162
 
168
 
163
-            # 7am cest germany
164
-            morning = (now[0], now[1], now[2], 7, 0, 0, 0, 0)
169
+            # 8am cest germany
170
+            morning = (now[0], now[1], now[2], 8, 0, 0, 0, 0)
165
 
171
 
166
-        if (now > morning) and (now < night):
172
+        if (now >= morning) and (now < evening):
167
             self.factor = 1.0
173
             self.factor = 1.0
168
-        else:
174
+        elif (now >= evening) or (now < night):
169
             self.factor = 0.42
175
             self.factor = 0.42
176
+        else:
177
+            self.factor = 0.1
170
 
178
 
171
     def buttons(self):
179
     def buttons(self):
172
         keys = self.input.get()
180
         keys = self.input.get()

+ 5
- 1
util.py 查看文件

88
 
88
 
89
             # If this fails fall back to the SDL/pygame GUI
89
             # If this fails fall back to the SDL/pygame GUI
90
             from test import TestGUI
90
             from test import TestGUI
91
-            target = TestGUI()
91
+            ui = TestGUI()
92
+
93
+            # TODO hard-coded adjustments
94
+            from mapper import MapperReduceBrightness
95
+            target = MapperReduceBrightness(ui, i)
92
 
96
 
93
             if targetPlatform == None:
97
             if targetPlatform == None:
94
                 # only print once
98
                 # only print once

Loading…
取消
儲存