|
34 | 34 | import board
|
35 | 35 | import adafruit_dotstar as dotstar
|
36 | 36 |
|
37 |
| -# Library Function Ideas |
38 |
| -# Gradient (probably just for example) |
39 |
| -# 20 40 60 80 100 |
40 |
| - |
41 | 37 | class DotStarFeatherWing:
|
42 | 38 | """Class representing a `DotStar FeatherWing
|
43 | 39 | <https://www.adafruit.com/product/3449>`_.
|
@@ -163,35 +159,35 @@ def shift_right(self, rotate=False):
|
163 | 159 | for y in range(0, self.rows):
|
164 | 160 | for x in range(self.columns - 1, 0, -1):
|
165 | 161 | self._dotstar[y * self.columns + x] = self._dotstar[y * self.columns + x - 1]
|
166 |
| - lastPixel = self._dotstar[(y + 1) * self.columns - 1] if rotate else 0 |
167 |
| - self._dotstar[y * self.columns] = lastPixel |
| 162 | + last_pixel = self._dotstar[(y + 1) * self.columns - 1] if rotate else 0 |
| 163 | + self._dotstar[y * self.columns] = last_pixel |
168 | 164 | self._update()
|
169 | 165 |
|
170 | 166 | def shift_left(self, rotate=False):
|
171 | 167 | """Shift all pixels left"""
|
172 | 168 | for y in range(0, self.rows):
|
173 | 169 | for x in range(0, self.columns - 1):
|
174 | 170 | self._dotstar[y * self.columns + x] = self._dotstar[y * self.columns + x + 1]
|
175 |
| - lastPixel = self._dotstar[y * self.columns] if rotate else 0 |
176 |
| - self._dotstar[(y + 1) * self.columns - 1] = lastPixel |
| 171 | + last_pixel = self._dotstar[y * self.columns] if rotate else 0 |
| 172 | + self._dotstar[(y + 1) * self.columns - 1] = last_pixel |
177 | 173 | self._update()
|
178 | 174 |
|
179 | 175 | def shift_up(self, rotate=False):
|
180 | 176 | """Shift all pixels up"""
|
181 | 177 | for x in range(0, self.columns):
|
182 | 178 | for y in range(self.rows - 1, 0, -1):
|
183 | 179 | self._dotstar[y * self.columns + x] = self._dotstar[(y - 1) * self.columns + x]
|
184 |
| - lastPixel = self._dotstar[(self.rows - 1) * self.columns + x] if rotate else 0 |
185 |
| - self._dotstar[x] = lastPixel |
| 180 | + last_pixel = self._dotstar[(self.rows - 1) * self.columns + x] if rotate else 0 |
| 181 | + self._dotstar[x] = last_pixel |
186 | 182 | self._update()
|
187 | 183 |
|
188 | 184 | def shift_down(self, rotate=False):
|
189 | 185 | """Shift all pixels down"""
|
190 | 186 | for x in range(0, self.columns):
|
191 | 187 | for y in range(0, self.rows - 1):
|
192 | 188 | self._dotstar[y * self.columns + x] = self._dotstar[(y + 1) * self.columns + x]
|
193 |
| - lastPixel = self._dotstar[x] if rotate else 0 |
194 |
| - self._dotstar[(self.rows - 1) * self.columns + x] = lastPixel |
| 189 | + last_pixel = self._dotstar[x] if rotate else 0 |
| 190 | + self._dotstar[(self.rows - 1) * self.columns + x] = last_pixel |
195 | 191 | self._update()
|
196 | 192 |
|
197 | 193 | def _update(self):
|
|
0 commit comments