Skip to content

Commit 1c3ceb2

Browse files
committed
update 1956 mpython.py
1 parent 949dbc9 commit 1c3ceb2

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

port/boards/labplus_1956/modules/mpython.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ def _get_raw(self):
210210
self.i2c.writeto(self.addr, b'\x00', False)
211211
buf = self.i2c.readfrom(self.addr, 6)
212212
data = ustruct.unpack('>3H', buf)
213-
print(data)
214213

215214
self.i2c.writeto(self.addr, b'\x09\x10', True) #reset
216215

@@ -224,7 +223,6 @@ def _get_raw(self):
224223
self.i2c.writeto(self.addr, b'\x00', False)
225224
buf = self.i2c.readfrom(self.addr, 6)
226225
data1 = ustruct.unpack('>3H', buf)
227-
print(data1)
228226

229227
self.raw_x = -((data[0] - data1[0])/2)
230228
self.raw_y = -((data[1] - data1[1])/2)
@@ -273,12 +271,7 @@ def get_field_strength(self):
273271
return (math.sqrt(self.raw_x * self.raw_x + self.raw_y * self.raw_y + self.raw_z * self.raw_z))*0.25
274272

275273
def calibrate(self):
276-
oled.fill(0)
277-
oled.DispChar("步骤1:", 0,0,1)
278-
oled.DispChar("如图",0,26,1)
279-
oled.DispChar("转几周",0,43,1)
280-
oled.bitmap(64,0,calibrate_img.rotate,64,64,1)
281-
oled.show()
274+
282275
self._get_raw()
283276
min_x = max_x = self.raw_x
284277
min_y = max_y = self.raw_y
@@ -294,12 +287,6 @@ def calibrate(self):
294287
self.cali_offset_x = (max_x + min_x) / 2
295288
self.cali_offset_y = (max_y + min_y) / 2
296289
print('cali_offset_x: ' + str(self.cali_offset_x) + ' cali_offset_y: ' + str(self.cali_offset_y))
297-
oled.fill(0)
298-
oled.DispChar("步骤2:", 85,0,1)
299-
oled.DispChar("如图",85,26,1)
300-
oled.DispChar("转几周",85,43,1)
301-
oled.bitmap(0,0,calibrate_img.rotate1,64,64,1)
302-
oled.show()
303290
ticks_start = time.ticks_ms()
304291
while (time.ticks_diff(time.ticks_ms(), ticks_start) < 15000) :
305292
self._get_raw()
@@ -313,10 +300,7 @@ def calibrate(self):
313300
print('cali_offset_z: ' + str(self.cali_offset_z))
314301
# print('cali_offset_y: ' + str(self.cali_offset_y))
315302

316-
oled.fill(0)
317-
oled.DispChar("校准完成", 40,24,1)
318-
oled.show()
319-
oled.fill(0)
303+
320304

321305
def get_heading(self):
322306
self._get_raw()
@@ -633,6 +617,10 @@ def disable_APWiFi(self):
633617
light = ADC(Pin(39))
634618
light.atten(light.ATTN_11DB)
635619

620+
# sound sensor
621+
sound = ADC(Pin(36))
622+
sound.atten(sound.ATTN_11DB)
623+
636624
# buttons
637625
button_a = Pin(0, Pin.IN, Pin.PULL_UP)
638626
button_b = Pin(2, Pin.IN, Pin.PULL_UP)

0 commit comments

Comments
 (0)