From 481358a682a1e4e01ca21eca8c65ae250705dd6d Mon Sep 17 00:00:00 2001 From: zhaohe Date: Fri, 28 Mar 2025 16:14:17 +0800 Subject: [PATCH] v1 --- .gitignore | 3 +- CMakeLists.txt | 1 - README.md | 85 +++++++--------------------------------------- resources/a8000_config.ini | 48 -------------------------- resources/config.ini | 48 ++++++++++++++++++++++++++ src/configs/version.hpp | 2 +- tools/packet.sh | 36 ++++++++++++++++++++ 7 files changed, 99 insertions(+), 124 deletions(-) delete mode 100644 resources/a8000_config.ini create mode 100644 resources/config.ini mode change 100644 => 100755 tools/packet.sh diff --git a/.gitignore b/.gitignore index 1ea25a5..6ed4e85 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ out ./libs buildpc buildhost -*.out \ No newline at end of file +*.out +dist \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f52e0b..63a3a0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,6 @@ zadd_executable( LINK_LIBRARIES libixwebsocket.a pthread - gpiod # # 配置头文件路径 # diff --git a/README.md b/README.md index ace7d6d..4f87914 100644 --- a/README.md +++ b/README.md @@ -1,96 +1,35 @@ # README -## 工程初始化 ``` - -./init.sh - +说明文档: https://iflytop1.feishu.cn/wiki/QFwVwGnI8iYp0fk20W9cnpYAnkg ``` -## 依赖 - -``` -# 编译环境 -sudo apt-get install libgpiod-dev:arm64 - -# 运行环境 -sudo apt-get install gpiod - - -``` - -## 工程编译 - +## 工程初始化 ``` -./build.sh -``` +./init.sh ``` -``` +## 依赖 ``` -第三方库说明: -https://iflytop1.feishu.cn/wiki/wikcnDuCFRGDunHGzns8gRV4Ahh - -sudo apt install clang llvm gcc-aarch64-linux-gnu g++-aarch64-linux-gnu ``` -## 配置文件说明 +## 脚本说明 -```ini -[server] -cmdport=19004 -wsport=19005 +```shell +# 编译 +./tools/build.sh -# -# zexcan -# 概述: zexcan 是公司内部自定义的can底层协议 -# 目的: 为了解决can单包数据太短的问题 -# 实现: 具体协议参考 .... -# -[[channels]] -type="zexcan" -name="zcan" -ifname="can0" -baudrate=500000 -enable=true +# 调试阶段部署 +./tools/deply.sh root@192.168.8.10 -[[channels]] -type="uart" -name="printer" -ifname="/dev/ttyS1" -baudrate=115200 -enable=true - -[[channels]] -type="inputkey" -name="emergency-key" -pinnum="GPIO2-A3" -enable=true - -[[channels]] -type="uart" -name="lis" -ifname="/dev/ttyS2" -baudrate=115200 -enable=true +#打包 +./tools/packet.sh version ``` -## zexcan协议 - -```txt - -| ID | byte0 | byte1...7 | -| from | [7:4] packet_num [3:0] packet_off | data | - -1. 通过packet_num和packet_off多个can帧,组装成一个长数据。 -2. 主机端使用默认ID 1 -3. 对上层来说,只透传data区的内容。 - -``` \ No newline at end of file diff --git a/resources/a8000_config.ini b/resources/a8000_config.ini deleted file mode 100644 index b18243b..0000000 --- a/resources/a8000_config.ini +++ /dev/null @@ -1,48 +0,0 @@ -[server] -cmdport=19004 -wsport=19005 - -[[channels]] -type="zexcan" -name="zexcan" -ifname="can0" -baudrate=500000 -enable=true - -[[channels]] -type="uart" -name="lis" -alias="UART_P1" -ifname="/dev/ttyS0" -baudrate=115200 -rxovertime=3 -hexchar=true -enable=true - -[[channels]] -type="uart" -name="rs485" -alias="UART_P2" -ifname="/dev/ttyS1" -baudrate=115200 -rxovertime=3 -hexchar=true -enable=true - -[[channels]] -type="uart" -name="printer" -alias="UART_P0" -ifname="/dev/ttyS5" -baudrate=115200 -rxovertime=3 -hexchar=true -enable=true - -[[channels]] -type="gpio-key" -name="key" -pins=["GPIO3_A6"] # IO0->GPIO3_A6, -pinalias=["emergency"] -mirror=[true] -enable=true diff --git a/resources/config.ini b/resources/config.ini new file mode 100644 index 0000000..e11f708 --- /dev/null +++ b/resources/config.ini @@ -0,0 +1,48 @@ +[server] +cmdport=19004 +wsport=19005 + +[[channels]] +type="zexcan" +name="zexcan" +ifname="can0" +baudrate=500000 +enable=true + +[[channels]] +type="uart" +name="uart_p0" +alias="uart_p0" +ifname="/dev/ttyS5" +baudrate=115200 +rxovertime=3 +hexchar=true +enable=true + +[[channels]] +type="uart" +name="uart_p1" +alias="uart_p1" +ifname="/dev/ttyS0" +baudrate=115200 +rxovertime=3 +hexchar=true +enable=true + +[[channels]] +type="uart" +name="uart_p2" +alias="uart_p2" +ifname="/dev/ttyS1" +baudrate=115200 +rxovertime=3 +hexchar=true +enable=true + +[[channels]] +type="gpio-key" +name="key" +pins=["GPIO3_A6"] # IO0->GPIO3_A6, +pinalias=["io0"] +mirror=[true] +enable=true diff --git a/src/configs/version.hpp b/src/configs/version.hpp index 025956d..ed61e6b 100644 --- a/src/configs/version.hpp +++ b/src/configs/version.hpp @@ -1,2 +1,2 @@ #pragma once -#define VERSION "0.1" \ No newline at end of file +#define VERSION "1" \ No newline at end of file diff --git a/tools/packet.sh b/tools/packet.sh old mode 100644 new mode 100755 index e69de29..9d86ec8 --- a/tools/packet.sh +++ b/tools/packet.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# +# ./packet.sh v1 +# + +if [ $# -ne 1 ]; then + echo "Usage: $0 version" + exit 1 +fi + +version=$1 +packetname=iflytophald +workdir=$(pwd) + +echo "workdir: $workdir" + + +mkdir -p /tmp/$packetname +cp -r ./build/app/iflytophald /tmp/$packetname/ +cp -r ./resources/spd_logger_cfg.json /tmp/$packetname/ +cp -r ./resources/*.ini /tmp/$packetname/ +cp -r ./resources/iflytophald.service /tmp/$packetname/ + +echo "Version: $version" > /tmp/$packetname/version + +cd /tmp +tar -czvf $packetname-$version.tar.gz $packetname + +cd $workdir +mv /tmp/$packetname-$version.tar.gz ./dist/ +echo "" +echo "#" +echo "# Packet: dist/$packetname-$version.tar.gz" +echo "# " +