diff --git a/FastApi/__pycache__/fastApi.cpython-38.pyc b/FastApi/__pycache__/fastApi.cpython-38.pyc index 2d79698..9929836 100644 Binary files a/FastApi/__pycache__/fastApi.cpython-38.pyc and b/FastApi/__pycache__/fastApi.cpython-38.pyc differ diff --git a/FastApi/fastApi.py b/FastApi/fastApi.py index 81c414a..0622706 100644 --- a/FastApi/fastApi.py +++ b/FastApi/fastApi.py @@ -37,10 +37,15 @@ async def websocket_distance(websocket: WebSocket): # except Exception as log_e: # print(f"日志写入失败: {log_e}") #调用 Modbus 可执行文件 - result = subprocess.run( - [MODBUS_BIN_PATH, str(int(distance))], - capture_output=True, text=True, timeout=5 + # print(f"调用 Modbus 程序,传递距离: {distance}") + signal = "echo 'orangepi' | sudo "+ MODBUS_BIN_PATH + result = subprocess.run( + [signal], + # shell=True,ocapture_output=True, text=True, timeout=0 + shell=True ) + # print("signal:", signal) + # print(f"Modbus 程序返回: {result.stdout.strip()}, 错误: {result.stderr.strip()}") if result.returncode != 0: # 发送错误信息给客户端 await websocket.send_json({ diff --git a/GPIOSignal/bin/sendGpioSignal b/GPIOSignal/bin/sendGpioSignal index 710d4dc..6708e27 100755 Binary files a/GPIOSignal/bin/sendGpioSignal and b/GPIOSignal/bin/sendGpioSignal differ diff --git a/GPIOSignal/src/sendGpioSignal.cpp b/GPIOSignal/src/sendGpioSignal.cpp index a720a4f..41cc24f 100644 --- a/GPIOSignal/src/sendGpioSignal.cpp +++ b/GPIOSignal/src/sendGpioSignal.cpp @@ -5,6 +5,7 @@ */ #include +#include #include #include "/home/orangepi/RKApp/ApCreate/NetraLib/include/Netra.hpp" @@ -56,6 +57,11 @@ int main(int argc, char *argv[]) WriteGpio(GPIO_Pin2, value); cout << "[sendGpioSignal] 完成" << endl; + this_thread::sleep_for(chrono::milliseconds(100)); + + WriteGpio(GPIO_Pin1, !value); + WriteGpio(GPIO_Pin2, !value); + return 0; } diff --git a/PyApp/upload.log b/PyApp/upload.log index f733db6..8db1e5f 100644 --- a/PyApp/upload.log +++ b/PyApp/upload.log @@ -255,3 +255,83 @@ 2025-10-08 12:47:29 - 上传图片 /mnt/save/warning/warning_20251008_124723.jpg 时出错: timed out 2025-10-08 12:48:24 - 开始上传图片: /mnt/save/warning/warning_20251008_124823.jpg 2025-10-08 12:48:30 - 上传图片 /mnt/save/warning/warning_20251008_124823.jpg 时出错: timed out +2025-10-08 13:26:19 - 开始上传图片: /mnt/save/warning/warning_20251008_132618.jpg +2025-10-08 13:26:19 - 串口读取失败: device reports readiness to read but returned no data (device disconnected or multiple access on port?) +2025-10-08 13:26:19 - 使用经纬度上传: lon=1201, lat=3129 +2025-10-08 13:26:20 - 数据库插入成功 +2025-10-08 13:26:20 - 上传线程结束: /mnt/save/warning/warning_20251008_132618.jpg: 成功! +2025-10-08 13:50:04 - 开始上传图片: /mnt/save/warning/warning_20251008_135004.jpg +2025-10-08 13:50:04 - 串口读取失败: device reports readiness to read but returned no data (device disconnected or multiple access on port?) +2025-10-08 13:50:04 - 使用经纬度上传: lon=1201, lat=3129 +2025-10-08 13:50:04 - 数据库插入成功 +2025-10-08 13:50:04 - 上传线程结束: /mnt/save/warning/warning_20251008_135004.jpg: 成功! +2025-10-08 13:52:16 - 开始上传图片: /mnt/save/warning/warning_20251008_135216.jpg +2025-10-08 13:52:16 - 串口读取失败: device reports readiness to read but returned no data (device disconnected or multiple access on port?) +2025-10-08 13:52:16 - 使用经纬度上传: lon=1201, lat=3129 +2025-10-08 13:52:17 - 数据库插入成功 +2025-10-08 13:52:17 - 上传线程结束: /mnt/save/warning/warning_20251008_135216.jpg: 成功! +2025-10-08 13:54:23 - 开始上传图片: /mnt/save/warning/warning_20251008_135422.jpg +2025-10-08 13:54:23 - 串口读取失败: device reports readiness to read but returned no data (device disconnected or multiple access on port?) +2025-10-08 13:54:23 - 使用经纬度上传: lon=1201, lat=3129 +2025-10-08 13:54:23 - 数据库插入成功 +2025-10-08 13:54:23 - 上传线程结束: /mnt/save/warning/warning_20251008_135422.jpg: 成功! +2025-10-08 13:54:27 - 开始上传图片: /mnt/save/warning/warning_20251008_135425.jpg +2025-10-08 13:54:27 - 串口读取失败: device reports readiness to read but returned no data (device disconnected or multiple access on port?) +2025-10-08 13:54:27 - 使用经纬度上传: lon=1201, lat=3129 +2025-10-08 13:54:27 - 数据库插入成功 +2025-10-08 13:54:27 - 上传线程结束: /mnt/save/warning/warning_20251008_135425.jpg: 成功! +2025-10-08 13:55:09 - 开始上传图片: /mnt/save/warning/warning_20251008_135508.jpg +2025-10-08 13:55:09 - 串口读取失败: device reports readiness to read but returned no data (device disconnected or multiple access on port?) +2025-10-08 13:55:09 - 使用经纬度上传: lon=1201, lat=3129 +2025-10-08 13:55:09 - 数据库插入成功 +2025-10-08 13:55:09 - 上传线程结束: /mnt/save/warning/warning_20251008_135508.jpg: 成功! +2025-10-08 13:55:11 - 开始上传图片: /mnt/save/warning/warning_20251008_135509.jpg +2025-10-08 13:55:11 - 串口读取失败: device reports readiness to read but returned no data (device disconnected or multiple access on port?) +2025-10-08 13:55:11 - 使用经纬度上传: lon=1201, lat=3129 +2025-10-08 13:55:11 - 数据库插入成功 +2025-10-08 13:55:11 - 上传线程结束: /mnt/save/warning/warning_20251008_135509.jpg: 成功! +2025-10-08 14:14:27 - 开始上传图片: /mnt/save/warning/warning_20251008_141427.jpg +2025-10-08 14:14:27 - 串口读取失败: device reports readiness to read but returned no data (device disconnected or multiple access on port?) +2025-10-08 14:14:27 - 使用经纬度上传: lon=1201, lat=3129 +2025-10-08 14:14:28 - 数据库插入成功 +2025-10-08 14:14:28 - 上传线程结束: /mnt/save/warning/warning_20251008_141427.jpg: 成功! +2025-10-08 14:19:00 - 开始上传图片: /mnt/save/warning/warning_20251008_141859.jpg +2025-10-08 14:19:00 - 串口读取失败: device reports readiness to read but returned no data (device disconnected or multiple access on port?) +2025-10-08 14:19:00 - 使用经纬度上传: lon=1201, lat=3129 +2025-10-08 14:19:00 - 数据库插入成功 +2025-10-08 14:19:00 - 上传线程结束: /mnt/save/warning/warning_20251008_141859.jpg: 成功! +2025-10-08 14:22:40 - 开始上传图片: /mnt/save/warning/warning_20251008_142240.jpg +2025-10-08 14:22:40 - 串口读取失败: device reports readiness to read but returned no data (device disconnected or multiple access on port?) +2025-10-08 14:22:40 - 使用经纬度上传: lon=1201, lat=3129 +2025-10-08 14:22:41 - 数据库插入成功 +2025-10-08 14:22:41 - 上传线程结束: /mnt/save/warning/warning_20251008_142240.jpg: 成功! +2025-10-08 14:25:18 - 开始上传图片: /mnt/save/warning/warning_20251008_142518.jpg +2025-10-08 14:25:20 - 开始上传图片: /mnt/save/warning/warning_20251008_142519.jpg +2025-10-08 14:25:20 - 开始上传图片: /mnt/save/warning/warning_20251008_142520.jpg +2025-10-08 14:25:22 - 上传图片 /mnt/save/warning/warning_20251008_142518.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:25:22 - 上传图片 /mnt/save/warning/warning_20251008_142520.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:25:22 - 上传图片 /mnt/save/warning/warning_20251008_142519.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:25:22 - 开始上传图片: /mnt/save/warning/warning_20251008_142521.jpg +2025-10-08 14:25:22 - 开始上传图片: /mnt/save/warning/warning_20251008_142522.jpg +2025-10-08 14:25:25 - 上传图片 /mnt/save/warning/warning_20251008_142522.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:25:25 - 上传图片 /mnt/save/warning/warning_20251008_142521.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:25:26 - 开始上传图片: /mnt/save/warning/warning_20251008_142525.jpg +2025-10-08 14:25:28 - 上传图片 /mnt/save/warning/warning_20251008_142525.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:25:42 - 开始上传图片: /mnt/save/warning/warning_20251008_142541.jpg +2025-10-08 14:25:45 - 上传图片 /mnt/save/warning/warning_20251008_142541.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:29:35 - 开始上传图片: /mnt/save/warning/warning_20251008_142935.jpg +2025-10-08 14:29:37 - 上传图片 /mnt/save/warning/warning_20251008_142935.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:29:39 - 开始上传图片: /mnt/save/warning/warning_20251008_142937.jpg +2025-10-08 14:29:39 - 开始上传图片: /mnt/save/warning/warning_20251008_142939.jpg +2025-10-08 14:29:40 - 上传图片 /mnt/save/warning/warning_20251008_142937.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:29:40 - 上传图片 /mnt/save/warning/warning_20251008_142939.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:32:59 - 开始上传图片: /mnt/save/warning/warning_20251008_143258.jpg +2025-10-08 14:32:59 - 开始上传图片: /mnt/save/warning/warning_20251008_143259.jpg +2025-10-08 14:33:02 - 开始上传图片: /mnt/save/warning/warning_20251008_143301.jpg +2025-10-08 14:33:02 - 上传图片 /mnt/save/warning/warning_20251008_143259.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:33:02 - 上传图片 /mnt/save/warning/warning_20251008_143258.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:33:02 - 上传图片 /mnt/save/warning/warning_20251008_143301.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:33:54 - 开始上传图片: /mnt/save/warning/warning_20251008_143353.jpg +2025-10-08 14:33:54 - 上传图片 /mnt/save/warning/warning_20251008_143353.jpg 时出错: [Errno 113] No route to host +2025-10-08 14:33:56 - 开始上传图片: /mnt/save/warning/warning_20251008_143354.jpg +2025-10-08 14:33:57 - 上传图片 /mnt/save/warning/warning_20251008_143354.jpg 时出错: [Errno 113] No route to host