device config in python files instead
Haldean Brown
3 years ago
18 | 18 | import time |
19 | 19 | import traceback |
20 | 20 | |
21 | try: | |
22 | import deviceconfig | |
23 | except ImportError: | |
24 | import defaultconfig as deviceconfig | |
25 | ||
21 | 26 | |
22 | 27 | class SerialError(Exception): |
23 | 28 | pass |
31 | 36 | except Exception as e: |
32 | 37 | raise SerialError(e) |
33 | 38 | |
39 | def set_brightness(self, b): | |
40 | if b > deviceconfig.MAX_BRIGHT: | |
41 | b = deviceconfig.MAX_BRIGHT | |
42 | super().set_brightness(b) | |
43 | ||
34 | 44 | |
35 | 45 | class Bitpic: |
36 | 46 | def __init__(self): |
37 | self._sid = None | |
47 | self.sid = deviceconfig.SID | |
38 | 48 | print("starting bitpic with screen ID {}".format(self.sid)) |
39 | 49 | self.new_screen = None |
40 | 50 | self.current_screen = None |
119 | 129 | if now.month == 11 and now.day == 21 and SID == "mnd": |
120 | 130 | return animtype(anims.KCS) |
121 | 131 | 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 | |
133 | 132 | |
134 | 133 | def load(self, sid=None): |
135 | 134 | if sid is None: |