From d4cd2e21d66cd4379d67d789ea82d6f4a8a4d272 Mon Sep 17 00:00:00 2001 From: linyimin <18316471919@139.com> Date: Tue, 23 Dec 2025 14:24:20 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20=E5=8E=8B=E5=8A=9B=E4=BC=A0=E6=84=9F?= =?UTF-8?q?=E5=99=A8=E6=B7=BB=E5=8A=A03s=E5=8F=AA=E8=83=BD=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E4=B8=80=E6=AC=A1=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index f1ea20c..f442efa 100644 --- a/main.py +++ b/main.py @@ -629,7 +629,7 @@ def tcp_main(): # 处理心跳 ACK elif logged_in and msg_type == 4: last_heartbeat_ack_time = time.ticks_ms() - print("✅ 收到心跳确认") + # print("✅ 收到心跳确认") # 处理业务指令 elif logged_in and isinstance(body, dict): @@ -723,7 +723,7 @@ def tcp_main(): print("💔 心跳发送失败") break last_heartbeat_send_time = current_time - print("💓 心跳已发送") + # print("💓 心跳已发送") # 心跳超时重连 if logged_in and current_time - last_heartbeat_ack_time > 6000: @@ -784,9 +784,17 @@ def cmd_str(): print("系统准备完成...") + last_adc_trigger = 0 + # 主循环:检测扳机触发 → 拍照 → 分析 → 上报 while not app.need_exit(): + current_time = time.ticks_ms() + # print("压力传感器数值: ", adc_obj.read()) if adc_obj.read() > ADC_TRIGGER_THRESHOLD: + diff_ms = current_time-last_adc_trigger + if diff_ms<3000: + continue + last_adc_trigger = current_time time.sleep_ms(60) # 防抖 frame = cam.read() x, y = laser_point