充能统计添加中间值滤波
修改晶振起振超时时间和flash相关以适应gd32
This commit is contained in:
@@ -416,7 +416,7 @@ class protu(QObject):
|
||||
data_str.clear()
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
# print(recv_str)
|
||||
print(recv_str)
|
||||
# else:
|
||||
# print("len(data)={d1},num_ro_recv={d2}".format(d1=len(data),d2=self.num_to_recv))
|
||||
def send(self,cmd:int,data:bytearray):
|
||||
|
44
python/slave_test.py
Normal file
44
python/slave_test.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import prottcp
|
||||
import time
|
||||
import numpy as np
|
||||
|
||||
|
||||
|
||||
#测试小板功能
|
||||
|
||||
|
||||
|
||||
|
||||
def random():
|
||||
return int(np.random.random_sample()*10000%10000)
|
||||
|
||||
|
||||
|
||||
def numlist_to_str(numlist:list):
|
||||
s=""
|
||||
for i in numlist:
|
||||
s+=str(i)+','
|
||||
return s[:-1]
|
||||
|
||||
|
||||
def randomlist(num:int):
|
||||
l=[]
|
||||
for i in range(num):
|
||||
l.append(random())
|
||||
return l
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
u=prottcp.protu()
|
||||
u.init("com11:38400")
|
||||
u.start_recv()
|
||||
for i in range(10):
|
||||
s='test '+numlist_to_str(randomlist(20))
|
||||
print("send:",s)
|
||||
u.send_str(s)
|
||||
time.sleep(1)
|
||||
u.close()
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user