From 26cddb076d053b3945b408e86a89fc4a7099ce59 Mon Sep 17 00:00:00 2001 From: zart Date: Fri, 28 Jun 2024 11:51:03 +0800 Subject: [PATCH] msg MQTT message --- edu_coder/extur_edu.py | 7 +++++-- smp_coder/mqtt_smp.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/edu_coder/extur_edu.py b/edu_coder/extur_edu.py index 029fd63..e1617c4 100644 --- a/edu_coder/extur_edu.py +++ b/edu_coder/extur_edu.py @@ -34,8 +34,11 @@ def on_message(client, userdata, msg): f.write(msg.payload) print("图片已保存。") - global response_received - response_received = True + client.loop_stop() + client.disconnect() + + # global response_received + # response_received = True try: diff --git a/smp_coder/mqtt_smp.py b/smp_coder/mqtt_smp.py index 072c5da..82ceb9d 100644 --- a/smp_coder/mqtt_smp.py +++ b/smp_coder/mqtt_smp.py @@ -61,7 +61,7 @@ with open("logex.txt", "w") as log_file: print("启动树莓派拍照客户端成功。") -client.publish("response/topic", "启动树莓派拍照客户端成功", qos=2) +client.publish("response/topic", "smp_coder started successfully!", qos=2) # 停止网络循环并断开连接 client.loop_stop()