@@ -159,8 +159,6 @@ class PyCamera: # pylint: disable=too-many-instance-attributes,too-many-public-
159
159
# espcamera.FrameSize.P_FHD, # 1080x1920
160
160
espcamera .FrameSize .QSXGA , # 2560x1920
161
161
)
162
- combined_list = list (zip (resolutions , resolution_to_frame_size ))
163
- print (combined_list )
164
162
165
163
effects = (
166
164
"Normal" ,
@@ -172,7 +170,7 @@ class PyCamera: # pylint: disable=too-many-instance-attributes,too-many-public-
172
170
"Sepia" ,
173
171
"Solarize" ,
174
172
)
175
- modes = ("JPEG" , "GIF" , "STOP" )
173
+ modes = ("JPEG" , "GIF" , "GBOY" , " STOP" )
176
174
177
175
_INIT_SEQUENCE = (
178
176
b"\x01 \x80 \x78 " # _SWRESET and Delay 120ms
@@ -451,7 +449,10 @@ def select_setting(self, setting_name):
451
449
self ._effect_label .background_color = 0x0
452
450
self ._res_label .color = 0xFFFFFF
453
451
self ._res_label .background_color = 0x0
454
- self ._res_label .text = self .resolutions [self ._resolution ]
452
+ if self .mode_text in ("GIF" , "GBOY" ):
453
+ self ._res_label .text = ""
454
+ else :
455
+ self ._res_label .text = self .resolutions [self ._resolution ]
455
456
self ._mode_label .color = 0xFFFFFF
456
457
self ._mode_label .background_color = 0x0
457
458
if setting_name == "effect" :
@@ -490,7 +491,7 @@ def mode(self, setting):
490
491
self ._mode_label .text = self .modes [setting ]
491
492
if self .modes [setting ] == "STOP" :
492
493
self .stop_motion_frame = 0
493
- if self .modes [setting ] == "GIF" :
494
+ if self .modes [setting ] in ( "GIF" , "GBOY" ) :
494
495
self ._res_label .text = ""
495
496
else :
496
497
self .resolution = self .resolution # kick it to reset the display
@@ -531,15 +532,15 @@ def resolution(self, res):
531
532
self ._res_label .text = self .resolutions [res ]
532
533
self .display .refresh ()
533
534
534
- def init_display (self ):
535
+ def init_display (self , reset = True ):
535
536
"""Initialize the TFT display"""
536
537
# construct displayio by hand
537
538
displayio .release_displays ()
538
539
self ._display_bus = displayio .FourWire (
539
540
self ._spi ,
540
541
command = board .TFT_DC ,
541
542
chip_select = board .TFT_CS ,
542
- reset = board .TFT_RESET ,
543
+ reset = board .TFT_RESET if reset else None ,
543
544
baudrate = 60_000_000 ,
544
545
)
545
546
self .display = board .DISPLAY
@@ -567,7 +568,7 @@ def display_message(self, message, color=0xFF0000, scale=3):
567
568
text_area = label .Label (terminalio .FONT , text = message , color = color , scale = scale )
568
569
text_area .anchor_point = (0.5 , 0.5 )
569
570
if not self .display :
570
- self .init_display ()
571
+ self .init_display (None )
571
572
text_area .anchored_position = (self .display .width / 2 , self .display .height / 2 )
572
573
573
574
# Show it
@@ -587,7 +588,9 @@ def mount_sd_card(self):
587
588
self ._card_power .value = True
588
589
card_cs = DigitalInOut (board .CARD_CS )
589
590
card_cs .switch_to_output (False )
590
- # deinit display and SPI
591
+ # deinit display and SPI bus because we need to drive all SD pins LOW
592
+ # to ensure nothing, not even an I/O pin, could possibly power the SD
593
+ # card
591
594
self .deinit_display ()
592
595
self ._spi .deinit ()
593
596
sckpin = DigitalInOut (board .SCK )
@@ -611,7 +614,7 @@ def mount_sd_card(self):
611
614
vfs = storage .VfsFat (self .sdcard )
612
615
print ("mount vfs @" , time .monotonic () - self ._timestamp )
613
616
storage .mount (vfs , "/sd" )
614
- self .init_display ()
617
+ self .init_display (None )
615
618
self ._image_counter = 0
616
619
self ._sd_label .text = "SD OK"
617
620
self ._sd_label .color = 0x00FF00
0 commit comments