git.haldean.org bitpic / a07e622
device config in python files instead Haldean Brown 11 months ago
3 changed file(s) with 14 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
00 *.pyc
11 __pycache__
22 sid.txt
3 deviceconfig.py
0 SID="__default"
1 MAX_BRIGHT=135
1818 import time
1919 import traceback
2020
21 try:
22 import deviceconfig
23 except ImportError:
24 import defaultconfig as deviceconfig
25
2126
2227 class SerialError(Exception):
2328 pass
3136 except Exception as e:
3237 raise SerialError(e)
3338
39 def set_brightness(self, b):
40 if b > deviceconfig.MAX_BRIGHT:
41 b = deviceconfig.MAX_BRIGHT
42 super().set_brightness(b)
43
3444
3545 class Bitpic:
3646 def __init__(self):
37 self._sid = None
47 self.sid = deviceconfig.SID
3848 print("starting bitpic with screen ID {}".format(self.sid))
3949 self.new_screen = None
4050 self.current_screen = None
119129 if now.month == 11 and now.day == 21 and SID == "mnd":
120130 return animtype(anims.KCS)
121131 return None
122
123 @property
124 def sid(self):
125 if self._sid is not None:
126 return self._sid
127 try:
128 with open("sid.txt") as sid_f:
129 self._sid = sid_f.read().strip()
130 return self._sid
131 except IOError:
132 return screen.DEFAULT_SID
133132
134133 def load(self, sid=None):
135134 if sid is None: