去掉静默录音前面数据杂音的问题
authordxy <1731678236qq.com>
Tue, 19 Aug 2025 02:51:05 +0000 (10:51 +0800)
committerdxy <1731678236qq.com>
Tue, 19 Aug 2025 02:51:05 +0000 (10:51 +0800)
2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py
2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/voice_record.py

index a0f5890..beac9ba 100644 (file)
@@ -1162,6 +1162,7 @@ class SockMangager(Abstract):
         self.iot_web_protoclo_recv_id=None
         self.iot_protocol_client = None
         self.connect_web_timer = osTimer() 
+        self.connect_web_timer_count = 0
         self.hr_report_timer = osTimer()
         self.resolver = None
         self.timerHr = 0
@@ -1537,6 +1538,7 @@ class SockMangager(Abstract):
 
         try:
             if token != None:
+                self.connect_web_timer_count = 0
                 url_t = "ws://220.160.104.34:30800/ws-hub/dev/v1?qp-dt={}".format(token)
                 try:
                     self.iot_protocol_client=uwebsocket.Client.connect(url_t, debug=True)
@@ -1572,7 +1574,12 @@ class SockMangager(Abstract):
                     if self.timer_id == 0:
                         self.hr_report_timer.start(DEFINE_TIME_COUNT*1000, 1, self.hr_report_event)
                         self.timer_id=1
-                
+            else:
+                print("没有token!!!!!!!!!!")
+                self.connect_web_timer_count+=1
+                if self.connect_web_timer_count <= 10:
+                    self.connect_web_timer.start(5000,0,self.iot_web_connect_timerCb)
+                pass
         except Exception as e:   
             self.iot_protocol_client = None
             print("connect_iot_websocket error")
index 2b82716..bba0fdf 100644 (file)
@@ -144,6 +144,7 @@ class VOICE_RECORD(Abstract): #静默录音
         EventMesh.publish("wakeup_BT")
         self.record_len_tmp = 0
         self.record_fd_len = 0
+        self.del_datat_len = 0
         while True:
             try:
                 
@@ -151,6 +152,9 @@ class VOICE_RECORD(Abstract): #静默录音
                 Record_read_buf = bytearray(self.Audio_buf_size)
                 Record_len = 0
                 Record_len = self.record.stream_read(Record_read_buf, self.Audio_buf_size)
+                if self.del_datat_len <20000:
+                    self.del_datat_len+=Record_len
+                    continue
                 if Record_len > 0:
                     read_buf = bytes(Record_read_buf[:Record_len])