66import display as lcd
77import utils
88
9- VERSION = "v0.3.8 "
9+ VERSION = "v0.3.9 "
1010
1111_BUTTON_A_PIN = const (39 )
1212_BUTTON_B_PIN = const (38 )
@@ -20,7 +20,7 @@ def __init__(self, pin, dbtime=50):
2020 from machine import Pin
2121 self ._pin = Pin (pin )
2222 self ._pin .init (Pin .IN )
23- self ._pin .irq (trigger = (Pin .IRQ_FALLING | Pin .IRQ_RISING ), handler = self . irq_cb )
23+ self ._pin .irq (self . irq_cb , (Pin .IRQ_FALLING | Pin .IRQ_RISING ))
2424 self ._wasPressed_cb = None
2525 self ._wasReleased_cb = None
2626 self ._releasedFor_cb = None
@@ -111,7 +111,6 @@ def releasedFor(self, timeout, callback=None):
111111 self ._releasedFor_cb = callback
112112
113113
114-
115114class Speaker :
116115 def __init__ (self , pin = 25 , volume = 2 ):
117116 self .pwm = machine .PWM (machine .Pin (pin ), 1 , 0 , 0 )
@@ -133,14 +132,13 @@ def volume(self, val):
133132 self ._volume = val * 10
134133
135134
136- #
137- def fimage (x , y , file ):
135+ def fimage (x , y , file , type = 1 ):
138136 if file [:3 ] == '/sd' :
139- utils .filecp (file , '/flash/fcache' , blocksize = 4096 )
140- lcd .image (x , y , '/flash/fcache' , 0 , lcd . JPG )
137+ utils .filecp (file , '/flash/fcache' , blocksize = 8192 )
138+ lcd .image (x , y , '/flash/fcache' , 0 , type )
141139 os .remove ('/flash/fcache' )
142140 else :
143- lcd .image (x , y , file , 0 , lcd . JPG )
141+ lcd .image (x , y , file , 0 , type )
144142
145143
146144def delay (ms ):
@@ -156,9 +154,9 @@ def delay(ms):
156154
157155# LCD
158156lcd = lcd .TFT ()
159- lcd .init (lcd .M5STACK , width = 240 , height = 320 , rst_pin = 33 , backl_pin = 32 , miso = 19 , mosi = 23 , clk = 18 , cs = 14 , dc = 27 , bgr = True , backl_on = 1 , invrot = 3 )
157+ lcd .init (lcd .M5STACK , width = 240 , height = 320 , speed = 27000000 , rst_pin = 33 , backl_pin = 32 , miso = 19 , mosi = 23 , clk = 18 , cs = 14 , dc = 27 , bgr = True , backl_on = 1 , invrot = 3 )
160158lcd .clear ()
161- lcd .setBrightness (600 )
159+ lcd .setBrightness (500 )
162160lcd .setColor (0xCCCCCC )
163161lcd .println ('M5Stack MicroPython ' + VERSION , 0 , 0 )
164162lcd .println ('Device ID:' + node_id )
0 commit comments