增加TVOC检测库,修复ASR声音采集
This commit is contained in:
@@ -104,3 +104,7 @@ class AI:
|
||||
self._ai.delete(_id)
|
||||
else:
|
||||
raise AttributeError('This model can only run face recognition')
|
||||
|
||||
def stop(self):
|
||||
if self._ai is not None:
|
||||
self._ai.stop()
|
||||
|
||||
@@ -156,9 +156,11 @@ class LED:
|
||||
onboard_led = LED(onboard_bot.led_pwm)
|
||||
|
||||
class Voice_Energy:
|
||||
def read(self):
|
||||
_dat = onboard_asr._rreg(0x08, 3) #在语音识别里获取
|
||||
return (_dat[0] | _dat[1] << 8) // 10
|
||||
def read(self, samples=10):
|
||||
values = []
|
||||
for _ in range(samples):
|
||||
values.append(int.from_bytes(onboard_asr._rreg(0x08, 3)[:2], 'little')) #在语音识别里获取
|
||||
return sorted(values)[samples // 2]
|
||||
|
||||
onboard_sound = Voice_Energy()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user