mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-28 16:20:26 +00:00
Hint missing import, exit on error.
This commit is contained in:
parent
256ccc4757
commit
08f9e4e0c8
@ -1,8 +1,13 @@
|
|||||||
# Install python3 HID package https://pypi.org/project/hid/
|
# Install python3 HID package https://pypi.org/project/hid/
|
||||||
import hid
|
# Install python3 matplotlib package https://pypi.org/project/matplotlib/
|
||||||
|
|
||||||
from ctypes import *
|
from ctypes import *
|
||||||
import matplotlib.pyplot as plt
|
try:
|
||||||
import matplotlib.animation as animation
|
import hid
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import matplotlib.animation as animation
|
||||||
|
except:
|
||||||
|
print("Missing import, please try 'pip install hid matplotlib' or consult your OS's python package manager.")
|
||||||
|
|
||||||
# Example must be compiled with CFG_AUDIO_DEBUG=1
|
# Example must be compiled with CFG_AUDIO_DEBUG=1
|
||||||
VID = 0xcafe
|
VID = 0xcafe
|
||||||
@ -32,15 +37,16 @@ if dev:
|
|||||||
def animate(i):
|
def animate(i):
|
||||||
info = None
|
info = None
|
||||||
for i in range(30):
|
for i in range(30):
|
||||||
str_in = dev.read(64, 10)
|
try:
|
||||||
if str_in:
|
str_in = dev.read(64, 50)
|
||||||
info = audio_debug_info_t.from_buffer_copy(str_in)
|
info = audio_debug_info_t.from_buffer_copy(str_in)
|
||||||
|
|
||||||
global fifo_avg
|
global fifo_avg
|
||||||
global fifo_cnt
|
global fifo_cnt
|
||||||
fifo_avg.append(info.fifo_count_avg)
|
fifo_avg.append(info.fifo_count_avg)
|
||||||
fifo_cnt.append(info.fifo_count)
|
fifo_cnt.append(info.fifo_count)
|
||||||
|
except:
|
||||||
|
exit(1)
|
||||||
# Limit to 1000 items
|
# Limit to 1000 items
|
||||||
fifo_avg = fifo_avg[-1000:]
|
fifo_avg = fifo_avg[-1000:]
|
||||||
fifo_cnt = fifo_cnt[-1000:]
|
fifo_cnt = fifo_cnt[-1000:]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user