5
5
import board
6
6
from digitalio import DigitalInOut , Direction , Pull
7
7
from adafruit_debouncer import Debouncer
8
+ import bitmaptools
8
9
import busio
9
10
import adafruit_lis3dh
10
11
import neopixel
@@ -76,7 +77,7 @@ class PyCamera:
76
77
espcamera .FrameSize .QSXGA ,
77
78
]
78
79
79
- effects = ("Normal" , "Negative " , "Grayscale " , "Reddish" , "Greenish" , "Bluish" , "Sepia" , "Overexp" , "Solarize " )
80
+ effects = ("Normal" , "Invert " , "B&W " , "Reddish" , "Greenish" , "Bluish" , "Sepia" )
80
81
modes = ("JPEG" , "GIF" , "STOP" )
81
82
82
83
_AW_DOWN = const (15 )
@@ -135,7 +136,7 @@ def __init__(self) -> None:
135
136
136
137
self .splash = displayio .Group ()
137
138
self ._sd_label = label .Label (terminalio .FONT , text = "SD ??" , color = 0x0 , x = 180 , y = 10 , scale = 2 )
138
- self ._effect_label = label .Label (terminalio .FONT , text = "" , color = 0xFFFFFF , x = 4 , y = 10 , scale = 2 )
139
+ self ._effect_label = label .Label (terminalio .FONT , text = "EFFECT " , color = 0xFFFFFF , x = 4 , y = 10 , scale = 2 )
139
140
self ._mode_label = label .Label (terminalio .FONT , text = "MODE" , color = 0xFFFFFF , x = 150 , y = 10 , scale = 2 )
140
141
141
142
# AW9523 GPIO expander
@@ -227,8 +228,6 @@ def __init__(self) -> None:
227
228
self .right = Debouncer (self .right_pin )
228
229
229
230
self ._bigbuf = None
230
- self ._bitmap1 = displayio .Bitmap (240 , 176 , 65535 )
231
- self ._bitmap2 = displayio .Bitmap (240 , 176 , 65535 )
232
231
233
232
self ._topbar = displayio .Group ()
234
233
self ._res_label = label .Label (terminalio .FONT , text = "" , color = 0xFFFFFF , x = 0 , y = 10 , scale = 2 )
@@ -245,8 +244,8 @@ def __init__(self) -> None:
245
244
self .display .refresh ()
246
245
247
246
#self.camera.colorbar = True
248
- # self.effect = microcontroller.nvm[_NVM_EFFECT]
249
- # self.camera.saturation = 3
247
+ self .effect = microcontroller .nvm [_NVM_EFFECT ]
248
+ self .camera .saturation = 3
250
249
self .resolution = microcontroller .nvm [_NVM_RESOLUTION ]
251
250
self .mode = microcontroller .nvm [_NVM_MODE ]
252
251
print ("init done @" , time .monotonic ()- self .t )
@@ -301,7 +300,7 @@ def effect(self, setting):
301
300
setting = (setting + len (self .effects )) % len (self .effects )
302
301
self ._effect = setting
303
302
self ._effect_label .text = self .effects [setting ]
304
- self .camera .effect = setting
303
+ self .camera .special_effect = setting
305
304
microcontroller .nvm [_NVM_EFFECT ] = setting
306
305
self .display .refresh ()
307
306
@@ -473,10 +472,10 @@ def capture_jpeg(self):
473
472
474
473
def continuous_capture_start (self ):
475
474
self ._bitmap1 = self .camera .take (1 )
476
- #self.camera._imagecapture.continuous_capture_start(self._bitmap1, self._bitmap2)
477
475
478
476
def capture_into_bitmap (self , bitmap ):
479
- self .camera .capture (bitmap )
477
+ self ._bitmap1 = self .camera .take (1 )
478
+ bitmaptools .blit (bitmap , self ._bitmap1 , 0 , 0 )
480
479
481
480
def continuous_capture (self ):
482
481
return self .camera .take (1 )
0 commit comments