|
72 | 72 | _NVM_EFFECT = const(2)
|
73 | 73 | _NVM_MODE = const(3)
|
74 | 74 | _NVM_TIMELAPSE_RATE = const(4)
|
| 75 | +_NVM_TIMELAPSE_SUBMODE = const(5) |
75 | 76 |
|
76 | 77 |
|
77 | 78 | class PyCameraBase: # pylint: disable=too-many-instance-attributes,too-many-public-methods
|
@@ -186,6 +187,12 @@ class PyCameraBase: # pylint: disable=too-many-instance-attributes,too-many-pub
|
186 | 187 | 60 * 30,
|
187 | 188 | 60 * 60
|
188 | 189 | )
|
| 190 | + |
| 191 | + timelapse_submodes = ( |
| 192 | + "HiPwr", |
| 193 | + "MedPwr", |
| 194 | + "LowPwr" |
| 195 | + ) |
189 | 196 |
|
190 | 197 | modes = ("JPEG", "GIF", "GBOY", "STOP", "LAPS")
|
191 | 198 |
|
@@ -288,16 +295,18 @@ def make_camera_ui(self):
|
288 | 295 | self._botbar.append(self._mode_label)
|
289 | 296 |
|
290 | 297 | self._timelapsebar = displayio.Group(x=0, y=180)
|
| 298 | + self._timelapse_submode_label = label.Label( |
| 299 | + terminalio.FONT, text="SubM", color=0xFFFFFF,x=160, y=10, scale=2 |
| 300 | + ) |
291 | 301 | self._timelapse_rate_label = label.Label(
|
292 | 302 | terminalio.FONT, text="Time", color=0xFFFFFF,x=90, y=10, scale=2
|
293 | 303 | )
|
294 |
| - self._timelapse_rate_label.background_color = None |
295 | 304 | self._timelapsestatus_label = label.Label(
|
296 | 305 | terminalio.FONT, text="Status", color=0xFFFFFF, x=0, y=10, scale=2
|
297 | 306 | )
|
298 |
| - self._timelapsestatus_label.background_color = None |
299 | 307 | self._timelapsebar.append(self._timelapse_rate_label)
|
300 | 308 | self._timelapsebar.append(self._timelapsestatus_label)
|
| 309 | + self._timelapsebar.append(self._timelapse_submode_label) |
301 | 310 |
|
302 | 311 | self.splash.append(self._topbar)
|
303 | 312 | self.splash.append(self._botbar)
|
@@ -371,6 +380,7 @@ def init_camera(self, init_autofocus=True) -> None:
|
371 | 380 | self.resolution = microcontroller.nvm[_NVM_RESOLUTION]
|
372 | 381 | self.mode = microcontroller.nvm[_NVM_MODE]
|
373 | 382 | self.timelapse_rate = microcontroller.nvm[_NVM_TIMELAPSE_RATE]
|
| 383 | + self.timelapse_submode = microcontroller.nvm[_NVM_TIMELAPSE_SUBMODE] |
374 | 384 |
|
375 | 385 | if init_autofocus:
|
376 | 386 | self.autofocus_init()
|
@@ -599,6 +609,18 @@ def timelapse_rate(self, setting):
|
599 | 609 | self.display.refresh()
|
600 | 610 |
|
601 | 611 |
|
| 612 | + @property |
| 613 | + def timelapse_submode(self): |
| 614 | + """Get or set the power mode for timelapsing""" |
| 615 | + return self._timelapse_submode |
| 616 | + |
| 617 | + @timelapse_submode.setter |
| 618 | + def timelapse_submode(self, setting): |
| 619 | + setting = (setting + len(self.timelapse_submodes)) % len(self.timelapse_submodes) |
| 620 | + self._timelapse_submode = setting |
| 621 | + self._timelapse_submode_label.text = self.timelapse_submodes[self._timelapse_submode] |
| 622 | + microcontroller.nvm[_NVM_TIMELAPSE_SUBMODE] = setting |
| 623 | + |
602 | 624 | def init_display(self):
|
603 | 625 | """Initialize the TFT display"""
|
604 | 626 | # construct displayio by hand
|
|
0 commit comments