保存到一半了

This commit is contained in:
2025-11-19 16:55:29 +08:00
parent 18885439e6
commit f6bb0bd55f
6 changed files with 79 additions and 2113 deletions

Binary file not shown.

View File

@@ -1,7 +1,7 @@
all:sendGpioSignal
sendGpioSignal:
g++ -g -o sendGpioSignal sendGpioSignal.cpp //home/orangepi/RKApp/softWareInit/NetraLib/src/Netra.cpp -I/home/orangepi/RKApp/softWareInit/NetraLib/include -lwiringPi
g++ -g -o sendGpioSignal sendGpioSignal.cpp -lwiringPi
mv sendGpioSignal ../bin

View File

@@ -6,12 +6,7 @@
#include <thread>
#include <wiringPi.h>
#include "/home/orangepi/RKApp/softWareInit/NetraLib/include/Netra.hpp"
using namespace std;
using namespace QCL;
const string SetFile = "/home/orangepi/RKApp/InitAuth/conf/.env";
// 初始化GPIO引脚
int InitGpio(int GPIO_Pin1, int GPIO_Pin2);
@@ -19,9 +14,6 @@ int InitGpio(int GPIO_Pin1, int GPIO_Pin2);
// 写入GPIO引脚
void WriteGpio(int GPIO_Pin, int value);
// 获取输出模式
bool GetOutValue(int &value);
int main(int argc, char *argv[])
{
int GPIO_Pin1 = 7;
@@ -44,70 +36,6 @@ int main(int argc, char *argv[])
WriteGpio(GPIO_Pin2, stoi(argv[1]));
return 0;
// int value = 0;
// bool useArg = false;
// // 修改点:如果传入了参数,直接使用参数作为电平值 (1 或 0)
// if (argc > 1)
// {
// value = atoi(argv[1]);
// useArg = true;
// cout << "[sendGpioSignal] 使用命令行参数: " << value << endl;
// }
// else
// {
// // 原有的读取文件逻辑
// cout << "[sendGpioSignal] 启动,读取配置: " << SetFile << endl;
// if (GetOutValue(value) == false)
// {
// cerr << "[sendGpioSignal] 未读取到 outPutMode程序退出" << endl;
// return -1;
// }
// cout << "[sendGpioSignal] 读取到 outPutMode=" << (value == 1 ? "true" : "false") << endl;
// }
// // 初始化GPIO引脚
// if (InitGpio(GPIO_Pin1, GPIO_Pin2) != 0)
// {
// cout << "Error: Failed to initialize GPIO pin " << endl;
// return 1;
// }
// // 写入GPIO引脚
// cout << "[sendGpioSignal] 设置 GPIO(" << GPIO_Pin1 << "," << GPIO_Pin2 << ") 为 "
// << (value == 1 ? "HIGH" : "LOW") << endl;
// WriteGpio(GPIO_Pin1, value);
// WriteGpio(GPIO_Pin2, value);
// cout << "[sendGpioSignal] 完成" << endl;
// this_thread::sleep_for(chrono::milliseconds(100));
return 0;
}
// 获取输出模式
bool GetOutValue(int &value)
{
bool flag = true;
// 读取文件
ReadFile rf(SetFile);
if (rf.Open() == false)
{
cerr << "读取文件失败" << endl;
flag = false;
}
auto str = rf.ReadLines();
for (auto &ii : str)
{
if (ii.find("outPutMode") != string::npos)
{
value = (ii.substr(string("outPutMode:").size()) == "true" ? 1 : 0);
}
}
rf.Close();
return flag;
}
// 初始化GPIO引脚

File diff suppressed because it is too large Load Diff