死代码清理+越界修复+构建去重: 注释PIDController/删除TimerVideo, floodFill半径10→5, ctl.sh删GPIO66/75, CMake双重互斥合并

This commit is contained in:
spdis
2026-06-13 13:30:39 +08:00
parent 7315a74773
commit d1e2234a43
8 changed files with 5 additions and 136 deletions
-36
View File
@@ -1,36 +0,0 @@
#include "Timer.h"
Timer::Timer(int interval_ms, std::function<void()> task)
: interval(interval_ms), task(task), running(false) {}
Timer::~Timer()
{
stop(); // Ensure the timer is stopped in the destructor
}
void Timer::start()
{
running = true;
worker = std::thread(&Timer::run, this);
}
void Timer::stop()
{
running = false;
if (worker.joinable())
{
worker.join();
}
}
void Timer::run()
{
while (running)
{
std::this_thread::sleep_for(std::chrono::milliseconds(interval));
if (running)
{
std::thread(task).detach();
}
}
}
+1 -1
View File
@@ -129,7 +129,7 @@ cv::Mat find_road(cv::Mat &frame)
// 4. 在种子点位置画一个白色实心圆,确保种子点落在赛道区域内
// 避免因二值化偶尔在种子位置为黑色导致洪泛失败
cv::circle(morphologyExFrame, seedPoint, 10, 255, -1);
cv::circle(morphologyExFrame, seedPoint, 5, 255, -1);
// 5. 洪泛填充参数
cv::Scalar newVal(128); // 填充值 = 128 (标记为赛道内部)
-20
View File
@@ -1,20 +0,0 @@
#include "video.h"
Video::Video(const std::string &filename, double fps)
: timer(static_cast<int>(1000 / fps), std::bind(&Video::streamCapture, this)), cap(filename)
{
streamCapture();
}
Video::~Video(void)
{
timer.stop();
}
void Video::streamCapture(void)
{
frameMutex.lock();
cap.read(frame);
frameMutex.unlock();
}